

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function change_mouse(valeur,clip)

{	

	clip.style.cursor=valeur;

}







var yeux_defaut=0;

var cheveux_defaut=0;

var chapeau_defaut=0;

var bouche_defaut=0;

var couleur_defaut="";



var yeux=0;

var bouche=0;

var chapeau=0;

var cheveux=0;

var couleur="";



var max_chapeau=6;

var max_cheveux=15;

var max_bouche=20;

var max_yeux=22;



function montre_main(clip,objet)

{

	objet.style.cursor=clip;

}



function determine_couleur(teinte)

{

	

	var new_color="0x"+teinte.substring(1,7);

	couleur=new_color;

	window.document.fla_modif_mouk.SetVariable("couleur_mouk", couleur);

}



function remet_defaut()

{

	chapeau=chapeau_defaut;

	cheveux=cheveux_defaut;

	bouche=bouche_defaut;

	yeux=yeux_defaut;

	couleur=couleur_defaut;

	

	window.document.fla_modif_mouk.SetVariable("chapeau_mouk", chapeau);

	window.document.fla_modif_mouk.SetVariable("cheveux_mouk", cheveux);

	window.document.fla_modif_mouk.SetVariable("yeux_mouk", yeux);

	window.document.fla_modif_mouk.SetVariable("bouche_mouk", bouche);

	window.document.fla_modif_mouk.SetVariable("couleur_mouk", couleur);

	

	document.getElementById("f_color").value="#"+couleur.substring(2,8);

}



function init_defaut(cha,che,yeu,bou,coul)

{

	chapeau_defaut=cha;

	cheveux_defaut=che;

	bouche_defaut=bou;

	yeux_defaut=yeu;

	couleur_defaut=coul;

	

	chapeau=chapeau_defaut;

	cheveux=cheveux_defaut;

	bouche=bouche_defaut;

	yeux=yeux_defaut;

	couleur=couleur_defaut;

	

	window.document.fla_modif_mouk.SetVariable("chapeau_mouk", chapeau);

	window.document.fla_modif_mouk.SetVariable("cheveux_mouk", cheveux);

	window.document.fla_modif_mouk.SetVariable("yeux_mouk", yeux);

	window.document.fla_modif_mouk.SetVariable("bouche_mouk", bouche);

	window.document.fla_modif_mouk.SetVariable("couleur_mouk", couleur);

	

}



function doChapeauPlus()

{

	chapeau++;

	if(chapeau>max_chapeau)

	{

		chapeau=1;

	}

	window.document.fla_modif_mouk.SetVariable("chapeau_mouk", chapeau);

}

	

function doChapeauMoins()

{

	chapeau--;

	if(chapeau==0)

	{

		chapeau=max_chapeau;

	}

	 window.document.fla_modif_mouk.SetVariable("chapeau_mouk", chapeau);

}



function doCheveuxPlus()

{

	cheveux++;

	if(cheveux>max_cheveux)

	{

		cheveux=1;

	}

	window.document.fla_modif_mouk.SetVariable("cheveux_mouk", cheveux);

}

	

function doCheveuxMoins()

{

	cheveux--;

	if(cheveux==0)

	{

		cheveux=max_cheveux;

	}

	 window.document.fla_modif_mouk.SetVariable("cheveux_mouk", cheveux);

}



function doYeuxPlus()

{

	yeux++;

	if(yeux>max_yeux)

	{

		yeux=1;

	}

	window.document.fla_modif_mouk.SetVariable("yeux_mouk", yeux);

}

	

function doYeuxMoins()

{

	yeux--;

	if(yeux==0)

	{

		yeux=max_yeux;

	}

	 window.document.fla_modif_mouk.SetVariable("yeux_mouk", yeux);

}



function doBouchePlus()

{

	bouche++;

	if(bouche>max_bouche)

	{

		bouche=1;

	}

	window.document.fla_modif_mouk.SetVariable("bouche_mouk", bouche);

}

	

function doBoucheMoins()

