  /**************************************************/
 /********* FONCTIONS COMMUNES JAVASCRIPT *********/
/************************************************/
/*---------------------------------*/
function makearray(n) {
/*---------------------------------*/
	this.length = n;
	for(var i = 1; i <= n; i++)
		this[i] = 0;
	return this;
}

hexa = new makearray(16);
/*---------------------------------*/
function fade(sr, sg, sb, er, eg, eb, step){
/*---------------------------------*/
	for(var i = 0; i < 10; i++)
	hexa[i] = i;
	hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
	hexa[13]="d"; hexa[14]="e"; hexa[15]="f";
	for(var i = 0; i <= step; i++){
		setbgColor(
		Math.floor(sr * ((step-i)/step) + er * (i/step)),
		Math.floor(sg * ((step-i)/step) + eg * (i/step)),
		Math.floor(sb * ((step-i)/step) + eb * (i/step)));
	}
}

/*---------------------------------*/
function customfade(){
/*---------------------------------*/
/*si fonction customfade() désactivé (return) -> activer la couleur de fond sur BODY (arkiane.css) */
/* background: #5035AE;*/
return
	sr = 255
	sg = 255
	sb = 255
	er = 80
	eg = 53
	eb = 174
	step = 64
	for(var i = 0; i < 10; i++)
		hexa[i] = i;
		hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
		hexa[13]="d"; hexa[14]="e"; hexa[15]="f";
		for(var i = 0; i <= step; i++)
		{
			setbgColor(
			Math.floor(sr * ((step-i)/step) + er * (i/step)),
			Math.floor(sg * ((step-i)/step) + eg * (i/step)),
			Math.floor(sb * ((step-i)/step) + eb * (i/step)));
		}
}

/*---------------------------------*/
function hex(i) {
/*---------------------------------*/
	if (i < 0)
		return "00";
	else if (i > 255)
		return "ff";
		else return "" + hexa[Math.floor(i/16)] + hexa[i%16];
}

/*---------------------------------*/
function setbgColor(r, g, b) {
/*---------------------------------*/
	var hr = hex(r), hg = hex(g), hb = hex(b);
	document.bgColor = "#"+hr+hg+hb;
}

/*---------------------------------*/
function DisableBtnSuite(){
/*---------------------------------*/
/* pour éviter les clicks successifs */
	/* le formulaire est référencé */
	document.forms[0].b_next.disabled = 1;
	document.forms[0].submit();
	/* si on veut nommer le formulaire */
	/*document.nom_du_formulaire.nom_du_bouton.disabled = 1;
	document.nom_du_formulaire.submit();*/
}

/*---------------------------------*/
function SendPrest(goPage,icount){
/*---------------------------------*/
	fcount = "form_prest"+icount;
	document.forms[icount].action = goPage;
	document.forms[icount].target = "_top";
	document.forms[icount].submit();
}

/*---------------------------------*/
function EnableCC(){
/*---------------------------------*/
/* active les zones de saise CB  */
/* am 26-09-2008 désactive avec PAYBOX
	document.forms[0].num_cb.disabled = 0;
	document.forms[0].mois_exp.disabled = 0;
	document.forms[0].an_exp.disabled = 0;
	document.forms[0].crypto.disabled = 0;
*/
}
/*---------------------------------*/
function DisableCC(){
/*---------------------------------*/
/* desactive les zones de saise CB  */
/* am 26-09-2008 désactive avec PAYBOX
	document.forms[0].num_cb.disabled = 1;
	document.forms[0].mois_exp.disabled = 1;
	document.forms[0].an_exp.disabled = 1;
	document.forms[0].crypto.disabled = 1;
	document.forms[0].num_cb.value = "";
	document.forms[0].mois_exp.value = "";
	document.forms[0].an_exp.value = "";
	document.forms[0].crypto.value = "";
*/
}

/*---------------------------------*/
function currentpage(numpage){
/*---------------------------------*/
	document.form_dispo.no_appel.value = numpage;
	document.form_dispo.submit();
}

/*---------------------------------*/
function envoiMail(){
/*---------------------------------*/
	action="mailto:";
	document.courrier.action=action;
}

