<!--

//-----------------------------------------------------------------------
// récup Données sur recherche moteur précédente
//
ejs_list = new Array;
ejs_list_valeur = new Array;
ejs_place = document.location.href.indexOf("?",0);
if(ejs_place >= 0){
	ejs_query_string = document.location.href.substring(ejs_place+1, document.location.href.length);
	ejs_place_and = ejs_query_string.indexOf("&",0);
	if(ejs_place_and >= 0)
		ejs_list = ejs_query_string.split("&");
	else
		ejs_list[0] = ejs_query_string;
	for (ejs_i=0;ejs_i<ejs_list.length;ejs_i++){
		ejs_temp = ejs_list[ejs_i].split("=");
		ejs_variable = ejs_temp[0];
		ejs_valeur = ejs_temp[1];
		ejs_plus_place = ejs_valeur.indexOf("+",0);
		while (ejs_plus_place >-1)
			{
			ejs_temp2 = ejs_valeur.substring(0,ejs_plus_place) + ' ' + ejs_valeur.substring(ejs_plus_place+1,ejs_valeur.length);
			ejs_valeur = ejs_temp2;
			ejs_plus_place = ejs_valeur.indexOf("+",ejs_plus_place+2);
			}
		ejs_list_valeur[ejs_variable] = ejs_valeur;
		}	
	}

function get(ejs_get){
	if(ejs_list_valeur[ejs_get])
		return(unescape(ejs_list_valeur[ejs_get]));
	else
		return("");
	}


//-----------------------------------------------------------------------
//  Affichage Critères Ville de départ & Destinations


function show_destinations(selObj,valid){
	VILLEDEPART = selObj.options[selObj.selectedIndex].value;
	//alert(VILLEDEPART);
	if (valid=="NON") selObj.selectedIndex=0;
		if (valid=="YES")
		document.location.href="?villedepart=" + VILLEDEPART + "";
}
function show_destinations2(selObj,valid){
	VILLEDEPART = document.forms["frm_search"].villedepart.value;
	THEME = selObj.options[selObj.selectedIndex].value;
	//alert(VILLEDEPART+" | "+THEME);
	if (valid=="NON") selObj.selectedIndex=0;
		if (valid=="YES")
		document.location.href="accueil-plongee.htm?villedepart=" + VILLEDEPART + "&theme=" + THEME + "";
}

//-----------------------------------------------------------------------
//  Affichage Critère DATE 
//  possibilité d'afficher la date complète JJ/MMAA (cas s==1 + s==2) 
//  ou juste MMAA (cas s==2)

function init_date(dateForm){ 
	// récupération du champs date à afficher dans le formulaire
	var s=dateForm;	
	// Initialisation de la date par défaut à aujourd'hui + 15 jours
	DEFAUT_DATE_AVANCE =15;
	// init jour-mois-année
	today = new Date();
	mois_courant = today.getMonth()+1; // mois calendaire
	annee_courante =today.getFullYear(); yyyy_courante=new String(annee_courante);yy_courante=yyyy_courante.substr(2,4);
	today.setDate(today.getDate() + DEFAUT_DATE_AVANCE);
	jour = today.getDate();
	mois = today.getMonth()+1; // mois par défaut correspondant à date_avance
	annee=today.getFullYear();
	yyyy=new String(annee); yy=yyyy.substr(2,4); //pour affichage annee format yy
	jj = get("jj");
	mm = get("mm");
	if(mm) { mois = mm; }
	if(jj) { jour = jj; }
	
	if(s==1){ //  mettre jour menu déroulant
		for(var i=1;i<=31;i++)
		{	document.write('<option value="'+ i+'" ');
			if(i==jour) { document.write(' selected="selected" ');	}
			document.write('>'+ i +'</option>');
		}
	}
	//	
	if(s==2){ //mettre mois + année menu déroulant
	
		var moisCodes = new Array("","01","02","03","04","05","06","07","08","09","10","11","12");
		var moisLib = new Array("","Janv.","F&eacute;v.","Mars","Avril","Mai","Juin","Juillet","Ao&ucirc;t","Sept.","Oct.","Nov.","Déc.");
		
		//document.write('<option value="">Indiff&eacute;rent</option>');
		for(var i=mois_courant;i<=12;i++) // à partir du mois courant, affiche tous les mois de l'année courante
		{      //alert(mois_courant+' <- courant /  + date_avance -> '+mois);
		       document.write('<option value="'+annee_courante+i+'"');
		       if(i==mois) { document.write(' selected="selected" ');        }
		       document.write('>'+moisLib[i]+'&nbsp;'+yy_courante+'</option>');
		}
		if((mois_courant)||(mois)>9) // à partir du mois d'octobre, affiche les m mois de l'année suivante
		{
		       if(annee_courante == annee){ annee+=1; }
		       for(var i=1;i<mois_courant;i++)
		       {
		       document.write('<option value="'+annee+i+'"');
		       if(i==mois) { document.write(' selected="selected" ');        }
		       yyyy=new String(annee); yy=yyyy.substr(2,4); //pour affichage annee format yy
		       document.write('>'+moisLib[i]+'&nbsp;'+yy+'</option>');
		       }
		}
	
	}
	
	
	// pour passer mm & aaaa séparément
	document.write('<input type="hidden" name="mm" value="'+mois+'" class="text" />');
	document.write('<input type="hidden" name="aaaa" value="'+annee+'" class="text" />');
}

