
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' est ncessaire.\n'; }
  } if (errors) alert('Les problèmes suivants sont apparus:\n'+errors);
  document.MM_returnValue = (errors == '');
}




function checkFields() {
missinginfo = "";
testfocus = "0";

	if ((document.main.email.value == "") || (document.main.email.value.indexOf('@') == -1) || (document.main.email.value.indexOf('.') == -1)) 
	{
		missinginfo += "\n- Courriel vide ou non conforme";
	}	
   
	
	if(document.main.Nom.value == ""){
		missinginfo += "\n- Nom";
	}
	
	if(document.main.Prenom.value == ""){
		missinginfo += "\n- Prénom";
	}

	if(document.main.Adresse.value == ""){
		missinginfo += "\n- Adresse";
	}
	
	if(document.main.Telephone.value == ""){
		missinginfo += "\n- Telephone";
	}			
		
	
	if(document.main.Arrivee.value == ""){
		missinginfo += "\n- Date d'arrivée";
	}	
	
	if(document.main.Depart.value == ""){
		missinginfo += "\n- Date de départ";
	}		
	
		
	if (missinginfo != "") 
	{
		missinginfo = "Champ(s) manquant(s) : \n" + missinginfo
		alert(missinginfo);
		return false;
	}
	
    else return true;
}





function KW_cal_class(m,d,y,d1,d2,mn,c) { // v1.3.0
	this.o="";this.dsp="";this.m=m;this.d=d;this.y=y;this.d1=d1;this.d2=d2;
	this.mn=mn,this.sy=((y%100)<10)?"0"+(y%100):(y%100);this.mm=(m<10)?"0"+m:m;this.c=c
	this.dd=(d<10)?"0"+d:d;	iD=new Date(y,(m-1),d);eD=new Date();eD.setMilliseconds(0)
	eD.setHours(0);eD.setMinutes(0);eD.setSeconds(0);this.ofs=parseInt((eD-iD)/86400000)
	this.gC=function(){iD=new Date(this.y,(this.m-1),this.d);sD=this.dsp.toString()
	retVal="on";if (sD.indexOf("<a")!=0)retVal="off";if (iD.getDay()==0||iD.getDay()==6)
	if (sD.indexOf("<a")!=0)retVal="wkendoff";else retVal="wkendon";if (this.c==0)
	if (sD.indexOf("<a")!=0)retVal="ntmoff";else retVal="ntmon";if (this.ofs==0) 
	retVal="today";	if (this.spc()==true)retVal="special";return "kw_cal_"+retVal;}
	this.spc=function(){var retVal=false;dc=document;if (dc.kw_sp){ for (var i=0;i<dc.kw_sp.length;i++){
	if (this.m==dc.kw_sp[i].m&&(this.y==dc.kw_sp[i].y||dc.kw_sp[i].y=="*")&&this.d==dc.kw_sp[i].d)
	retVal=true;}} return retVal;}
}

function KW_setThisDisplay(f,n,d,o,a1,a2,a3,a4,w,l,sd){ // v1.4.0
	var rV="<a href=\"javascript:window.opener.KW_setCalendar('"+f+"',"+n+",'"+l+"'); window.close();\">"+d+"</a>";
	if ((a1==1&&o>0)||(a1==-1&&o<1)||(a1==2&&o>=0)) rV=d;if (a2>0) {if (o<=-a2) rV=d;} 
	else if (a2<0) {if (o>=-a2) rV=d;}if (a3!=-1) {ss=a3.split("|");if (ss[w]==1) rV=d} 
	if (a4>0) {if (o>=-a4 && o<0) rV=d;} if (a4<0) {if (o<=-a4 && o>0) rV=d; } if (sd) {
	rV=d} return rV;
}

function KW_date_class(m,d,y) {this.m=m;this.d=d;this.y=y;}

function KW_setCalendar(obj,n,l) { // v1.3.0
	dc=document;dO=dc.tMh[n];if (obj.indexOf("|")==-1)MM_findObj(obj).value=dO.o;
	else {oS=obj.split("|");tV= new Array(dO.m,dO.d,dO.y);for(var i=0;i<3;i++) {
	tO=MM_findObj(oS[i]);dc.KW_calYear=dO.y;for (var j=0;j<tO.options.length;j++)
	if (tO.options[j].value==tV[i]) tO.selectedIndex=j;}}dc.KW_calMonth=dO.m-1;
	if (l!=''){o=MM_findObj(l);v="hide";if (o.style){o=o.style; v='hidden'} o.visibility=v}
}

function KW_setDel(val) { // v1.3.1
	return (val.match(/\.gif$|\.png$|\.jpg$|\.jpeg$/i))?"<img src=\""+val+"\" class=\"kw_img\">":val
}

