/* AUTEUR: Philippe Hemled */
/* Date de création: 01/02/2004 */
<!-- Debut script
function ControlerBandeaux() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	

	//document.forms[0].onsubmit();
	

	//Controle Titre (Titre)
	if (! ControleExprReg('Titre',".+","La saisie d'un titre est obligatoire")) {
		return false;
	}
	
	//Controle Debut de Validite (DebutValidite)
	if (! ControleDate('DebutValidite')) {
		return false;
	}

	//Controle Fin de Validite (FinValidite)
	if (! ControleDate('FinValidite')) {
		return false;
	}

	//La fin de validite doit etre supérieur ou égale au début
	
	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}

function ControlerCdefrais() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}

function ControlerTarifaide() {
	var f = document.forms[0]

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//document.forms[0].onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerCdepaiements() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//document.forms[0].onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}

function ControlerCdecarnets() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//document.forms[0].onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}

function ControlerCde() {
	alert("ControlerCde")
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//document.forms[0].onsubmit();
	
	//Controle Societe (Societe)
	if (! f.Type[0].checked == true) {
		if (! ControleExprReg('Societe',".+","La saisie d'un nom de societe est obligatoire")) {
			return false;
		}
	}
		
	//Controle Nom (Nom)
	if (! ControleExprReg('Nom',".+","La saisie d'un nom est obligatoire")) {
		return false;
	}
	
	//Controle Prénom (Prenom)
	if (! ControleExprReg('Prenom',".+","La saisie d'un prénom est obligatoire")) {
		return false;
	}
	//Controle Adresse (Adresse)
	if (! ControleExprReg('Adresse',".+","La saisie d'une adresse est obligatoire")) {
		return false;
	}
	//Controle Code postal (CodePostal)
	if (! ControleExprReg('CodePostal',".+","La saisie du code postal est obligatoire")) {
		return false;
	}
	//Controle Ville (Ville)
	if (! ControleExprReg('Ville',".+","La saisie de la ville est obligatoire")) {
		return false;
	}
	JSREG=new RegExp(".+")
	if ((!JSREG.test(f.TelephonePerso.value))
	&& (!JSREG.test(f.TelephoneBureau.value))
	&& (!JSREG.test(f.TelephonePortable.value))) {
		alert("La saisie d'un téléphone au moins est obligatoire !");
		f.TelephonePerso.focus();
		f.TelephonePerso.select();
		return false;
	}
		//Controle Email (Email)
	if (! ControleExprReg("Email","(.+)(@)(.+)(\.)(.+)","La structure de l\'email doit être correcte !")) {
		return false;
	}



	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox() 
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}

	f.submit()
}

function ControlerTarifsCategorie() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//Controle Titre
	//if (! ControleExprReg('GeoZone',".+","La saisie d'une zone géographique est obligatoire")) {
	//	return false;
	//}
	//document.forms[0].onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerGeoZones() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//Controle Titre
	if (! ControleExprReg('GeoZone',".+","La saisie d'une zone géographique est obligatoire")) {
		return false;
	}
	//document.forms[0].onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerGeoAffichage() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerSubmit() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}


	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControleDesCheckbox() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];
	j=f.length
	for (var i = 0;i<j;i++) {
		if(f.elements[i].type=='checkbox')  {
			if (! f.elements[i].checked == true) {
				f.elements[i].value = 0
				f.elements[i].checked =true
			}
		}
	}
}
function ControlerKdo_Themes() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	
	//Controle Thème 
	if (! ControleExprReg('Theme',".+","La saisie d'un thème est obligatoire")) {
		return false;
	}
	//document.forms[0].onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}





function ControlerKdo() {
	var f = document.forms[0]
	
	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}
	

	

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	//document.forms[0].onsubmit();
	//alert(f.onsubmit)
	//f.onsubmit();
	//alert("le submit")
	
	//clipBoard(document.body.innerHTML)

	j=document.all.length
	ch=""
	j=0
	for (var i = 0;i<j;i++) {
		if (document.all[i].className!="undefined")
			ch=ch+document.all[i].tagName+"   >>   "+document.all[i].className+"   >>   "+document.all[i].id+"\n"
	}
	//alert(ch)
	//clipBoard(ch)
	j=f.length
	j=0
	for (var i = 0;i<j;i++) {
		if(f.elements[i].type=="textarea") {
			ch="IDTXT_"+f.elements[i].name
			oElement = document.getElementById(ch)
			alert(ch+"\n"+oElement.className+"\n"+oElement.innerHTML+"\n"+f.elements[i].value)
			f.elements[i].value = oElement.innerHTML
			ch="f.elements[i].value=oElement.innerHTML"
			//alert(f.elements[i].type+'\n'+f.elements[i].name+'\n'+f.elements[i].value+"\n"+ch)
			//eval(ch);
		}
			
	}
	f.submit()
}

function ControlerRubriques() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle NomAgence
	if (! ControleExprReg('Rubrique',".+","La saisie d'une rubrique est obligatoire")) {
		return false;
	}

	//Controle Debut de Validite (DebutValidite)
	if (! ControleDate('DebutValidite')) {
		return false;
	}

	//Controle Fin de Validite (FinValidite)
	if (! ControleDate('FinValidite')) {
		return false;
	}

	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		//f.onsubmit();
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()

}
function ControlerChapitres() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle NomAgence
	if (! ControleExprReg('Chapitre',".+","La saisie d'un chapitre est obligatoire")) {
		return false;
	}
	//f.onsubmit();

	//Controle Debut de Validite (DebutValidite)
	if (! ControleDate('DebutValidite')) {
		return false;
	}

	//Controle Fin de Validite (FinValidite)
	if (! ControleDate('FinValidite')) {
		return false;
	}

	//La fin de validite doit etre supérieur ou égale au début

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerPages() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerBannieres() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}


	//f.onsubmit();


	//Controle Titre (Titre)
	if (! ControleExprReg('Titre',".+","La saisie d'un titre est obligatoire")) {
		return false;
	}

	//Controle Debut de Validite (DebutValidite)
	if (! ControleDate('DebutValidite')) {
		return false;
	}

	//Controle Fin de Validite (FinValidite)
	if (! ControleDate('FinValidite')) {
		return false;
	}

	//La fin de validite doit etre supérieur ou égale au début

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerAgences() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//f.onsubmit();
	//Controle NomAgence
	if (! ControleExprReg('NomAgence',".+","La saisie d'un nom d\'agence est obligatoire")) {
		return false;
	}
	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerPointsDeVente() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerDdr() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}



	//f.onsubmit();

	//Controle Societe (Societe)
	if (! f.Type[0].checked == true) {
		if (! ControleExprReg('Societe',".+","La saisie d'un nom de societe est obligatoire")) {
			return false;
		}
	}

	//Controle Nom (Nom)
	if (! ControleExprReg('Nom',".+","La saisie d'un nom est obligatoire")) {
		return false;
	}

	//Controle Prénom (Prenom)
	if (! ControleExprReg('Prenom',".+","La saisie d'un prénom est obligatoire")) {
		return false;
	}
	//Controle Adresse (Adresse)
	if (! ControleExprReg('Adresse',".+","La saisie d'une adresse est obligatoire")) {
		return false;
	}
	//Controle Code postal (CodePostal)
	if (! ControleExprReg('CodePostal',".+","La saisie du code postal est obligatoire")) {
		return false;
	}
	//Controle Ville (Ville)
	if (! ControleExprReg('Ville',".+","La saisie de la ville est obligatoire")) {
		return false;
	}
	JSREG=new RegExp(".+")
	if ((!JSREG.test(f.TelephonePerso.value))
	&& (!JSREG.test(f.TelephoneBureau.value))
	&& (!JSREG.test(f.TelephonePortable.value))) {
		alert("La saisie d'un téléphone au moins est obligatoire !");
		f.TelephonePerso.focus();
		f.TelephonePerso.select();
		return false;
	}
		//Controle Email (Email)
	if (! ControleExprReg('email','(.+)(@)(.+)(\.)(.+)',"La structure de l'email doit être correcte !")) {
		return false;
	}




	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerEtapes() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Titre
	if (! ControleExprReg('TitreEtape',".+","La saisie d'un titre est obligatoire")) {
		return false;
	}
	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControleFormules() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Thème
	if (! ControleExprReg('Formule',".+","La saisie d'une formule est obligatoire")) {
		return false;
	}
	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControleThemes() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Thème
	if (! ControleExprReg('Theme',".+","La saisie d'un thème est obligatoire")) {
		return false;
	}
	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControleBrochures() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControleModeles() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Modele
	if (! ControleExprReg('Modele',".+","La saisie d'un modèle est obligatoire")) {
		return false;
	}
	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlePays() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Thème
	if (! ControleExprReg('Pays',".+","La saisie d'un pays est obligatoire")) {
		return false;
	}
	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}