/*---------------------------------*/
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) {
/*---------------------------------*/
	if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

/*--------------------------------oc =030708-v9-*/
function verif_coord(lang,mailconf,top_no,last_minute){
/*---------------------------------*/
	liste_zones = ""
	if(document.form_coord.cc_accept.checked == false){
		switch (lang){
		 case "FR":msg = "Vous devez accepter les conditions générales pour poursuivre !";
			break;
		 default : msg="The booking conditions have not been accepted!";
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.cc_accept.focus();
		return false;
	}
	zone=document.form_coord.nom.value;
	if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"nom\n";}else{liste_zones=liste_zones+"name\n";}}
	zone=document.form_coord.prenom.value;
	if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"prénom\n";}else{liste_zones=liste_zones+"first name\n";}}
	zone=document.form_coord.pays.value;
	if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"pays\n";}else{liste_zones=liste_zones+"country\n";}}
	zone=document.form_coord.email.value;
	if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"email\n";}else{liste_zones=liste_zones+"email\n";}}
	if (top_no == 0) {
		/* SPEC2300 : Si TO on ne demande pas la confirmation des infos si dessous */
		zone=document.form_coord.adr1.value;
		if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"adresse\n";}else{liste_zones=liste_zones+"address\n";}}
		zone=document.form_coord.cp.value;
		if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"code postal\n";}else{liste_zones=liste_zones+"postal code\n";}}
		zone=document.form_coord.ville.value;
		if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"ville\n";}else{liste_zones=liste_zones+"city\n";}}
		zone=document.form_coord.tel.value;
		if ((zone.length<1)||(zone=="")){if (lang=="FR"){liste_zones=liste_zones+"téléphone\n";}else{liste_zones=liste_zones+"phone number\n";}}
	}
	/*oc150508-message final*/
	if (liste_zones!=""){
		switch (lang)	{
		 case "FR":msg="Les zones suivantes sont obligatoires : \n"+liste_zones;
			break;
		 default : msg="The following areas must be filled : \n"+liste_zones;
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.nom.focus();
		return false;
	}
	zone=document.form_coord.email.value;
	if ((zone.length>0) && (zone != "")){
		pos_arro = -1;
		pos_point = -1;
		pos_arro = zone.indexOf('@');
		if (pos_arro > -1){pos_point = zone.substring(pos_arro+1).indexOf('.');}
		if ((pos_arro == -1) || (pos_point == -1)) {
			switch (lang)	{
			 case "FR": msg="Email : ce n'est pas une adresse électronique valable !";
				break;
			 default :  msg="Email : it isn't a valid e-mail !";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.email.focus();
			return false;
	    	}
	}
	/*--- oc160508 --- gestion des abonnements ---*/
	liste_cocher = "";
	optin0_checked =document.form_coord.cc_optin[0].checked+"";
	optin1_checked =document.form_coord.cc_optin[1].checked+"";
	if ((optin0_checked == "false") && (optin1_checked == "false")){
		if (lang=="FR"){liste_cocher = liste_cocher+"informations commerciales,\n";}else{liste_cocher=liste_cocher+"commercial informations,\n";}
	}
	try{
		abnt0_checked =document.form_coord.cc_abnt_1[0].checked+ "";
		abnt1_checked =document.form_coord.cc_abnt_1[1].checked + "";
		if ((abnt0_checked == "false") && (abnt1_checked == "false")){
			liste_cocher = liste_cocher+document.getElementById("lib_abnt_1").innerHTML+"\n";
		}
	}catch(e){}
	try{
		abnt0_checked =document.form_coord.cc_abnt_2[0].checked + "";
		abnt1_checked =document.form_coord.cc_abnt_2[1].checked + "";
		if ((abnt0_checked == "false") && (abnt1_checked == "false")){
			liste_cocher = liste_cocher+document.getElementById("lib_abnt_2").innerHTML+"\n";
		}
	}catch(e){}
	try{
		abnt0_checked =document.form_coord.cc_abnt_3[0].checked + "";
		abnt1_checked =document.form_coord.cc_abnt_3[1].checked + "";
		if ((abnt0_checked == "false") && (abnt1_checked == "false")){
			liste_cocher = liste_cocher+document.getElementById("lib_abnt_3").innerHTML+"\n";
		}
	}catch(e){}
	try{
		abnt0_checked =document.form_coord.cc_abnt_4[0].checked + "";
		abnt1_checked =document.form_coord.cc_abnt_4[1].checked + "";
		if ((abnt0_checked == "false") && (abnt1_checked == "false")){
			liste_cocher = liste_cocher+document.getElementById("lib_abnt_4").innerHTML+"\n";
		}
	}catch(e){}
	if (liste_cocher != ""){
		switch (lang){
		  case "FR":msg="Vous devez cocher une case par ligne sur les éléments suivants : \n"+liste_cocher;
			break;
		  default : msg="You have to click an answer for each follwing line : \n"+liste_cocher;
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.cc_accept.focus();
		return false;
	}

	/*cc_secure_cheked = "true"*/ /*oc191004-cb obligatoire */
	cc_secure_cheked = document.form_coord.cc_secure[1].checked + "";
	/* ac030206 si ancienne ligne, pas le choix de paiement > CB obligatoire là on a le choix */
	if(cc_secure_cheked == "true"){
		zone=document.form_coord.num_cb.value;
		// if ((zone.length>0) && (zone != "")){
		indexe_espace=zone.indexOf(" ");
		if ( (zone.length!=16) || (indexe_espace!=-1 ) || isNaN(zone) || zone == "" || zone.length == 0 ) {
			switch (lang)	{
			  case "FR":msg="Le numéro de carte de crédit doit comporter 16 chiffres sans espaces.";
				break;
			  default : msg="Card number is 16 digits without spaces.";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.num_cb.focus();
			return false;
		}
		mois_exp = document.form_coord.mois_exp.value;
		an_exp   = document.form_coord.an_exp.value;
		if ( isNaN(mois_exp) || isNaN(an_exp)  ) {
			switch (lang)	{
			  case "FR":msg="Le date d'expiration doit être renseignée";
				break;
			  default : msg="Expiration date must be selected.";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.mois_exp.focus();
			return false;
		}
		// }
		zone=document.form_coord.crypto.value;
		if ((zone.length<1) || (zone == "")){
			switch (lang)	{
			  case "FR":msg="Veuillez entrer votre Cryptogramme visuel";
				break;
			  default : msg="Enter your Three-digit CVV number";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.crypto.focus();
			return false;
		}
	}/* if cc_secure_cheked==true*/
	document.form_coord.cc_accept.checked = false;
	document.form_coord.b_next.disabled = 1;

}/* function verif_coord*/

/*---------------------------------*/
function verif_coord_old(lang,mailconf,top_no,last_minute){
/*---------------------------------*/
	if(document.form_coord.cc_accept.checked == false){
		switch (lang){
			case "FR" :
				msg = "Vous devez accepter les conditions générales pour poursuivre !";
				break;
			default :
				msg="You don't have accepted booking conditions !";
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.cc_accept.focus();
		return false;

	}
	zone=document.form_coord.nom.value;
	if ((zone.length<1) || (zone == "")){
		switch (lang)	{
			case "FR" :
				msg="Veuillez entrer votre nom !";
				break;
			default :
				msg="Enter your last name !";
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.nom.focus();
		return false;
	}
	zone=document.form_coord.prenom.value;
	if ((zone.length<1) || (zone == "")){
		switch (lang)	{
			case "FR" :
				msg="Veuillez entrer votre prénom !";
				break;
			default :
				msg="Enter your first name !";
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.prenom.focus();
		return false;
	}
	zone=document.form_coord.pays.value;
	if ((zone.length<1) || (zone == ".")){
		switch (lang)	{
			case "FR" :
				msg="Veuillez entrer votre pays !";
				break;
			default :
				msg="Enter your country !";
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.pays.focus();
		return false;
	}
	if(parseInt(top_no) > 0) {
		/* Si TO on ne demande pas la confirmation des infos si dessous */
	} else {
		zone=document.form_coord.adr1.value;
		if ((zone.length<1) || (zone == "")){
			switch (lang)	{
				case "FR" :
					msg="Veuillez entrer votre adresse !";
					break;
				default :
					msg="Enter your address !";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.adr1.focus();
			return false;
		}
		zone=document.form_coord.cp.value;
		if ((zone.length<1) || (zone == "")){
			switch (lang)	{
				case "FR" :
					msg="Veuillez entrer votre code postal !";
					break;
				default :
					msg="Enter your zip code !";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.cp.focus();
			return false;
		}
		zone=document.form_coord.ville.value;
		if ((zone.length<1) || (zone == "")){
			switch (lang)	{
				case "FR" :
					msg="Veuillez entrer votre ville !";
					break;
				default :
					msg="Enter your city !";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.ville.focus();
			return false;
		}
		zone=document.form_coord.tel.value;
		if ((zone.length<1) || (zone == "")){
			switch (lang)	{
				case "FR" :
					msg="Veuillez entrer votre téléphone !";
					break;
				default :
					msg="Enter your phone number !";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.tel.focus();
			return false;
		}
	} /* Fin pas TO */

	zone=document.form_coord.email.value;
	if ((zone.length>0) && (zone != "")){
		pos_arro = -1;
		pos_point = -1;
		pos_arro = zone.indexOf('@');
		if (pos_arro > -1){pos_point = zone.substring(pos_arro+1).indexOf('.');}
		if ((pos_arro == -1) || (pos_point == -1)) {
			switch (lang)	{
				case "FR" :
					msg="Ce n'est pas une adresse électronique valable !";
					break;
				default :
					msg="Wrong email !";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.email.focus();
			return false;
		}
	}else{
		switch (lang)	{
		case "FR" :
			msg="Veuillez entrer votre email !";
			break;
		default :
			msg="Enter your email !";
		}
		setTimeout('Flash(msg)', speed);
		document.form_coord.email.focus();
		return false;
	}

	cc_secure_cheked = document.form_coord.cc_secure[1].checked + "";

	if(cc_secure_cheked == "true"){
		zone=document.form_coord.num_cb.value;
		var modele = /^[0-9]{16}$/i;
		if (!modele.test(zone)) {
			switch (lang)	{
				case "FR" :
					msg="Le numéro de carte de crédit doit comporter 16 chiffres sans espaces.";
					break;
				default :
					msg="Please check your credit card number (16 digits whitout space).";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.num_cb.focus();
			return false;
		}
		mois_exp = document.form_coord.mois_exp.value;
		an_exp   = document.form_coord.an_exp.value;
		var modele = /^[0-9]{2}$/i;
		if (!modele.test(mois_exp) || !modele.test(an_exp) ) {
			switch (lang)	{
				case "FR" :
					msg="Le date d'expiration doit être renseignée";
					break;
				default :
					msg="Expiration date must be selected.";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.mois_exp.focus();
			return false;
		}
		zone=document.form_coord.crypto.value;
		var modele = /^[0-9]{3}$/i;
		if (!modele.test(zone)){
			switch (lang)	{
				case "FR" :
					msg="Veuillez entrer votre Cryptogramme visuel (3 chiffres)";
					break;
				default :
					msg="Enter your three-digit CVV number";
			}
			setTimeout('Flash(msg)', speed);
			document.form_coord.crypto.focus();
			return false;
		}
    }
	document.form_coord.cc_accept.checked = false;
	document.form_coord.b_next.disabled = 1;

}

/*---------------------------------*/
function Flash(mess) {
/*---------------------------------*/
	if (visible == 0) {
		alert(mess);
		visible=1;
	} else {
		alert(mess);
		visible=0;
	}
}

/*---------------------------------*/
function prestVerif(idRubr) {
/*---------------------------------*/
	rubrQte = document.getElementById(idRubr).value;
	if (isNaN(rubrQte) || (rubrQte.indexOf('-') >= 0)) {
		document.getElementById(idRubr).value = "0";
		document.getElementById(idRubr).focus();
	}
}

var newwindow;
/*---------------------------------*/
function openpopup(url, width, height)
/*---------------------------------*/
{
	newwindow=window.open(url,'name','height='+height+',width='+width+',left=0, top=0,resizable=yes,scrollbars=yes,toolbar=no,status=no')
	if (window.focus) {newwindow.focus()}
}

/*---------------------------------*/
function showPrest(idDiv, show, idText)
/*---------------------------------*/
{
	var div  = document.getElementById(idDiv);
	var text = document.getElementById(idText);
	if (show == 0) {
		div.style.display = "none";
	} else {
		div.style.display = "";
	}
}