//-----------------------------------------------------------------------
//  Affichage Critère THEME

function init_theme(){
	var formule="\$$FORM:THEME$$";
	var rep1="$$REP:3$$";
	var th1=new Array('T02','T03','T04','T05','T06','T07','U03','M01');
	var th2=new Array('Baln&eacute;oth&eacute;rapie','Thalasso &amp; Spa','Zen','Forme &amp; Sant&eacute;','Silhouette &amp; Beaut&eacute;','Future et jeune Maman','Luxe','Maxi affaires');

	var nb=th1.length;
	//document.write('<option value="">Indiff&eacute;rent</option>');
	for(var i=0;i<nb;i++)
	{
		document.write('<option value="'+th1[i]+'"');
		if( (th1[i]==formule) || (th1[i]==rep1) ) {document.write(' selected="selected"');}
		document.write('>'+th2[i]+'</option>')
	}
}


//-----------------------------------------------------------------------
function ValidForm() {
	objform = document.forms["moteur"]
	codeurl = objform.action;
	VILLEDEPART = objform.VILLEDEPART.value;
	
	if ((VILLEDEPART=="0")||(VILLEDEPART=="Paris")){
		codeurl = "/recherche.htm"
	}else{
		codeurl = "/rechercheregion.htm"
	}
	if( objform.PAYS ){
		pays = objform.PAYS.value;
		var srv = "" + document.location ;
		if (pays == "France sejours"){
			if ( srv.indexOf("pmvc",0) != -1 || srv.indexOf("promovacances",0) != -1 ){
				codeurl = "/FS1/BZ/00/sejlist-france.htm"
			}else{
				codeurl = "/FS1/BZ/00/sejlist.htm"
			}
		}else if( pays == "France locations_karavel" ){
			codeurl = "http://locations.karavel.com/cgi-net/karavel/index?"
		}else if( pays == "France locations"){
			codeurl = "http://locations.promovacances.com/cgi-net/promovac/accueil?"
		}
		if( pays.indexOf( "france--") != -1 ){
			aPays = split(pays, "--")
			pays = aPays(1)
			if ( srv.indexOf("pmvc") != -1 || srv.indexOf("promovacances") != -1 ){
				codeurl = "/FS1/BZ/" + pays + "/sejlist-france.htm" 
			}else{
				codeurl = "/FS1/BZ/" + pays + "/sejlist.htm"
			}
		}
		
	}
	codeurl += "?pays=" + pays
	
	
	if( objform.BUDMAX){
		budget=objform.BUDMAX.value;
		arrbudget=budget.split(" - ")
		BUDMAX=arrbudget[1];
		BUDMIN=arrbudget[0];
	}else{
		BUDMAX="9999999";
		BUDMIN="0";
	}
	codeurl += "&budmax=" + BUDMAX + "&budmin=" + BUDMIN;
	theme=objform.THEME.value;
	codeurl += "&theme=" + theme;
	yyyy = objform.MMAAAA.value; //alert(yyyy);
	mois = yyyy.substr(4,2);
	codeurl += "&mois=" + mois;
	if(objform.site){
		site = objform.site.value;
		codeurl += "&site=" + site;
	}else{
		site = ""
	}
	
	day = objform.JJ.value;
	codeurl+= "&jj=" + day
	codeurl+= "&mm=" + ( mois < 10 ? "0" + mois : mois )
	codeurl+= "&aaaa=" + yyyy.substr(0,4)
	delta = objform.DELTA.value;
	codeurl+= "&delta=" + delta;
	icid = objform.icid.value;
	if(icid) {codeurl+= "&icid=" + icid;}
	
// pour ttt suivis de clics eStats sur recherche moteur PMV & pa
	if (site ==""){
		
		if (VILLEDEPART=="0"){
			RECHERCHE= codeurl +"&villedepart=" + VILLEDEPART + "";
		}else{
			//ajout précision ville sur quelques departsProvince	
			var province="Province";
			if ((VILLEDEPART =="LILLE")||(VILLEDEPART =="LYON")||(VILLEDEPART =="MARSEILLE")||(VILLEDEPART =="TOULOUSE")||(VILLEDEPART =="NANTES")||(VILLEDEPART =="BORDEAUX") )
			{province=VILLEDEPART;}
		RECHERCHE= codeurl +"&villedepart=" + VILLEDEPART + "";
		}
		
}
	if (site =="pa"){	
		if (VILLEDEPART=="0"){ 
			RECHERCHE= codeurl +"&villedepart=" + VILLEDEPART + "";
		}else{
			RECHERCHE= codeurl +"&villedepart=" + VILLEDEPART + "";
	}
	}
	return RECHERCHE + "&PMV_RECH_MOTEURpg=1" ;
}