{

	bouche--;

	if(bouche==0)

	{

		bouche=max_bouche;

	}

	 window.document.fla_modif_mouk.SetVariable("bouche_mouk", bouche);

}



/******************************************************************************************/



function determine_couleur_ie(teinte)

{

	

	var new_color="0x"+teinte.substring(1,7);

	couleur=new_color;

	document.getElementById("myFlash").SetVariable("couleur_mouk", couleur);

//	window.document.fla_modif_mouk.SetVariable("couleur_mouk", couleur);

}



function remet_defaut_ie()

{

	chapeau=chapeau_defaut;

	cheveux=cheveux_defaut;

	bouche=bouche_defaut;

	yeux=yeux_defaut;

	couleur=couleur_defaut;

	

	document.getElementById("myFlash").SetVariable("chapeau_mouk", chapeau);

	document.getElementById("myFlash").SetVariable("cheveux_mouk", cheveux);

	document.getElementById("myFlash").SetVariable("yeux_mouk", yeux);

	document.getElementById("myFlash").SetVariable("bouche_mouk", bouche);

	document.getElementById("myFlash").SetVariable("couleur_mouk", couleur);

	

/*	window.document.fla_modif_mouk.SetVariable("chapeau_mouk", chapeau);

	window.document.fla_modif_mouk.SetVariable("cheveux_mouk", cheveux);

	window.document.fla_modif_mouk.SetVariable("yeux_mouk", yeux);

	window.document.fla_modif_mouk.SetVariable("bouche_mouk", bouche);

	window.document.fla_modif_mouk.SetVariable("couleur_mouk", couleur);*/

	

	document.getElementById("f_color").value="#"+couleur.substring(2,8);

}



function init_defaut_ie(cha,che,yeu,bou,coul)

{

	chapeau_defaut=cha;

	cheveux_defaut=che;

	bouche_defaut=bou;

	yeux_defaut=yeu;

	couleur_defaut=coul;

	

	chapeau=chapeau_defaut;

	cheveux=cheveux_defaut;

	bouche=bouche_defaut;

	yeux=yeux_defaut;

	couleur=couleur_defaut;

	/*

	document.getElementById("fla_modif_mouk").SetVariable("chapeau_mouk", chapeau);

	document.getElementById("fla_modif_mouk").SetVariable("cheveux_mouk", cheveux);

	document.getElementById("fla_modif_mouk").SetVariable("yeux_mouk", yeux);

	document.getElementById("fla_modif_mouk").SetVariable("bouche_mouk", bouche);

	document.getElementById("fla_modif_mouk").SetVariable("couleur_mouk", couleur);*/

	

	/*

	window.document.fla_modif_mouk.SetVariable("chapeau_mouk", chapeau);

	window.document.fla_modif_mouk.SetVariable("cheveux_mouk", cheveux);

	window.document.fla_modif_mouk.SetVariable("yeux_mouk", yeux);

	window.document.fla_modif_mouk.SetVariable("bouche_mouk", bouche);

	window.document.fla_modif_mouk.SetVariable("couleur_mouk", couleur);

	*/

}



function doChapeauPlus_ie()

{

	chapeau++;

	if(chapeau>max_chapeau)

	{

		chapeau=1;

	}

	document.getElementById("myFlash").SetVariable("chapeau_mouk", chapeau);

//	window.document.fla_modif_mouk.SetVariable("chapeau_mouk", chapeau);

}

	

function doChapeauMoins_ie()

{

	chapeau--;

	if(chapeau==0)

	{

		chapeau=max_chapeau;

	}

	document.getElementById("myFlash").SetVariable("chapeau_mouk", chapeau);

}



function doCheveuxPlus_ie()

{

	cheveux++;

	if(cheveux>max_cheveux)

	{

		cheveux=1;

	}

	

	document.getElementById("myFlash").SetVariable("cheveux_mouk", cheveux);

}

	

function doCheveuxMoins_ie()

{

	cheveux--;

	if(cheveux==0)

	{

		cheveux=max_cheveux;

	}

	document.getElementById("myFlash").SetVariable("cheveux_mouk", cheveux);

}