function ControleVilles() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Thème
	if (! ControleExprReg('Ville',".+","La saisie d'une ville de départ est obligatoire")) {
		return false;
	}
	//f.onsubmit();

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControlerOffres() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Destination
	if (! ControleExprReg('Destination',".+","La saisie d'une Destination est obligatoire")) {
		return false;
	}


	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		ControleDesCheckbox();
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	//f.onsubmit();
	//alert(f.onsubmit)
	//f.onsubmit();
	//alert("le submit")

	//clipBoard(document.body.innerHTML)

	j=document.all.length
	ch=""
	j=0
	for (var i = 0;i<j;i++) {
		if (document.all[i].className!="undefined")
			ch=ch+document.all[i].tagName+"   >>   "+document.all[i].className+"   >>   "+document.all[i].id+"\n"
	}
	//alert(ch)
	//clipBoard(ch)
	j=f.length
	j=0
	for (var i = 0;i<j;i++) {
		if(f.elements[i].type=="textarea") {
			ch="IDTXT_"+f.elements[i].name
			oElement = document.getElementById(ch)
			alert(ch+"\n"+oElement.className+"\n"+oElement.innerHTML+"\n"+f.elements[i].value)
			f.elements[i].value = oElement.innerHTML
			ch="f.elements[i].value=oElement.innerHTML"
			//alert(f.elements[i].type+'\n'+f.elements[i].name+'\n'+f.elements[i].value+"\n"+ch)
			//eval(ch);
		}

	}
	//f.onsubmit()
	f.submit()
}

function ControleVille() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}

	//Controle Ville
	if (! ControleExprReg('Ville',".+","La saisie d'une Ville est obligatoire")) {
		return false;
	}

	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function ControleGestionVente() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	//Controle Code Vente (codeVente)
	if (! ControleExprReg('codeVente',".+","La saisie d'un code de vente est obligatoire")) {
		return false;
	}

	//Controle Libelle Vente (lblVente)
	if (! ControleExprReg('lblVente',".+","La saisie d'un libelle de vente est obligatoire")) {
		return false;
	}

	//Controle Mise A Prix (mapVente)
	var wMiseAPrix = parseFloat(f.mapVente.value)
	if (! wMiseAPrix > 0) {
		alert("La mise à prix doit être supérieure à zéro !")
		f.mapVente.focus()
		f.mapVente.select()
		return false
	}
	//Controle Date de fin (dateFinVente)
	if (! ControleDate('dateFinVente')) {
		return false;
	}

	//Controle heure de fin (heureFinVente)
	if (! ControleHeure('heureFinVente')) {
		return false;
	}

	//Controle SurEnchère minimum (minEnchere)
	var wEnchereMinimum = parseFloat(f.minEnchere.value)
	if (! wEnchereMinimum > 0) {
		alert("L'enchère minimum doit être supérieure à zéro !")
		f.minEnchere.focus()
		f.minEnchere.select()
		return false
	}
	//Controle SurEnchère maximum (maxEnchere)
	var wEnchereMaximum = parseFloat(f.maxEnchere.value)
	if (! wEnchereMaximum > 0) {
		alert("L'enchère maximum doit être supérieure à zéro !")
		f.maxEnchere.focus()
		f.maxEnchere.select()
		return false
	}
	if (! wEnchereMaximum > wEnchereMinimum) {
		alert("L'enchère maximum doit être supérieure à l'enchère minimum !")
		f.maxEnchere.focus()
		f.maxEnchere.select()
		return false
	}
	//Controle Prix de réserve (prixReserve)
	var wPrixDeReserve = parseFloat(f.prixReserve.value)
	if (! wPrixDeReserve > 0) {
		alert("Le prix de réserve doit être supérieure à zéro !")
		f.prixReserve.focus()
		f.prixReserve.select()
		return false
	}
	//Controle Prix plafond (prixPlafond)
	var wPrixPlafond = parseFloat(f.prixPlafond.value)
	if (! wPrixPlafond > 0) {
		alert("Le prix plafond doit être supérieure à zéro !")
		f.prixPlafond.focus()
		f.prixPlafond.select()
		return false
	}
	if (! wPrixPlafond > wPrixDeReserve) {
		alert("Le prix plafond doit être supérieur au prix de réserve !")
		f.prixPlafond.focus()
		f.prixPlafond.select()
		return false
	}

	//Controle EmailModérateur (modEmail)
	if (! ControleExprReg('modEmail','(.+)(@)(.+)(\.)(.+)',"La structure de l'email doit être correcte !")) {
		return false;
	}

	f.submit()
}
function ControleGestionSouscripteur() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.MAJ.value=='Consultation') {
		f.MAJ.value='PreModification';
		f.submit();
	}


	//Controle Email (Email)
	if (! ControleExprReg('Email','(.+)(@)(.+)(\.)(.+)',"La structure de l'email doit être correcte !")) {
		return false;
	}

	//Controle Pseudo (Pseudo)
	if (! ControleExprReg('Pseudo',".+","La saisie d'un pseudo est obligatoire")) {
		return false;
	}


	//Controle Civilite (Civilite)
	if (f.Civilite.selectedIndex==0) {
		alert("La civilité doit être renseignée !")
		f.Civilite.focus()
		return false
	}
	//Controle Nom (Nom)
	if (! ControleExprReg('Nom',".+","La saisie d'un nom est obligatoire")) {
		return false;
	}

	//Controle Prénom (Prenom)
	if (! ControleExprReg('Prenom',".+","La saisie d'un prénom est obligatoire")) {
		return false;
	}
	//Controle Adresse (Adresse)
	if (! ControleExprReg('Adresse',".+","La saisie d'une adresse est obligatoire")) {
		return false;
	}
	//Controle Code postal (CodePostal)
	if (! ControleExprReg('CodePostal',".+","La saisie du code postal est obligatoire")) {
		return false;
	}
	//Controle Ville (Ville)
	if (! ControleExprReg('Ville',".+","La saisie de la ville est obligatoire")) {
		return false;
	}
	//Controle Date de naissance(DateDeNaissance)
	if (! ControleDate('DateDeNaissance')) {
		return false;
	}
	//Tous les controles sont passés on submit la page
	if (f.MAJ.value=='PreModification') {
		f.MAJ.value='Modification';
	} else {
		if (f.MAJ.value=='Modification') {
			f.MAJ.value='Consultation';
		} else {
			if (f.MAJ.value.length==0) {
				f.MAJ.value="Creation";
			}
		}
	}
	f.submit()
}
function EnvoyerFaireConnaitre() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];
	//f.onsubmit();
	
	if (! ControleExprReg('PrenomPartage',".+","La saisie d'un prénom est obligatoire")) {
		return false;
	}
	if (! ControleExprReg('NomPartage',".+","La saisie d'un Nom est obligatoire")) {
		return false;
	}
	if (! ControlEmail(f.EmailEPartage)) {
		alert("La structure de l'email expéditeur est incorrecte !")
		return false
	}
	if (! ControlEmail(f.EmailDPartage)) {
		alert("La structure de l'email destinataire est incorrecte !")
		return false
	}

	f.submit()
	
}
//  Les Utilitaires -->
function ControlEmail(Champs) {
var tst=/(.+)(@)(.+)(\.)(.+)/
	if ( tst.test(Champs.value)==false) return false;
	return true;
}
function ControleExprReg(Champ,ExprReg,wErreur) {
	var f = arguments.length==3 ? document.forms[0] : f=arguments[3];
	var i = ElementChamp(Champ,f)
	JSREG=new RegExp(ExprReg)
	if (!JSREG.test(f.elements[i].value)) {
		alert(wErreur);
		f.elements[i].focus();
		f.elements[i].select();
		return false;
	}
	return true;
}
function ElementChamp(Champ) {
	var f = arguments.length==1 ? document.forms[0] : f=arguments[1];

	j=f.length
	txt=Champ


	for (var i = 0;i<j;i++) {

		if(f.elements[i].name==txt) break;
	}

	return i
}
function ControleDesCheckbox() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];
	j=f.length
	for (var i = 0;i<j;i++) {
		if(f.elements[i].type=='checkbox')  {
			if (! f.elements[i].checked == true) {
				f.elements[i].value = 0
				f.elements[i].checked =true
			}
		}
	}
}
function ControleDateHeure(Champ) {
	var f = arguments.length==1 ? document.forms[0] : f=arguments[1];
	reg = /^(0?[1-9]|[1-3][0-9])[ .\/\-]?(0?[1-9]|1[0-2])[ .\/\-]?((18|19|20)?\d{2}) ([0-9:]*)$/;

	var i = ElementChamp(Champ,f)
	valeur = f.elements[i].value;
   	reg.exec(valeur);
	val=RegExp.$1+"-"+RegExp.$2+"-"+RegExp.$3
	tim=RegExp.$5
	if (! ValidDate(val,i,f)) {
		f.elements[i].focus();
		f.elements[i].select()
		return false;
	}
	var newval = f.elements[i].value

	if (! ValidHeure(tim,i,f)) {
		f.elements[i].focus();
		f.elements[i].select();
		return false;
	}
  	var newtim = f.elements[i].value

	f.elements[i].value = newval+" "+newtim
	return true;

}

