function affiche(div) {
	if(document.getElementById(div).style.display == 'none') {
		document.getElementById(div).style.display = '';
	} else {
		document.getElementById(div).style.display = 'none';
	}
}

function afficheonglets(onglet,div) {
	var onglet0 = document.getElementById(onglet+0);
	onglet0.className='onglet-selectionne';
	
	var onglet1 = document.getElementById(onglet+1);
	onglet1.className='onglet-non-selectionne';
	
	var onglet2 = document.getElementById(onglet+2);
	onglet2.className='onglet-non-selectionne';
	
	if(document.getElementById(div).style.display == 'none') {
		document.getElementById(div).style.display = '';
	} else {
		document.getElementById(div).style.display = 'none';
	}
}

function bascule(div,nb,total) {
	var i=0;
	for(i;i<=total;i++) {
		if(i==nb) document.getElementById(div+i).style.display = '';
		else document.getElementById(div+i).style.display = 'none';
	}
}

function changeonglets(onglet,div,nb,total) {
	var i=0;
	for(i;i<=total;i++) {
		if(i==nb)  {
			document.getElementById(div+i).style.display = '';
			var clic = document.getElementById(onglet+i);
			clic.className='onglet-selectionne';
		}
		else {
			document.getElementById(div+i).style.display = 'none';
			var clic = document.getElementById(onglet+i);
			clic.className='onglet-non-selectionne';
		}
	}
}

function verif_email(elm) {
	if (!(elm.value.indexOf("@") != "-1" && elm.value.indexOf(".") != "-1")) {
	  alert('Merci d\'indiquer un email valide');
	}
}

// MOTEUR : FONCTION POPUP LINKEO POUR RAPPEL IMMEDIAT
function linkeoPopup(url) {
window.open(url,"popuplinkeo",'width=400,height=350,top=5,left=5,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=1');
}

// MOTEUR : FONCTION PERMETTANT DE CHANGER D'ONGLET DANS LES PAGES PRODUITS
function onglets(nom,nombre) {
	for(i=1;i<=nombre;i++) {
		if(i!=nom) {
			document.getElementById('produit-principal-'+i).style.display="none";
		}
		else {
			document.getElementById('produit-principal-'+i).style.display="block";
		}
	}
}
// MOTEUR : FONCTION PERMETTANT DE VISUALISER LES PHOTOS DANS LES PAGES PRODUITS
function photos(nom,nombre) {
	for(i=1;i<=nombre;i++) {
		if(i!=nom) {
			document.getElementById('image-big'+i).style.display="none";
		}
		else {
			document.getElementById('image-big'+i).style.display="block";
		}
	}
}
// MOTEUR : FONCTION POUR AFFICHER LA SELECT DES REGIONS SI PAYS FRANCE 
// AJOUT 17.11.2008 - SUPPRIMER DEPARTS SI PAYS FRANCE, CAR 0 RESULTATS SUR FRANCE SI UNE VILLE DE DEPART EST SELECTIONNEE
function affiche_regions(valeur) {
	if((valeur=='FRA1')) {
		//alert('France');
		document.getElementById('select_regions').style.visibility='visible';
		document.getElementById('select_regions').style.display='';
		//ajout
		document.getElementById('select_depart').style.visibility='hidden';
		document.getElementById('select_depart').style.display='none';
		document.getElementById('depart').value='0';
	}
	else {
		//alert('pas France');
		document.getElementById('select_regions').style.visibility='hidden';
		document.getElementById('select_regions').style.display='none';
		document.getElementById('multidepartement').value='0';
		//ajout
		document.getElementById('select_depart').style.visibility='visible';
		document.getElementById('select_depart').style.display='';
	}
}

// MOTEUR : FONCTION POUR ACTIVER LA SELECT DES REGIONS SI PAYS FRANCE
function affiche_regions_rubrique(valeur) {
	if((valeur=='FRA1')) {
		//alert('France');
		document.forms['moteur'].multidepartement.disabled=false;
		document.forms['moteur'].depart.disabled=true;
		document.getElementById('depart').value='0';
	}
	else {
		//alert('pas France');
		document.forms['moteur'].multidepartement.disabled=true;
		document.getElementById('multidepartement').value='0';
		document.forms['moteur'].depart.disabled=false;
		document.getElementById('multidepartement').value='0';

	}
}
function defile_photos(id) {
	document.getElementById('photos-produit-'+id).style.display = ''
}

function controledevis() {
	if(document.forms['formulaire'].ddepart.value=='') {alert('Merci d\'indiquer la date de votre départ'); return false;}
	if(document.forms['formulaire'].nom.value=='') {alert('Merci d\'indiquer votre nom'); return false;}
	if(document.forms['formulaire'].prenom.value=='') {alert('Merci d\'indiquer votre prénom'); return false;}
	if(document.forms['formulaire'].email.value=='') {alert('Merci d\'indiquer votre email'); return false;}
	if (!(document.forms['formulaire'].email.value.indexOf("@") != "-1" && document.forms['formulaire'].email.value.indexOf(".") != "-1")) {alert('Merci d\'indiquer un email valide'); return false;}
	if(document.forms['formulaire'].tel.value=='') {alert('Merci d\'indiquer votre téléphone'); return false;}
	return true;
}

