var nbr;
function stopTimer(){
	clearInterval(timerDiapo);
	document.getElementById('backGround').style.display="none";
}

function showCat(elmt,path){
	etat_nav="thumbs";
	new Ajax.Updater(
		'cat',
		'php/showCat.php',
		{
			method: 'get',
			parameters: {id: elmt},
		}
	);
	showThumbs(elmt);
}
	
	
	
function showSub(elmt,path){




etat_nav="thumbs";
	new Ajax.Updater(
	'sub',
	'php/showSub.php',
	{
		method: 'get',
		parameters: {id: elmt},
	}
	);
	showThumbs(elmt,path);
}

nbr=0;
function showThumbs(elmt,path){



	etat_nav="thumbs";
    document.images["full_picture"].src = "";
	document.body.style.overflowY="auto";
	document.getElementById('full').style.display = "none";
	document.getElementById('nav_full').style.display = "none";
	
	var noeud = document.getElementById("thumbs");
	while (noeud.firstChild) {
 	 	noeud.removeChild(noeud.firstChild);
	}
	
    //position du div
	margin = 20;
	thumbWidth = 170;
	spaceX = 0;
	spaceY = 0;
				
	//stage
	
	if (window.document.innerHeight){
  	   stageW = (innerWidth-((2*margin)+15));
	   stageH = innerHeight-(2*margin)-120;
		}
    if (window.document.documentElement.clientHeight){
  		stageW = (window.document.documentElement.clientWidth-((2*margin)+15));
  		stageH = window.document.documentElement.clientHeight-(2*margin)-120;
  		}

	
	
	
	
					
	//colonnes possibles		
	colonnes = parseInt((stageW)/(thumbWidth));
	raw = parseInt(stageH/thumbWidth);
					
	//espace restant
	freeSpaceW = stageW-(colonnes*thumbWidth);
	freeSpaceH = stageH-(raw*thumbWidth);
	//espace réparti
	spacerW = freeSpaceW/(colonnes-1);
	spacerH = freeSpaceH/(colonnes-1);
	
	//position
	var posY = 0;
	var posX = margin;
	var thumbs;
//sur base de l'array top --->  all top
	if(elmt=="Works"){
	
		nbr=0;
		origine="Works";
		i=0;
		while(i<top[3].length){
 			if(top[3][i]==5 ){
				newDiv=document.createElement('div');
				newDiv.setAttribute("id","div_"+nbr);
				newDiv.setAttribute("style","width:170px;height:170px;position:relative;");
				newDiv.innerHTML="<img id='img"+nbr+"' class='shade' name='"+i+"'  src='img/works"+top[4][i]+"' onclick='showFullTop(name);'  >";	
				 thumbs = document.getElementById("thumbs");
				thumbs.appendChild(newDiv);
				img = document.getElementById("img"+nbr);
				height = top[7][i];
				width = top[6][i];	
				nbr++;
                //centrage de l'image
				topImg = (170 - height)/2;
				leftImg = (170 -width)/2;
                img.style.marginTop = topImg+"px" ;
                img.style.marginLeft = leftImg+"px" ;
                newDiv.style.position = "absolute";
                newDiv.style.left = posX+"px";
                newDiv.style.top = posY+"px";
				if(posX+thumbWidth+margin+30<stageW){
					posX = posX+thumbWidth+spacerW;
				}
				else {
					posX = margin;
					posY = posY+thumbWidth+spacerH;
				}
			}
		i++;
		}
	}  	
//sur base de l'array top->categorie
  		else if(elmt!="Works"){
  		
  		
  		switch(path){
		
		
		
		case "cat":
		topcat = new Array();
		topcat[0] = new Array()
		topcat[1] = new Array()
		topcat[2] = new Array()
		topcat[3] = new Array()
		topcat[4] = new Array()
		topcat[5] = new Array()
		topcat[6] = new Array()
		topcat[7] = new Array()
		topcat[8] = new Array()
		topcat[9] = new Array()

  		chem = path;
  		
  		  		
  		  	b=0;
			nbr=0;
  			origine=elmt;
  			i=0;
  			while(i<top[3].length){
  				if(top[8][i]==elmt){
  					if(top[3][i]==5){
  					
  					topcat[0][b] = top[0][i];
  					topcat[1][b] = top[1][i];
  					topcat[2][b] = top[2][i];
  					topcat[3][b] = top[3][i];
  					topcat[4][b] = top[4][i];
  					topcat[5][b] = top[5][i];
  					topcat[6][b] = top[6][i];
  					topcat[7][b] = top[7][i];
  					topcat[8][b] = top[8][i];
  					topcat[9][b] = top[9][i];
  					
  					
  				
  					
  					
   					origine = elmt;	
				    newDiv=document.createElement('div');
				    newDiv.setAttribute("id","div_"+nbr);
				    newDiv.setAttribute("style","width:170px;height:170px;position:relative;");
				    newDiv.innerHTML="<img id='img"+nbr+"' class='shade' name='"+b+"' src='img/works"+topcat[4][b]+"'onclick='showFullTopCat(name);' >";	
				    thumbs = document.getElementById("thumbs");
					thumbs.appendChild(newDiv);
					img = document.getElementById("img"+nbr);
					height = topcat[7][b];
					width = topcat[6][b];	
					b++;nbr++
					//centrage de l'image
					topImg = (170 - height)/2;
					leftImg = (170 -width)/2;
					img.style.marginTop = topImg+"px" ;
               		img.style.marginLeft = leftImg+"px" ;
					newDiv.style.position = "absolute";
                	newDiv.style.left = posX+"px";
                	newDiv.style.top = posY+"px";
                		if(posX+thumbWidth+margin+30<stageW){
                			posX = posX+thumbWidth+spacerW;
                		}
                		else {
                			posX = margin;
                			posY = posY+thumbWidth+spacerH;
                		};

  					}
  				}
  				i++;
  		}
  		//b=0;
		//nbr=0;
		i=0;
		break;
		
		case "sub":
		
		
		subcat = new Array();
		subcat[0] = new Array()
		subcat[1] = new Array()
		subcat[2] = new Array()
		subcat[3] = new Array()
		subcat[4] = new Array()
		subcat[5] = new Array()
		subcat[6] = new Array()
		subcat[7] = new Array()
		subcat[8] = new Array()
		subcat[9] = new Array()

  		
  		chem = path;
  		  		
  		  	b=0;
			nbr=0;
  			origine=elmt;
  			i=0;
  			while(i<a[0].length){
  				if(a[9][i]==elmt){
  					
  					
  					subcat[0][b] = a[0][i];
  					subcat[1][b] = a[1][i];
  					subcat[2][b] = a[2][i];
  					subcat[3][b] = a[3][i];
  					subcat[4][b] = a[4][i];
  					subcat[5][b] = a[5][i];
  					subcat[6][b] = a[6][i];
  					subcat[7][b] = a[7][i];
  					subcat[8][b] = a[8][i];
  					subcat[9][b] = a[9][i];
  					
  					
  			  					
  					
   					origine = elmt;	
				    newDiv=document.createElement('div');
				    newDiv.setAttribute("id","div_"+nbr);
				    newDiv.setAttribute("style","width:170px;height:170px;position:relative;");
				    newDiv.innerHTML="<img id='img"+nbr+"' class='shade' name='"+b+"' src='img/works"+subcat[4][b]+"'onclick='showFullsubCat(name);' >";	
				    thumbs = document.getElementById("thumbs");
					thumbs.appendChild(newDiv);
					img = document.getElementById("img"+nbr);
					height = subcat[7][b];
					width = subcat[6][b];	
					b++;nbr++
					//centrage de l'image
					topImg = (170 - height)/2;
					leftImg = (170 -width)/2;
					img.style.marginTop = topImg+"px" ;
               		img.style.marginLeft = leftImg+"px" ;
					newDiv.style.position = "absolute";
                	newDiv.style.left = posX+"px";
                	newDiv.style.top = posY+"px";
                		if(posX+thumbWidth+margin+30<stageW){
                			posX = posX+thumbWidth+spacerW;
                		}
                		else {
                			posX = margin;
                			posY = posY+thumbWidth+spacerH;
                		};

  					
  				}
  				i++;
  		}
  		//b=0;
		//nbr=0;
		i=0;

		
		
		break;
		
		
		
		
		
		
		
		}
		
		
		
  		  		}	
 }
  		
  		
  		
  	
  		 				
 							
