var isIE=navigator.appName.indexOf("icrosoft");
var encours=0;
var nodeAppelant;

function allerA(url) { 	window.location.href=url; }

function allerAutrePart(url)
{
	window.open(url);	
}


function survolLogo(truc)
{
	var img=truc.getElementsByTagName("img")[0];
	var te=/_off.jpg/;
	var newsrc=img.src.replace(te,'_on.jpg');
	img.src=newsrc;
	truc.style.cursor="pointer";
}

function survolLogoOut(truc)
{
	var img=truc.getElementsByTagName("img")[0];
	var te=/_on.jpg/;
	var newsrc=img.src.replace(te,'_off.jpg');
	img.src=newsrc;
	
}

function survolLienHome(truc)
{
	truc.style.cursor="pointer";
	document.getElementById("lien_cie").style.display="block";
	document.getElementById("lien_unsoir").style.display="block";	
}

function survolLienOutHome()
{
	document.getElementById("lien_cie").style.display="none";
	document.getElementById("lien_unsoir").style.display="none";	
}

function boutonImageSurvol(truc)	{	truc.style.cursor="pointer";	}

function boutonImagesurvolOut(truc){	}

function buttonClick(evt)
{
	evt=(evt) ? evt : event;
	var _target=(evt.target) ? evt.target : evt.srcElement;
	//AIGUILLAGE
	
	if((_target.id=="cadreImage" || _target.className=="cadreImageImage") && encours==0)
	{
		encours=1;
		supprimerCadre();
	}
	encours=0;
}

function buttonMouseOver(evt)
{
	evt=(evt) ? evt : event;
	var _target=(evt.target) ? evt.target : evt.srcElement;
	_target.style.cursor="pointer";
	//AIGUILLAGE
	if(_target.className=="bouton" || _target.className=="bouton_off")
		_target.className="bouton_on";
	else if(_target.className=="bouton_on")
		_target.className="bouton_off";	
}

function buttonMouseOut(evt)
{
	evt=(evt) ? evt : event;
	var _target=(evt.target) ? evt.target : evt.srcElement;
	//AIGUILLAGE
	if(_target.className=="bouton_on")
		_target.className="bouton_off";	
}


function montrerGrandeImage(truc,hauteurImage,largeurImage,srcImage,changerAlpha)
{
	truc.style.visibility="hidden";
	nodeAppelant=truc;
	var calculY
	var offsetParent_=truc.parentNode.offsetTop;
	var offsetGParent=truc.parentNode.parentNode; //.offsetTop;
	
	var noeudLegende=truc.getElementsByTagName("span")[0];
	if(isIE==1)
		calculY=parseInt(truc.offsetTop)+offsetParent_+10;
	else
		calculY=parseInt(truc.offsetTop)-1; //-parseInt(truc.offsetTop);

	creerCadre(srcImage,calculY,noeudLegende,largeurImage,changerAlpha);
}

function creerCadre(srcImage,offset_Y,noeudLegende,largeurImage,changerAlpha)
{
	var zone=document.getElementById("zcontenu");
	var div_=document.createElement("div");
	div_.className="cadreImage";
	div_.id="cadreImage";
	div_.style.position="absolute";
	div_.style.top=offset_Y+"px";
	//div_.style.left="470px";
	if(isIE6==0)
		div_.style.left="470px";
	else
	{
		var oo=467+parseInt(document.getElementById("page").offsetLeft);
		//alert(oo);
		div_.style.left=oo+"px";
		
		
	}
	
	div_.style.width=largeurImage+"px";
	div_.style.zIndex="1000";
	
	
	if(isIE==-1)
	{
		div_.addEventListener("click",buttonClick,true);
		div_.addEventListener("mouseover",buttonMouseOver,false);
		div_.addEventListener("mouseout",buttonMouseOut,false);
	}
	else
	{
		div_.attachEvent("onclick",buttonClick);
		div_.attachEvent("onmouseover",buttonMouseOver);
		div_.attachEvent("onmouseout",buttonMouseOut);		
	}
	
	
	var image=image_create(srcImage,"",0,0,"cadreImageImage","");
	var zonel=document.createElement("div");
	
	zonel.className="zlegende";
	
	var legende=document.createElement("span");
	legende.innerHTML=noeudLegende.innerHTML;	
	
	var bouton=document.createElement("div");
	bouton.className="boutongrand";
	
	
	var imagebouton=image_create(repertoireMedias+"/petitecroixmoins.gif","",10,10,"","");
	imagebouton.className="boutongrand";
	bouton.appendChild(imagebouton);	
	zonel.appendChild(bouton);
	zonel.appendChild(legende);
	div_.appendChild(image);
	div_.appendChild(zonel);
	
	if(isIE6==0)
		document.getElementById("page").appendChild(div_);
	else
		document.body.appendChild(div_);
	
	
	if(changerAlpha==true)
	{
		if(isIE!=1)
			document.getElementById("bock").style.MozOpacity=0.3;
		else
			document.getElementById("bock").style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=30)";
	}
}

function supprimerCadre()
{
	var n=document.getElementById("cadreImage");
	var zone;
	if(isIE6==0)
		zone=document.getElementById("page");
	else
		zone=document.body;
	
	var tdiv=new Array();	
	tdiv=document.body.getElementsByTagName("div");
	for(var x=0;x<tdiv.length;x++)
	{
		if(tdiv[x].id=="cadreImage")
			zone.removeChild(tdiv[x]);						
	}
		
	if(isIE!=1)
		document.getElementById("bock").style.MozOpacity=1;	
	else
		document.getElementById("bock").style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=100)";		
	
	nodeAppelant.style.visibility="visible";	
}

function actionSurvol(truc) 	{	truc.className="actionOn";	}
function actionSurvolOut(truc){	truc.className="action";		}
function actionClick(truc)
{
	var voisin;
	if(isIE==1)
		voisin=truc.nextSibling;
	else
		voisin=truc.nextSibling.nextSibling;
	
	if(voisin.style.display=="none")
	{
		voisin.style.display="block";
		truc.innerHTML="&lt;- moins";		
	}
	else
	{
		voisin.style.display="none";
		truc.innerHTML="-&gt; en savoir +";		
	}
}

