var vprix=0;
//prend valeur de prix après calcul du prix
var vbook=0;
//prend valeur 1 quand la fonction validbook est appelée

function tabligne(formul){
//renvoie la ligne query avec les champs du formulaire - les trois lignes ci-dessous arrivent au même résultat
//document.getElementById("forme").submit();
//formulaire.submit();
//window.location=('plamenudemandeenvoi.php'+tabligne(formulaire)); 
var i, long = formul.length , ligne = "?"+formul.elements[0].name+"="+formul.elements[0].value;
for(i=0 ; i<long ; i=i+1) {
	ligne = ligne+"&"+formul.elements[i].name+"="+formul.elements[i].value ; }
return ligne ;
}

function isemail(email){
var place = email.indexOf("@",1);
var point = email.indexOf(".",1);
if ((place < 0) || (email.length < 6) || (point < 1)) { return false; }
else { return true; } 
}

function isnumeric(number,valeur){
	if (Number(number) == valeur) { return false; }
    return (/^[0-9]+$/.test(number));
}

function file(fichier)  {
if(window.XMLHttpRequest) // FIREFOX
	xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
	xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else
    return(false);
xhr_object.open("GET", fichier, false);
xhr_object.send(null);
if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);
}

function trim(texta) {
texta = texta.replace(/^\s*|\s*$/,"");
return texta
}

function booking() {
window.location=("scbooking.php");
}

function capitalize(gvar) {
return gvar.charAt(0).toUpperCase() + gvar.substring(1).toLowerCase()
}

function cgv(gvar) {
//affiche les "terms and conditions" gvar = "book" si vient de booking
var haut = 300 ;		
var top =(screen.height-haut)/2;
var left=(screen.width-520)/2;
var opts=', statusbar=no, toolbar=no, menubar=no, scrollbars=yes, width=520, height='+haut;
var wind=window.open('sccgv.htm','essai','top='+top+', left='+left+opts);
wind.focus();
}

function flegal(gvar) {
var hauteur = 230
var largeur = 390
var top =(screen.height-hauteur-80)/2;
var left=(screen.width-largeur)/2;
var opts=', channelmode=no ,directories=no, location=no, statusbar=no, toolbar=no, menubar=no, scrollbars=yes, width='+largeur+', height='+hauteur;
var wind=window.open('legal.htm','essai','top='+top+', left='+left+opts)
wind.focus();
}	

function fcgv(gvar) {
//affiche les "terms and conditions" si vient d'un site operateur gvar = "book" si vient de booking
var haut = 300 ;		
var top =(screen.height-haut)/2;
var left=(screen.width-520)/2;
var opts=', statusbar=no, toolbar=no, menubar=no, scrollbars=yes, width=520, height='+haut;
var wind=window.open('sccgv_f.htm','essai','top='+top+', left='+left+opts);
wind.focus();
}

function screquest(page)
{
//affiche le formulaire de demande de devis
var haut = 520 ;		
var top =(screen.height-haut)/2;
var left=(screen.width-540)/2;
var opts=', statusbar=no, toolbar=no, menubar=no, scrollbars=yes, width=540, height='+haut;
var wind=window.open('screquest.php','essai','top='+top+', left='+left+opts);
wind.focus();
}