var chem; 							
 							
restSpace=0;
espaceX=0;

function posThumbs(){
	//if(etat_nav=="thumbs"){	    
		//position du div
		margin = 20;
		thumbWidth = 170;
		spaceX = 0;
		spaceY = 0;		
		//stage
		if (window.document.innerHeight){
  	   stageW = (innerWidth-((2*margin)+15));
	stageH = innerHeight-(2*margin)-120;
		}
    if (window.document.documentElement.clientHeight){
  		stageW = (window.document.documentElement.clientWidth-((2*margin)+15));
  		stageH = window.document.documentElement.clientHeight-(2*margin)-120;
  		}
			
		//colonnes possibles		
		colonnes = parseInt((stageW)/(thumbWidth));
		raw = parseInt(stageH/thumbWidth);			
		//espace restant
		freeSpaceW = stageW-(colonnes*thumbWidth);
		freeSpaceH = stageH-(raw*thumbWidth);
		//espace réparti
		spacerW = freeSpaceW/(colonnes-1);
		spacerH = freeSpaceH/(colonnes-1);
		//position			
		var posY = 0;
	    var posX = margin;
        for (k=0;k<nbr;k++) {
        	thumb = document.getElementById("div_"+k);
        	thumb.style.position = "absolute";
        	thumb.style.left = posX+"px";
        	thumb.style.top = posY+"px";
        	if(posX+thumbWidth+margin+30<stageW){
        		posX = posX+thumbWidth+spacerW;
        		}
        	else {
        		posX = margin;
        		posY = posY+thumbWidth+spacerH;
        	}
		}
}




