document.writeln("<script language='javascript'>");
document.writeln("var array_lieu_autre=[];");
document.writeln("var objLieu;");
document.writeln("function lieu(id,typelieu, nom,littoral, golf, thalasso,montagne)");
document.writeln("{");
document.writeln("	this.id = id;");
document.writeln("	this.nom = nom;");
document.writeln("	this.littoral = littoral;");
document.writeln("	this.golf = golf;");
document.writeln("	this.thalasso = thalasso;");
document.writeln("	this.montagne = montagne;");
document.writeln("	this.typelieu=typelieu;");
document.writeln("	this.peres=[];");
document.writeln("}");
document.writeln("function getTypeLieu(lngLieuId)");
document.writeln("{");
document.writeln("	var i,j,k;");
document.writeln("	var objPays,objRegion,objZT;");
document.writeln("	var array_lieu = getArrayLieu();");
document.writeln("	if(lngLieuId==0 || lngLieuId=='')");
document.writeln("		return 0;");
document.writeln("	else");
document.writeln("	{");
document.writeln("		for (i=0; i<array_lieu.length; i++)");
document.writeln("		{");
document.writeln("			objPays = array_lieu[i];");
document.writeln("			if(objPays.id==lngLieuId)");
document.writeln("				return objPays.typelieu;");
document.writeln("		}");
document.writeln("	}");
document.writeln("	return 0;");
document.writeln("}");
document.writeln("function getArrayLieu()");
document.writeln("{");
document.writeln("	return array_lieu_autre;");
document.writeln("}");
document.writeln("function addLieu(strType,id,typelieu, nom,littoral, golf, thalasso,montagne)");
document.writeln("{");
document.writeln("	var i,j;");
document.writeln("	var objPays,objRegion;");
document.writeln("	var array_lieu = getArrayLieu();");
document.writeln("	var objLieu;");
document.writeln("	objLieu = new lieu(id,typelieu, nom,littoral, golf, thalasso,montagne);");
document.writeln("	array_lieu[array_lieu.length] = objLieu;");
document.writeln("	return objLieu;");
document.writeln("}");
document.writeln("function on_change_pays()");
document.writeln("{");
document.writeln("	var i,nbStation=0;");
document.writeln("	var pays_id;");
document.writeln("	var array_lieu = getArrayLieu();");
document.writeln("	var select_pays = document.getElementById('pays');");
document.writeln("	var select_lieu = document.getElementById('lieu');");
document.writeln("	var objLieu;");
document.writeln("	clear_select(select_lieu);");
document.writeln("	pays_id = select_pays.value;");
document.writeln("	// genere les station de l'activite");
document.writeln("	for (i=0; i<array_lieu.length; i++)");
document.writeln("	{");
document.writeln("		objLieu = array_lieu[i];");
document.writeln("		if(isFils(objLieu,pays_id))");
document.writeln("		{");
document.writeln("			select_lieu[nbStation] = new Option(objLieu.nom,objLieu.id);");
document.writeln("			nbStation++;");
document.writeln("		}");
document.writeln("	}");
document.writeln("}");
document.writeln("function fillPays()");
document.writeln("{");
document.writeln("	var i;");
document.writeln("	var array_lieu = getArrayLieu();");
document.writeln("	var select_pays = document.getElementById('pays');");
document.writeln("	var objLieu;");
document.writeln("	clear_select(select_pays);");
document.writeln("	// genere les station de l'activite");
document.writeln("	for(i=0; i<array_lieu.length; i++)");
document.writeln("	{");
document.writeln("		objLieu = array_lieu[i];");
document.writeln("		if(objLieu.typelieu==2)");
document.writeln("			select_pays[select_pays.length] = new Option(objLieu.nom,objLieu.id);");
document.writeln("	}");
document.writeln("	select_pays.selectedIndex=0;");
document.writeln("	on_change_pays();");
document.writeln("}");
document.writeln("function isFils(objLieu,lngPereId)");
document.writeln("{");
document.writeln("	var i;");
document.writeln("	for(i=0;i<objLieu.peres.length;i++)");
document.writeln("	{");
document.writeln("		if(objLieu.peres[i]==lngPereId)");
document.writeln("			return true;");
document.writeln("	}");
document.writeln("	return false;");
document.writeln("}");
document.writeln("// vide select completement");
document.writeln("function clear_select(select)");
document.writeln("{	");
document.writeln("	if(select!=null)");
document.writeln("		while (select.length > 0) select.options[0] = null;");
document.writeln("}");
document.writeln("function valide_form(strform,strLang)");
document.writeln("{");
document.writeln("	var form= document.getElementById(strform);");
document.writeln("	var date= form.date_debut;");
document.writeln("	var err='';");
document.writeln("	if (form.lieu) {");
document.writeln("	 if (form.lieu.value=='') {");
document.writeln("		switch(strLang)");
document.writeln("		{");
document.writeln("			case 'fr':");
document.writeln("				err='Veuillez indiquer votre destination de manière plus précise.';");
document.writeln("				break;");
document.writeln("			default:");
document.writeln("				err='Error';");
document.writeln("		}");
document.writeln("	 }");
document.writeln("	}");
document.writeln("	if(date.value=='')");
document.writeln("	{");
document.writeln("		switch(strLang)");
document.writeln("		{");
document.writeln("			case 'fr':");
document.writeln("				err='Veuillez saisir une date.';");
document.writeln("				break;");
document.writeln("			default:");
document.writeln("				err='Error';");
document.writeln("		}");
document.writeln("	}");
document.writeln("	else");
document.writeln("	{");
document.writeln("		if(!IsDate(date.value, 'yyyy-mm-dd'))");
document.writeln("		{");
document.writeln("			switch(strLang)");
document.writeln("			{");
document.writeln("				case 'fr':");
document.writeln("					err='Veuillez saisir une date valide.';");
document.writeln("					break;");
document.writeln("				default:");
document.writeln("					err='Error';");
document.writeln("			}");
document.writeln("		}");
document.writeln("		else");
document.writeln("		{");
document.writeln("			if(DateDiff('d', new Date(),str2Date(date.value, 'yyyy-mm-dd'))<4)");
document.writeln("			{");
document.writeln("				switch(strLang)");
document.writeln("				{");
document.writeln("					case 'fr':");
document.writeln("						err=\"La date que vous avez choisi est trop proche d'aujourd'hui.\";");
document.writeln("						break;");
document.writeln("					default:");
document.writeln("						err='Error';");
document.writeln("				}");
document.writeln("			}");
document.writeln("		}");
document.writeln("	}");
document.writeln("	if(err!='')");
document.writeln("		alert(err)");
document.writeln("	else");
document.writeln("		form.submit();");
document.writeln("}");
document.writeln("//IsDate");
document.writeln("//Verifie qu'une date existe");
document.writeln("function IsDate (strVal, strFormat)");
document.writeln("{	  ");
document.writeln("	var dd, mm, yyyy;  ");
document.writeln("	switch (strFormat)");
document.writeln("	{");
document.writeln("		// fr  ");
document.writeln("		case 'dd/mm/yyyy' :");
document.writeln("			dd = strVal.substr(0, 2);");
document.writeln("			mm = strVal.substr(3, 2);");
document.writeln("			yyyy = strVal.substr(6, 4);");
document.writeln("			return DateExiste(dd,mm,yyyy);   ");
document.writeln("		// us   ");
document.writeln("		case 'yyyy-mm-dd' :	 ");
document.writeln("			yyyy = strVal.substr(0, 4);	");
document.writeln("			mm = strVal.substr(5, 2);");
document.writeln("			dd = strVal.substr(8, 2);");
document.writeln("			return DateExiste(dd,mm,yyyy);   ");
document.writeln("	} ");
document.writeln("}	");
document.writeln("//DateExiste");
document.writeln("//Verifie qu'une date existe");
document.writeln("function DateExiste (day,month,year) ");
document.writeln("{	");
document.writeln("    var today = new Date();  ");
document.writeln("    if(!year)	return false;");
document.writeln("					  ");
document.writeln("	if(!month) return false;");
document.writeln("	");
document.writeln("    if (!day) return false;");
document.writeln("    var test = new Date(year,month-1,day);");
document.writeln("    if ( (test.getFullYear() == year) &&   ");
document.writeln("         (month == test.getMonth()+1) &&");
document.writeln("         (day == test.getDate()) ) ");
document.writeln("        return true;   ");
document.writeln("    else	 ");
document.writeln("        return false;	");
document.writeln("}	");
document.writeln("// chaine --> date ");
document.writeln("function str2Date(strVal, strFormat)");
document.writeln("{	");
document.writeln("	var dd, mm, yyyy;");
document.writeln("	switch (strFormat)");
document.writeln("	{			");
document.writeln("		// fr  ");
document.writeln("		case 'dd/mm/yyyy' :");
document.writeln("			dd = strVal.substr(0, 2);");
document.writeln("			mm = strVal.substr(3, 2);");
document.writeln("			yyyy = strVal.substr(6, 4);	");
document.writeln("			return new Date(yyyy, mm - 1, dd);");
document.writeln("		// us   ");
document.writeln("		case 'yyyy-mm-dd' :");
document.writeln("			yyyy = strVal.substr(0, 4);");
document.writeln("			mm = strVal.substr(5, 2);");
document.writeln("			dd = strVal.substr(8, 2);");
document.writeln("			return new Date(yyyy, mm - 1, dd);");
document.writeln("	}  ");
document.writeln("} ");
document.writeln("// DateDiff");
document.writeln("function DateDiff(strType,datVal1, datVal2)  ");
document.writeln("{	 ");
document.writeln("	var seconde = 1000;	");
document.writeln("	var minute	= 60;");
document.writeln("	var heure	= 60;");
document.writeln("	var jour	= 24;");
document.writeln("	var intDuree=0;	");
document.writeln("	switch(strType)");
document.writeln("	{  ");
document.writeln("		case 'd':");
document.writeln("			intDuree = ((datVal2 - datVal1)/ (seconde*minute*heure*jour));");
document.writeln("			break;");
document.writeln("		case 'h':");
document.writeln("			intDuree = ((datVal2 - datVal1)/ (seconde*minute*heure*jour));   ");
document.writeln("			break;   ");
document.writeln("		case 'm':  ");
document.writeln("			intDuree = ((datVal2 - datVal1)/ (seconde*minute));	");
document.writeln("			break;");
document.writeln("		case 's':  ");
document.writeln("			intDuree = ((datVal2 - datVal1)/ (seconde)); ");
document.writeln("			break;   ");
document.writeln("	}  ");
document.writeln("	intDuree = Math.round(intDuree); ");
document.writeln("	return intDuree;  ");
document.writeln("}	   ");
document.writeln("objLieu = addLieu(3,2,2,'FRANCE',0,0,0,0);objLieu = addLieu(3,4,2,'ITALIE',0,0,0,0);objLieu = addLieu(3,7,2,'ALLEMAGNE',0,0,0,0);objLieu = addLieu(3,13,2,'BELGIQUE',0,0,0,0);objLieu = addLieu(3,14,2,'ESPAGNE',0,0,0,0);objLieu = addLieu(3,16,2,'GRÈCE',0,0,0,0);objLieu = addLieu(3,19,2,'PORTUGAL',0,0,0,0);objLieu = addLieu(3,24,2,'ANDORRE',0,0,0,0);objLieu = addLieu(3,43,2,'HONGRIE',0,0,0,0);objLieu = addLieu(3,50,2,'MAROC',0,0,0,0);objLieu = addLieu(3,55,2,'TUNISIE',0,0,0,0);objLieu = addLieu(3,58,2,'TURQUIE',0,0,0,0);objLieu = addLieu(3,69,2,'CHYPRE',0,0,0,0);objLieu = addLieu(3,70,2,'JORDANIE',0,0,0,0);objLieu = addLieu(3,71,2,'MALTE',0,0,0,0);objLieu = addLieu(3,3081,1,'Ain',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,1814,1,'Alpes du Nord',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2632,1,'Alsace - Lorraine',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2526,1,'Andalousie',0,0,0,0);objLieu.peres[objLieu.peres.length]=14;objLieu = addLieu(3,2399,1,'Andorre',0,0,0,0);objLieu.peres[objLieu.peres.length]=24;objLieu = addLieu(3,1079,1,'Aquitaine',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2633,1,'Auvergne',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2513,1,'Belgique',0,0,0,0);objLieu.peres[objLieu.peres.length]=13;objLieu = addLieu(3,2634,1,'Bourgogne',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,1076,1,'Bretagne',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2037,1,'Canaries',0,0,0,0);objLieu.peres[objLieu.peres.length]=14;objLieu = addLieu(3,2032,1,'Catalogne',0,0,0,0);objLieu.peres[objLieu.peres.length]=14;objLieu = addLieu(3,2540,1,'Centre',0,0,0,0);objLieu.peres[objLieu.peres.length]=50;objLieu = addLieu(3,2635,1,'Centre',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2510,1,'Chypre',0,0,0,0);objLieu.peres[objLieu.peres.length]=69;objLieu = addLieu(3,2534,1,'Communauté Valencienne',0,0,0,0);objLieu.peres[objLieu.peres.length]=14;objLieu = addLieu(3,1339,1,'Corse',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2134,1,'Crète',0,0,0,0);objLieu.peres[objLieu.peres.length]=16;objLieu = addLieu(3,1081,1,'Côte d Azur',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,939,1,'Forêt Noire',0,0,0,0);objLieu.peres[objLieu.peres.length]=7;objLieu = addLieu(3,2676,1,'Golfe de Vizcaya',0,0,0,0);objLieu.peres[objLieu.peres.length]=14;objLieu = addLieu(3,2515,1,'Grèce Continentale',0,0,0,0);objLieu.peres[objLieu.peres.length]=16;objLieu = addLieu(3,2985,1,'Hongrie du Nord',0,0,0,0);objLieu.peres[objLieu.peres.length]=43;objLieu = addLieu(3,2516,1,'Jordanie',0,0,0,0);objLieu.peres[objLieu.peres.length]=70;objLieu = addLieu(3,2738,1,'Lacs Italiens',0,0,0,0);objLieu.peres[objLieu.peres.length]=4;objLieu = addLieu(3,1080,1,'Languedoc-Roussillon',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2687,1,'Littoral Mer Marmara',0,0,0,0);objLieu.peres[objLieu.peres.length]=58;objLieu = addLieu(3,2537,1,'Littoral Méditerranéen',0,0,0,0);objLieu.peres[objLieu.peres.length]=58;objLieu = addLieu(3,2888,1,'Malte Nord',0,0,0,0);objLieu.peres[objLieu.peres.length]=71;objLieu = addLieu(3,2501,1,'Nord - Littoral',0,0,0,0);objLieu.peres[objLieu.peres.length]=50;objLieu = addLieu(3,1438,1,'Nord - Littoral',0,0,0,0);objLieu.peres[objLieu.peres.length]=55;objLieu = addLieu(3,1073,1,'Nord / Picardie',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,1074,1,'Normandie',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2638,1,'Paris',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,1077,1,'Pays de Loire',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,2639,1,'Poitou Charentes',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,1432,1,'Provence',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,1816,1,'Pyrenées',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;objLieu = addLieu(3,999,1,'Pyrenées espagnoles',0,0,0,0);objLieu.peres[objLieu.peres.length]=14;objLieu = addLieu(3,2554,1,'Sardaigne',0,0,0,0);objLieu.peres[objLieu.peres.length]=4;objLieu = addLieu(3,2625,1,'Sud - Littoral',0,0,0,0);objLieu.peres[objLieu.peres.length]=50;objLieu = addLieu(3,2816,1,'Sud - Littoral',0,0,0,0);objLieu.peres[objLieu.peres.length]=19;objLieu = addLieu(3,2586,1,'Sud - Littoral',0,0,0,0);objLieu.peres[objLieu.peres.length]=55;objLieu = addLieu(3,2630,1,'Vallée du Rhône',0,0,0,0);objLieu.peres[objLieu.peres.length]=2;");
document.writeln("fillPays();");
document.writeln("</script>");