function ControleDate(Champ) {
	var f = arguments.length==1 ? document.forms[0] : f=arguments[1];
	//alert(Champ);
	reg = /^(0?[1-9]|[1-3][0-9])[ .\/\-]?(0?[1-9]|1[0-2])[ .\/\-]?((18|19|20)?\d{2})$/;

	var i = ElementChamp(Champ,f)
	valeur = f.elements[i].value;
   	reg.exec(valeur);
	val=RegExp.$1+"/"+RegExp.$2+"/"+RegExp.$3

	if (! ValidDate(val,i,f)) {
		f.elements[i].focus();
		f.elements[i].select()
		return false;
	}

	return true;

}

function ControleHeure(Champ) {
	var f = arguments.length==1 ? document.forms[0] : f=arguments[1];
	//reg = /^([0-9:]*)$/;

	var i = ElementChamp(Champ,f)
	valeur = f.elements[i].value;
   	//reg.exec(valeur);
	//val=RegExp.$1+":"+RegExp.$2

	//alert(valeur)
	if (! ValidHeure(valeur,i,f)) {
		f.elements[i].focus();
		f.elements[i].select()
		return false;
	}

	return true;

}

function ValidHeure(val,i) {
	var f = arguments.length==2 ? document.forms[0] : f=arguments[2];
	
 iVal=val
 ind=i
 regT = new Array(
    /^([0-9]):([0-5][0-9]):([0-5][0-9])$/, // ex : 1:24:59,
    /^([0-2][0-9]):([0-5][0-9]):([0-5][0-9])$/, // ex : 11:24:59,
    /^(\d{2}):(\d{2}):(\d{2})$/, // ex : 11:24:59,
	/^(\d{2})(\d{2})(\d{2})$/, // ex : 112459,
	/^(\d{2})(\d{2})$/, // ex : 1124,
    /^(\d{2}):(\d{2})$/ // ex : 11:24,
    );
	if(iVal) {
		isReg=false;
		for (var i=0; i<regT.length; i++) {
			if( isReg = regT[i].test(iVal) ) {
				regT[i].exec(iVal)
				break;
			}
		}
		if(isReg) {
			h = RegExp.$1; m = RegExp.$2; s = RegExp.$3;
			if (s=="") s="00"
//			alert(h+":"+m+":"+s)
			f.elements[ind].value=h+":"+m+":"+s
			if (parseInt(h)>23) {
				alert("Les journées n'ont pas plus de 23 heures 59 minutes");
				return false;
			}
			if (parseInt(m)>59) {
				alert("Les heures n'ont pas plus de 59 minutes");
				return false;
			}
			if (parseInt(s)>59) {
				alert("Les minutes n'ont pas plus de 59 secondes");
				return false;
			}
		} else {
			alert("le format de l'heure est HH:MN:SS")
			return false;
		}
	} else {
		f.elements[ind].value=" 00:00:00"
		return false;
	}
	return true;
}
function ValidDate(val,i) {
		var f = arguments.length==2 ? document.forms[0] : f=arguments[2];
	
  iVal = val
  ind=i
  regT = new Array(
    /^([1-9])[ .\/\-]?([1-9])[ .\/\-]?((18|19|20)?\d{2})$/, // ex : 5 5 1800, 1 1 2002 (05-05-1800, 01-01-2002)
    /^([1-9])\D?(1[0-2])\D?((18|19|20)?\d{2})$/, // ex : 5 11 1800, 1 10 2002 (05-11-1800, 01-10-2002)
    /^([1-3]0)\D?([1-9])\D?((18|19|20)?\d{2})$/, // ex : 10 3 2001, 30 6 1911 (10-03-2001, 30-06-1911)
    /^(0[1-9]|[1-3][1-9])\D?([1-9])\D?((18|19|20)?\d{2})$/, // ex : 09 3 2001, 31 6 1911 (09-03-2001, 31-06-1911)
    /^(0[1-9]|[1-3][0-9])\D?(0[1-9]|1[0-2])\D?((18|19|20)?\d{2})$/ // ex : 10 02 2000, 39 12 1999 (10-02-2000, 39-12-1999)
    );
  if(iVal) {
	isReg=false;
    for(var i=0; i<regT.length; i++) {
      if( isReg = regT[i].test(iVal) ) {
        regT[i].exec(iVal);
        break;
      }
	}
    if(isReg) {
      d = RegExp.$1; m = RegExp.$2; y = RegExp.$3;
      theDate = new Date();
      if(d.length==1) d = '0'+d;
	  if(m.length==1) m = '0'+m;
      if(y.length==2) y = ( y > String(theDate.getYear()).substr(2,2) ) ? '19'+y : '20'+y;
      f.elements[ind].value = d+'/'+m+'/'+y;

      mT = new Array("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");

      reg = /^(0?[1-9]|[1-3][0-9])\D?(0?[1-9]|1[0-2])\D?((18|19|20)\d{2})$/;
      reg.exec(f.elements[ind].value);
      if( parseInt(RegExp.$1) > nbJMonth(RegExp.$3,RegExp.$2) ) {
        alert('LA DATE ENTRÉE N\'EXISTE PAS...il y a '+nbJMonth(RegExp.$3,RegExp.$2)+' jours pour le mois de '+mT[RegExp.$2-1]+' ('+RegExp.$3+').');
        f.elements[ind].value = '-'+RegExp.$2+'-'+RegExp.$3;
		return false;
      }
    } else {
       alert('FORMAT DE DATE ERRONÉ...\n\nLes formats valides sont :\n\tjmaa\n\tjmaaaa\n\tjmmaa\n\tjmmaaaa\n\tjjmaa\n\tjjmaaaa\n\tjjmmaa\n\tjjmmaaaa \net où l\'année est supérieure à 1800.\n\n\nREMARQUE(S) :\n1. L\'utilisation de séparateurs (- . \/ _ etc...) est facultative.');
       return false;
    }
  }
  return true;
}
function Controler12(Champ) {

	var f = arguments.length==1 ? document.forms[0] : f=arguments[1];
	var i = ElementChamp(Champ,f)
	wDate = f.elements[i].value.substr(6,4)+f.elements[i].value.substr(3,2)+f.elements[i].value.substr(0,2);
	//alert(wDate)
	Today = new Date(2006,00,13)
	//alert (Today)
	wYNais = Today.getFullYear() - 12
	//alert(wYNais)
	wMNais = Today.getMonth() + 1
	if (wMNais<10) wMNais = "0"+wMNais
	//alert(wMNais)
	wDNais =  Today.getDate()
	if (wDNais<10) wDNais = "0"+wDNais
	//alert(wDNais)
	wNais = "" + wYNais + wMNais + wDNais
	//alert(wNais)
	//alert(wDate+">"+wNais)
	if (wDate<wNais) {
		alert("Les enfants doivent avoir moins de 12 ans le jour du départ");
		f.elements[i].focus();
		f.elements[i].select();
		return false;
	} else {
		//alert(true)
		return true;
	}

}
function ControlerMajorite(Champ) {

	var f = arguments.length==1 ? document.forms[0] : f=arguments[1];
	
	var i = ElementChamp(Champ,f)
	wDate = f.elements[i].value.substr(6,4)+f.elements[i].value.substr(3,2)+f.elements[i].value.substr(0,2);
	//alert(wDate)
	Today = new Date()
	//alert (Today)
	wYNais = Today.getFullYear() - 18
	//alert(wYNais)
	wMNais = Today.getMonth() + 1
	if (wMNais<10) wMNais = "0"+wMNais
	//alert(wMNais)
	wDNais =  Today.getDate()
	if (wDNais<10) wDNais = "0"+wDNais
	//alert(wDNais)
	wNais = "" + wYNais + wMNais + wDNais
	//alert(wNais)
	//alert(wDate+">"+wNais)
	if (wDate>wNais) {
		alert("Vous devez être majeur !");
		f.elements[i].focus();
		f.elements[i].select();
		return false;
	} else {
		//alert(true)
		return true;
	}

}
function ControlePeriode(Champ,DateDebut,DateFin) {
	//var f = arguments.length==3 ? document.forms[0] : f=arguments[3];
	var f = document.forms[0]
	//alert(Champ);
	reg = /^(0?[1-9]|[1-3][0-9])[ .\/\-]?(0?[1-9]|1[0-2])[ .\/\-]?((18|19|20)?\d{2})$/;

	var i = ElementChamp(Champ,f)
	//alert( i )
	valeur = f.elements[i].value;
	//alert(valeur)
   	reg.exec(valeur);
	val=RegExp.$1+"/"+RegExp.$2+"/"+RegExp.$3	
	//alert(val)

	if (! ValidDate(val,i,f)) {
		f.elements[i].focus();
		f.elements[i].select();
		return false;
	}
	valeur = f.elements[i].value;
	//alert(valeur)
   	reg.exec(valeur);
	val=RegExp.$3+RegExp.$2+RegExp.$1
//	alert(parseInt(DateDebut) + ' < ' + parseInt(val) + ' > ' + parseInt(DateFin) )
	if ( parseInt(val) < parseInt(DateDebut) || parseInt(val) > parseInt(DateFin)) {

		alert("La date doit etre comprise entre " + DateDebut.substr(6,2) + '/' + DateDebut.substr(4,2) + '/' + DateDebut.substr(0,4) + " et " + DateFin.substr(6,2) + '/' + DateFin.substr(4,2) + '/' + DateFin.substr(0,4))
		f.elements[i].focus();
		f.elements[i].select()
		return false;

	}
	return true;

}

