// fonctions de gestion des onglets

	function onglAccueil() {
		// on masque infohdr et carte visite
		document.getElementById("infohdr").style.display="none";
		document.getElementById("cartevisite").style.display="none";
		// on va masquer les onglets par un script aléatoire
		nbonglets=4;
		blocaff=Math.floor(Math.random() * nbonglets)+1;
		i=1;
		while (i<=nbonglets) {
			if (i!=blocaff) {
				Effect.SlideUp("contmet"+i,{duration:0});
			}
			i++;
		}
		// on affiche le titre de l'onglet en selected
		document.getElementById("ssmenu"+blocaff).className="ssmenuslctd";
	}

	function onglMetiers() {
		// on masque infohdr et carte visite
		document.getElementById("infohdr").style.display="none";
		document.getElementById("cartevisite").style.display="none";
		// on va masquer les onglets sauf le premier
		nbonglets=4;
		i=2;
		while (i<=nbonglets) {
			if (i!=blocaff) {
				Effect.SlideUp("contmet"+i,{duration:0});
			}
			i++;
		}
		// on affiche le titre de l'onglet en selected
		document.getElementById("ssmenu"+blocaff).className="ssmenuslctd";
		// on affiche le visuel de l'onglet s&eacute;lectionn&eacute;
		if (document.getElementById("visu"+blocaff)) {
			document.getElementById("visu"+blocaff).style.display="block";
		}
	}
	
// fonction de centrage d'un popup

	function centrer(id) {
		// recuperer les dimensions du browser
		if (window.innerHeight==undefined) {
			// IE
			h=document.body.clientHeight;
			l=document.body.clientWidth;
		} else {
			// NS, FF, GC
			h=window.innerHeight;
			l=window.innerWidth;
		}
		// centrer
		elem=document.getElementById(id);
		elem.style.top=Math.floor((h-elem.offsetHeight)/2);
		elem.style.left=Math.floor((l-elem.offsetWidth)/2);
	}

