//-->
var FenetreRapp;
function FenetreRappel(Adresse) {
if (!FenetreRapp || FenetreRapp.closed)
	{
	FenetreRapp = window.open(Adresse,'FenetreCamp','scrollbars=no,width=700,height=460');
	}
	else
	{
	FenetreRapp.location.href=Adresse;
	}
FenetreRapp.focus();
}

function PrintDateFrench() {
  
   var ladate = new Date();
   var jour_semaine;
   var jour;
   var id_mois; 
   var mois;
   var annee;
   
   jour = ladate.getDate();
   id_mois = ladate.getMonth();
   
   annee = ladate.getYear();   
   
   if (navigator.appName == "Netscape")
    {
   		annee = annee + 1900;
    }
      
   switch (ladate.getDay())
   {   
   		case 0 : 
			jour_semaine = "Dimanche";      
			break;   
		case 1 : 
			jour_semaine = "Lundi";      
			break;   
		case 2 : 
			jour_semaine = "Mardi";      
			break;
		case 3 : 
			jour_semaine = "Mercredi";      
			break;
		case 4 : 
			jour_semaine = "Jeudi";      
			break;
		case 5 : 
			jour_semaine = "Vendredi";      
			break;
		case 6 : 
			jour_semaine = "Samedi";      
			break;
		default : 
			jour_semaine = "jour inconnu";
   }
	
   switch (id_mois)
   {   
   		case 0 : 
			mois = "janvier";      
			break;   
		case 1 : 
			mois = "f&eacute;vrier";      
			break;   
		case 2 : 
			mois = "Mars";      
			break;
		case 3 : 
			mois = "avril";      
			break;
		case 4 : 
			mois = "mai";      
			break;
		case 5 : 
			mois = "juin";      
			break;
		case 6 : 
			mois = "juillet";      
			break;
		case 7 : 
			mois = "ao&ucirc;t";      
			break;
		case 8 : 
			mois = "septembre";      
			break;
		case 9 : 
			mois = "octobre";      
			break;
		case 10 : 
			mois = "novembre";      
			break;
		case 11 : 
			mois = "d&eacute;cembre";      
			break;	
		default : 
			jour_semaine = "mois inconnu";
   }   	 
	
   document.writeln (jour_semaine + " " + jour + " " + mois + " " + annee);
}
//  End -->
<!--
function RestoreImage() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//-->
<!--
function ChercheImage(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=ChercheImage(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
//-->
<!--
function SwapImage() { 
  var i,j=0,x,a=SwapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=ChercheImage(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!--
function add_favoris() {
	if (navigator.appName == "Netscape") {
		alert ('Utilisateur de Netscape, Appuyez sur CTRL+d  pour ajouter cette page à vos favoris');
	} else {
		window.external.AddFavorite('<?echo $Serveur?>','<?echo $SiteNomWeb?>');
	}
}
//-->
<!--
function dropemail() {
alert ('En ne divulgant pas votre adresse émail, vous perdez diminuez vos chances et perdez des clients ');

}
//-->
<!--
if (parent.frames.length > 0)
	{
	window.top.location.href = location.href;
	}

function Lien(Url)
	{
	opener.location.href = Url;
	}
function Lien2(Url)
	{
	window.location.href = Url;
	}
function Maximiser()
	{
	window.moveTo(0,0);
	window.resizeTo(screen.availWidth,screen.availHeight);
	}
function Page(SiteAdresse, Demarrage)
{
if ((navigator.appName.search('Microsoft Internet Explorer') != -1)&&(navigator.userAgent.search('Opera') == -1))
{
document.write('<A HREF="#" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'' + SiteAdresse + '\');"><img src="<?echo $Serveur_Photo;?>/Images/Site/Home.gif" alt="' + Demarrage + '" border=0 ></A>');
}
}
var FenetreMembre;
function OuvrirFenetre(Adresse) {
if (!FenetreMembre || FenetreMembre.closed)
	{
	FenetreMembre = window.open(Adresse,'','scrollbars=yes,width=1024,height=600');
	}
	else
	{
	FenetreMembre.location.href=Adresse;
	}
FenetreMembre.focus();
}

tpsClignotte=100
MAC=(navigator.userAgent.indexOf('Mac')!=-1)?1:0;
NS4=(document.layers)?1:0; var IE=(document.all)?1:0;

numErreur=0
nomForm=""

function newChp()
{
	var a=newChp.arguments
	args="";virg=""
	for(i=0;i<a.length;i++){args+=virg+"\""+a[i]+"\"";virg=","}
	eval("Chp"+(++indexChp)+"=new C_Chp("+args+")")
	H_NomsIndex[nom]=indexChp;
}

function C_Chp()
{
	var a=C_Chp.arguments
	this.nom=a[0]
	this.nom_form=a[1]
	this.alertVide=a[2]
	this.alertType=a[3]
	this.type=a[4]
	this.format=a[5]
	this.vide=a[6]
	this.maxChars=a[7]
	this.specialCondAnd=a[8]
//	this.specialCondPlus=a[9]
//	this.alerttaille=a[9]
	return
}

function getObj(indexChp, nomProprerty)
{
	return eval("Chp"+indexChp+"."+nomProprerty)
}

function fct_alert(obj, nom, str_alert)
{
	obj.focus()
	alert(str_alert)
	if(!NS4 && !MAC && type!="radio" && type!="checkbox" && clignotteActif)clignotte(nom,0,10,0)
	return false
}

function setCouleurErreur(nom)
{
	setCouleurBG(nom, couleurErreur)
}

function setCouleurBG(nom, couleur)
{
	eval('document.'+nomForm+'.'+nom+'.style.background="'+couleur+'"')
}
	
function clignotte(nom,c,nbre,indexC)
{
	eval('document.'+nomForm+'.'+nom+'.style.background=('+c+')?"'+couleurClignotte1+'":"'+couleurClignotte0+'"')
	c=1-c
	indexC++
	if(indexC>nbre)
	{
		if(changeCouleur) setCouleurErreur(nom)
		return
	}
	setTimeout("clignotte('"+nom+"',"+c+","+nbre+","+indexC+")",tpsClignotte)
}


function test_form(formulaire)
{
	var val;
	nomForm=formulaire.name
	for(var indexChp=0;indexChp<nbreChp;indexChp++)
	{
		nom=getObj(indexChp, "nom")
		exceptField=0
		for(var i=0;i<tab_except_fields_of_test_form.length;i++)
		{
			if(tab_except_fields_of_test_form[i] == nom)
			{
				exceptField=1
				break
			}
		}
		if(exceptField) continue
		type=getObj(indexChp, "type")
		var format=getObj(indexChp, "format")
		var str_alert_vide=getObj(indexChp, "alertVide")
		var str_alert_type=getObj(indexChp, "alertType")
		var str_specialCondPlus=getObj(indexChp, "specialCondPlus")
		var str_specialCondAnd=getObj(indexChp, "specialCondAnd")
		var str_alert_special_cond=getObj(indexChp, "alertSpecialCondPlus")
		//var str_alerttaille=getObj(indexChp, "alerttaille")*
		
		eval("var obj=formulaire."+nom)

		// CAS OU IL Y A 2 FORMULAIRES DS LA MEME PAGE
		if(getObj(indexChp, "nom_form")!=nomForm) continue;

		
		if(typeof(obj)=="undefined")
		{
			alert("ERREUR: le champ '"+nom+"' n'existe pas")
			return false
		}
		if(type=="radio")
		{
			var str="";ok=0
			for(i=0;i<obj.length;i++)
				if(obj[i].checked)
				{
					str=obj[i].value
					obj=obj[i]
					ok=1
				}
			if(!ok) {obj=obj[0];nom=nom+"[0]"}
		}
		else if(type=="select")
		{
			var str=obj.options[obj.selectedIndex].value
		}
		else if(type=="checkbox")
		{
		
		}
		else
		{
			if(!NS4 && typeof(obj.selectedIndex)!="undefined") alert("ERREUR: preciser type => 'select'")
			var str=obj.value
		}

		if(str_specialCondAnd=="") specialCondAnd=1
		else specialCondAnd=eval(str_specialCondAnd)
		
		
		// TEST CHECKBOX
		if(type=="checkbox" && !obj.checked && specialCondAnd)
			return fct_alert(obj, nom, str_alert_type)

		// TEST CHP VIDE
		if(getObj(indexChp, "vide")==0 && str.length==0 && specialCondAnd)
			return fct_alert(obj, nom, str_alert_vide)
			
		// TEST CHP DATE
		if(type=='date' && str!="")
		{
			if(format!="")
			{
				posj=format.search(/jj/i)
				posm=format.search(/mm/i)
				posa=format.search(/aaaa/i)
				poss=format.search(/\W/)
				poss2=format.substring(poss+1, format.length).search(/\W/)+poss+1
				s1=format.substring(poss, poss+1)
				s2=format.substring(poss2, poss2+1)

				s_jj=str.substring(posj, posj+2)
				s_mm=str.substring(posm, posm+2)
				s_aaaa=str.substring(posa, posa+4)
				jj=parseInt(s_jj*1)
				mm=parseInt(s_mm*1)
				aaaa=parseInt(s_aaaa*1)
				sep1=str.substring(poss, poss+1)
				sep2=str.substring(poss2, poss2+1)

				if(
				(
					isNaN(jj) || isNaN(mm) || isNaN(aaaa)
					|| jj<1 || jj>31 || mm<1 || mm>12 || aaaa<1900 || aaaa>3000
					|| s1!=sep1 || s2!=sep2
					|| s_jj.indexOf(" ")!="-1" || s_mm.indexOf(" ")!="-1" || s_aaaa.indexOf(" ")!="-1"
				)	&& specialCondAnd
					)
					return fct_alert(obj, nom, str_alert_type)
			}
			else
				return alert("ERREUR: Format du champ '"+nom+"' non renseigné !")
		}
		
		// TEST CHP HEURE
		if(type=='heure' && str!="")
		{
			val=parseInt(str)
			if(val<0 || val>23 || isNaN(val) || specialCondAnd)
				return fct_alert(obj, nom, str_alert_type)
			obj.value=val
		}

		// TEST CHP MINUTES
		if(type=='min' && str!="")
		{
			val=parseInt(str)
			if(val<0 || val>59 || isNaN(val) || specialCondAnd)
				return fct_alert(obj, nom, str_alert_type)
			obj.value=val
		}

		// TEST CHP MAIL
		if(type=='email' &&  str!="")
		{
			if (!isemail(obj) && specialCondAnd)
				return fct_alert(obj, nom, str_alert_type)
		}

		// TEST CHP TEL
		if(type=='tel' && str!="")
		{
			val=parseInt(str)
			if ((!isTel(obj) || isNaN(val)) && specialCondAnd)
				return fct_alert(obj, nom, str_alert_type)
		}

		// TEST CHP codepostal
				if(type=='code' && str!="")
		{
			val=parseInt(str)
			if ((!iscode(obj) || isNaN(val)) && specialCondAnd)
				return fct_alert(obj, nom, str_alert_type)
		}
		// TEST CHP nombre
				if(type=='nombre' && str!="")
		{
			val=parseInt(str)
			if ((!isnombre(obj) || isNaN(val)) && specialCondAnd)
				return fct_alert(obj, nom, str_alert_type)
		}


		// TEST CONDITON SPECIALE PLUS

	}
	return true
}

function iscode(eml)
{
	a = eml.value.search(/^[0-9][0-9][0-9][0-9][0-9]+$/i)
	
	if(a!=-1)
		return true
	else
		return false
}
function isTel(eml)
{
	a = eml.value.search(/^0[0-5][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]+$/i)
	
	if(a!=-1)
		return true
	else
		return false
}

function isemail(eml)
{
	a = eml.value.search(/^[-0-9_.a-z]+@([-0-9a-z][-0-9a-z]+\.)+[a-z][a-z]+$/i)
	if(a!=-1)
		return true
	else
		return false
}
function isnombre(eml)
{
	a = eml.value.search(/^[0-9]+$/i)
	if(a!=-1)
		return true
	else
		return false
}



function CheckLen(nom)
{
	maxLength=getObj(H_NomsIndex[nom], "maxChars")
	if(maxLength==0) return 
	Target=eval("document."+nomForm+"."+nom)
	StrLen = Target.value.length

	if (StrLen > maxLength)
	{
		Target.value = Target.value.substring(0,maxLength)
		CharsLeft = maxLength
	}
	else
	{
		CharsLeft = StrLen;
	}
	if(typeof(eval('document.'+nomForm+'.CarCount_'+nom))!="undefined")
		eval('document.'+nomForm+'.CarCount_'+nom+'.value = maxLength - CharsLeft;')
}
		clignotteActif=1
		changeCouleur=1
		couleurErreur="#CAE6F3"
		couleurDefaut="#FFFFFF"
		couleurClignotte0="#FFFFFF"
		couleurClignotte1="#FFFFAA"

		indexChp=-1
		H_NomsIndex=new Array()
		tab_except_fields_of_test_form=new Array()

		newChp(
			nom = "prenom_campeur"
			,"form1"
			,"Veuillez entrer le prénom du contact, merci."
			,""
			,""
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)
		newChp(
			nom = "nom_campeur"
			,"form1"
			,"Veuillez entrer le nom du contact, merci."
			,""
			,""
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)
		newChp(
			nom = "ad1_campeur"
			,"form1"
			,"Veuillez entrer une adresse, merci."
			,""
			,""
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)
		newChp(
			nom = "codepostal_campeur"
			,"form1"
			,"Veuillez entrer votre code postal, merci."
			,""
			,""
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)
		newChp(
			nom = "commune_campeur"
			,"form1"
			,"Veuillez entrer votre commune, merci."
			,""
			,""
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)
newChp(
			nom = "email_campeur"
			,"form1"
			,"Veuillez saisir l'adresses email, merci."
			,"L'adresse email ne semble pas correcte"
			,"email"
			,""
			,0			
			,0			
			,""
			,""
			,""
		)
		
				newChp(
			nom = "nb_campeur"
			,"form"
			,"Le nombre de personnes est indispensable pour pouvoir réserver, merci."
			,"Le nombre de personnes doit être numérique!"
			,"nombre"
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
		)
newChp(
			nom = "email_campeur"
			,"form3"
			,"Veuillez saisir l'adresses email, merci."
			,"L'adresse email ne semble pas correcte"
			,"email"
			,""
			,0			
			,0			
			,""
			,""
			,""
		)
		
		newChp(
			nom = "prenom_campeur"
			,"form4"
			,"Veuillez entrer le prénom du contact, merci."
			,""
			,""
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)
		newChp(
			nom = "nom_campeur"
			,"form4"
			,"Veuillez entrer le nom du contact, merci."
			,""
			,""
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)
		newChp(
			nom = "tel_campeur"
			,"form4"
			,"Veuillez saisir le numéro de téléphone du contact, merci."
			,"Le numero entré n'est pas correct."
			,"tel"
			,""
			,0			
			,0			
			,""
			,""
			,""
			,""
			
		)

nbreChp=indexChp+1


