$(document).ready(function(){

    $('#diaporama').crossSlide({
      sleep: 2,
      fade: 1
    }, [
      { src: '/images/promotions-banner-1.png' },
      { src: '/images/promotions-banner-2.png' },
      { src: '/images/promotions-banner-3.png' },
      { src: '/images/promotions-banner-4.png' },
      { src: '/images/promotions-banner-5.png' }
    ])

   $('#actionspopup').prepend("salut");

});


var opened = "";

function popupLayer(id,width,height) {
 $("#masque").fadeTo("fast",0.5);

 var pageWidth = $(window).width();
 var pageHeight = $(window).height();

 document.getElementById(id).style.width = width+"px";
 document.getElementById(id).style.height = height+"px";

 var c_width = $("#"+id).outerWidth();
 var c_height = $("#"+id).outerHeight();
  
 document.getElementById(id).style.top = ((pageHeight - c_height) / 2) + "px";
 document.getElementById(id).style.left = ((pageWidth - c_width) / 2) + "px";
 
 document.getElementById("closer").style.top = (((pageHeight - c_height) / 2) - 24) + "px";
 document.getElementById("closer").style.left = (((pageWidth - c_width) / 2) + c_width - 106) + "px";

 $("#"+id).fadeIn("fast");
 $("#closer").fadeIn("fast");

 if (id=="actionspopup") {
  document.getElementById("printer").style.top = (((pageHeight - c_height) / 2) - 24) + "px";
  document.getElementById("printer").style.left = (((pageWidth - c_width) / 2) + c_width - 216) + "px";
 $("#printer").fadeIn("fast");
 }

}

function closelayers() {

 $("#closer").fadeOut("fast");
 $("#printer").fadeOut("fast");
 $("#masque").fadeOut("fast");
 $(".poplayer").fadeOut("fast");

}

function printactions() {
  actionspopup.focus();
  actionspopup.print();
}

function ajaxQueryRandomAction() {

 xmlHttp=getHttpObject()
 if (xmlHttp==null)
 {
 alert ("Votre navigateur ne supporte pas cette fonctionnalit&eacute;")
 return
 } 
 var url="/ajax_random_action.php";
 xmlHttp.onreadystatechange=ajaxResponseRandomAction
 xmlHttp.open("GET",url,true)
 xmlHttp.send(null)

}

function ajaxResponseRandomAction() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
 html = xmlHttp.responseText;
 document.getElementById("random_action").innerHTML=html;
} 
} 

function random_action_in() {
 ajaxQueryRandomAction();
 $("#random_action").fadeIn('slow',random_action_out);
}

function random_action_out() {
 $("#random_action").delay('4000').fadeOut('slow',random_action_in);
}


function getHttpObject() {
        if (window.ActiveXObject) {
                return new ActiveXObject("Microsoft.XMLHTTP")
        }
        if (window.XMLHttpRequest) {
                return new XMLHttpRequest();
        }
        return false;
}