function isBissext(theY) { return ( theY % 4 == 0 && (theY % 100 !=0 || theY % 400 ==0) ); }
function nbJMonth(theY,theM) {
	if(theM.substr(0,1)=="0") {
		theM=theM.substr(1,1)
	}
    jpm = ['',31,[28,29],31,30,31,30,31,31,30,31,30,31];
    theM = parseInt(theM);
    if(theM==2) return isBissext(theY) ? jpm[theM][1] : jpm[theM][0];
    else return jpm[theM];
}
function OpenWin(pURL,pLargeur,pHauteur) {

var Hauteur=screen.height
var Largeur=screen.width
PositionY=(Largeur-pLargeur)/2
PositionX=(Hauteur-pHauteur)/2

var wino=window.open(pURL,"Win","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+pLargeur+",height="+pHauteur+",top="+PositionX+",left="+PositionY+",screenX="+PositionX+",screenY="+PositionY)

}
function OpenWinXY(pURL,pLargeur,pHauteur,pX,pY) {

var Hauteur=screen.height
var Largeur=screen.width
PositionY=pY
PositionX=pX

var wino=window.open(pURL,"Win","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+pLargeur+",height="+pHauteur+",top="+PositionX+",left="+PositionY+",screenX="+PositionX+",screenY="+PositionY)

}
function DivDevant(pDiv,pSrc) {
	elt=document.getElementById(pDiv)
	//alert(pDiv+" visibility :"+elt.style.visibility)
	if (elt.style.visibility == "visible") {
		elt.style.visibility = "hidden";
		elt.style.display = "none"
		eMain=document.getElementById("cache")
		eMain.style.visibility = "hidden"
		eMain.style.display = "none";		
	} else {
		eMain=document.getElementById("cache")
		eMain.style.visibility = "visible"
		eMain.style.display = "block";
		elt.style.visibility = "visible";
		elt.style.display = "block"
		eAff=document.getElementById("aff_telemail")
		eAff.src = pSrc

	}
}
function GererTableEtapes(pIDOffres) {
	OpenWin('ListerTable.php?Table=etapes&Where=IDOffres='+document.forms[0].IDOffres.value+'&Include=tplEtapes.php&Champs=*&Mode=W&ServeurOrigine='+document.forms[0].ServeurOrigine.value,800,450)
}
function GererTable(Table,Where,Order,Champs,Include,ServeurOrigine,Mode,Valid) {
	location.href='GererTable.php?Table='+Table+'&Where='+Where+'&Order='+Order+'&Champs='+Champs+'&Include='+Include+'&ServeurOrigine='+ServeurOrigine+'&Mode='+Mode+'&Valid='+Valid;
}
function FermerGerer(pTable) {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];
	
if (f.Table.value=="agences" || f.Table.value=="mentionslegales"  || f.Table.value=="accueil"  || f.Table.value=="tarifaide"  || f.Table.value=="cdefrais") {
	location.href='index.php'
} else {
	location.href='ListerTable.php?Table='+f.Table.value+'&Where='+f.Where.value+'&Order='+f.Order.value+'&Champs='+f.Champs.value+'&Include='+f.Include.value+'&Mode='+f.Mode.value+'&ServeurOrigine='+f.ServeurOrigine.value+'&Valid='+f.Valid.value;
}

}
function FermerLister(pMode,pServeurOrigine) {

	if (pMode=="W") {
		if (opener.gTable=='offres') opener.AjaxReload(opener.gTable,gCle,gServeurOrigine)
		self.close();
	} else {
		location.href='index.php';
	}
}
function RetourErreur() {
var f = arguments.length==0 ? document.forms[0] : f=arguments[0];;
location.href='../ListerTable.php?Table='+f.Table.value+'&Where='+f.Where.value+'&Order='+f.Order.value+'&Champs='+f.Champs.value+'&Include='+f.Include.value+'&ServeurOrigine='+f.ServeurOrigine.value;
}
function Expand(pID) {
	var ch = 'if (ID_'+pID+'.style.visibility == "hidden") { ID_'+pID+'.style.visibility = "visible"; ID_'+pID+'.style.display = "block"; } else { ID_'+pID+'.style.visibility = "hidden"; ID_'+pID+'.style.display = "none"; }'
//	alert(ch)
	eval(ch)

}
function Expand2(pID) {
	var ch = 'if (ID_'+pID+'.style.visibility == "hidden") { IMG_'+pID+'.src="../images/Collapse.gif"; ID_'+pID+'.style.visibility = "visible"; ID_'+pID+'.style.display = "block"; } else { IMG_'+pID+'.src="../images/Expand.gif"; ID_'+pID+'.style.visibility = "hidden"; ID_'+pID+'.style.display = "none"; }'
	//alert(ch)
	eval(ch)

}
function Expand3(pID) {
	var ch = 'if (ID_'+pID+'.style.visibility == "hidden") { IMG_'+pID+'.src="img/Collapse2.gif"; ID_'+pID+'.style.visibility = "visible"; ID_'+pID+'.style.display = "block"; } else { IMG_'+pID+'.src="img/Expand2.gif"; ID_'+pID+'.style.visibility = "hidden"; ID_'+pID+'.style.display = "none"; }'
	//alert(ch)
	eval(ch)

}
function ExpandJaune(pID) {
	//var ch = 'if (ID_'+pID+'.style.visibility == "hidden") { IMG_'+pID+'.src="selectour/img/CollapseJaune.gif"; ID_'+pID+'.style.visibility = "visible"; ID_'+pID+'.style.display = "block"; } else { IMG_'+pID+'.src="selectour/img/ExpandJaune.gif"; ID_'+pID+'.style.visibility = "hidden"; ID_'+pID+'.style.display = "none"; }'
	//alert(ch)
	
	elt=document.getElementById('ID_'+pID)
	if (elt.style.visibility == "hidden") {
		eval('document.IMG_'+pID+'.src="selectour/img/CollapseJaune.gif"');
		elt.style.visibility = "visible";
		elt.style.display = "block"
	} else {
		eval('document.IMG_'+pID+'.src="selectour/img/ExpandJaune.gif"');
		elt.style.visibility = "hidden";
		elt.style.display = "none";		
	}

}
function Cacher(pID) {

	elt=document.getElementById('TR_'+pID)
	elt.style.visibility = "hidden";
	elt.style.display = "none";

}
function Montrer(pID,pLibelle) {

	elt=document.getElementById('TR_'+pID)
	elt.style.visibility = "visible";
	elt.style.display = "block";
	if( typeof(pLibelle) != "undefined") {
		 if(pLibelle.length>0) elt.children(0).children(0).innerHTML = pLibelle
	}
}
function CacherDIV(pID) {
	
	elt=document.getElementById(pID)
	elt.style.visibility = "hidden";
	elt.style.display = "none";

}
function MontrerDIV(pID) {
	
	elt=document.getElementById(pID)
	elt.style.visibility = "visible";
	elt.style.display = "block";

}

function TraiterType() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];

	if (f.Type[0].checked == true)	Cacher('Societe')
	else							Montrer('Societe')
}