function KW_expertCalendar(){ // v1.4.1 
	var dc=document,a=KW_expertCalendar.arguments,d=new Date();d.setDate(1); if (a[29]!=-1) 
	d.setMonth(a[29]);else if (dc.KW_calMonth) d.setMonth(dc.KW_calMonth);cMn= d.getMonth(); 
	pMt=((cMn-1)<0)?11:cMn-1;nMh=((cMn+1)>11)?0:cMn+1;if (a[30]!=-1) d.setFullYear(a[30]);
	else if (dc.KW_calYear) d.setYear(dc.KW_calYear);cYr=d.getFullYear();pYr=(pMt==11)?cYr-1:cYr;
	nYr=(nMh==0)?cYr+1:cYr;wdy=d.getDay();dc.tMh=new Array();if (a[25]==1) wdy=((--wdy)<0)?6:wdy;
	tpM=new Date(d.getFullYear(),d.getMonth(),d.getDate()-wdy);for (var i=0;i<wdy;i++) {
	n=dc.tMh.length;dc.tMh[n]= new KW_cal_class((tpM.getMonth()+1),tpM.getDate(),tpM.getFullYear(),
	a[21],a[23],a[tpM.getMonth()],0);dc.tMh[n].o=eval("dc.tMh["+n+"]."+a[20])+dc.tMh[n].d1+
	eval("dc.tMh["+n+"]."+a[22])+dc.tMh[n].d2+eval("dc.tMh["+n+"]."+a[24]);	dc.tMh[n].dsp=
	(a[31]==1)?"&nbsp;":KW_setThisDisplay(a[19],n,tpM.getDate(),dc.tMh[n].ofs,a[26],a[27],
	a[28],a[42],tpM.getDay(),a[41],(dc.tMh[n].spc() && a[45]==1));tpM.setDate(tpM.getDate()+1)}EOM=false;for (var i=1;!EOM;i++) {
	n=dc.tMh.length;dc.tMh[n]=new KW_cal_class((d.getMonth()+1),d.getDate(),d.getFullYear(),
	a[21],a[23],a[d.getMonth()],1);;dc.tMh[n].o=eval("dc.tMh["+n+"]."+a[20])+dc.tMh[n].d1+
	eval("dc.tMh["+n+"]."+a[22])+dc.tMh[n].d2+eval("dc.tMh["+n+"]."+a[24]);
	dc.tMh[n].dsp=KW_setThisDisplay(a[19],n,d.getDate(),dc.tMh[n].ofs,a[26],a[27],a[28],a[42],
	d.getDay(),a[41],(dc.tMh[n].spc() && a[45]==1));d.setDate(d.getDate()+1);if (d.getDate()==1) EOM=true;} wdy=d.getDay();
	if (a[25]==1) wdy=((--wdy)<0)?6:wdy;for (var i=wdy;i<7;i++) {n=dc.tMh.length;
	dc.tMh[n]= new KW_cal_class((d.getMonth()+1),d.getDate(),d.getFullYear(),a[21],a[23],
	a[d.getMonth()],0);dc.tMh[n].o=eval("dc.tMh["+n+"]."+a[20])+dc.tMh[n].d1+
	eval("dc.tMh["+n+"]."+a[22])+dc.tMh[n].d2+eval("dc.tMh["+n+"]."+a[24]);
	dc.tMh[n].dsp=(a[31]==1)?"&nbsp;":KW_setThisDisplay(a[19],n,d.getDate(),dc.tMh[n].ofs,
	a[26],a[27],a[28],a[42],d.getDay(),a[41],(dc.tMh[n].spc() && a[45]==1));d.setDate(d.getDate()+1);} 
	ns4 =(dc.layers)?true:false;px=(ns4||window.opera)?'':'px';s=a[32];if (a[33]==-1) 
	{ww=window;d="document.getElementById('"+a[32].name+"')";k=1;x=0;y=0;xpos=0;ypos=0;
	iM=(navigator.appVersion.indexOf("Mac")==-1);p=".offsetParent";if (dc.getElementById) {
	if (!eval(d)) {d=d.replace(/.getElementById/,".getElementsByName")}
	while (eval(d+p)) {	x+=parseInt(eval(d+p+".offsetLeft"));
	y+=parseInt(eval(d+p+".offsetTop"));p+=".offsetParent";}ox=parseInt(s.offsetLeft);
	oy=parseInt(s.offsetTop);} else {x=parseInt(screen.height/2-75);ox=0;oy=0;
	y=parseInt(screen.width/2-75);}xp=parseInt(x+ox),yp=parseInt(y+oy+20);
	winW=(ns4)?window.innerWidth-16:dc.body.offsetWidth-20;
	winH=(ns4)?window.innerHeight:dc.body.offsetHeight;if (dc.all && iM) winH+=dc.body.scrollTop
	if ((xp+a[35])>winW) xp=winW-a[35]; if ((yp+a[36])>winH) yp=winH-a[36];	
	if (a[41]=='') {if (isNaN(ww.screenX)) {xp=xp-dc.body.scrollLeft+ww.screenLeft;
	yp=yp-dc.body.scrollTop+ww.screenTop;}else {xp=xp+ww.screenX+
	(ww.outerWidth-ww.innerWidth)-ww.pageXOffset;yp=yp+ww.screenY+
	(ww.outerHeight-24-ww.innerHeight)-ww.pageYOffset;	}if (!iM && dc.all)
	{ xp=xp-dc.body.scrollLeft;yp=yp-dc.body.scrollTop}}a[33]=xp;a[34]=yp}
	str="<html><head><title>"+a[cMn]+" "+cYr; accs="<a class=\"kw_cal_a\" ";
	str+="</title></head><link href=\""+a[43]+"\" rel=\"stylesheet\" type=\"text/css\" />"
	str+="<body style=\"margin:0; background-color:"+a[44]+";\">";if (a[41]!='' && !ns4) str="";
	str+="<table class=\"kw_cal_tbl2\"><tr><td colspan=\"7\">"
	str+="<table width=\""+(a[35]-10)+"\" border=0 cellspacing=0 cellpadding=0 class=\"kw_cal_tbl2\">";
	endStr="','"+a[31]+"',0";for(ix=33;ix<37;ix++)endStr+=","+a[ix];for(ix=37;ix<46;ix++)
	endStr+=",'"+a[ix]+"'";bStr="";for (var j=0;j<29;j++) bStr+="'"+a[j]+"',";
	aStr1=bStr+"'"+pMt+"','"+pYr+endStr;aStr2=bStr+"'"+nMh+"','"+nYr+endStr;str+="<tr><td "
	str+="class=\"kw_cal_mnth\">"+accs+"href=\"javascript:window.opener.KW_expertCalendar("+aStr1;
	str+=")\">"+KW_setDel(a[37])+"</a>"+a[cMn]+accs+"href=\"javascript:window.opener.KW_expertCalendar("
	str+=aStr2+")\">"+KW_setDel(a[38])+"</a></td>";aStr1=bStr+"'"+cMn+"','"+(cYr-1)+endStr;
	aStr2=bStr+"'"+cMn+"','"+(cYr+1)+endStr;str+="<td class=\"kw_cal_yr\">"+accs
	str+="href=\"javascript:window.opener.KW_expertCalendar("+aStr1+")\">"+KW_setDel(a[39])+"</a>"
	str+=cYr+accs+"href=\"javascript:window.opener.KW_expertCalendar("+aStr2+")\">"
	str+=KW_setDel(a[40])+"</a></td></tr></table></td></tr><tr>"
	for (var i=(a[25]==1)?13:12;i<19;i++) str+="<td class=\"kw_cal_wktitle\">"+a[i]+"</td>";
	if (a[25]==1) str+="<td class=\"kw_cal_wktitle\">"+a[12]+"</td>";str+="</tr>";
	for (var i=0;i<dc.tMh.length;i++) {if ((i)/7==parseInt((i)/7)) str+="<tr>"; 
	tdClass=dc.tMh[i].gC();temp=dc.tMh[i].dsp.toString();tdActive=(temp.indexOf("<a")!=-1)?"id='kwon'":"";
	str+="<td class=\""+tdClass+"\" "+tdActive+">"+dc.tMh[i].dsp+"</td>"
	if ((i+1)/7==parseInt((i+1)/7))str+="</tr>";}str+=(a[41]==''&&!ns4)?"</table></body></html>":"</table>";
	if (a[41]!='' && !ns4) {t=MM_findObj(a[41]);v="show";if (t.style) { t=t.style; v='visible'}
	t.visibility=v;	t.left=xp+px;t.top=yp+px;while (str.indexOf('window.opener.')!=-1)
	str=str.replace('window.opener.','');p1=str.indexOf(" window.close();"); while (p1!=-1) {
	str=str.substring(0,p1)+str.substring(p1+16);p1=str.indexOf(" window.close();")}
	MM_findObj(a[41]).innerHTML=str;} else {var nnx=(ns4)?1.25:1;var look='width='+(a[35]*nnx)
	look+=',height='+(a[36]*nnx)+',left='+a[33]+',top='+a[34];
	popwin=window.open('','calendar',look);	with(popwin.document){open();write(str);close();}}
}

