


jQuery.fn.center = function () {

this.css("position","absolute");
    this.css("top", (( $(window).height() - this.height() ) / 2+$(window).scrollTop()) + "px");//
    this.css("left", (( $(window).width() -this.width() ) / 2 +$(window).scrollLeft()) + "px");//

  return this;
}
jQuery.fn.fullscreen = function () {
  this.css("position","absolute");
  this.css("top",  "0px");
  this.css("left", "0px");
  this.css("right", "0px");
  this.css("height", ($(window).height()+$(window).scrollTop()) +"px");
  return this;
}
   function fond_fermer()
{
        $("#fond-semi").animate({opacity: 0}, 500);

        $("#fond-semi").css("width", "0px");
        $("#fond-semi").css("height", "0px");
        $("#fond-semi").css("left", "-3000px");
        $("#fond-semi").css("top", "-3000px");

$("#div-grande-image").animate({opacity: 0}, 500);
 $("#div-grande-image").css("width", "0px");
        $("#div-grande-image").css("height", "0px");
        $("#div-grande-image").css("left", "-3000px");
        $("#div-grande-image").css("top", "-3000px");
}

function   fond_ouvrir()
     {
        $("#fond-semi").css("left", "0px");
        $("#fond-semi").css("top", "0px");
        $("#fond-semi").css("width", "100%");
        $("#fond-semi").css("height", ($(window).height()+$(window).scrollTop())+ "px");
        $("#fond-semi").fullscreen();
        $("#fond-semi").animate({opacity: 0.8}, 500);
    }
function ouvre_image(i)
{
    fond_ouvrir();
    $("#div-grande-image").html('<img id="grande-image" src="image.php?img=/images/'+i+'&amp;dx=800&amp;dy=600" alt="Cliquer pour fermer" onclick="fond_fermer();" style="cursor:pointer"/>');

     $("#div-grande-image").css("left", "0px");
        $("#div-grande-image").css("top", "0px");
        $("#div-grande-image").css("width", "800px");
        $("#div-grande-image").css("height", "600px");
        $("#div-grande-image").center();
$("#div-grande-image").animate({opacity: 1}, 500);

}
 