function afdetailsprix(formulaire)
{
	var img =''
	var imgh=119
	var imgw=200
	var plus=90
	var bt=''
	
	if (formulaire.aprix.disabled) {
		img = 'images/notpossible.jpg'
		imgh=83
		imgw=110
		plus=-10 }	
	else if (formulaire.out_prix.value == 0) {
		img = 'images/notpossible.jpg'
		imgh=83
		imgw=110
		plus=-10 }		
	else if (formulaire.out_pax.value < 4) {
		img = 'images/octavia1.jpg'
		imgh=109
		imgw=171 }
	else if (formulaire.out_pax.value < 7) {
		img = 'images/807.jpg'
		imgh=92
		imgw=155	}
	else if (formulaire.out_pax.value < 9) {
		img = 'images/trafic3.jpg'
		imgh=103
		imgw=191	}
	else if (formulaire.out_pax.value < 16) {
		img = 'images/vwlt.jpg'
		imgh=109
		imgw=193	}
	else if (formulaire.out_pax.value < 56) {
		img = 'images/autocar.jpg'
		imgh=133
		imgw=174	}		

	if (formulaire.aprix.disabled) {
		var txt= "<font class=etiquette>No route calculated ...</font><BR>"
		txt=txt+"<font class=etiquette>Please press <font class=champ><B>Calculate</B><font class=etiquette> button</font><BR>";}
	else if (formulaire.out_prix.value == 0) {
		var txt= "<font class=etiquette>This transfer is not available ...</font><BR>"
		txt=txt+"<font class=etiquette>Please change <font class=champ><B>Resort/Passengers</B></font><BR>";}
	else { 	
		var txt=""
		if (formulaire.out_duree.value != " " && formulaire.home_duree.value != " ") {		
			txt=txt+"<font class=champ><strong>RETURN</strong><font class=etiquette> Transfer Quote"+'<BR>';}	
		else if (formulaire.out_duree.value != " ") {		
			txt=txt+"<font class=champ><strong>SINGLE</strong><font class=etiquette> Outward Transfer Quote"+'<BR>';}	
		else if (formulaire.home_duree.value != " ") {		
			txt=txt+"<font class=champ><strong>SINGLE</strong><font class=etiquette> Homeward Transfer Quote"+'<BR>';}	
			
		//var txt= "<font class=etiquette>From: <font class=champ>"+formulaire.out_airport.value+'<BR>'
		txt=txt+"<font class=etiquette>From: <font class=champ>"+formulaire.out_airport.value+'<BR>'
		txt=txt+"<font class=etiquette>To: <font class=champ>"+formulaire.out_resort.value
		+"<font class=etiquette> Distance: <font class=champ>"+formulaire.kms.value+'<font class=petit-blu> Kms<font class=champ><BR>';
		txt=txt+"<font class=etiquette>Passengers: <font class=champ>"+formulaire.out_pax.value+' '
		txt=txt+"<font class=etiquette>Total: <font class=champ>"+formulaire.out_prix.value+'<BR>';
		txt=txt+"<font class=etiquette>Price/Passenger: <font class=champ>"+formulaire.out_prixpax.value+'<BR>'

		if (formulaire.promo.value != " "  && formulaire.promocode.value != '0') {
			txt=txt+"<font class=etiquette>Personal Promotional Code: <font class=champ>"+formulaire.promo.value+'<BR>';}
		else if (formulaire.promo.value != " ") {
			txt=txt+"<font class=etiquette>Discount Included: <font class=champ>"+formulaire.promo.value+'<BR>';}

		if (formulaire.out_duree.value != " ") {
			txt=txt+formulaire.out_date.value+"<font class=etiquette> Duration: <font class=champ>"+formulaire.out_duree.value+'<BR>';}

		if (formulaire.home_duree.value != " ") {
			txt=txt+formulaire.home_date.value+"<font class=etiquette> Pickup: <font class=champ>"+formulaire.home_rdv.value+' ';
			txt=txt+"<font class=etiquette>Duration: <font class=champ>"+formulaire.home_duree.value+'<BR>';
			txt=txt+"<font class=petit-ora>(Pickup time could be requested earlier)";}
	
		txt=txt+"</font>"; }
	
	var haut = imgh+100+plus;		
	var top =(screen.height-haut)/2;
  	var left=(screen.width-350)/2;
	var opts=', channelmode=no ,directories=no, location=no, statusbar=no, toolbar=no, menubar=no, scrollbars=no, width=350, height='+haut;
	var wind=window.open('scmessage.php?image='+img+'&imgw='+imgw+'&imgh='+imgh+'&texte='+txt+'&bt='+bt,'essai','top='+top+', left='+left+opts);
	wind.focus();
}