function doYeuxPlus_ie()

{

	yeux++;

	if(yeux>max_yeux)

	{

		yeux=1;

	}

	document.getElementById("myFlash").SetVariable("yeux_mouk", yeux);

}

	

function doYeuxMoins_ie()

{

	yeux--;

	if(yeux==0)

	{

		yeux=max_yeux;

	}

	document.getElementById("myFlash").SetVariable("yeux_mouk", yeux);

}



function doBouchePlus_ie()

{

	bouche++;

	if(bouche>max_bouche)

	{

		bouche=1;

	}

	document.getElementById("myFlash").SetVariable("bouche_mouk", bouche);

}

	

function doBoucheMoins_ie()

{

	bouche--;

	if(bouche==0)

	{

		bouche=max_bouche;

	}

	document.getElementById("myFlash").SetVariable("bouche_mouk", bouche);

}



/******************************************************************************************/



function envoi_form_crea()

{

	document.getElementById("chapeau_mouk").value=chapeau;

	document.getElementById("cheveux_mouk").value=cheveux;

	document.getElementById("yeux_mouk").value=yeux;

	document.getElementById("bouche_mouk").value=bouche;

	document.getElementById("couleur_mouk").value=couleur;

	document.getElementById("form_crea_mouk").submit();

}



window.onload = function()

{

 if(typeof fctLoad == 'function') {

	 fctLoad();

 }

}

window.onscroll = function()

{

 //fctShow();

}

window.onresize = function()

{

 //fctShow();

}







/********************************************************************************************/

function EcrireCookie(nom, valeur)

{

	var theDate = new Date();

	var an=theDate.getFullYear();

	an+=1;

	theDate.setFullYear(an);

		

	var argv=EcrireCookie.arguments;

	var argc=EcrireCookie.arguments.length;

	var expires=(argc > 2) ? argv[2] : null;

	var path=(argc > 3) ? argv[3] : null;

	var domain=(argc > 4) ? argv[4] : null;

	var secure=(argc > 5) ? argv[5] : false;

	document.cookie=nom+"="+escape(valeur)+

	((expires==null) ? ("; expires="+theDate.toGMTString()) : ("; expires="+expires.toGMTString()))+

	((path==null) ? "" : ("; path="+path))+

	((domain==null) ? "" : ("; domain="+domain))+

	((secure==true) ? "; secure" : "");

}



function getCookieVal(offset)

{

	var endstr=document.cookie.indexOf (";", offset);

	if (endstr==-1) endstr=document.cookie.length;

	return unescape(document.cookie.substring(offset, endstr));

}



function envoi_form_logout()

{

	document.getElementById('form_logout').submit();

}



function LireCookie(nom)

{

	var arg=nom+"=";

	var alen=arg.length;

	var clen=document.cookie.length;

	var i=0;

	while (i<clen)

	{

		var j=i+alen;

		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);

		i=document.cookie.indexOf(" ",i)+1;

		if (i==0) break;



	}

	return null; 

}



function largeur_fenetre()

{

 if (window.innerWidth) return window.innerWidth;

 else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;

 else return 0;

}

/*****************************************/

/************** S l a d e **************/

/**************************************/

function reconstruction()
{
	var winWidth = largeur_fenetre();
	
	var global = document.getElementById('global');
	var globalWidth = 1100;
	var swf = document.getElementById('fond_swf');
	swf.style.width= '100%';
	var newMLeft = winWidth - globalWidth;
	/*if (winWidth < globalWidth ){
		if(newMLeft > -150){
			//global.style.marginLeft = newMLeft + 'px';
			swf.style.left = newMLeft + 'px';
		}
	} else {
		//var newMLeft = winWidth - globalWidth;
		//global.style.marginLeft = (newMLeft * 0.5) + 'px';
		swf.style.left = (newMLeft * 0.5) + 'px';
	}*/
	return winWidth;
}

/* Panneau plančte */

var timer;

var available = true;