function resize(){

	menuwidth = innerWidth - 200;
	//menuzone.style.width = menuwidth+"px";

     if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	
	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	
	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
	        
     document.images["bg"].width=orW;
	 document.images["bg"].height=orH;
	 
	 if (window.document.innerHeight){
  	     document.images["noCopy"].width = innerWidth;
		 document.images["noCopy"].height=innerHeight;
		}
    if (window.document.documentElement.clientHeight){
  		 document.images["noCopy"].width = window.document.documentElement.clientWidth;
  		 document.images["noCopy"].height = window.document.documentElement.clientHeight;
  		}

	 
		  posX = (stW-orW)/2+"px";
        posY = 100+"px";
       document.getElementById('backGround').style.left = posX;
       document.getElementById('backGround').style.top = posY;
     
    
     document.getElementById('full_picture').style.width = orW+"px";
     document.getElementById('full_picture').style.height = orH+"px";
     
     document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
  document.getElementById('nav_full').style.right = 20+"px";  
		 }

function showFullTop(elmt){	




    etat_nav="full";
	//document.getElementById('noCopy').
	document.body.scrollTo(0);
    document.getElementById('full').style.display = "none";
	var string = elmt;
		var select = string.substr(string.lastIndexOf('/') + 1);
		
		var cible = top[5][elmt];
		origine=origine;
		document.images["full_picture"].src = "img/works"+cible;
		
		
		 current = parseInt(elmt);
		 next_id = current+1;
		 previous_id = current-1;
		 if(previous_id<0){previous_id = current;}
         if(next_id==top[5].length){next_id=current}
		 next_cible = top[5][next_id];
		 
		
		 
		 previous_cible = top[5][previous_id];
		 //alert("elmt = "+elmt+" next = "+next_id)
		preload = new Image();
		preload.src = "img/works"+next_cible;
		preload_previous = new Image();
		preload_previous.src = "img/works"+previous_cible;	
     var noeud = document.getElementById("thumbs");
	 while (noeud.firstChild) {
 	 noeud.removeChild(noeud.firstChild);}
 		
 		
 	 orW = top[1][elmt];
	 orH = top[2][elmt];
	 if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}
	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
        
		
		
			
 		
 	 document.body.style.overflowY= "hidden";	
 
	
	 document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	  
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear()',1200);
    
    
     
     document.getElementById('nav_full').innerHTML = "<a class='prevnext' onclick='showPrevious()'>back</a><a class='grid' onclick='showThumbs(origine)'>grid</a><a class='prevnext' onclick='showNext()'>next</a>";
document.getElementById('nav_full').style.display = "block";
//document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";
}


function showFullTopCat(elmt){	

	
	document.body.scrollTo(0);
    document.getElementById('full').style.display = "none";
	var string = elmt;
	
	//elmt = position pict dans la liste
	
		var select = string.substr(string.lastIndexOf('/') + 1);
		
		var cible = topcat[5][elmt];
		
		
		
	
		
		
		document.images["full_picture"].src = "img/works"+cible;
		
		
		 current = parseInt(elmt);
		 next_id = current+1;
		 previous_id = current-1;
		 
		 if(previous_id<0){previous_id = current;}
		 
		
		 
		  if(next_id==topcat[5].length){next_id = current;}
		 
		 
		 next_cible = topcat[5][next_id];
		 previous_cible = topcat[5][previous_id];
		 //alert("elmt = "+elmt+" next = "+next_id)
		preload = new Image();
		preload.src = "img/works"+next_cible;
		preload_previous = new Image();
		preload_previous.src = "img/works"+previous_cible;	
     var noeud = document.getElementById("thumbs");
	 while (noeud.firstChild) {
 	 noeud.removeChild(noeud.firstChild);}
 		
 		
 	 orW = topcat[1][elmt];
	 orH = topcat[2][elmt];
	 if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
        
		
		
			
 		
 	 document.body.style.overflowY= "hidden";	
 
	
	 document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	  
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear()',1200);
    
     document.getElementById('nav_full').innerHTML = "<a class='prevnext' onclick='showPreviousTopCat()'>back</a><a class='grid' onclick='showThumbs(origine,chem)'>grid</a><a class='prevnext' onclick='showNextTopCat()'>next</a>";
document.getElementById('nav_full').style.display = "block";
//document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";
}