//-----------------------------------------------------------------------
//  Submit Button 


function rechercher(objform){
// traitement du moteur en fonction de la provenance id partenaire 
	objForm = document.forms[objform];
	urlPart = objForm.urlpart.value;
	//--- url de redirection à Paramétrer ici
	urlForm = "http://"+ urlPart +"";
	//   
	// date saisie
	day = objForm.jj.value;
	yyyy = objForm.mmaaaa.value;  
	objForm.mm.value = yyyy.substr(4,2);  
	objForm.aaaa.value = yyyy.substr(0,4);

	
	VILLEDEPART = objForm.VILLEDEPART.value;
	PAYS = objForm.pays.value;
	THEME = objForm.theme.value;
	BUDMAX = objForm.budmax.value;
	JOUR = objForm.jj.value;
	MOIS = objForm.mm.value;
	ANNEE = objForm.aaaa.value;
	DELTA = objForm.delta.value;

		
   if ((VILLEDEPART=="0")||(VILLEDEPART=="Paris")) { urlForm = urlForm +"/recherche.htm?"; }
   else { urlForm = urlForm +"/rechercheregion.htm?"; }

	urlForm = urlForm + "villedepart=" + VILLEDEPART + "&pays=" + PAYS + "&jj=" + JOUR + "&mm=" + MOIS + "&aaaa=" + ANNEE + "&theme=" + THEME + "&delta=" + DELTA + "&budmax=" + BUDMAX + "";
	objform.action="" + urlForm + "";
	// Lancement de la recherche dans une autre fenêtre
	//window.open(urlForm);
	// Lancement de la recherche dans la même fenêtre
	 window.parent.location.href = urlForm;
	
}

function Remplace(expr,a,b) {
      var i=0
      while (i!=-1) {
         i=expr.indexOf(a,i);
         if (i>=0) {
            expr=expr.substring(0,i)+b+expr.substring(i+a.length);
            i+=b.length;
         }
      }
      return expr
   }
   
function rechercher2 () {
	urlres=ValidForm();
	if( top.location != null){
		top.location = urlres
	}else{
		document.location = urlres
	}	
}

