window.onscroll = moveMenu;


function moveMenu()
{

	if( document.getElementById('menuleft')){

		if( document.body.scrollTop){ dist=document.body.scrollTop; }else{ dist=document.documentElement.scrollTop; }
	
	
		if (document.getElementById('menuleft')) {
	
			ref=320;
	
					
			if(dist>ref){
				
				hauteur=document.getElementById('menuleft').offsetHeight;
				dispo=document.getElementById('tablepage').offsetHeight;	
				position=dist-ref+15;
				
				if (document.getElementById('haut')) { document.getElementById('haut').style.visibility="visible"; }
				
				if(position+hauteur > dispo  ){
					position2=dispo-hauteur;
					document.getElementById('menuleft').style.top=position2+"px";
					
				}else{
					document.getElementById('menuleft').style.top=position+"px";
				}
			}else{
				
				document.getElementById('menuleft').style.top="15px";
				if (document.getElementById('haut')) { document.getElementById('haut').style.visibility="hidden"; }
			}
		}
	}
}


function ouvre(fichier,larg,haut,px,py) {
	ff=window.open(fichier,"_blank","height="+haut+",width="+larg+",left="+px+",top="+py+",scrollbars=yes,resizable=no,menubar=no,status=yes/no,toolbar=no,location=no")
}
function photog(id) {
	ff=window.open("photog.php?id="+id,"_blank","height=650,width=850,left=0,top=0,scrollbars=yes,resizable=no,menubar=no,status=yes/no,toolbar=no,location=no")
}

function refer() {
if(document.ref.ref.value!=''){ window.location.href='fiche.php?ti=0&ref='+document.ref.ref.value;}
else{ alert('Veuillez indiquez une référence!');}
}


function montre(id) {
	var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
			if (document.getElementById('contenu'+i)) {document.getElementById('contenu'+i).style.display='none';}
		}
	if (d) {d.style.display='block';}
}