function scmessage(gvar)
{
	var img =''
	var imgh=10
	var imgw=0
	var plus=0
	var bt=''
if (gvar == "0") {
		// message copyright
		img = 'francois2.gif'
		imgh = 61
		imgw = 90
		var txt='SKIcab.com is registered by NETIM<BR>For any information contact webmaster@skicab.com'; }
	else if (gvar == "1") {
		img = 'images/vehicules.jpg'
		imgh = 165
		imgw = 335
		plus = 0
		var txt='We use comfortable <font class=texte-ora><B>Minibus, ';
		txt = txt+'Car, Coach or People carriers</B></font> depending on needs for your transfer.'; }
	else if (gvar == "2") {
		img = 'images/letsnow.jpg'
		imgh = 75
		imgw = 90
		plus = 0
		var txt="For the comfort of passengers each vehicle has a <font class=texte-ora><B>Climate System</B></font>. Minibuses have a separated heating system for back seats.";	}
	else if (gvar == "3") {
		img = 'images/gift.jpg'
		imgh = 75
		imgw = 100
		plus = 10		
		var txt='In case your flight is delayed up to one hour, <font class=texte-ora><B>we will wait for you for free</B></font>. ';
		txt=txt+'For a delay of more than one hour, call before departing.';	}
	else if (gvar == "4") {
		img = 'images/chauffeur.jpg'
		imgh = 49
		imgw = 110
		plus = 10
		var txt='Our drivers are trained for your own <font class=texte-ora><B>safety</B></font> and service <font class=texte-ora><B>On Time';
		txt=txt+'</B></font>. You can always phone us for any information.';	}
	else if (gvar == "5") {
		img = 'images/dvdpetit.jpg'
		imgh = 60
		imgw = 80
		plus = 0	
		var txt='On request we can provide you with a <font class=texte-ora><B>DVD Player</B></font> to make your journey shorter. ';
		txt=txt+'<BR><font class=petit-ora>(option with supplement)</font>.';	}
	else if (gvar == "6") {
		img = 'images/babyseat.jpg'
		imgh = 94
		imgw = 149
		plus = 0		
		var txt='On request we can provide you with <BR>a <font class=texte-ora><B>Baby</B></font> or a <font class=texte-ora><B>';
		txt=txt+'Child Car Seat</B></font> for safety. <BR><font class=petit-ora>(option with supplement)</font>';	}		
	else if (gvar == "7") {
		img = 'images/trajet.gif'
		imgh = 52
		imgw = 110
		plus = 20				
		var txt='First Class, we guarantee the transfer with a <font class=texte-ora><B>Car, People carrier</B></font> or a ';
		txt=txt+'<font class=texte-ora><B>SUV</B></font>';
		txt=txt+'<BR>DVD player included.<BR><font class=petit-ora>(available for 1/7 passengers - supplement 15%)</font>';	}		
	else if (gvar == "8") {
		img = 'images/1class.jpg'
		imgh = 95
		imgw = 72
		plus = 30
		var txt='VIP Class comfort and safety,<BR> we guarantee the transfer with <BR><font class=texte-ora>';
		txt=txt+'<B>Leather Seats </B></font>';
		txt=txt+'<BR>DVD player and a Coffee stop.<BR><font class=petit-ora>(available for 1/7 passengers - supplement 25%)</font>';}
	else if (gvar == "9") {
		img = 'images/pt2ptfotolia_813643.jpg'
		imgh = 95
		imgw = 150
		plus = 50		
		var txt='From Geneva to the Tarentaise resorts <font class=texte-ora>(3 Valleys, Val Isere, Tignes...)</font>';
		txt=txt+' the normal route passes through Annecy (heavy traffic).'; 
		txt=txt+'<BR>We suggest passing via Chambery on the motorway for more comfort and to save time (-15/30mns)';
		//trough To avoid the Maximum comfort and safety,<BR> we can guarantee the transfer with a<BR><font class=texte-ora>';
		//<B>Leather Seats 4x4</B></font>';
		txt=txt+'<font class=petit-ora> (with supplement)</font>';}
	else if (gvar == "10") {
		//index 
		img = 'images/pt2fotolia_1100222.jpg'
		imgh = 57
		imgw = 100
		plus = 10
		var txt='We can also offer transfers from other Airports<BR><font class=texte-ora>(Torino, Paris, Milano...)</font>';
		txt=txt+' to get a quotation send us a special request.'; 
		bt='request';}
	else if (gvar == "11") {
		//index 
		img = 'images/pt2ptfotolia_813643.jpg'
		imgh = 95
		imgw = 150
		plus = 10
		var txt='We can also offer transfers from any City<BR><font class=texte-ora>(Lyon, Annecy, Aix les Bains, Saint Etienne...)</font>';
		txt=txt+'<BR>to get a quotation send us a special request.'; 
		bt='request';}
	else if (gvar == "12") {
		//index 
		img = 'images/pt2fotolia_956165.jpg'
		imgh = 88
		imgw = 120
		plus = 10
		var txt='We can also offer transfers to other Resorts<BR><font class=texte-ora>(La Toussuire, Valloire, Megeve...)</font>';
		txt=txt+'<BR>to get a quotation send us a special request.'; 
		bt='request';}
	else if (gvar == "14") {
		//index 
		img = 'images/xtrailtrafic.jpg'
		imgh = 93
		imgw = 302
		plus = 20
		var txt='We use very comfortable vehicles <font class=texte-ora>(Minibuses, Monospaces, 4x4 ...)</font>';
		txt=txt+' Our drivers are trained for your safety.';}
	else if (gvar == "15") {
		//index 
		img = 'images/bonjour.jpg'
		imgh = 110
		imgw = 83
		plus = 20
		var txt='Our driver will wait for you in the arrival hall <font class=texte-ora>with a sign displaying your name</font>';
		txt=txt+' we will help you with your luggage. In case of problem you can always get information by phone.';}
	else if (gvar == "16") {
		//index 
		img = 'images/attente.jpg'
		imgh = 110
		imgw = 86
		plus = 35
		var txt='What would you like on your way ?<BR>To look for skis in a sport shop, have a coffee or buy food in a supermarket ...';
		txt=txt+'<BR><font class=texte-ora>Just ask the driver to stop you on the way.</font>';
		txt=txt+'<BR><font class=petit-blu>(Except on Saturdays and heavy traffic hours)</font>';}
	else if (gvar == "17") {
		img = 'images/baby.jpg'
		imgh = 94
		imgw = 78
		plus = 0		
		var txt='On request we can provide you<BR>with a <font class=texte-ora><B>Baby Car Seat</B></font> for safety. <BR><font class=petit-ora>(option with supplement)</font>';}			
	else if (gvar == "18") {
		img = 'images/child.jpg'
		imgh = 70
		imgw = 70
		plus = 0		
		var txt='On request we can provide you<BR>with a <font class=texte-ora><B>Child Car Seat</B></font> for safety. <BR><font class=petit-ora>(option with supplement)</font>';}			
	else if (gvar == "19") {
		img = 'images/santafe.jpg'
		imgh = 66
		imgw = 150
		plus = 10
		var txt='First Class: transfer with a<font class=texte-ora><B> Car, Monospace or 4x4</B></font> DVD player <font class=petit-ora>(1-4p sup 15%)</font><BR>';
		txt=txt+'VIP Class: transfer with a<font class=texte-ora><B> Leather Seats 4x4</B></font> DVD player, Soft drinks <font class=petit-ora>(1-8 sup 25%)</font>'; }
	else if (gvar == "20") {
		img = 'images/bois2.jpg'
		imgh = 98
		imgw = 52
		plus = 35
		var txt='Indicate the actual Flight/Train departure time, <font class=texte-ora><B>the Pick-Up time will be calculated </B></font>';
		txt=txt+'and indicated during the booking process.<BR>';
		txt=txt+'In case you have a special wish, indicate it in the <font class=texte-ora><B>Special Requirements </B></font>zone.'; }
	else if (gvar == "20b") {
		img = 'images/bois2.jpg'
		imgh = 98
		imgw = 52
		plus = 35
		var txt='The Pick Up time has been calculated.<BR>';
		txt=txt+'<font class=petit-ora><B>(It is subject to changes in case of heavy or difficult traffic)</B></font><BR>';
		txt=txt+'If you want to change the Pick Up time,<BR>press <font class=champ><B>Prev</B></font>'; 
		txt=txt+' and indicate your wish<BR>in the <font class=champ><B>Special Requirements</B></font> zone.'; }
	else if (gvar == "21") {
		img = 'images/eurosvisa.gif'
		imgh = 120
		imgw = 120
		plus = 95
		var txt='To guarantee your booking<BR>you can choose your option :<BR><BR>';
		txt=txt+'<font class=texte-ora>1)<font class=etiquette> Pay Online a 20% deposit <font class=petit-ora>(secure transaction)</font>.<BR>';
		txt=txt+'<font class=texte-ora>2)<font class=etiquette> No deposit, just send your credit card details.</font><BR><BR>';
		txt=txt+'<font class=texte-blu>The final fare can be paid directly to the driver<BR>'
		txt=txt+'or prepaid Online before your arrival.</font><BR>';
		txt=txt+'<font class=petit-ora>(For groups > 8p, prepayment Online required)</font>'; }
	else if (gvar == "22") {
		img = 'images/telephone.jpg'
		imgh = 92
		imgw = 50
		plus = 50
		var txt='Please indicate the telephone number of the <BR><font class=texte-ora>Hotel, Chalet, Reception ... </font>where you will stay.<BR>';
		txt=txt+'We might need it to find the directions. We might speak to you about the <font class=texte-ora>traffic conditions</font>';
		txt=txt+' and change the pickup time for your departure.'; }
	else if (gvar == "23") {
		img = 'images/thankyou.jpg'
		imgh = 66
		imgw = 100
		plus = 20
		var txt='Your booking has been sent to our system.<BR>';
		txt=txt+'<font class=texte-ora>A booking confirmation will reach you shortly</font><BR>';
		txt=txt+'Have a nice journey to the Alps.'; }
	else if (gvar == "24") {
		img = 'images/back_disabled.gif'
		imgh = 20
		imgw = 20
		plus = 10
		var txt='Your booking has <B>NOT</B> been sent.<BR>';
		txt=txt+'<font class=texte-ora>An error occured...</font><BR>';
		txt=txt+'Please send us a new booking form.'; }
		
	var haut = imgh+100+plus;		
	var top =(screen.height-haut)/2;
  	var left=(screen.width-350)/2;
	var opts=', channelmode=no ,directories=no, location=no, statusbar=no, toolbar=no, menubar=no, scrollbars=no, width=350, height='+haut;
	var wind=window.open('scmessage.php?image='+img+'&imgw='+imgw+'&imgh='+imgh+'&texte='+txt+'&bt='+bt,'essai','top='+top+', left='+left+opts);
	wind.focus();
}	