function TraiterInfos() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];
	if (! f.infos[0].checked == true)	Cacher('inf_calage1')
	else								Montrer('inf_calage1')
	for (var i = 0 ; i < f.length;i++) {
		//alert(f.elements[i].name+" --> "+f.elements[i].name.substr(0,3) );
		if (f.elements[i].name.substr(0,4)=="inf_") {
			if (! f.infos[0].checked == true)	Cacher(f.elements[i].name)
			else							Montrer(f.elements[i].name)
		}
	}
//	if (! f.infos[0].checked == true) CacherDIV('BOXInfos')
//	else							MontrerDIV('BOXInfos')
}


function TraiterSuivi() {
	var f = arguments.length==0 ? document.forms[0] : f=arguments[0];
	if(f.MAJ.value.length > 0) MontrerDIV('BOXSuivi')
}
function AjaxModele() {
   var f = arguments.length==0 ? document.forms[0] : f=arguments[0];
   var xhr_object = null;

   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "AJAXModele.php", true);

   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
        //alert(xhr_object.responseText);
		 eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var index = f.IDModeles.options.selectedIndex;
   var data = "Modele="+escape(f.IDModeles.options[index].value);
   //var data  = '';
   //alert("data:"+data)
   xhr_object.send(data);

}
function AjaxReload(pTable,pChamp,pServeurOrigine) {
   var f = arguments.length==3 ? document.forms[0] : f=arguments[3];
	//alert('Table : '+pTable+' Champ : '+pChamp)
	var xhr_object = null;

   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "AJAXModele.php", true);

   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
         //alert(xhr_object.responseText);
		 eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var index = 0
   if (pTable == "offres") {
	   index = f.IDModeles.options.selectedIndex;
   } else {
	   index = -1
   }
   var data = "Table="+pTable;
   data = data+"&Champ="+pChamp;
   data = data+"&ServeurOrigine="+pServeurOrigine;
   //var data  = '';
   //alert(data)
   xhr_object.send(data);

}

function AjaxCtrl(pTable,pChamp,pServeurOrigine) {
   var f = arguments.length==3 ? document.forms[0] : f=arguments[3];
	//alert('Table : '+pTable+' Champ : '+pChamp)
	var xhr_object = null;

   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "AJAXCtrl.php", false);

   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
         //alert(xhr_object.responseText);
		 eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var index = 0
   if (pTable == "offres") {
	   index = f.IDModeles.options.selectedIndex;
   } else {
	   index = -1
   }
   var data = "Table="+pTable;
   data = data+"&Champ="+pChamp;
   data = data+"&Valeur="+eval('document.forms[0].'+pChamp+'.value');
   data = data+"&ServeurOrigine="+pServeurOrigine;
   //var data  = '';
   //alert(data)
   xhr_object.send(data);

}
function AjaxDecor(pFonction,pArg1) {
	//alert('Table : '+pTable+' Champ : '+pChamp)
	var xhr_object = null;

   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "selectour/AJAXDecor.php", false);

   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
         //alert(xhr_object.responseText);
		 eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var index = 0
   var data = "Fonction="+pFonction;
   data = data+"&ID="+pArg1;
   //alert(data)
   xhr_object.send(data);

}
function AJAXClic(pFonction,pTable,pChamp,pID,pValue) {
	//alert('Table : '+pTable+' Champ : '+pChamp)
	var xhr_object = null;

   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "AJAXClic.php", false);

   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
         //alert(xhr_object.responseText);
		 if (xhr_object.responseText.length>0)  eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var index = 0
   var data = "Fonction="+pFonction;
   data = data + "&Table="+pTable;
   data = data+"&Champ="+pChamp;
   data = data+"&ID="+pID;
   switch (pFonction) {
	   case 'checkbox' :
		   data = data+"&Checked="+pValue;  
		   break;
	   case 'combo' :
		   data = data+"&Value="+pValue;  
		   break;
		default :
			alert('pFonction '+pFonction+' incorrecte')
   }
   //alert(data)
   xhr_object.send(data);
 
}
function subEmail() {
	var tst=/(.+)(@)(.+)(\.)(.+)/
	if (! tst.test(document.nl.email.value)==false) {
   		 window.open('http://newsletter.netfly.fr/newsletter.php?email='+document.nl.email.value+'&idagence='+document.nl.idagence.value+'&g='+document.nl.g.value+'&t='+document.nl.t.value+'','nl','width=300,height=200, toolbar=no, menubar=no, scrollbars=no');
 document.nl.email.value = "";
	} else {
		alert ('Veuillez entrer une adresse valide');
	}
}
function sendfile(pLien) {
	OpenWin('selectour/SendFile.php?File='+pLien,10,10)
}
function OpenBook(pNum,pAtr){
window.open('http://main.aulivre.com/engine/isapi/frame.dll?bc='+pNum+'&amp;co='+pAtr+'&amp;ul=fr', '_new', 'location=no, menubar=no, resizable=no, status=no, toolbar=no, top=40, left=40, height=' + (screen.height - 80) + ', width=' + (screen.width - 80), true);
}
function CTRLAvions() {
	if (! form1.checkboite.checked) {
		alert('Vous devez avoir pris connaissance et accepter les conditions de vente !')
		return false;
	} else {
		location.href="Reservation-vols-avions.php"
	}
}
function ASejourTarif(pID,pCodeCategorie,pCodeTypeProduit,pOccurrence,pPrix,pNombreTypeProduit) {
	alert('ID : '+pID+' CodeCategorie : '+pCodeCategorie+' CodeTypeProduit : '+pCodeTypeProduit+' Occurrence : '+pOccurrence+' Prix : '+pPrix+' NombreTypeProduit : '+pNombreTypeProduit)
	var xhr_object = null;
	
   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "SejoursTarifsA.php", true);
	
   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
         //alert(xhr_object.responseText);
		 eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var data 	="ID="+pID;
   data = data	+"&CodeCategorie="+pCodeCategorie;
   data = data	+"&CodeTypeProduit="+pCodeTypeProduit;
   data = data	+"&Occurrence="+pOccurrence;
   data = data	+"&Prix="+pPrix;
   //var data  = '';
   //alert(data)
   xhr_object.send(data);

}
function AjaxMontantTotalCommande() {

	var xhr_object = null;
	
   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "/selectour/MontantCommande.php", false);
	
   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
         //alert(xhr_object.responseText);
		 eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

   var i =  ElementChamp('cde_carnet')
   for (i = i ; i < document.forms[0].length;i++) {
	   //alert(document.forms[0].elements[i].name + ' : '+document.forms[0].elements[i].checked)
   		if (document.forms[0].elements[i].name != 'cde_carnet') break;
		if (document.forms[0].elements[i].checked) {
			var indexCarnet=document.forms[0].elements[i].value
			break;
		}
   }
   var data = "PrixFinal="+document.forms[0].PrixFinal.value;
   data = data+"&cde_carnet="+indexCarnet;
   data = data+"&ServeurOrigine="+document.forms[0].ServeurOrigine.value;
   //alert(data)
   xhr_object.send(data);

}