// fonctions pour l'opacité progressive

	function changeOpac(opacity,id) {
		// fonction qui change l'opacité d'un élement
		// appelée par la fonction opacity
		var object = document.getElementById(id).style;
		object.opacity = (opacity / 100);
		object.MozOpacity = (opacity / 100);
		object.KhtmlOpacity = (opacity / 100);
		object.filter = "alpha(opacity=" + opacity + ")";
	}		

	function opacity(id,opacStart,opacEnd,millisec) {
		// fonction qui gère le fondu de l'opacité
		// appelée sur mouseover/out vignettes
		var millisec = 700;
		var speed = Math.round(millisec / 100);
		var timer = 0;		
		if(opacStart > opacEnd) {
			for(i = opacStart; i >= opacEnd; i--) {
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		} else if(opacStart < opacEnd) {
			for(i = opacStart; i <= opacEnd; i++) {
				setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
				timer++;
			}
		}
	}
	

// fonctions pour affichage ou masquage des onglets ********************************************

		// var globale pour mémoriser le bloc affiché pour changement onglet
		var blocaff=1;

		function coucou(id) {
			// si le bloc demand&eacute; est diff&eacute;rent du bloc affich&eacute;
			if (id!=blocaff) {
				Effect.SlideUp("contmet"+blocaff,{delay:0.1,duration:0.5});
				Effect.SlideDown("contmet"+id,{delay:0.6,duration:0.5});
				// classe de l'ancien lien en normal
				document.getElementById("ssmenu"+blocaff).className="ssmenu";
				// classe du nouveau lien en selected
				document.getElementById("ssmenu"+id).className="ssmenuslctd";
				// revalorise la var globale
				blocaff=id;
			}
		}
		
// fonctions pour affichage popups

		function showInfoHDR() {
			// on vire l'affichage de l'onglet car sinon bug visuel avec flash...
			if (document.getElementById('contmet'+blocaff)) {
				document.getElementById('contmet'+blocaff).style.display="none";
			} else {
				document.getElementById('main').style.display="none";
			}
			// on affiche infohdr
			mask('contenu');
			Effect.SlideDown('infohdr',{duration:1});
		}
		function hideInfoHDR() {
			Effect.SlideUp('infohdr',{duration:1});
			// on affiche l'onglet ouvert avant infohdr
			if (document.getElementById('contmet'+blocaff)) {
				setTimeout("document.getElementById('contmet'+blocaff).style.display='block';",1000);
			} else {
				setTimeout("document.getElementById('main').style.display='block';",1000);
			}
			setTimeout("unmask('contenu')",1000);
		}

		function show(id,option) {
			if (option!=2) {
				// on vire l'affichage de l'onglet car sinon bug visuel avec flash...
				if (document.getElementById('contmet'+blocaff)) {
					document.getElementById('contmet'+blocaff).style.display="none";
				} else {
					document.getElementById('main').style.display="none";
				}
			}
			window.location.hash='rien';
			window.location.hash='ancrehaut';
			// on affiche le bouzin
			document.getElementById(id).style.zIndex=20;
			Effect.SlideDown(id,{duration:1});
			mask('contenu');
		}

		function hide(id) {
			Effect.SlideUp(id,{duration:1});
			document.getElementById(id).style.zIndex=0;
			// on affiche l'onglet ouvert avant infohdr
			if (document.getElementById('contmet'+blocaff)) {
				setTimeout("document.getElementById('contmet'+blocaff).style.display='block';",1000);
			} else {
				setTimeout("document.getElementById('main').style.display='block';",1000);
			}
			setTimeout("unmask('contenu')",1000);
		}
		
		function mask(id) {
			opac=20;
			document.getElementById(id).style.opacity = (opac / 100);
			document.getElementById(id).style.MozOpacity = (opac / 100);
			document.getElementById(id).style.KhtmlOpacity = (opac / 100);
			document.getElementById(id).style.filter = "alpha(opacity=" + opac + ")";
		}
		
		function unmask(id) {
			opac=100;
			document.getElementById(id).style.opacity = (opac / 100);
			document.getElementById(id).style.MozOpacity = (opac / 100);
			document.getElementById(id).style.KhtmlOpacity = (opac / 100);
			document.getElementById(id).style.filter = "alpha(opacity=" + opac + ")";
		}


/* fonctions pour affichage gallerie *******************************************************************/

		function affichgal(id,type) {
			libel="";rep="";prelibel2="";libel2="";
			if (type==1) {
				libel="Photo HDR";
				prelibel2="comparer &agrave; une ";
				libel2="photo classique";
				rep="photohdr";
			}
			if (type==3) {
				if ((id*1)<1000) {
					libel="Photo HDR-is&eacute;e";
					prelibel2="comparer &agrave; la ";
					libel2="photo originale";
				} else {
					libel="Photo Panoram-is&eacute;e";
					prelibel2="voir l'";
					libel2="assemblage";
				}
				rep="dmpixisation";
			}
			// recherche précédent
			chaineprec='&nbsp;';
			prec=id-1;precnb=prec;
			prec+="";
			while (prec.length<4) {
				prec="0"+prec;
			}
			if (document.getElementById('gal'+prec)!=null) {
				chaineprec='<a rel="nofollow" href="javascript:affichgal(\''+prec+'\','+type+');">&#9668;&nbsp;Pr&eacute;c&eacute;dent</a>';
			}
			// recherche suivant
			chainesuiv='&nbsp;'
			suiv=precnb+2;
			suiv+="";
			while (suiv.length<4) {
				suiv="0"+suiv;
			}
			if (document.getElementById('gal'+suiv)!=null) {
				chainesuiv='<a rel="nofollow" href="javascript:affichgal(\''+suiv+'\','+type+');">Suivant&nbsp;&#9658;</a>';
			}
			visu=document.getElementById('visugal');
			chaine='	<div class="bloctxt">';
			chaine+='		<p><strong>'+libel+'</strong> (survolez pour '+prelibel2+libel2+')<span class="right"><a href="javascript:hide(\'visugal\');">Fermer</a></span><br/><br/></p>';
			chaine+='		<a href="javascript:hide(\'visugal\');"><img src="metier/'+rep+'/g'+id+'.jpg" alt="photo HDR / '+libel2+'" title="Survolez pour comparer. Cliquez pour fermer" onmouseover="this.src=\'metier/'+rep+'/b'+id+'.jpg\';" onmouseout="this.src=\'metier/'+rep+'/g'+id+'.jpg\';" class="photovisugal"/></a><br/><br/>';
			chaine+='		<div id="precgal" class="left dix" style="margin-left:5px;">'+chaineprec+'</div>';
			chaine+='		<div id="suivgal" class="right dix" style="margin-right:20px;">'+chainesuiv+'</div>';
			chaine+='		<div class="clear dix"><br/></div>';
			chaine+='	</div>';
			visu.innerHTML=chaine;
		}

		function showgal(id,type) {
			affichgal(id,type);
			show('visugal');
		}
		
/* fonctions pour affichage gallerie *******************************************************************/

		function affichvis(id,type) {
			libel="";rep="";prelibel2="";libel2="";
			if (type==1) {
				libel="Visite Virtuelle HDR";
			}
			if (type==2) {
				libel="Visite Virtuelle Classique";
			}
			// recherche précédent
			chaineprec='&nbsp;';
			prec=id-1;precnb=prec;
			prec+="";
			while (prec.length<4) {
				prec="0"+prec;
			}
			if (document.getElementById('gal'+prec)!=null) {
				chaineprec='<a rel="nofollow" href="javascript:affichvis(\''+prec+'\','+type+');">&#9668;&nbsp;Pr&eacute;c&eacute;dent</a>';
			}
			// recherche suivant
			chainesuiv='&nbsp;'
			suiv=precnb+2;
			suiv+="";
			while (suiv.length<4) {
				suiv="0"+suiv;
			}
			if (document.getElementById('gal'+suiv)!=null) {
				chainesuiv='<a rel="nofollow" href="javascript:affichvis(\''+suiv+'\','+type+');">Suivant&nbsp;&#9658;</a>';
			}
			visu=document.getElementById('visuvis');
			chaine='	<div class="bloctxt">';
			chaine+='		<p><strong>Visite virtuelle HDR</strong><span class="right"><a href="javascript:hide(\'visuvis\');">Fermer</a></span><br/><br/></p>';
			chaine+='		<object type="application/x-shockwave-flash"  data="flash/'+id+'.swf" width="500" height="375" class="photovisugal">';
			chaine+='			<param name="movie" value="flash/'+id+'.swf" /> ';
			chaine+='			<param name="allowfullscreen" value="true" /> ';
			chaine+='		</object>';
			chaine+='		<div id="precgal" class="left dix" style="margin-left:5px;">'+chaineprec+'</div>';
			chaine+='		<div id="suivgal" class="right dix" style="margin-right:20px;">'+chainesuiv+'</div>';
			chaine+='		<div class="clear dix"><br/></div>';
			chaine+='	</div>';
			visu.innerHTML=chaine;
		}

		function showvis(id,type) {
			affichvis(id,type);
			show('visuvis');
		}
		
/* fonctions pour déroulants dans les galleries ********************************************************/

		function plusgal(id) {
			Effect.SlideDown(document.getElementById("contgal"+id),{duration:0.5});
			document.getElementById("sepgal"+id).innerHTML='<a href="javascript:moinsgal('+id+');">&#9650; Afficher - d\'exemples</a>';
		}

		function moinsgal(id) {
			Effect.SlideUp(document.getElementById("contgal"+id),{duration:0.5});
			document.getElementById("sepgal"+id).innerHTML='<a href="javascript:plusgal('+id+');">Afficher + d\'exemples &#9660;</a>';
		}
		
/*   A VOIR ? ******************************************************************************************/

		
		
		function star(sel) {
			// eclaire ou pas les etoiles du vote en fonction du mouseOver
			i=1;
			while (i<=5) {
				if (i<=sel) {
					document.getElementById("str"+i).src="star1.png";
				} else {
					document.getElementById("str"+i).src="star0.png";
				}
				i++;
			}
		}