//PAIEMENT OGONE
function paiement(dossier) {
	if(document.forms['form1'].nom.value=='') {alert('Merci d\'indiquer votre nom'); return false;}
	if(document.forms['form1'].prenom.value=='') {alert('Merci d\'indiquer votre prénom'); return false;}
	if(document.forms['form1'].EMAIL.value=='') {alert('Merci d\'indiquer votre email'); return false;}
	if(document.forms['form1'].dossier.value=='') {alert('Merci d\'indiquer votre numéro de dossier'); return false;}
	if(document.forms['form1'].depart.value=='') {alert('Merci d\'indiquer votre date de départ'); return false;}
	if(document.forms['form1'].amount.value=='0' || document.forms['form1'].amount.value=='') {alert('Merci d\'indiquer un montant'); return false;}
	if(document.forms['form1'].mention_taxes.checked==0) {alert('Merci d\'indiquer que vous avez pris connaissance des hausses possibles de taxes en cochant la case appropriée'); return false;}
	document.forms['form1'].COM.value = document.forms['form1'].nom.value+'*'+document.forms['form1'].depart.value+'*'+document.forms['form1'].dossier.value;
	document.forms['form1'].CN.value = document.forms['form1'].nom.value.toUpperCase()+' '+document.forms['form1'].prenom.value;
	document.forms['form1'].SHASign.value = hex_sha1(document.forms['form1'].orderID.value+''+document.forms['form1'].amount.value+'EURCercleagaga');
	if(dossier==1) {return verif_dossier();}
	else return true;
}
function paiement_CB() {
	document.forms['form1'].montant.value = document.forms['form1'].montant.value.replace(',', '.');
	if(isNaN(document.forms['form1'].montant.value)) {
		alert('Merci d\'indiquer une valeur numérique');
		return false;
	}
	document.forms['form1'].amount.value = document.forms['form1'].montant.value*100;
}
function verif_dossier() {
	if(document.forms['form1'].dossier.value.length!=10 || document.forms['form1'].dossier.value.charAt(0)!=0 || document.forms['form1'].dossier.value.charAt(1)>1 || document.forms['form1'].dossier.value.charAt(2)==0 || document.forms['form1'].dossier.value.charAt(3)!='-' || document.forms['form1'].dossier.value=='000-000000' || document.forms['form1'].dossier.value=='123-456789' || document.forms['form1'].dossier.value=='123-123456' || document.forms['form1'].dossier.value=='005-756567') {
		alert('Votre numéro de facture semble invalide. Merci de vérifier votre facture, qui doit comporter un numéro à 9 chiffres du type 000-000000');
		return false;
	}
	return true;
}


//24.11.2008 - LIEN SELON DESTINATION CDV SELECTIONNEE
function lien_cdv(destination){
//alert(destination)
switch(destination){
	case "afrique":window.open("http://www.vacancesafrique.com","_self"); break;
	case "australie":window.open("http://www.vacancesaustralie.com","_self"); break;
	case "canada":window.open("/vacances-canada/","_self"); break;
	case "dubai":window.open("/vacances-dubai/","_self"); break;
	case "egypte":window.open("/vacances-egypte/","_self"); break;
	case "guadeloupe":window.open("/voyage-iles/index.php?destination=GUA1","_self"); break;
	case "maurice":window.open("/voyage-iles/index.php?destination=ILE1","_self"); break;
	case "islande":window.open("/vacances-islande/","_self"); break;
	case "kenya":window.open("http://www.vacancesafrique.com","_self"); break;
	case "madagascar":window.open("/vacances-madagascar/","_self"); break;
	case "MAD1":window.open("/vacances-madagascar/","_self"); break;
	case "martinique":window.open("/voyage-iles/index.php?destination=MAR3","_self"); break;
	case "nouvelle-zelande":window.open("http://www.vacancesnouvellezelande.com","_self"); break;
	case "reunion":window.open("/voyage-iles/index.php?destination=REU1","_self"); break;
	case "seychelles":window.open("/vacances-seychelles/","_self"); break;
	case "tanzanie":window.open("/voyage-afrique/index.php?destination=TAN1","_self"); break;
	case "usa":window.open("/vacances-usa/","_self"); break;
	}
}

function PopupImage(img) { 
titre="Agrandissement"; 
w=open("",'image','width=200,height=200,toolbar=no,scrollbars=no,resizable=yes,top=50,left=50'); 
w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>"); 
w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+10,document.images[0].height+30); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
w.document.write("<BODY onload='checksize()' onblur='window.close()' onclick='window.close()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
w.document.write("<TD valign='middle' align='center'><IMG src='"+img+"' border=0 alt='Mon image'>"); 
w.document.write("</TD></TR></TABLE>");
w.document.write("</BODY></HTML>"); 
w.document.close(); 
}