pst = 0;

$(document).ready(function() {
/*
  oe = window.location.hash;
  num = oe.substring(1, oe.length);
  charge_image(1, num);
*/
  $(".ico > a").each(function() {
     adr = $(this).attr("href");
//	 adr = adr.substring(adr.indexOf("?", 0), adr.length);
	 d=adr.substr(3,1);
	 n=adr.substr(7,2);
     $(this).attr("href", "javascript:charge_image('"+d+"','"+n+"')");
  });
/*
  $("#liens > a").each(function() {
	     adr = $(this).attr("href");
//		 adr = adr.substring(adr.indexOf("?", 0), adr.length);
		 d=adr.substr(3,1);
		 n=adr.substr(7,2);
	     $(this).attr("href", "javascript:charge_image('"+d+"','"+n+"')");
  });
*/
});

function charge_image(dmn, num) {
	n = window.location.hash.substr(1,2);
	if (n == num) return;
    $.post("renvoi.php", { n: num, d: dmn }, function(data) {
        $("#oeuvre").fadeOut("slow", function(){
        	$("#oeuvre").html(data);
        });
        setTimeout(
        		$("#oeuvre").fadeIn("fast"), 2000
        );
        
		window.location.hash = "#" + num;
	});
}
/*
function charge_chapitre(dmn) {
    if (dmn == 1 || dmn  == 2)
	$.post("renvoi.php", { d: dmn }, function(data) {
        $("#oeuvre").fadeOut("fast", function(){$("#oeuvre").html(data);});
        $("#oeuvre").fadeIn("fast");
		window.location.hash = "#" + num;

	});  
}
*/

function depl_haut() {
    if (pst > 0) {
	    $(".ico").animate({"top": "+=200px"}, "fast");
	    pst -= 200;
//	    window.status = pst;
    }
}

function depl_bas() {
    if (pst < bot) {
        $(".ico").animate({"top": "-=200px"}, "fast");
        pst += 200;
//	    window.status = pst;
    }
}