function bookconfirm(formulaire)
{
	/* var haut = 200		
	var top =(screen.height-haut)/2;
  	var left=(screen.width-350)/2; */
	// cett fonction est appelée par scbooking après calcul et affichage des prix (afprix) 
	// affecter 0 à hidbook pour eviter le nouvel appel inopiné de booking, affecter aprix à la bonne valeur
	if(formulaire.tarif.value == 0) {
		alert('This transfer is not available...');
		return false }
	var opts= window.location.search.substr(0,window.location.search.length-1)+'0'+'&aprix='+formulaire.aprix.value+'&tarif='+formulaire.tarif.value+'&prc='+formulaire.promocode.value;
	opts = opts+'&oduree='+formulaire.out_duree.value+'&hrdv='+formulaire.home_rdv.value+'&hduree='+formulaire.home_duree.value;
	opts = opts+'&kms='+formulaire.kms.value;
	window.location=('bookconfirm.php'+opts);
}

function calemailconfirm(formulaire)
{
	/* var haut = 200		
	var top =(screen.height-haut)/2;
  	var left=(screen.width-350)/2; */
	// cett fonction est appelée par scbooking après calcul et affichage des prix (afprix) 
	// affecter 0 à hidbook pour eviter le nouvel appel inopiné de booking, affecter aprix à la bonne valeur
	var opts= window.location.search.substr(0,window.location.search.length-1)+'0'+'&aprix='+formulaire.aprix.value+'&tarif='+formulaire.tarif.value;
	window.location=('calemailform.php'+opts);
}