function SejoursTarifs(pCodeTarif,pID,pCodeCategorie,pCodeTypeProduit,pOccurrence,pPrix,pNombreTypeProduit,pDateDebut,pDateFin,pTarif) {
	//alert('Code Tarif : '+pCodeTarif+' ID : '+pID+' CodeCategorie : '+pCodeCategorie+' CodeTypeProduit : '+pCodeTypeProduit+' Occurrence : '+pOccurrence+' Prix : '+pPrix+' NombreTypeProduit : '+pNombreTypeProduit+' Date début : '+pDateDebut+' Date fin : '+pDateFin)
	j=tCodeCategorie.length
	for (i=1;i<=j;i++) {
		if (tCodeCategorie[i] == pCodeCategorie) break;
	}
	IDTRCherche='TR_'+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence
	elt = document.getElementById(IDTRCherche)
	if (elt==null) {
		elt = document.getElementById("FORMCOMMANDE")

		switch (pCodeTypeProduit) {
			case "O":
				LibTypeProduit=""
			case "0":
				LibTypeProduit=""
				break;
			case "1":
				LibTypeProduit="Nuit Supplémentaire"
				break;
			case "2":
				LibTypeProduit="Chambre supérieure"
				break;
			case "3":
				LibTypeProduit="Suite"
				break;
			default:
		}
		var pDates = 'Du '+pDateDebut.substr(8,2)+'/'+pDateDebut.substr(5,2)+'/'+pDateDebut.substr(0,4)+'<BR>';
		pDates    += ' au '+pDateFin.substr(8,2)+'/'+pDateFin.substr(5,2)+'/'+pDateFin.substr(0,4);
		ch="<TR CLASS=\"TRLIGTARIF\" ID=\""+IDTRCherche+"\">"
		ch+="<TD>"+pDates+"</TD>"
		ch+="<TD ID=\"TDA"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\">"+tAffichageCategorie[i]+' '+LibTypeProduit+"</TD>";

		ch+="<TD ID=\"TDD"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\">"
		ch+="<input name=\""+"TTarif"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\""
		ch+=" value=\""+pTarif+"\" type=\"hidden\">";
		ch+="<input name=\""+"CTarif"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\""
		ch+=" value=\""+pCodeTarif+"\" type=\"hidden\">";
		ch+="<input name=\""+"Lib"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\""
		ch+=" value=\""+tAffichageCategorie[i]+' '+LibTypeProduit+"\" type=\"hidden\">";
		if (pCodeTypeProduit=="O" || pCodeTypeProduit=="0") {
			ch+="<input name=\""+"NPax"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\""
			ch+=" value=\""+tNbrPax[i]+"\" type=\"hidden\">";
		} else {
			ch+="<input name=\""+"NPax"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\""
			ch+=" value=\"0\" type=\"hidden\">";
		}

		if (pCodeTypeProduit=="O" || pCodeTypeProduit=="0") {
			ch+="<input Class=\"inputdate\" name=\""+"Dd"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\""
			ch+=" id=\"Field"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\"";
			ch+=" value=\""+pDateDebut.substr(8,2)+'/'+pDateDebut.substr(5,2)+'/'+pDateDebut.substr(0,4)+"\" type=\"text\" onFocus=\"blur(); CalendarPH('"
		    ch+=pDateDebut.substr(8,2)+pDateDebut.substr(5,2)+pDateDebut.substr(0,4)+"','"
			ch+=pDateFin.substr(8,2)+pDateFin.substr(5,2)+pDateFin.substr(0,4)
			ch+="','Commande','Dd"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"','ID_CAL')\">";
			ch+="<a href=\"javascript:CalendarPH('"
			ch+=pDateDebut.substr(8,2)+pDateDebut.substr(5,2)+pDateDebut.substr(0,4)+"','"
			ch+=pDateFin.substr(8,2)+pDateFin.substr(5,2)+pDateFin.substr(0,4)
			ch+="','Commande','Dd"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"','ID_CAL')\" id=\"Trigger"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\">"
		
			ch+="<img align=\"middle\" border=\"0\" src=\"selectour/jscalendar/img.gif\" alt=\"Saisir une date dans les limites de l'offre\"></a>"
		} else {
			ch+="&nbsp;";
		}
		ch+="<input name=\""+"PrixLig"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\""
		ch+=" value=\"0\" type=\"hidden\">";
		ch+="</TD>";
		ch+="<TD><SELECT CLASS=\"inputselect\"NAME=\"Ch"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\" onChange=\"javascript:ChoixChambre('"+pCodeCategorie+"','"+pCodeTypeProduit+"','"+pOccurrence+"','"+pPrix+"','"+tFacteurPrix[i]+"','"+tNbrPax[i]+"')\">"
		ch+="<OPTION VALUE=\"0\">0</OPTION><OPTION VALUE=\"1\">1</OPTION><OPTION VALUE=\"2\">2</OPTION><OPTION VALUE=\"3\">3</OPTION><OPTION VALUE=\"4\">4</OPTION>"
		ch+="<OPTION VALUE=\"5\">5</OPTION><OPTION VALUE=\"6\">6</OPTION><OPTION VALUE=\"7\">7</OPTION><OPTION VALUE=\"8\">8</OPTION><OPTION VALUE=\"9\">9</OPTION>"
		ch+="</SELECT></TD>"
		ch+="<TD CLASS=\"TDPRIX\" ID=\"TDP"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+"\"></TD></TR>"
		ch+="</TABLE>";
		elt.innerHTML = elt.innerHTML.replace(/<\/TABLE>/,ch);
	} else {
		elt.style.display='block';
	}
	
	
	for(i=1;i<9;i++) {
		IDCherche=pCodeCategorie+i+'_'+pOccurrence
		elt = document.getElementById(IDCherche)
		if (elt != null) {
			elt.innerHTML = elt.innerHTML.replace(/<!--|-->/g,"");
		}
	}
	eval("document.FORMCOMMANDE.Ch"+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+".focus()");
}
function ChoixChambre(pCodeCategorie,pCodeTypeProduit,pOccurrence,pPrix,pFacteurPrix,pNbrPax) {
	//alert('CodeCategorie : '+pCodeCategorie+' Occurrence : '+pOccurrence+' Prix : '+pPrix+' FacteurPrix : '+pFacteurPrix)
	
	eval("i=document.forms[0].Ch"+pCodeCategorie+"_"+pCodeTypeProduit+"_"+pOccurrence+".value")
	//alert(i)
	IDM="TDP"+pCodeCategorie+"_"+pCodeTypeProduit+"_"+pOccurrence
	elt = document.getElementById(IDM)
	elt.innerHTML=pPrix*pFacteurPrix*i+" €"
	if (i==0) {
		IDTRCherche='TR_'+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence
		elt = document.getElementById(IDTRCherche)
		if (elt != null) {
			//alert(elt.outerHTML);
			elt.style.display='none';
			for(i=1;i<9;i++) {
				IDCherche=pCodeCategorie+i+'_'+pOccurrence
				elt = document.getElementById(IDCherche)
				if (elt != null) {
					//elt.innerHTML = elt.innerHTML.replace(/<!--|-->/g,"");
					//alert(elt.innerHTML)
					var expression=/(<A.*\).>)/;
					expression.exec(elt.innerHTML)
					ww=RegExp.$1
					//alert(ww)
					var reg=new RegExp("<A[^>]>") 
					//elt.innerHTML = elt.innerHTML.replace(/(<A.*\).>)(.*)(<\/A>)/,"<!--"+RegExp.$1+"-->"+RegExp.$2+"<:--"+RegExp.$3+"-->");
//					elt.innerHTML = elt.innerHTML.replace(/$/,"-->");
//					elt.innerHTML = elt.innerHTML.replace(/<\/A>/,"<!--</A>-->");
					//alert(elt.innerHTML)
				}
			}
			for(i=1;i<9;i++) {
				IDCherche='TR_'+pCodeCategorie+'_'+i+'_'+pOccurrence
				//alert(IDCherche)
				elt = document.getElementById(IDCherche)
				if (elt != null) {
					elt.style.display='none';
					ww='document.forms[0].Ch'+pCodeCategorie+'_'+i+'_'+pOccurrence+'.selectedIndex=0'
					eval(ww)
					ww='document.forms[0].PrixLig'+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+'.value=0'
					eval(ww)
					IDM="TDP"+pCodeCategorie+"_"+i+"_"+pOccurrence
					elt = document.getElementById(IDM)
					elt.innerHTML="0 €"
				}
			}
		}
	} else {
		IDM="TDP"+pCodeCategorie+"_"+pCodeTypeProduit+"_"+pOccurrence
		elt = document.getElementById(IDM)
		elt.innerHTML=pPrix*pFacteurPrix*i+" €"
		ww='document.forms[0].PrixLig'+pCodeCategorie+'_'+pCodeTypeProduit+'_'+pOccurrence+'.value='+pPrix*pFacteurPrix*i
		eval(ww)
	}
	var j = document.forms[0].length
	var TotalPax=0;
	var TotalPrix=0;
	for (i=0;i<j;i++) {
		if(document.forms[0].elements[i].name.substr(0,4)=="NPax") {
			if(document.forms[0].elements[i+3].selectedIndex>0) {
				TotalPax+=(parseInt(document.forms[0].elements[i].value) * document.forms[0].elements[i+3].selectedIndex)
			}
		} else {
			if(document.forms[0].elements[i].name.substr(0,7)=="PrixLig") {
				if(document.forms[0].elements[i+1].selectedIndex>0) {
					TotalPrix+=parseInt(document.forms[0].elements[i].value)
				}
			}
		}
	}
	if (TotalPrix>0 ) {
		IDRecherche="NbrPax"
		elt = document.getElementById(IDRecherche)
		elt.innerHTML=TotalPax
		IDRecherche="TotalPrix"
		elt = document.getElementById(IDRecherche)
		elt.innerHTML=TotalPrix+' €'
		IDRecherche="TOTAL"
		elt = document.getElementById(IDRecherche)
		elt.style.display='block'
		document.forms[0].PrixTotal.value=TotalPrix
		document.forms[0].NbPax.value=TotalPax
		elt = document.getElementById("hautsaisie")
		elt.className='TARIFHaut'
		
	} else {
		IDRecherche="TOTAL"
		elt = document.getElementById(IDRecherche)
		elt.style.display='none'
		document.forms[0].PrixTotal.value=0
		elt = document.getElementById("hautsaisie")
		elt.className=''		
	}
	
	AfficherPax(TotalPax);
	MtAssurance();
	
}
function AfficherPax(TotalPax) {
	//alert(TotalPax)
	for (i=1;i<=9;i++) {
		ww="IDRecherche='TR_PAX_"+i+"'"
		//alert(ww)
		eval(ww)
		elt = document.getElementById(IDRecherche)
		if (i <= TotalPax)	elt.style.display='block'
		else				elt.style.display='none'
	}
	IDRecherche="PAX"
	elt = document.getElementById(IDRecherche)
	elt.style.display='block'

}
function MtAssurance() {

	for(i=0;i<4;i++) {
		if (document.forms[0].Assurance[i].checked==true) break;
	}
	j=document.forms[0].Assurance[i].value
	var PannierMoyen = parseFloat(document.forms[0].PrixTotal.value) / parseInt(document.forms[0].NbPax.value)
	//alert('Pax : '+parseInt(document.forms[0].NbPax.value)+' PannierMoyen : '+PannierMoyen)
	//var tMtAss= new Array([0,20,19,70],[0,29,26,104],[0,49,42,167],[0,89,-1,-1])
	//var tMtAss= new Array([0,20,70],[0,29,26,104],[0,49,42,167],[0,89,-1,-1])
	if (PannierMoyen > 0 && PannierMoyen <= 350)		MtBase = 19;
	if (PannierMoyen > 350 && PannierMoyen <= 700)		MtBase = 29;
	if (PannierMoyen > 700 && PannierMoyen <= 1200)		MtBase = 39;
	if (PannierMoyen > 1200 && PannierMoyen <= 2000)	MtBase = 59;
	if (PannierMoyen > 2000 && PannierMoyen <= 3000)	MtBase = 79;
	if (PannierMoyen > 3000 )							MtBase = 89;
	if (PannierMoyen < 0) {
		alert('Consultez nous pour le montant de l\'assurance !')
		MtTA=0
	} else {
		if (j == 0) {
			MtTA=0
		} else {
			if (j != 2)	{
				MtTA = MtBase * parseInt(document.forms[0].NbPax.value)
			} else {
				n = parseInt(document.forms[0].NbPax.value)
				if (n > 3) {
					m = 3
					n -= 3
					MtTAn = (MtBase * n) / 2
					MtTAm = (MtBase * m)
					MtTA = MtTAn + MtTAm
				} else {
					MtTA = MtBase * parseInt(document.forms[0].NbPax.value)
				}
			}
		}
	}
	MtTA += 0.5
	document.forms[0].MontantAssurance.value = parseInt(MtTA)
	document.forms[0].PrixFinal.value = parseFloat(document.forms[0].PrixTotal.value) + parseFloat(document.forms[0].FraisDossier.value) + parseFloat(document.forms[0].MontantAssurance.value)
	IDRecherche="TotalAss"
	elt = document.getElementById(IDRecherche)
	elt.innerHTML=parseInt(MtTA)+' €'
	IDRecherche="TotalFinal"
	elt = document.getElementById(IDRecherche)
	elt.innerHTML=document.forms[0].PrixFinal.value+' €'
	
	
}



