function survol(img,mode) {
 var flip=s?"'norm','surv'":"'surv','norm'";
 document[img].src=eval("document['"+img+"'].src.replace("+flip+")");
}

function ouvrirPage(page,titre,t,l,w,h) {
  window.open(page,titre,"toolbar=0,menubar=0,scrollbars=1,resizable=1,location=0,directories=0,top="+t+",left="+l+",width="+w+",height="+h);
}

function validMail() {
	var mail=String(document.f.mail.value);
	regEmail=/^([a-z]([_\.0-9a-z-]+)?@)([a-z]([_\.0-9a-z-]+)?\.)([a-z]{2,4})$/i;
//	if !regEmail.test(mail) {
//  		alert("\n\nInscrivez une adresse valide!\n\n");
//	}
}

function prelod(){
var d=document ,di=d.images, im=new Array();
 for(var i=0,j=0;i<di.length;i++){
  if(di[i].src.indexOf("_norm.")!=-1){
   im[j]= new Image();
   im[j].src=di[i].src.replace("_norm.", "_surv.");
    if(!di[i].onmouseover){
	di[i].onmouseover=Function("this.src=this.src.replace('_norm.','_surv.')");di[i].onmouseout=Function("this.src=this.src.replace('_surv.','_norm.')")
	}
   j++;
  }
 }
}

function isReal(valeur)
{
	var re = /^\d+([\.|,])?\d+$/;
	if(!re.test(valeur))
	{
		return false;
	}
	return true;
}

function isInteger(valeur)
{
	var re = /^\d+$/;
	if(!re.test(valeur))
	{
		return false;
	}
	return true;
}

function isNumeric(valeur)
{
	if (isInteger(valeur) || isReal(valeur))
		return true;
	else
		return false;
}


function findObj(n) { /* retrouve un obj par son identifiant */
var i,x, d=document;
if(!(x=d[n])&&d.all) x=d.all[n];
if(!x && d.getElementById) x=d.getElementById(n);
return x;
}
/* _________________________________  */
marge_top_origine='0px';
marge_left_origine='-360px';
/* _______________________________ */
t_marge=true;w_marge=true;
function removeMargin(){ /* attribuer ou enlever les marges en fonction de la position du caque principal "centrale" */
var obj = findObj("centrale");
if(!obj.marge_top_origine){ obj.marge_top_origine=obj.style.marginTop; obj.marge_left_origine=obj.style.marginLeft }
var t1, t_body, w_body, t_centrale=(findObj('centrale').offsetHeight+20), w_centrale=(findObj('centrale').offsetWidth+20);
t_body=window.innerHeight||document.body.clientHeight;
w_body=window.innerWidth||document.body.clientWidth;
if(obj.offsetTop<0){ obj.style.top='0px'; obj.style.marginTop='0px';t_marge=false; }
if(obj.offsetLeft<0){ obj.style.left='0px'; obj.style.marginLeft='0px';w_marge=false; }
if(!t_marge && t_body>t_centrale){ obj.style.top='50%'; obj.style.marginTop=marge_top_origine; t_marge=true; }
if(!w_marge && w_body>w_centrale){ obj.style.left='50%'; obj.style.marginLeft=marge_left_origine; w_marge=true; }
}

var divencours=1;	//1=petit;2=grand
function PlaceLegislation(obj){
if (obj){
	Y=0;
	var H=obj.offsetHeight;
	while(obj.tagName!='BODY')
	{
		Y+=obj.offsetTop;
		if(!obj.offsetParent) break;
		obj=obj.offsetParent;
	}
	if (findObj("divTelechargement"))
	{
		findObj("divTelechargement").style.top='' + (Y+H+10) + 'px';
		if(divencours==2)
		{
			findObj("divTelechargement").style.visibility="visible";
		}
	}
	if (findObj("divTelechargementPetit"))
	{
		findObj("divTelechargementPetit").style.top='' + (Y+H+10) + 'px';
		if(divencours==1)
		{
			findObj("divTelechargementPetit").style.visibility="visible";
		}
	}
}
}

function ShowPetitLeg()
{
	findObj("divTelechargementPetit").style.visibility="visible";
	findObj("divTelechargement").style.visibility="hidden";
}

function ShowGrandLeg()
{
	findObj("divTelechargementPetit").style.visibility="hidden";
	findObj("divTelechargement").style.visibility="visible";
}
	
	onload=function(){prelod();PlaceLegislation(findObj("MenuLiensPages"));removeMargin()}
	onresize=function(){removeMargin()}