function full_appear(){new Effect.Appear('full', {duration:0.2, fps:25, from:0.0, to:1.0})}

function full_appear_fast(){new Effect.Appear('full_picture', {duration:0.1, fps:50, from:0.5, to:1.0})}

function showNext(){

	
	current = next_id;
	document.getElementById('full_picture').style.display="none";
	document.images["full_picture"].src = preload.src;
 	 orW = top[1][next_id];
	 orH = top[2][next_id];
	 if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	  if(next_id==top[5].length){next_id=current}
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
     
     document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	 
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear_fast()',0);
      //document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";
        




next_id=current+1;
if(next_id==top[5].length){next_id=current}
next_cible = top[5][next_id];

preload.src = "img/works"+next_cible;

previous_id=current-1;
 if(previous_id<0){previous_id = current;}
 
previous_cible = top[5][previous_id];

preload_previous.src = "img/works"+previous_cible;

}
function showNextTopCat(){



	current = next_id;
	document.getElementById('full_picture').style.display="none";
	document.images["full_picture"].src = preload.src;
 	 orW = topcat[1][next_id];
	 orH = topcat[2][next_id];
	 if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
     
     document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	 
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear_fast()',0);
     // document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";


next_id=current+1;
if(next_id==topcat[5].length){next_id=current}
next_cible = topcat[5][next_id];

preload.src = "img/works"+next_cible;

previous_id=current-1;
 if(previous_id<0){previous_id = current;}
  
previous_cible = topcat[5][previous_id];

preload_previous.src = "img/works"+previous_cible;

}



function showPrevious(){




	current = previous_id;
	document.getElementById('full_picture').style.display="none";
	document.images["full_picture"].src = preload_previous.src;
 	 orW = top[1][previous_id];
	 orH = top[2][previous_id];
	 if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
     
     document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	 
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear_fast()',100);
    // document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";     




next_id=current+1;
 if(next_id==top[5].length){next_id=current}
next_cible = top[5][next_id];

preload.src = "img/works"+next_cible;

previous_id=current-1;
 if(previous_id<0){previous_id = current;}
previous_cible = top[5][previous_id];

preload_previous.src = "img/works"+previous_cible;

}

function showPreviousTopCat(){



	current = previous_id;
	document.getElementById('full_picture').style.display="none";
	document.images["full_picture"].src = preload_previous.src;
 	 orW = topcat[1][previous_id];
	 orH = topcat[2][previous_id];
	if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
     
     document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	 
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear_fast()',100);
      //document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";

next_id=current+1;
 if(next_id==topcat[5].length){next_id=current}
next_cible = topcat[5][next_id];

preload.src = "img/works"+next_cible;

previous_id=current-1;
 if(previous_id<0){previous_id = current;}
previous_cible = topcat[5][previous_id];

preload_previous.src = "img/works"+previous_cible;

}

function mainmenu(){
	menuwidth = innerWidth - 400;
	menuzone = document.getElementById('menu');
	menustate = 1;
	thumbs = document.getElementById('thumbs');
	//menuzone.style.width = menuwidth+"px";
	//thumbs.addEventListener( "mouseover", menuHide, false );
	//menuShow();
}

function menuShow(){
	clearTimeout(timout);
	//thumbs.addEventListener( 'mouseover', menuHide, false );
	if (menustate == 0){
		menuzone.removeEventListener( "mouseover", menuShow, false );
		new Effect.Appear('menu', {duration:0.1, fps:50, from:0, to:1});
		menustate = 1;
	}
}

var timout;

function menuHide(){
    if (menustate == 1){
		timout = setTimeout("menustate = 0;new Effect.Appear('menu', {duration:0.1, fps:50, from:1, to:0});menuzone.addEventListener( 'mouseover', menuShow, false )",2000);
		//menuzone.addEventListener( "mouseover", menuShow, false );
	}
}