function TraiterConnaitre() {
	f=document.forms[0];
	for (var i = 0 ; i < f.length;i++) {
		//alert(f.elements[i].name+" --> "+f.elements[i].name.substr(0,3) );
		if (f.elements[i].name.substr(0,4)=="con_") {
			if (! f.Connaitre[0].checked == true)	Cacher(f.elements[i].name)
			else								Montrer(f.elements[i].name)
		}
	}
}


function ChercherCLient(pParam) {
 if ((document.forms[0].email.value.length==0) || (document.forms[0].Prenom.value.length==0) || (document.forms[0].Nom.value.length==0)) return false;


   var xhr_object = null;
	
   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }

   xhr_object.open("POST", "/selectour/AJAXclient.php", false);
	
   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
        //alert(xhr_object.responseText);
		eval(xhr_object.responseText);
	  }
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var data = "Type="+pParam;   
   data = data+"&Email="+escape(document.forms[0].email.value);   
   data = data+"&Nom="+escape(document.forms[0].Nom.value);
   data = data+"&Prenom="+escape(document.forms[0].Prenom.value);
   data = data+"&ServeurOrigine="+escape(document.forms[0].ServeurOrigine.value);

   //var data  = '';
   //alert(data)
   xhr_object.send(data);

	return true;
}