function searchEngine(objForm,idForm){

if(idForm == "sejours")
{
		urlres=ValidForm();
		if( top.location != null){
			top.location = urlres;
		}else{
			document.location = urlres;
		}
		
}else	{	
// traitement du moteur en fonction de la provenance id partenaire 
	objForm = document.forms[objForm];
	urlPart = objForm.urlpart.value;
	//--- url de redirection à Paramétrer ici
	urlForm = "http://"+ urlPart +"";
	//   
	// date saisie
	day = objForm.jj.value;
	yyyy = objForm.mmaaaa.value;  
	objForm.mm.value = yyyy.substr(4,2);  
	objForm.aaaa.value = yyyy.substr(0,4);

	
	VILLEDEPART = objForm.villedepart.value;
	PAYS = objForm.pays.value;
	if (PAYS == "France sejours") { PAYS = "France"; }

	THEME = objForm.theme.value;
	BUDMAX = objForm.budmax.value;
	JOUR = objForm.jj.value;
	MOIS = objForm.mm.value;
	ANNEE = objForm.aaaa.value;
	DELTA = objForm.delta.value;
	DUREE = objForm.duree.value;
	lstbx = objForm.lstbx.value; // pour affichage good listbox sur la page de destination

	if (PAYS == "France") {bool = false;}

	if (!PAYS) {objForm.lstbx.value="true";lstbx="true";}
	
	/* traitement en fonction de la thématique "segment" */
	switch(idForm) {
	
		case "sejours" :
		//urlForm = urlForm +"/recherche-sejours.htm?"; 
		urlForm = ValidForm();
		break;	
		
		case "thalasso" :
		urlForm = urlForm +"/recherche-thalasso.htm?"; 
		break;

		case "plongee" :
		if ((THEME=="") && (BUDMAX=="0 - 9999999") && (DUREE=="")) 
		{
			objForm.lstbx.value="false";lstbx="false";
		}
		urlForm = urlForm +"/recherche-plongee.htm?"; 
		break;

		case "lunedemiel" :
		urlForm = urlForm +"/recherche-lunedemiel.htm?"; 
		break;
		
		case "circuits" :
		urlForm = urlForm +"/recherche-circuits.htm?"; 
		break;
		
		case "weekend" :
		urlForm = urlForm +"/recherche-weekend.htm?"; 
		break;		
				
	}
	
	if(idForm!="sejours"){		
		urlForm = urlForm + "villedepart=" + VILLEDEPART + "&pays=" + PAYS + "&jj=" + JOUR + "&mm=" + MOIS + "&aaaa=" + ANNEE + "&theme=" + THEME + "&delta=" + DELTA + "&budmax=" + BUDMAX + "&duree=" + DUREE + "&lstbx=" + lstbx ;
	//alert(urlForm);
	}
	
	objForm.action = "" + urlForm + "";
	// Lancement de la recherche dans une autre fenêtre
	//window.open(urlForm);
	// Lancement de la recherche dans la même fenêtre
	 window.parent.location.href = urlForm;
}
	 

}

function searchMoteur(objForm,idForm){

	
// traitement du moteur en fonction de la provenance id partenaire 
	objForm = document.forms[objForm];
	urlPart = objForm.urlpart.value;
	//--- url de redirection à Paramétrer ici
	urlForm = "http://"+ urlPart +"";
	//   
	// date saisie
	day = objForm.jj.value;
	yyyy = objForm.mmaaaa.value;  
	objForm.mm.value = yyyy.substr(4,2);  
	objForm.aaaa.value = yyyy.substr(0,4);
	
	PAYS = objForm.pays.value;
	if (PAYS == "France sejours") { PAYS = "France"; }

	THEME = objForm.theme.value;
	BUDMAX = objForm.budmax.value;
	JOUR = objForm.jj.value;
	MOIS = objForm.mm.value;
	ANNEE = objForm.aaaa.value;
	DELTA = objForm.delta.value;
	
	if (PAYS == "France") {bool = false;}

	
	/* traitement en fonction de la thématique "segment" */
	switch(idForm) {
	
		case "sejours" :
		
		urlForm = urlForm +"/recherche-sejours.htm"; 
		break;	
					
	}
	
	urlForm = urlForm +  "?pays=" + PAYS + "&jj=" + JOUR + "&mm=" + MOIS + "&aaaa=" + ANNEE + "&theme=" + "&delta=" + DELTA + THEME + "&budmax=" + BUDMAX  ;

	
	
	objForm.action = "" + urlForm + "";
	// Lancement de la recherche dans une autre fenêtre
	//window.open(urlForm);
	// Lancement de la recherche dans la même fenêtre
	 window.parent.location.href = urlForm;

	 

}
// -->