function callText(){/*
	textdiv = document.createElement('div');
	textdiv.setAttribute("style","position:absolute;left:100px;top:100px;widh:400px;height:400px;");
	textdiv.innerHTML="<a href='mailto:eva@evastassart.com'>mail</a><br><a href='http://www.facebook.com/eva.stassart'>connect</a>";
	body.appendChild(textdiv);*/
}



function showFullsubCat(elmt){	
	
	document.body.scrollTo(0);
    document.getElementById('full').style.display = "none";
	var string = elmt;
	
	//elmt = position pict dans la liste
	
		var select = string.substr(string.lastIndexOf('/') + 1);
		
		var cible = subcat[5][elmt];
		
			
		
		document.images["full_picture"].src = "img/works"+cible;
		
		
		 current = parseInt(elmt);
		 next_id = current+1;
		 previous_id = current-1;
		 
		 if(previous_id<0){previous_id = current;}
		 
		
		 
		  if(next_id==subcat[5].length){next_id = current;}
		 
		 
		 next_cible = subcat[5][next_id];
		 previous_cible = subcat[5][previous_id];
		 //alert("elmt = "+elmt+" next = "+next_id)
		preload = new Image();
		preload.src = "img/works"+next_cible;
		preload_previous = new Image();
		preload_previous.src = "img/works"+previous_cible;	
     var noeud = document.getElementById("thumbs");
	 while (noeud.firstChild) {
 	 noeud.removeChild(noeud.firstChild);}
 		
 		
 	 orW = subcat[1][elmt];
	 orH = subcat[2][elmt];
	 if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
        
		
		
			
 		
 	 document.body.style.overflowY= "hidden";	
 
	
	 document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	  
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear()',1200);
    
     document.getElementById('nav_full').innerHTML = "<a class='prevnext' onclick='showPrevioussubcat()'>back</a><a class='grid' onclick='showThumbs(origine,chem)'>grid</a><a class='prevnext' onclick='showNextsubcat()'>next</a>";
document.getElementById('nav_full').style.display = "block";
//document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";
}



function showPrevioussubcat(){



	current = previous_id;
	document.getElementById('full_picture').style.display="none";
	document.images["full_picture"].src = preload_previous.src;
 	 orW = subcat[1][previous_id];
	 orH = subcat[2][previous_id];
	if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
     
     document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	 
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear_fast()',100);
      //document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";

next_id=current+1;
 if(next_id==subcat[5].length){next_id=current}
next_cible = subcat[5][next_id];

preload.src = "img/works"+next_cible;

previous_id=current-1;
 if(previous_id<0){previous_id = current;}
previous_cible = subcat[5][previous_id];

preload_previous.src = "img/works"+previous_cible;

}

function showNextsubcat(){
	current = next_id;
	document.getElementById('full_picture').style.display="none";
	document.images["full_picture"].src = preload.src;
 	 orW = subcat[1][next_id];
	 orH = subcat[2][next_id];
	 if (window.document.innerHeight){
  	    var  stW = innerWidth;
		var stH = innerHeight-100;
		}
    if (window.document.documentElement.clientHeight){
  		var stW = window.document.documentElement.clientWidth;
  		var stH = window.document.documentElement.clientHeight-100;
  		}

	 ratioScreen = stW/stH;
	 ratioImage = orW/orH;
	 
	 
	 	if(ratioScreen<ratioImage){
	 
	 orW = stW - 40;
	 orH = orW/ratioImage;
	 } 
	else if (ratioScreen>=ratioImage){
	 orH = stH - 20;
	 orW = orH*ratioImage;
	 }
			

	//positionement
	
		posX = parseInt(stW-orW)/2+"px";
		
        posY = 100+"px";
     
     document.getElementById("full_picture").style.width = orW+"px";
	 document.getElementById("full_picture").style.height = orH+"px";
	 
 	 document.getElementById('full').style.left = posX;
     document.getElementById('full').style.top = posY;
     document.getElementById('full').style.width = stW;
     document.getElementById('full').style.height = orH+40;
     setTimeout('full_appear_fast()',0);
     // document.getElementById('nav_full').style.width = document.getElementById("full_picture").style.width;
document.getElementById('nav_full').style.right = 20+"px";


next_id=current+1;
if(next_id==subcat[5].length){next_id=current}
next_cible = subcat[5][next_id];

preload.src = "img/works"+next_cible;

previous_id=current-1;
 if(previous_id<0){previous_id = current;}
  
previous_cible = subcat[previous_id];

preload_previous.src = "img/works"+previous_cible;

}