function ChoixTopologieChambre(pParam) {
	
	
if (document.forms[0].DateDep.value =="") {
	alert("Merci d'indiquer votre date de départ")
	return
}

if ( (document.forms[0].Adultes.selectedIndex + document.forms[0].Enfants.selectedIndex) > 9 ) {
	alert("9 voyageurs maximum! Pour plus de voyageurs, veuillez nous contacter")
	return
} 
	
if (document.forms[0].Adultes.selectedIndex == 0) {
	document.forms[0].Enfants.selectedIndex = 0
	document.forms[0].Bebes.selectedIndex = 0
	document.getElementById('VOIRCHAMBRES').style.display = 'none';
	document.getElementById('CHAMBRES').style.display = 'none';
	document.getElementById('PRIXCHAMBRES').style.display = 'none';
	document.getElementById('NUITSSUPLIB').style.display = 'none';
	document.getElementById('NUITSSUPSELECT').style.display = 'none';
	document.getElementById('CHAMBRES').options.length = 0;
	
	document.getElementById('VOIRLOCATIONS').style.display = 'none';
	document.getElementById('LOCATIONS').style.display = 'none';
	document.getElementById('LOCATIONLIB').style.display = 'none';
	document.getElementById('LOCATIONSELECT').style.display = 'none';
	document.getElementById('LOCATIONS').options.length = 0;
	
	AfficherTotalPrix();
	return;
}


    var xhr_object = null;
	
   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
   }
   xhr_object.open("POST", "/selectour/AJAXChambre.php", true);

	
   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4) {
        //alert(xhr_object.responseText);
		eval(xhr_object.responseText);
	  }
   }
   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   var data = "IDOffre="+pParam;   
   data = data+"&DateDep="+escape(document.forms[0].DateDep.value); 
   data = data+"&Adultes="+escape(document.forms[0].Adultes.selectedIndex);   
   data = data+"&Enfants="+escape(document.forms[0].Enfants.selectedIndex);
   data = data+"&Bebes="+escape(document.forms[0].Bebes.selectedIndex);
   //data = data+"&ServeurOrigine="+escape(document.forms[0].ServeurOrigine.value);

   //var data  = '';
   //alert(data)
   xhr_object.send(data);

	AfficherPax(document.forms[0].Adultes.selectedIndex + document.forms[0].Enfants.selectedIndex)
	//return true;
}
function ChoixDeLaChambre() {
	
	document.getElementById('PRIXCHAMBRES').style.display = 'block';
	i = document.forms[0].Chambres.selectedIndex;
	
	if (document.forms[0].CHPrix.options[i].value != '0') {
		w = 'Prix des chambres : ';
		w+= document.forms[0].CHPrix.options[i].value;
		w+= ' €';
		document.getElementById('PRIXCHAMBRES').innerHTML = w;
		if (document.forms[0].NSPrix.options[i].value != '-1') {
			w = 'Nuits supplémentaires à ';
			w+= document.forms[0].NSPrix.options[i].value;
			w+= ' € :';
			document.getElementById('NUITSSUPLIB').innerHTML = w;
			document.getElementById('NUITSSUPLIB').style.display = 'block';
			document.getElementById('NUITSSUPSELECT').style.display = 'block';
			document.getElementById('NUITSSUPSELECT').selectedIndex = 0;
		} else {
			document.getElementById('NUITSSUPLIB').style.display = 'none';
			document.getElementById('NUITSSUPSELECT').selectedIndex = 0;
			document.getElementById('NUITSSUPSELECT').style.display = 'none';
		}
	} else {
		document.getElementById('PRIXCHAMBRES').style.display = 'none';
		document.getElementById('NUITSSUPLIB').style.display = 'none';
		document.getElementById('NUITSSUPSELECT').style.display = 'none';

	}

	AfficherTotalPrix();

	
}

function ChoixDesNuitsSup() {
	
	document.getElementById('PRIXNUITSSUP').style.display = 'block';
	i = document.forms[0].NuitsSups.selectedIndex;
	j = document.forms[0].Chambres.selectedIndex;	
	if (i > 0) {
		w = 'Prix des nuits supplémentaires : ';
		w+=  parseInt(document.forms[0].NSPrix.options[j].value) * document.forms[0].NuitsSups.selectedIndex;
		w+= ' €';
		document.getElementById('PRIXNUITSSUP').innerHTML = w;
	} else {
		w = '';
		document.getElementById('PRIXNUITSSUP').innerHTML = w;
	}

	AfficherTotalPrix();

	
}

function ChoixDesJoursDeLoc() {
	
	document.getElementById('PRIXLOCATION').style.display = 'block';
	i = document.forms[0].JoursLoc.selectedIndex;
	j = document.forms[0].Locations.selectedIndex;		
	if (i > 0) {
		w = 'Prix de la location de voiture : ';
		w+=  parseInt(document.forms[0].LOPrix.options[j].value) * document.forms[0].JoursLoc.selectedIndex;
		w+= ' €';
		document.getElementById('PRIXLOCATION').innerHTML = w;
	} else {
		w = '';
		document.getElementById('PRIXLOCATION').innerHTML = w;
	}

	AfficherTotalPrix();

	
}
function ChoixDeLaLocation() {
	

	i = document.forms[0].Locations.selectedIndex;
	
	if (document.forms[0].LOPrix.options[i].value != '0') {
		w = 'Prix de la location (/jour) : ';
		w+= document.forms[0].LOPrix.options[i].value;
		w+= ' €';
		document.getElementById('LOCATIONLIB').innerHTML = w;
		document.getElementById('LOCATIONLIB').style.display = 'block';
		document.getElementById('LOCATIONSELECT').style.display = 'block';
		document.getElementById('LOCATIONSELECT').selectedIndex = 0;		
	} else {
		document.getElementById('LOCATIONLIB').style.display = 'none';
		document.getElementById('LOCATIONSELECT').style.display = 'none';
		document.getElementById('LOCATIONSELECT').selectedIndex = 0;

	}

	AfficherTotalPrix();

	
}
function AfficherTotalPrix() {
	
	var TotalPrix = 0;
	var TotalPax = document.forms[0].Adultes.selectedIndex + document.forms[0].Enfants.selectedIndex;
	//alert(TotalPax)
	if ( TotalPax > 0 ) {
		i = document.forms[0].Chambres.selectedIndex;
		
		if (i >= 0) {	
			if (document.forms[0].CHPrix.options[i].value != '0') {
				TotalPrix = parseInt(document.forms[0].CHPrix.options[i].value);
				if ( document.forms[0].NSPrix.options[i].value != '-1' ) {
					w = parseInt(document.forms[0].NSPrix.options[i].value) * document.forms[0].NuitsSups.selectedIndex;
				} else {
					w = 0;
				}
				TotalPrix += w;
			}
		}
		i = document.forms[0].Locations.selectedIndex;
		if (i >= 0) {
			if (document.forms[0].LOPrix.options[i].value != '0') {
				w = parseInt(document.forms[0].LOPrix.options[i].value) * document.forms[0].JoursLoc.selectedIndex;
				TotalPrix += w;
			}
		}
		
	}
	//alert(TotalPrix);
	if (TotalPrix>0 ) {
		IDRecherche="NbrPax"
		elt = document.getElementById(IDRecherche)
		elt.innerHTML=TotalPax
		IDRecherche="TotalPrix"
		elt = document.getElementById(IDRecherche)
		elt.innerHTML=TotalPrix+' €'
		IDRecherche="TOTAL"
		elt = document.getElementById(IDRecherche)
		elt.style.display='block'
		document.forms[0].PrixTotal.value=TotalPrix
		document.forms[0].NbPax.value=TotalPax
		elt = document.getElementById("hautsaisie")
		elt.className='TARIFHaut'
		
	} else {
		IDRecherche="TOTAL"
		elt = document.getElementById(IDRecherche)
		elt.style.display='none'
		document.forms[0].PrixTotal.value=0
		elt = document.getElementById("hautsaisie")
		elt.className=''		
	}
	AfficherPax(TotalPax);
	MtAssurance();
}
function ControleContinuer() {

	if(parseInt(document.forms[0].NbPax.value)== 0) {
		alert("Les voyageurs doivent être renseignés !")
	} else {
		document.Commande.submit();
	}
}
function ImprimerOffre(pOffre) {

window.print();

//pLargeur=1020;
//pHauteur=500;

//var Hauteur=screen.height
//var Largeur=screen.width
//PositionY=(Largeur-pLargeur)/2
//PositionX=(Hauteur-pHauteur)/2

//var wino=window.open("/selectour/PreparerImprimer.php","Win","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+pLargeur+",height="+pHauteur+",top="+PositionX+",left="+PositionY+",screenX="+PositionX+",screenY="+PositionY)
//wino.location.href=pOffre;
	
}
//  Fin script -->