function validform(formulaire,prix) 
//vient de scprices
{
	if (formulaire.p_type.value != "SKICAB") 		
		var v1  = 'scprices.php?p_type='+formulaire.p_type.value+'&airport='+formulaire.sairport.value ;
	else  		
		var v1  = 'scprices.php?airport='+formulaire.sairport.value ;
	
	//var v1  = 'scprices.php?airport='+formulaire.sairport.value ;
	var v2  = '&resort='+formulaire.sresort.value ;
	var v3  = '&type='+formulaire.stype.value ;
	var v4  = '&pax='+formulaire.pax.value ;
	//var v5  = '&skis='+formulaire.skis.value ;
	var v5 = '&specialresort='+formulaire.specialresort.value ;	
	var v6  = '&outday='+formulaire.outday.value ;	
	var v7  = '&outmonth='+formulaire.outmonth.value ;
	var v8  = '&outyear='+formulaire.outyear.value ;
	var v9  = '&outh='+formulaire.outh.value ;	
	var v10 = '&homeday='+formulaire.homeday.value ;	
	var v11 = '&homemonth='+formulaire.homemonth.value ;
	var v12 = '&homeyear='+formulaire.homeyear.value ;	
	var v13 = '&homeh='+formulaire.homeh.value ;	
	var v14 = '&prix='+prix
	
	var temp = window.navigator.appName
	if (window.navigator.userLanguage == undefined) 
		var v15 = '&navi='+window.navigator.language+'-'+temp.substr(0,3) ;
	else
		var v15 = '&navi='+window.navigator.userLanguage+'-'+temp.substr(0,3) ;
		
	window.location.replace(v1+v2+v3+v4+v5+v6+v7+v8+v9+v10+v11+v12+v13+v14+v15);	
}

