function RestoreImg(){
  var i,x,a=document.xsr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function preloadImg(){
  var d=document; if(d.images){ if(!d.xp) d.xp=new Array();
    var i,j=d.xp.length,a=preloadImg.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.xp[j]=new Image; d.xp[j++].src=+a[i];}}
}
function findObj(n,d){
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function swapImg(){
  var i,j=0,x,a=swapImg.arguments; document.xsr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.xsr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function GetByID(ID){
	if(document.getElementById){
		return document.getElementById(ID);
	}else if(document.all){
    return document.all[ID];
	}
}
function AjoutePart(){
	Tval=GetByID('NBpart').value;
	value=GetByID('NBpart').value=parseFloat(Tval)+0.5;
}
function DiminuePart(){
	Tval=GetByID('NBpart').value;
	if(Tval>1)GetByID('NBpart').value=parseFloat(Tval)-0.5;
}
function SetVal(val,chp){
	GetByID(chp).value=val;
}
function TextTools(a){
	U="<img src='images/TSDOWN.gif' width='221' height='18' align='absmiddle'>";
	D="<img src='images/TSUP.gif' width='221' height='18' align='absmiddle'>";
	if(a==1){msg=U;}
	if(a==2){msg=D;}
	if(a==3){msg="";}
	GetByID('ToolTip').innerHTML=msg;
}
function chk(){
	return true;
}
function validate(F){
	var obj = document.getElementById(F);
	if(F=='frmemail' || F=='frmrapid' || F=='frmrdv' || F=='frmpro' || F=='newsletter'){
		ValidateForm(F);
	}else{
		if(chk()==true)obj.submit();
	}
}
function ValidateForm( fid ){
	var F, N, M, T;
	var err, e, result;
	this.F = fid;
	this.err = false;
	this.e = 0;
	this.result = "";
	//this.GetByID = function(ID){
	//	if(document.getElementById){
	//		return document.getElementById(ID);
	//	}else if(document.all){
	//    return document.all[ID];
	//	}
	//};
	this.HL = function(C){
		GetByID(C).style.backgroundColor = "#DCBBBB";
	};
	this.chkNom = function(){
		this.N = GetByID(this.F).nom.value;
		this.err = false;
		if(this.N.length>=5){
			this.err = regNom();
		}else{
			this.err = true;
		}
		return( !this.err );
	};
	this.chkPrenom = function(){
		this.N = GetByID(this.F).prenom.value;
		this.err = false;
		if(this.N.length>=5){
			this.err = regNom();
		}else{
			this.err = true;
		}
		return( !this.err );
	};
	this.chkEmail = function(){
		this.M = GetByID(this.F).email.value;
		if(this.M.length>8){
			this.err = !regEmail();
		}else{
			this.err = true;
		}
		return( !this.err );
	};
	this.chkNewsletter = function(){
		this.M = GetByID(this.F).nemail.value;
		if(this.M.length>8){
			this.err = !regEmail();
		}else{
			this.err = true;
		}
		return( !this.err );
	};
	this.chkTel = function(){
		this.T = GetByID(this.F).telperso.value;
		if(this.T.length>8){
			this.err = !regTel();
		}else{
			this.err = true;
		}
		return( !this.err );
	};
	this.chkTelMb = function(){
		this.T = GetByID(this.F).telgsm.value;
		if(this.T.length>8){
			this.err = !regTel();
		}else{
			this.err = true;
		}
		return( !this.err );
	};
	this.chkCP = function(){
		this.Z = GetByID(this.F).cp.value;
		if(this.Z.length<5)this.err = true;
		return( !this.err );
	};
	this.chkSjt = function(){
		this.Z = GetByID(this.F).subject.value;
		if(this.Z.length<6)this.err = true;
		return( !this.err );
	};
	this.chkMsg = function(){
		this.Z = GetByID(this.F).message.value;
		if(this.Z.length<10)this.err = true;
		return( !this.err );
	};
	this.chkAdresse = function(){
		this.Z = GetByID(this.F).adresse.value;
		if(this.Z.length<10)this.err = true;
		return( !this.err );
	};
	this.regNom = function(){
		return(this.N.search(/^\w+((-\w+)|(\.\w+))*[0-9]+$/)!=-1);
	};
	this.regEmail = function(){
		return(this.M.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]+$/)!=-1);
	};
	this.regTel = function(){
		return(this.T.search(/^\w+((-\w+)|(\.\w+))*[0-9]+$/)!=-1);
	};
	if(this.F=='frmemail'){
		if( !chkNom() ){this.e++;HL('nom');}
		if( !chkEmail() ){this.e++;HL('email');}
		if( !chkSjt() ){this.e++;HL('subject');}
		if( !chkCP() ){this.e++;HL('cp');}
		if( !chkMsg() ){this.e++;HL('message');}
	}else if( this.F == 'frmrapid' ){
		if( !chkNom() ){this.e++;HL('nom');}
		if( !chkTel() ){this.e++;HL('telperso');}
		if( !chkCP() ){this.e++;HL('cp');}
	}else if( this.F == 'frmpro' || this.F=='frmrdv'){
		if( !chkNom() ){this.e++;HL('nom');}
		if( !chkTel() ){this.e++;HL('telperso');}
		if( !chkAdresse() ){this.e++;HL('adresse');}
		if( !chkCP() ){this.e++;HL('cp');}
		if( !chkEmail() ){this.e++;HL('email');}
	}else if( this.F == 'newsletter'){
		if( !chkNewsletter() ){this.e++;HL('nemail');}
	}
	if( !this.e ){
		this.result = GetByID(fid).submit();
	}else{
		this.result = alert("veuillez verifier votre saisi.");
	}
	return this.result;
}