function setTimer(){

	var time	= 	new Date();

	hours		= 	time.getHours();

	mins		= 	time.getMinutes();

	secs		= 	time.getSeconds();

	etime		=	hours*3600+mins*60+secs;

	if(available){

		etime		+=	3; 

	} else {

		etime		+= 1;

	}

	checktime();

}

function checktime(){

	var time	= 	new Date();

	hours		= 	time.getHours();

	mins		= 	time.getMinutes();

	secs		= 	time.getSeconds();

	ctime		=	hours*3600+mins*60+secs;

	if(ctime>=etime){

		if(available){

			$("#div_planete").animate( { 

				marginTop: '-197px'

			}, { queue:false, duration:'slow' });

		} else {

			available = true;

		}

	}else{

		display();

	}

}

function hidePanelInstant(){

	$("#div_planete").animate( { 

		marginTop: '-197px'

	}, { queue:false, duration:'slow' });

	available = false;

	setTimer();

}

function display(){

	window.clearTimeout(timer);	

	timer = setTimeout("checktime()",1000);

}



function setMouseEvents(i){

	for(var k=0; k < i; k++){

		showPanel("#case_jeu_"+k);

		hidePanel("#case_jeu_"+k);

	}

}



function showPanel(itemId){

	$(itemId).mouseover(function(){

		if(available){

			window.clearTimeout(timer);

			$("#div_planete").animate( { 

				marginTop:'25px' 

			}, { queue:false, duration:'slow' });

		}

	});

}

function hidePanel(itemId){

	$(itemId).mouseout(function(){

		setTimer();

	});

}

var tooltipState = 'none';

function showTooltips(){

	if(tooltipState == 'none'){

		//$("#drap_help").src = 'biblio/images/icones/help_ON.png';

		document.getElementById('drap_help').src = rel+'biblio/images/icones/help_ON.png';

		$("div.tooltip").css({'display':'block'});

	    $("div.tooltip").hover(function (e) {

	    	var botPos = $("div", this).height();

	        $("div", this).css({'display':'block', 'position': 'absolute', 'left':'20px', 'top': -botPos});

	      }, function () {

	    	$("div", this).css({'display':'none'});

	    });

	    /*$("div.tooltip").mouseMove(function () {

	        $("span", this).css({'display':'block', 'position': 'absolute', 'left':'20', 'top':'20'});

	    });*/

		tooltipState = 'block';

	} else {

		$("div.tooltip").css({'display':'none'});

		//$("#drap_help").src = 'biblio/images/icones/help_OFF.png';

		document.getElementById('drap_help').src = rel+'biblio/images/icones/help_OFF.png';

		tooltipState = 'none';

	}

	 $.ajax({

		   type: "GET",

		   url: "biblio/ajax.php",

		   data: 'action=tooltip&state='+tooltipState

	});

}

function hideTooltips(){

	$(".tooltip").css({'display':'none'});



}

var columnsState = 'block';

function showColumns(){
	if(columnsState == 'none'){

		$("#col_gauche_content").css({'display':'block'});

		$("#col_droite_content").css({'display':'block'});

		document.getElementById('drap_view').src = rel+'biblio/images/icones/view_ON.png';

		columnsState = 'block';

	} else {

		$("#col_gauche_content").css({'display':'none'});

		$("#col_droite_content").css({'display':'none'});

		document.getElementById('drap_view').src = rel+'biblio/images/icones/view_OFF.png';

		columnsState = 'none';

	}

	 $.ajax({

		   type: "GET",

		   url: "biblio/ajax.php",

		   data: 'action=colmunsState&state='+columnsState

	});



}

function removeItem(itemId){

	//$("#totd").css({'display':'none'})
	
	document.getElementById(itemId).style.display="none";
}

function loadAjax(data, targetId){

	var target = document.getElementById(targetId);

	 $.ajax({

		   type: "GET",

		   url: "biblio/ajax.php",

		   data: data,

		   success: function(data){

		     target.innerHTML = data;

		   }

	});

}
function envoi_form(id_form)
{
	var item = document.getElementById(id_form);
	item.submit();	
}