function validbooking(formulaire,prix) 
//vient de scbooking
{
	if (window.location.search.substr(1,8)=="calemail")
		var v1  = 'scbooking.php?calemail=1&airport='+formulaire.sairport.value ;
	else if (formulaire.p_type.value != "SKICAB") 		
		var v1  = 'scbooking.php?p_type='+formulaire.p_type.value+'&airport='+formulaire.sairport.value ;
	else  		
		var v1  = 'scbooking.php?airport='+formulaire.sairport.value ;
	
	var v2  = '&resort='+formulaire.sresort.value ;
	var v3  = '&type='+formulaire.stype.value ;
	var v4  = '&pax='+formulaire.pax.value ;
	var v5  = '&skis='+formulaire.skis.value ;
	var v6  = '&outday='+formulaire.outday.value ;	
	var v7  = '&outmonth='+formulaire.outmonth.value ;
	var v8  = '&outyear='+formulaire.outyear.value ;
	var v9  = '&outh='+formulaire.outh.value ;	
	var v10 = '&outm='+formulaire.outm.value ;		
	var v11 = '&homeday='+formulaire.homeday.value ;	
	var v12 = '&homemonth='+formulaire.homemonth.value ;
	var v13 = '&homeyear='+formulaire.homeyear.value ;	
	var v14 = '&homeh='+formulaire.homeh.value ;
	var v15 = '&homem='+formulaire.homem.value ;	
	var v16 = '&prix='+prix ;
	var v17 = '&adressresort='+formulaire.adressresort.value ;	
	var v18 = '&telresort='+formulaire.telresort.value ;	
	var v19 = '&specialresort='+formulaire.specialresort.value ;		
	var v20 = '&outnumber='+formulaire.outnumber.value ;	
	var v21 = '&outrequire='+formulaire.outrequire.value ;		
	var v22 = '&homenumber='+formulaire.homenumber.value ;	
	var v23 = '&homerequire='+formulaire.homerequire.value ;		
	var v24 = '&service='+formulaire.service.value ;	
	var v25 = '&motorway='+formulaire.motorway.value ;	
	var v26 = '&fname='+capitalize(formulaire.firstname.value) ;	
	var v27 = '&sname='+formulaire.surname.value.toUpperCase() ;		
	var v28 = '&femail='+formulaire.femail.value.toLowerCase() ;
	var v29 = '&mobile='+formulaire.mobile.value ;	
	var v30 = '&baby='+formulaire.baby.value ;	
	var v31 = '&child='+formulaire.child.value ;
	var v32 = '&dvd='+formulaire.dvd.value ;
	var v33 = ''

	var temp = window.navigator.appName
	if (window.navigator.userLanguage == undefined) 
		var v34 = '&navi='+window.navigator.language+'-'+temp.substr(0,3) ;
	else
		var v34 = '&navi='+window.navigator.userLanguage+'-'+temp.substr(0,3) ;
	
	var opt = v1+v2+v3+v4+v5+v6+v7+v8+v9+v10+v11+v12+v13+v14+v15+v16+v17+v18+v19+v20

	if (vbook==1) {
		//indique que bouton Booking a été pressé et que les controles ont été effectués
		v33 = '&hidbook=1' ; }
	window.location.replace(opt+v21+v22+v23+v24+v25+v26+v27+v28+v29+v30+v31+v32+v33+v34);	
}

function prevbooking(xvar)
//appelée par bouton prev dans bookconfirm
{
vbook=0;
var temp  = xvar.indexOf('&hidbook=1',1);
var temp2 = xvar.substr(0,temp);
var temp3 = xvar.substr(temp+10,200); 
window.location.replace('scbooking.php'+temp2+temp3);
return true
}

//function changedate(formulaire)
//voir fonctions PHP choixnum pour incrémenter date retour avec dte arrivée
//{
//alert('Bonjour');
//}

function validday(d,m,y)
{
if ((m=="04" || m=="06" || m=="09" || m=="11") && d=="31")
	return false;
else if (m=="02" && (d=="30" || d=="31"))
	return false;	
else if (m=="02" && d=="29" && (y!="2008" || y!="2012" || y!="2016"))
	return false;		
else
	return true;	
}

function dateok(formulaire)
{
var voutd  = new Date(formulaire.outyear.value, formulaire.outmonth.value -1, formulaire.outday.value, formulaire.outh.value);
var vhomed = new Date(formulaire.homeyear.value, formulaire.homemonth.value -1, formulaire.homeday.value, formulaire.homeh.value);

if (validday(formulaire.outday.value,formulaire.outmonth.value,formulaire.outyear.value) == false)
	alert("Please enter a valid Outward date..."); 
else if (validday(formulaire.homeday.value,formulaire.homemonth.value,formulaire.homeyear.value) == false)
	alert("Please enter a valid Homeward date..."); 
else if (voutd.getTime() > vhomed.getTime() && formulaire.stype.value == "Return")
	alert("Homeward can't be before Outward..."); 
else 
return true ;
}

function calculform(formulaire) 
{
//passe un pour modifier prix et afficher les résultats dans le champ des prix
if (dateok(formulaire) == true)
	validform(formulaire,1) ;
else
	return false
}

function calculbooking(formulaire) 
{
//passe un pour modifier prix et afficher les résultats dans le champ des prix
if (dateok(formulaire) == true)
	validbooking(formulaire,1) ;
else
	return false
}

function bookform(formulaire) 
{

if (dateok(formulaire) == true) {

	if(formulaire.firstname.value == "") {
	alert('Please enter your Firstname...');}
	else if(formulaire.surname.value == "") {
	alert('Please enter your Surname...');}
	else if(isemail(formulaire.femail.value) == false) {
	alert('Please enter a valid Email address...');}
	else if(formulaire.mobile.value == "") {
	alert('Please enter your Mobile Number...');}  
	else if(formulaire.adressresort.value == "") {
	alert('Please enter your address in Resort...');}
	else if(formulaire.telresort.value == "") {
	alert('Please enter your Resort Phone Number...');}
	else if(formulaire.outnumber.value == "" && (formulaire.stype.value == "Outward" || formulaire.stype.value == "Return") ) {
	alert('Please enter your Outward Flight/Train Number...');}
	else if(formulaire.homenumber.value == "" && (formulaire.stype.value == "Homeward" || formulaire.stype.value == "Return") ) {
	alert('Please enter your Homeward Flight/Train Number...') ;}
	//else if(formulaire.aprix.value == 0) {
	//alert('This route is not available...');}
	else {
	//alert(formulaire.aprix.value);}}
	//window.parent.vprix=23
	//formulaire.hidbook.value="1"
	vbook=1;
	validbooking(formulaire,1) ;}}
	//envoyer le formulaire ;
else {
	return false ;}
}

function emailform(formulaire) 
{

if (dateok(formulaire) == true) {

	var adresse = formulaire.femail.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);

	if(formulaire.surname.value == "") {
	alert('Please enter your Surname...');}
	else if(formulaire.femail.value == "") {
	alert('Please enter your Email address...');}
	else if ((place < 0)&&(adresse.length < 6)&&(point < 2)) {
	alert('Please enter a valid Email address...');}
	else {
	//alert(formulaire.aprix.value);}}
	//window.parent.vprix=23
	//formulaire.hidbook.value="1"
	vbook=1;
	validbooking(formulaire,1) ;}}
	//envoyer le formulaire ;
else {
	return false ;}
}
