// JavaScript Document
function genererDocument(in_type_document){
	// marquage yahoo
	MarquerYahoo();
	MarquerGoogle();
	document.getElementById("type_document").value=in_type_document;
	if(in_type_document == "contrat"){
		document.getElementById("formulaire_devis").target="_self";
		document.getElementById("formulaire_devis").submit();
	}
	if(in_type_document == "bulletin_vierge"){
		document.getElementById("formulaire_devis").target="_blank";
		document.getElementById("formulaire_devis").submit();
	}
	if(in_type_document == "impression_contrat"){
		document.getElementById("formulaire_devis").target="_blank";
		document.getElementById("formulaire_devis").submit();
	}
	if(in_type_document == "impression_actualisation"){
		document.getElementById("formulaire_devis").target="_blank";
		document.getElementById("formulaire_devis").submit();
	}
	if(in_type_document == "actualisation"){
		document.getElementById("formulaire_devis").target="_self";
		document.getElementById("formulaire_devis").submit();
		// document.location="remerciements.php?type_formulaire=impression_actualisation";
	}
}

function controler_chiffre(inChamp){
	// on controle que le choix pro amateur a bien été fait
	retour=controlerCheckProAmateur(document.getElementById("formulaire_devis"));
	
	if(retour != -1 && inChamp.value != ""){
			// on remplace les , en .
			inChamp.value=inChamp.value.replace(",",".");
			
			  if (!(isNaN(inChamp.value))) {
				 calculerprime(document.getElementById("type_calcul").value);
			  } else {
					retour_utilisateur=alert("Attention, vous n'avez pas entré un chiffre (exemple:  154.25) .\n");
				inChamp.focus();
				inChamp.className="champ_erreur";
				return false
			  }
	  }
	  else{
	  	inChamp.value="";
		// apres effacement on remet à jour le total
		calculerprime(document.getElementById("type_calcul").value);
	  }
}
function verifiermail(mail) {
      if(mail.value != ""){
		  if ((mail.value.indexOf("@")>=0)&&(mail.value.indexOf(".")>=0)) {
			 return true
		  } else {
				retour_utilisateur=alert("Attention, vous n'avez pas renseigné une adresse e-mail correcte.\n");
			mail.focus();
			mail.className="champ_erreur";
			return false
		  }
	  }
}
function afficherValeurAssurer (){
	calculerprime("calculPrime");
	// maj du HT/TTc
	if(document.getElementById("amateur").checked == true){
		document.getElementById("HtTtc").innerHTML="TTC";
		document.getElementById("col2Ans").style.visibility="visible";
	}else{
		document.getElementById("HtTtc").innerHTML="HT";
		document.getElementById("col2Ans").style.visibility="collapse";
	}
	document.getElementById("valeurAAssurer").style.display="block";
}
function afficherPrime (){
	var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de controler
													// si une chaine est
													// bien composé
													// uniquement de nombre
													// entre 2 et 6 digits
	var prix=document.getElementById("prix");
	if(controle_nombre.test(prix.value) == false){
		alert("Le total doit être un chiffre sans les centimes.");
		prix.value="";
		document.getElementById("primeDevis").style.display="none";
	}else{
		calculerprime("calculPrime");
		document.getElementById("primeDevis").style.display="block";
	}
}
function changer_type_contrat(in_type_calcul, in_type_contrat){
	mettreLabelErreur('pro_amateur', false);
	
	calculerprime(in_type_calcul);
	if(in_type_contrat == "pro"){
		document.getElementById("taxe").innerHTML="HT";
		document.getElementById("cotisationDeuxAnsSansVol").style.display="none";
		document.getElementById("cotisationDeuxAnsSansVol").style.visibility="hidden";
		document.getElementById("typeCotisationDeuxAnsSansVol").style.display="none";
		document.getElementById("typeCotisationDeuxAnsSansVol").style.visibility="hidden";
		document.getElementById("cotisationDeuxAnsAvecVol").style.display="none";
		document.getElementById("cotisationDeuxAnsAvecVol").style.visibility="hidden";
		document.getElementById("typeCotisationDeuxAnsAvecVol").style.display="none";
		document.getElementById("typeCotisationDeuxAnsAvecVol").style.visibility="hidden";
		document.getElementById("colonneDeuxAns").style.display="none";
		document.getElementById("colonneDeuxAns").style.visibility="hidden";
		document.getElementById("ttcDeuxAnsAvecVol").style.display="none";
		document.getElementById("ttcDeuxAnsAvecVol").style.visibility="hidden";
		document.getElementById("ttcDeuxAnsSansVol").style.display="none";
		document.getElementById("ttcDeuxAnsSansVol").style.visibility="hidden";
	}
	else{
		document.getElementById("taxe").innerHTML="TTC";
		document.getElementById("cotisationDeuxAnsSansVol").style.display="block";
		document.getElementById("cotisationDeuxAnsSansVol").style.visibility="visible";
		document.getElementById("typeCotisationDeuxAnsSansVol").style.display="block";
		document.getElementById("typeCotisationDeuxAnsSansVol").style.visibility="visible";
		document.getElementById("cotisationDeuxAnsAvecVol").style.display="block";
		document.getElementById("cotisationDeuxAnsAvecVol").style.visibility="visible";
		document.getElementById("typeCotisationDeuxAnsAvecVol").style.display="block";
		document.getElementById("typeCotisationDeuxAnsAvecVol").style.visibility="visible";
		document.getElementById("colonneDeuxAns").style.display="block";
		document.getElementById("colonneDeuxAns").style.visibility="visible";
		document.getElementById("ttcDeuxAnsAvecVol").style.display="block";
		document.getElementById("ttcDeuxAnsAvecVol").style.visibility="visible";
		document.getElementById("ttcDeuxAnsSansVol").style.display="block";
		document.getElementById("ttcDeuxAnsSansVol").style.visibility="visible";
	}
	
	// reinit du type de cotisation
	document.getElementById("typeCotisationUnAnSansVol").checked = false;
	document.getElementById("typeCotisationUnAnAvecVol").checked = false;
	document.getElementById("typeCotisationDeuxAnsSansVol").checked = false;
	document.getElementById("typeCotisationDeuxAnsAvecVol").checked = false;
	document.getElementById("cotisationUnAnAvecVol").style.backgroundColor="#f2f2f2";
	document.getElementById("cotisationUnAnSansVol").style.backgroundColor="#f2f2f2";
	document.getElementById("cotisationDeuxAnsSansVol").style.backgroundColor="#f2f2f2";
	document.getElementById("cotisationDeuxAnsAvecVol").style.backgroundColor="#f2f2f2";
}
function recalcule_garantie_vol(){
	calculerprime(document.getElementById("type_calcul").value);
}

function calculerprime(in_type_calcul){
	prix1=0;
	prix2=0;
	prix3=0;
	var total_a_assurer=0;
	var retour=true;
	
	if((in_type_calcul == "actualisation")&&(document.getElementById("total_assure").value != "")){
		total_a_assurer=parseFloat(document.getElementById("total_assure").value);
	}
	
	// calcul du total à assurer
	if( (document.getElementById("prix") != null) &&
			(isNaN(document.getElementById("prix").value) == false)
			&& (document.getElementById("prix").value != "") ){
		total_a_assurer=total_a_assurer+parseFloat(document.getElementById("prix").value);
		document.getElementById("total").value=parseInt(total_a_assurer, 10);
		
		}

	if(in_type_calcul == "adhesion" && total_a_assurer != 0){
		document.getElementById("total_assure").innerHTML=parseInt(total_a_assurer, 10);
	}

	primeUnAnSansVol =0;
	primeUnAnAvecVol =0;
	// ********************Un an avec vol*************************
	if(document.getElementById("amateur").checked == true){		   
		if((total_a_assurer >0) && (total_a_assurer < 1501)  ){
				primeUnAnAvecVol=100;
			}
		if((total_a_assurer >=1501) && (total_a_assurer < 2001)  ){
				primeUnAnAvecVol=108;
			}
		if((total_a_assurer >=2001) && (total_a_assurer < 2501)  ){
				primeUnAnAvecVol=140;
			}
		if((total_a_assurer >=2501) && (total_a_assurer < 3001)  ){
				primeUnAnAvecVol=174;
			}
		if((total_a_assurer >=3001) && (total_a_assurer < 3501)  ){
				primeUnAnAvecVol=199;
			}
		if((total_a_assurer >=3501) && (total_a_assurer < 4001)  ){
				primeUnAnAvecVol=220;
			}
		if((total_a_assurer >=4001) && (total_a_assurer < 4501)  ){
				primeUnAnAvecVol=254;
			}
		if((total_a_assurer >=4501) && (total_a_assurer < 5001)  ){
				primeUnAnAvecVol=273;
			}
		if((total_a_assurer >=5001) && (total_a_assurer < 5501)  ){
				primeUnAnAvecVol=297;
			}
		if((total_a_assurer >=5501) && (total_a_assurer < 6001)  ){
				primeUnAnAvecVol=316;
			}
		if((total_a_assurer >=6001) && (total_a_assurer < 6501)  ){
				primeUnAnAvecVol=331;
			}
		if((total_a_assurer >=6501) && (total_a_assurer < 7001)  ){
				primeUnAnAvecVol=346;
			}
		if(total_a_assurer >=7001){
				primeUnAnAvecVol=Math.floor((4.98*(total_a_assurer)/100));
			}
		if(primeUnAnAvecVol != null && primeUnAnAvecVol != ""){
			document.getElementById("cotisationUnAnAvecVol").innerHTML=parseFloat(primeUnAnAvecVol, 10);
		}

	// ********************Un an sans vol*************************	   
		if((total_a_assurer >0) && (total_a_assurer < 1501)  ){
				primeUnAnSansVol=50;
			}
		if((total_a_assurer >=1501) && (total_a_assurer < 2001)  ){
				primeUnAnSansVol=54;
			}
		if((total_a_assurer >=2001) && (total_a_assurer < 2501)  ){
				primeUnAnSansVol=70;
			}
		if((total_a_assurer >=2501) && (total_a_assurer < 3001)  ){
				primeUnAnSansVol=87;
			}
		if((total_a_assurer >=3001) && (total_a_assurer < 3501)  ){
				primeUnAnSansVol=100;
			}
		if((total_a_assurer >=3501) && (total_a_assurer < 4001)  ){
				primeUnAnSansVol=110;
			}
		if((total_a_assurer >=4001) && (total_a_assurer < 4501)  ){
				primeUnAnSansVol=127;
			}
		if((total_a_assurer >=4501) && (total_a_assurer < 5001)  ){
				primeUnAnSansVol=137;
			}
		if((total_a_assurer >=5001) && (total_a_assurer < 5501)  ){
				primeUnAnSansVol=148;
			}
		if((total_a_assurer >=5501) && (total_a_assurer < 6001)  ){
				primeUnAnSansVol=158;
			}
		if((total_a_assurer >=6001) && (total_a_assurer < 6501)  ){
				primeUnAnSansVol=165;
			}
		if((total_a_assurer >=6501) && (total_a_assurer < 7001)  ){
				primeUnAnSansVol=173;
			}
		if(total_a_assurer >=7001){
				primeUnAnSansVol=Math.floor((2.44*(total_a_assurer)/100));
			}
		if(primeUnAnSansVol != null && primeUnAnSansVol != ""){
			document.getElementById("cotisationUnAnSansVol").innerHTML=parseFloat(primeUnAnSansVol, 10);			
		}
		if(total_a_assurer>15000){
			alert("Pour un total à assurer supérieur à 15 000 euros, veuillez directement prendre contact avec nous. Merci.");
			retour=false;
		}	
	}
	// ********************Un an avec vol*************************
	if(document.getElementById("amateur").checked == false){
		if((total_a_assurer >0) && (total_a_assurer < 1501)  ){
				primeUnAnAvecVol=142;
			}
		if((total_a_assurer >1500) && (total_a_assurer < 3001)  ){
				primeUnAnAvecVol=218;
			}
		if((total_a_assurer >3000) && (total_a_assurer < 4501)  ){
				primeUnAnAvecVol=331;
			}
		if((total_a_assurer >4500) && (total_a_assurer < 6001)  ){
				primeUnAnAvecVol=428;
			}
		if((total_a_assurer >6000) && (total_a_assurer < 7501)  ){
				primeUnAnAvecVol=541;
			}
		if((total_a_assurer >7500) && (total_a_assurer < 9001)  ){
				primeUnAnAvecVol=666;
			}
		if((total_a_assurer >9000) && (total_a_assurer < 10501)  ){
				primeUnAnAvecVol=789;
			}
		if((total_a_assurer >10500) && (total_a_assurer < 12001)  ){
				primeUnAnAvecVol=876;
			}
		if((total_a_assurer >12000) && (total_a_assurer < 13501)  ){
				primeUnAnAvecVol=971;
			}
		if((total_a_assurer >13500) && (total_a_assurer < 15001)  ){
				primeUnAnAvecVol=1001;
			}
		if(total_a_assurer >15000){
				primeUnAnAvecVol=Math.floor(((6.78*total_a_assurer)/100));
			}
		if(primeUnAnAvecVol != null && primeUnAnAvecVol != ""){
			document.getElementById("cotisationUnAnAvecVol").innerHTML=parseFloat(primeUnAnAvecVol, 10);	
		}

	// ********************Un an sans vol*************************

		if((total_a_assurer >0) && (total_a_assurer < 1501)  ){
				primeUnAnSansVol=71;
			}
		if((total_a_assurer >1500) && (total_a_assurer < 3001)  ){
				primeUnAnSansVol=109;
			}
		if((total_a_assurer >3000) && (total_a_assurer < 4501)  ){
				primeUnAnSansVol=165;
			}
		if((total_a_assurer >4500) && (total_a_assurer < 6001)  ){
				primeUnAnSansVol=214;
			}
		if((total_a_assurer >6000) && (total_a_assurer < 7501)  ){
				primeUnAnSansVol=270;
			}
		if((total_a_assurer >7500) && (total_a_assurer < 9001)  ){
				primeUnAnSansVol=333;
			}
		if((total_a_assurer >9000) && (total_a_assurer < 10501)  ){
				primeUnAnSansVol=394;
			}
		if((total_a_assurer >10500) && (total_a_assurer < 12001)  ){
				primeUnAnSansVol=438;
			}
		if((total_a_assurer >12000) && (total_a_assurer < 13501)  ){
				primeUnAnSansVol=485;
			}
		if((total_a_assurer >13500) && (total_a_assurer < 15001)  ){
				primeUnAnSansVol=500;
			}
		if(total_a_assurer >15000){
				primeUnAnSansVol=Math.floor(((3.39*total_a_assurer)/100));
			}
		if(primeUnAnSansVol != null && primeUnAnSansVol != ""){
			document.getElementById("cotisationUnAnSansVol").innerHTML=parseFloat(primeUnAnSansVol, 10);	
		}
		if(total_a_assurer>30000){
			alert("Pour un total à assurer supérieur à 30 000 euros, veuillez directement prendre contact avec nous. Merci.");
			retour=false;
		}
	}
	
	if(document.getElementById("amateur").checked == true){
		// on calcule la prime pour 2 ans
		// 15 % sur 2 ans
		if(primeUnAnAvecVol != null && primeUnAnAvecVol != ""){
			document.getElementById("cotisationDeuxAnsAvecVol").innerHTML=Math.floor((primeUnAnAvecVol*2.0)*0.9);
			document.getElementById("cotisationDeuxAnsSansVol").innerHTML=Math.floor((primeUnAnSansVol*2.0)*0.9);
		}
	}
	return retour;
}

function GoClignoter(inObjet, inCompteur) {
	var delai1=400; // temps d'affichage du texte exprimé en millisecondes (ici
					// 0.5 seconde)
	var delai2=400; // temps d'affichage du bouton vide
	var bouton=document.getElementById(inObjet); // ici on récupère le bouton
													// concerné
	var outCompteur=0;
	var delai=0;
	
	if(inCompteur == "10"){
		// reinitialisation
		outCompteur=0;
		delai=10000;
	}
	else{if(bouton != null){
			if (bouton.style.visibility=="visible") {
				bouton.style.visibility="hidden";
				delai=delai1;
			} else {
				bouton.style.visibility="visible";
				bouton.value="";
				delai=delai2;
			}
			outCompteur=parseInt(inCompteur)+1;
		}
	}
	var chaine_appel="GoClignoter(\""+inObjet+"\",\""+outCompteur+"\")";
	setTimeout(chaine_appel,delai);
}
function supprimer_div(in_div){

document.getElementById(in_div).style.visibility="hidden";

}
function imprimerpage(){

if(window.print)
	{
	document.write('<A HREF="javascript:window.print()">Imprimer cette page</A>');
	}
}
function inverserSelectionFormulaireParrainage(in_selection){
	
	if(in_selection == "parrain"){
		document.getElementById("parrain").style.backgroundColor="#CCCCCC";
		document.getElementById("filleul").style.backgroundColor="";
	}
	else{
		document.getElementById("filleul").style.backgroundColor="#CCCCCC";
		document.getElementById("parrain").style.backgroundColor="";
	}
}

function ouvrir_informations_legales(in_url, in_nom_fenetre, in_largeur_fenetre, in_longueur_fenetre) { // v2.0
  var largeur_offset=0;
  var longueur_offset=0;
  var largeur_fenetre=0;
  var longueur_fenetre=0;
  var parametres="";
  var nouvelle_fenetre;
  // ajout de l'offset
  largeur_fenetre=in_largeur_fenetre+largeur_offset;
  longueur_fenetre=in_longueur_fenetre+longueur_offset;
  if (longueur_fenetre<410){
  	// longueur minimale
  	longueur_fenetre=411;
  }
  parametres="width="+largeur_fenetre;
  parametres+=",height="+longueur_fenetre;
  parametres+=",status=\'yes\',top=0,left=0,";
	parametres+="scrollbars=yes,resizable=yes";
  if(largeur_fenetre>740 || longueur_fenetre>560){
  	parametres+="scrollbars=yes,resizable=yes";
  }
  else{
  	parametres+="scrollbars=no,resizable=no";
  }
  nouvelle_fenetre = window.open(in_url, null, parametres);
}
function mettreLabelErreur(nomLabel, isErreur){
		var labelRecherche;
		var labels = document.getElementsByTagName('label');
		for (var i = 0; i < labels.length; i++) {
		    if (labels[i].htmlFor == nomLabel) {
		         labelRecherche=labels[i];              
		    }
		}
		
		if(isErreur == true){
			labelRecherche.className="intitule_champ_formulaire mandatory erreur";
		}else{
			labelRecherche.className="intitule_champ_formulaire mandatory";
		}
		
		return labelRecherche;
}
function controlerCheckProAmateur(in_formulaire){
		// recherche du label
		mettreLabelErreur('pro_amateur', false);
	
		// radio button pro/amateur
		isChecked=false;
		for (var i=0; i<in_formulaire.pro_amateur.length;i++) {
         if (in_formulaire.pro_amateur[i].checked) {
            isChecked=true;
         }
      	}
		if( (isChecked == false)){
			retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : contrat amateur/pro.\n");
			
			// on met le style erreur
			mettreLabelErreur('pro_amateur', true);
			return -1;
		}
}
// -----------------------------------------------------------------------------
// Fonction : addListener
// Paramètres :
// Retour : aucun
// Description : ajoute un listener sur un element
// -----------------------------------------------------------------------------
function addListener(element, baseName, handler){
	if(element.addEventListener){
		retour=element.addEventListener(baseName, handler, false);
	}else{
		// compatibilite pour IE
		element.attachEvent('on'+baseName, handler);
	}
}
function initSouscriptionEventHandlers(){
	var prix=document.getElementById("prix");
	addListener(prix, 'change', controlerPrix);
	var jourAchat=document.getElementById("jourAchat");
	addListener(jourAchat, 'click', ds_sh);
	var tabIndiceMateriel = new Array();
	for(var i=25; i>=0;i--){
		tabIndiceMateriel[26-i]=i;
	}
	document.tabIndiceMateriel=tabIndiceMateriel;
}
function controlerPrix(){
	var retour=true;
	var prix=document.getElementById("prix");
	var erreur="";
	
	//raz erreur
	prix.className="champ_formulaire_tableau";
	
	var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de controler
														// si une chaine est
														// bien composé
														// uniquement de nombre
														// entre 2 et 6 digits
	if(controle_nombre.test(prix.value) == false){
		erreur+="Erreur: Le champ \"prix\" doit être un chiffre les centimes.<br />";
		prix.className="champ_erreur";
		prix.focus();
		document.getElementById("erreurAjout").innerHTML=erreur;
		document.getElementById("erreurAjout").style.visibility="visible";
		mettreLabelErreur('prix',true);
		retour=false;
	}
	
	if(! ( (prix.value != null) && prix.value != "")){
		erreur+="Erreur: Le champ \"prix\" est obligatoire<br />";
		prix.className="champ_erreur";
		prix.focus();
		document.getElementById("erreurAjout").innerHTML=erreur;
		document.getElementById("erreurAjout").style.visibility="visible";
		mettreLabelErreur('prix',true);
		retour=false;
	}else{
		mettreLabelErreur('prix',false);
	}
	
	return retour;
}
function controlerSerie(){
	var retour=true;
	var numSerie=document.getElementById("num_serie");
	var erreur="";
	//raz erreur
	numSerie.className="champ_formulaire_tableau";
	
	if(! ( (numSerie.value != null) && numSerie.value != "")){
		erreur+="Erreur: Le champ \"numéro de série\" est obligatoire<br />";
		numSerie.className="champ_erreur";
		numSerie.focus();
		document.getElementById("erreurAjout").innerHTML=erreur;
		document.getElementById("erreurAjout").style.visibility="visible";
		mettreLabelErreur('num_serie',true);
		retour=false;
	}else{
		mettreLabelErreur('num_serie',false);
	}
	
	return retour;
}
function controlerType(){
	var retour=true;
	var type=document.getElementById("type");
	var erreur="";
	//raz erreur
	type.className="champ_formulaire_tableau";
	
	if(! ( (type.value != null) && type.value != "")){
		erreur+="Erreur: Le champ \"type\" est obligatoire<br />";
		type.className="champ_erreur";
		type.focus();
		document.getElementById("erreurAjout").innerHTML=erreur;
		document.getElementById("erreurAjout").style.visibility="visible";
		mettreLabelErreur('type',true);
		retour=false;
	}else{
		mettreLabelErreur('type',false);
	}
	
	return retour;
}
function controlerMarque(){
	var retour=true;
	var marque=document.getElementById("marque");
	var erreur="";
	//raz erreur
	marque.className="champ_formulaire_tableau";
	
	if(! ( (marque.value != null) && marque.value != "")){
		erreur+="Erreur: Le champ \"marque\" est obligatoire<br />";
		marque.className="champ_erreur";
		document.getElementById("erreurAjout").innerHTML=erreur;
		document.getElementById("erreurAjout").style.visibility="visible";
		mettreLabelErreur('marque',true);
		retour=false;
	}else{
		mettreLabelErreur('marque',false);
	}
	
	return retour;
}
// -----------------------------------------------------------------------------
// Fonction : ajouterMateriel
// Paramètres :
// Retour : aucun
// Description : ajoute un element dans le tableau
// -----------------------------------------------------------------------------
function ajouterMateriel(){
	var compteur=0;
	var retour=false;
	
	//raz erreur
	document.getElementById("erreurAjout").style.visibility="hidden";
	
	//controler les para de l'element à ajouter
	retour=controlerMarque()&&controlerType()&&controlerSerie()&&controlerPrix();
	
	if(retour == true){
		//on décremente ce qu'il reste a declarer
		var prix = document.getElementById("prix").value;
		var restantADeclarer=document.getElementById("restantADeclarer").value;
		restantADeclarer=restantADeclarer-prix;
		
		var nbrLigne=document.tabIndiceMateriel.pop();
	
		if(restantADeclarer >= 0){
			var tr=document.createElement('tr');
			tr.setAttribute('id', compteur);
			var td=document.createElement('td');
			var texte = document.createTextNode(document.getElementById("marque").value);
			td.appendChild(texte);
			var input=document.createElement('input');
			input.setAttribute('type', "hidden");
			input.setAttribute('name', "marque"+nbrLigne);
			input.setAttribute('id', "marque"+nbrLigne);
			input.setAttribute('value', document.getElementById("marque").value);
			td.appendChild(input);
			tr.appendChild(td);
			var texte = document.createTextNode(document.getElementById("type").value);
			var td=document.createElement('td');
			td.appendChild(texte);
			var input=document.createElement('input');
			input.setAttribute('type', "hidden");
			input.setAttribute('name', "type"+nbrLigne);
			input.setAttribute('id', "type"+nbrLigne);
			input.setAttribute('value', document.getElementById("type").value);
			td.appendChild(input);
			tr.appendChild(td);
			var texte = document.createTextNode(document.getElementById("num_serie").value);
			var td=document.createElement('td');
			td.appendChild(texte);
			var input=document.createElement('input');
			input.setAttribute('type', "hidden");
			input.setAttribute('name', "num_serie"+nbrLigne);
			input.setAttribute('id', "num_serie"+nbrLigne);
			input.setAttribute('value', document.getElementById("num_serie").value);
			td.appendChild(input);
			tr.appendChild(td);
			var texte = document.createTextNode(document.getElementById("jourAchat").value);
			var td=document.createElement('td');
			td.appendChild(texte);
			var input=document.createElement('input');
			input.setAttribute('type', "hidden");
			input.setAttribute('name', "jourAchat"+nbrLigne);
			input.setAttribute('id', "jourAchat"+nbrLigne);
			input.setAttribute('value', document.getElementById("jourAchat").value);
			td.appendChild(input);
			tr.appendChild(td);
			var texte = document.createTextNode(document.getElementById("prix").value);
			var td=document.createElement('td');
			td.appendChild(texte);
			var input=document.createElement('input');
			input.setAttribute('type', "hidden");
			input.setAttribute('name', "prix"+nbrLigne);
			input.setAttribute('id', "prix"+nbrLigne);
			input.setAttribute('value', document.getElementById("prix").value);
			td.appendChild(input);
			tr.appendChild(td);
			var div = document.createElement('div');
			div.className = 'boutonCorbeille';
			var a = document.createElement('a');
		    a.setAttribute('href', "#hautInventaire");
		    a.setAttribute('title', "supprimer");
		    a.setAttribute('id', "supprimer"+compteur);
		    a.setAttribute('prix', document.getElementById("prix").value);
		    a.setAttribute('ligne', nbrLigne);
		    addListener(a, 'click', supprimerMateriel);
		    var texte = document.createTextNode(" ");
		    a.appendChild(texte);
		    div.appendChild(a);
		    var td=document.createElement('td');
		    td.appendChild(div);
		    tr.appendChild(td);	
			document.getElementById("tableauMateriels").appendChild(tr);
		     
			// reinitialisation des champs
			document.getElementById("marque").value="";
			document.getElementById("type").value="";
			document.getElementById("num_serie").value="";
			document.getElementById("jourAchat").value="";
			document.getElementById("prix").value="";
			
			//on meta jour le montant restant a déclarer
			document.getElementById("restantADeclarer").value=restantADeclarer;
			document.getElementById("affichageRestantADeclarer").innerHTML=restantADeclarer;
		}else{
			alert("Le montant total des matériels déclarés dépasse le montant demandé lors du devis. Merci de rectifier votre déclaration. ")
		}
	}
}
// -----------------------------------------------------------------------------
// Fonction : supprimerMateriel
// Paramètres :
// Retour : aucun
// Description : ajoute un element dans le tableau
// -----------------------------------------------------------------------------
function supprimerMateriel(event){
	var t=event.target;
	if(t == null){
		// cas de IE
		t=window.event.srcElement;
	}
	//maj du restant a declarer
	var prix = t.getAttribute("prix");
	var restantADeclarer=document.getElementById("restantADeclarer").value;
	restantADeclarer=parseFloat(restantADeclarer, 10)+parseFloat(prix, 10);
	document.tabIndiceMateriel.push(t.getAttribute("ligne"));
	var tr=t.parentNode.parentNode.parentNode;
	var table=tr.parentNode;
	table.removeChild(tr);
	
	//on meta jour le montant restant a déclarer
	document.getElementById("restantADeclarer").value=restantADeclarer;
	document.getElementById("affichageRestantADeclarer").innerHTML=restantADeclarer;
}
// -----------------------------------------------------------------------------
// Fonction : Analyser_formulaire_contact
// Paramètres : in_formulaire | le formulaire
// Retour : aucun
// Description : controle que tous les paramètres du formulaire sont ok
// -----------------------------------------------------------------------------
function souscrire(inTypeCotisation)
{
	// maj du type de souscription
	document.getElementById('typeCotisation').value=inTypeCotisation;
	document.getElementById('formulaire_devis').submit();
}
function validerContrat(in_formulaire){
		var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de
															// controler si une
															// chaine est bien
															// composée
															// uniquement de
															// nombre entre 2 et
															// 6 digits
	
		// controle des champs obligatoires
		in_formulaire.nom.className="champ_formulaire";
		in_formulaire.prenom.className="champ_formulaire";
		in_formulaire.telephone.className="champ_formulaire";	
		in_formulaire.adresse.className="champ_formulaire";	
		in_formulaire.code_postal.className="champ_formulaire";
		in_formulaire.ville.className="champ_formulaire";
		in_formulaire.connaissance.className="champ_formulaire";
		
		mettreLabelErreur('nom',false);
		mettreLabelErreur('prenom',false);
		mettreLabelErreur('telephone',false);	
		mettreLabelErreur('adresse',false);	
		mettreLabelErreur('code_postal',false);
		mettreLabelErreur('ville',false);
		mettreLabelErreur('connaissance',false);
		
		if( (in_formulaire.nom.value == "")){
			retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : nom.\n");
			in_formulaire.nom.focus();
			in_formulaire.nom.className="champ_erreur";
			mettreLabelErreur('nom',true);
			return -1;
		}
		
		if( (in_formulaire.prenom.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : prénom.\n");
			in_formulaire.prenom.focus();
			in_formulaire.prenom.className="champ_erreur";
			mettreLabelErreur('prenom',true);
			return -1;
		}
		
		if( (in_formulaire.adresse.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : adresse.\n");
			in_formulaire.adresse.focus();
			in_formulaire.adresse.className="champ_erreur";
			mettreLabelErreur('adresse',true);
			return -1;
		}
		
		if( (in_formulaire.code_postal.value == "")){
			retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : code postal.\n");
			in_formulaire.code_postal.focus();
			in_formulaire.code_postal.className="champ_erreur";
			mettreLabelErreur('code_postal',true);
			return -1;
		}
		
		if( (in_formulaire.ville.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : ville.\n");
			in_formulaire.ville.focus();
			in_formulaire.ville.className="champ_erreur";
			mettreLabelErreur('ville',true);
			return -1;
		}
		if( (in_formulaire.pays.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : pays.\n");
			in_formulaire.pays.focus();
			in_formulaire.pays.className="champ_erreur";
			mettreLabelErreur('pays',true);
			return -1;
		}
		
		if( (in_formulaire.telephone.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : téléphone.\n");
			in_formulaire.telephone.focus();
			in_formulaire.telephone.className="champ_erreur";
			mettreLabelErreur('telephone',true);
			return -1;
		}
		
		if( (in_formulaire.connaissance.value == "")){
				retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : comment nous avez-vous connu.\n");
					in_formulaire.connaissance.focus();
					in_formulaire.connaissance.className="champ_erreur";
					mettreLabelErreur('connaissance',true);
					return -1;
		}
		if(document.getElementById("restantADeclarer").value != "0"){
			retour_utilisateur=alert("Vous n'avez pas fini de déclarer votre matériel.\n");
			return -1;
		}
		
		genererDocument('contrat');
}
// -----------------------------------------------------------------------------
// Fonction : Analyser_formulaire_contact
// Paramètres : in_formulaire | le formulaire
// Retour : aucun
// Description : controle que tous les paramètres du formulaire sont ok
// -----------------------------------------------------------------------------
function Analyser_formulaire_contact(in_formulaire)
{
	if(calculerprime()){
		var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de
															// controler si une
															// chaine est bien
															// composée
															// uniquement de
															// nombre entre 2 et
															// 6 digits
	
		// controle des champs obligatoires
		in_formulaire.nom.className="champ_formulaire";
		in_formulaire.prenom.className="champ_formulaire";
		in_formulaire.telephone.className="champ_formulaire";	
		in_formulaire.adresse.className="champ_formulaire";	
		in_formulaire.code_postal.className="champ_formulaire";
		in_formulaire.ville.className="champ_formulaire";
		in_formulaire.connaissance.className="champ_formulaire";
		
		mettreLabelErreur('nom',false);
		mettreLabelErreur('prenom',false);
		mettreLabelErreur('telephone',false);	
		mettreLabelErreur('adresse',false);	
		mettreLabelErreur('code_postal',false);
		mettreLabelErreur('ville',false);
		mettreLabelErreur('connaissance',false);
		
		// radio button pro/amateur
		retour=controlerCheckProAmateur(in_formulaire);
		if(retour == -1){
			return -1;
		}
		
		if( (in_formulaire.nom.value == "")){
			retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : nom.\n");
			in_formulaire.nom.focus();
			in_formulaire.nom.className="champ_erreur";
			mettreLabelErreur('nom',true);
			return -1;
		}
		
		if( (in_formulaire.prenom.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : prénom.\n");
			in_formulaire.prenom.focus();
			in_formulaire.prenom.className="champ_erreur";
			mettreLabelErreur('prenom',true);
			return -1;
		}
		
		if( (in_formulaire.adresse.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : adresse.\n");
			in_formulaire.adresse.focus();
			in_formulaire.adresse.className="champ_erreur";
			mettreLabelErreur('adresse',true);
			return -1;
		}

		if( (in_formulaire.pays.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : pays.\n");
			in_formulaire.pays.focus();
			in_formulaire.pays.className="champ_erreur";
			mettreLabelErreur('pays',true);
			return -1;
		}
		
		
		if( (in_formulaire.code_postal.value == "")){
			retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : code postal.\n");
			in_formulaire.code_postal.focus();
			in_formulaire.code_postal.className="champ_erreur";
			mettreLabelErreur('code_postal',true);
			return -1;
		}
		
		if( (in_formulaire.ville.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : ville.\n");
			in_formulaire.ville.focus();
			in_formulaire.ville.className="champ_erreur";
			mettreLabelErreur('ville',true);
			return -1;
		}
		
		if( (in_formulaire.telephone.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : telephone.\n");
			in_formulaire.telephone.focus();
			in_formulaire.telephone.className="champ_erreur";
			mettreLabelErreur('telephone',true);
			return -1;
		}
		
		if( (in_formulaire.cotisationUnAnSansVol.value == "") || (in_formulaire.cotisationUnAnSansVol.value == "0")){
			retour_utilisateur=alert("Vous n'avez pas de matériel à assurer.\n");
			in_formulaire.prix1.focus();
			in_formulaire.prix1.className="champ_erreur";
			mettreLabelErreur('prix1',true);
			return -1;
		}
		if( (in_formulaire.connaissance.value == "")){
				retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : comment nous avez-vous connu.\n");
					in_formulaire.connaissance.focus();
					in_formulaire.connaissance.className="champ_erreur";
					mettreLabelErreur('connaissance',true);
					return -1;
		}
		if( (document.getElementById("typeCotisationUnAnSansVol").checked == false ) &&
			 (document.getElementById("typeCotisationUnAnAvecVol").checked == false ) &&
			  (document.getElementById("typeCotisationDeuxAnsSansVol").checked == false ) &&
			   (document.getElementById("typeCotisationDeuxAnsAvecVol").checked == false ) ){
			retour_utilisateur=alert("Vous n'avez pas renseigné le type de cotisation que vous souhaitiez\n (1 an / 2 ans / option vol / sans vol)");
			return -1;
		}
		genererDocument('contrat');
	}
}
function Analyser_formulaire_devis(in_formulaire)
{
	if(calculerprime()){
		var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de
															// controler si une
															// chaine est bien
															// composé
															// uniquement de
															// nombre entre 2 et
															// 6 digits
	
		// controle des champs obligatoires
		in_formulaire.nom.className="champ_formulaire";
		in_formulaire.prenom.className="champ_formulaire";
		in_formulaire.telephone.className="champ_formulaire";	
		in_formulaire.adresse.className="champ_formulaire";	
		in_formulaire.code_postal.className="champ_formulaire";
		in_formulaire.ville.className="champ_formulaire";
		in_formulaire.connaissance.className="champ_formulaire";
		
		mettreLabelErreur('nom',false);
		mettreLabelErreur('prenom',false);
		mettreLabelErreur('telephone',false);
		mettreLabelErreur('adresse',false);
		mettreLabelErreur('code_postal',false);
		mettreLabelErreur('ville',false);
		mettreLabelErreur('connaissance',false);
		
		
		if( (in_formulaire.nom.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : nom.\n");
			in_formulaire.nom.focus();
			in_formulaire.nom.className="champ_erreur";
			mettreLabelErreur('nom',true);
			return -1;
		}
		
		if( (in_formulaire.prenom.value == "")){
		retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : prénom.\n");
			in_formulaire.prenom.focus();
			in_formulaire.prenom.className="champ_erreur";
			mettreLabelErreur('prenom',true);
			return -1;
		}
		
		if( (in_formulaire.cotisationUnAnSansVol.value == "") || (in_formulaire.cotisationUnAnSansVol.value == "0")){
			retour_utilisateur=alert("Vous n'avez pas de matériel à assurer.\n");
			in_formulaire.prix1.focus();
			in_formulaire.prix1.className="champ_erreur";
			return -1;
		}

		if( (document.getElementById("typeCotisationUnAnSansVol").checked == false ) &&
			 (document.getElementById("typeCotisationUnAnAvecVol").checked == false ) &&
			  (document.getElementById("typeCotisationDeuxAnsSansVol").checked == false ) &&
			   (document.getElementById("typeCotisationDeuxAnsAvecVol").checked == false ) ){
			retour_utilisateur=alert("Vous n'avez pas renseigné le type de cotisation que vous souhaitiez\n (1 an / 2 ans / option vol / sans vol)");
			return -1;
		}
		genererDocument('devis');
	}
}
function Analyser_formulaire_parrainage(in_formulaire)
{
	var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de controler
														// si une chaine est
														// bien composé
														// uniquement de nombre
														// entre 2 et 6 digits

	// controle des champs obligatoires
	in_formulaire.nom_parrain.className="champ_formulaire";
	in_formulaire.prenom_parrain.className="champ_formulaire";
	in_formulaire.email_parrain.className="champ_formulaire";	
	in_formulaire.nom_filleul.className="champ_formulaire";
	in_formulaire.prenom_filleul.className="champ_formulaire";
	in_formulaire.telephone_filleul.className="champ_formulaire";
	
	mettreLabelErreur('nom_parrain',false);
	mettreLabelErreur('prenom_parrain',false);
	mettreLabelErreur('email_parrain',false);
	mettreLabelErreur('nom_filleul',false);
	mettreLabelErreur('prenom_filleul',false);
	mettreLabelErreur('telephone_filleul',false);
	
	if( (in_formulaire.nom_parrain.value == "")){
	retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : nom du parrain.\n");
		in_formulaire.nom_parrain.focus();
		in_formulaire.nom_parrain.className="champ_erreur";
		mettreLabelErreur('nom_parrain',true);
		return -1;
	}
	
	if( (in_formulaire.prenom_parrain.value == "")){
	retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : prénom du parrain.\n");
		in_formulaire.prenom_parrain.focus();
		in_formulaire.prenom_parrain.className="champ_erreur";
		mettreLabelErreur('prenom_parrain',true);
		return -1;
	}
	
	if( (in_formulaire.email_parrain.value == "")){
	retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : e-mail du parrain.\n");
		in_formulaire.email_parrain.focus();
		in_formulaire.email_parrain.className="champ_erreur";
		mettreLabelErreur('email_parrain',true);
		return -1;
	}
	if( (in_formulaire.nom_filleul.value == "")){
	retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : nom du filleul.\n");
		in_formulaire.nom_filleul.focus();
		in_formulaire.nom_filleul.className="champ_erreur";
		mettreLabelErreur('nom_filleul',true);
		return -1;
	}
	if( (in_formulaire.prenom_filleul.value == "")){
	retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : prénom du filleul.\n");
		in_formulaire.prenom_filleul.focus();
		in_formulaire.prenom_filleul.className="champ_erreur";
		mettreLabelErreur('prenom_filleul',true);
		return -1;
	}
	if( (in_formulaire.telephone_filleul.value == "")){
	retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : téléphone du filleul.\n");
		in_formulaire.telephone_filleul.focus();
		in_formulaire.telephone_filleul.className="champ_erreur";
		mettreLabelErreur('telephone_filleul',true);
		return -1;
	}
	document.getElementById('formulaire_parrainage').submit();
}





function Analyser_formulaire_message(in_formulaire, in_typeFormulaire)
{
	var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de controler
														// si une chaine est
														// bien composé
														// uniquement de nombre
														// entre 2 et 6 digits

switch(in_typeFormulaire){
	case "sinistres":
		var champMandatory = ["numero_adherent","nom", "prenom", "adresse", "telephone", "message"];
		var intitulechampMandatory = ["numero d'adherent","nom", "prénom", "adresse", "téléphone", "message"]; 
	break;
	case "contact":
		var champMandatory = ["nom", "telephone", "message"];
		var intitulechampMandatory = ["nom", "téléphone", "message"];
	break;
	case "modification":
		var champMandatory = ["numero_adherent","nom", "prenom", "adresse", "code_postal", "ville", "pays", "telephone", "total_assure"];
		var intitulechampMandatory = ["numero d'adherent","nom", "prénom", "adresse", "code postal", "ville", "pays", "téléphone", "total matériel déjà assuré"];
	break;
	case "actualiser_coordonnees":
		var champMandatory = ["numero_adherent","nom", "prenom", "adresse", "code_postal", "ville", "pays", "telephone"];
		var intitulechampMandatory = ["numero d'adherent", "nom", "prénom", "adresse", "code postal", "ville", "pays", "téléphone"];
	break;	
	default:
	break;
}
	// controle des champs obligatoires
	for(i=0; i<champMandatory.length ; i++){
		in_formulaire[champMandatory[i]].className="champ_formulaire";
		mettreLabelErreur(champMandatory[i],false);
		if(in_formulaire[champMandatory[i]].value == ""){
			retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : "+intitulechampMandatory[i]+".\n");
			in_formulaire[champMandatory[i]].focus();
			in_formulaire[champMandatory[i]].className="champ_erreur";
			mettreLabelErreur(champMandatory[i],true);
			return -1;	
		}
	}
	
	if(in_typeFormulaire == "modification"){
		if( (in_formulaire.cotisation.value == "") || (in_formulaire.cotisation.value == "0")){
		retour_utilisateur=alert("Vous n'avez pas de matériel à assurer.\n");
			in_formulaire.prix1.focus();
			in_formulaire.prix1.className="champ_erreur";
			return -1;
		}
	}
}
function Analyser_formulaire_message_modification(in_formulaire, in_typeFormulaire)
{
	var controle_nombre=new RegExp("^[0-9]{1,6}$","g"); // permet de controler
														// si une chaine est
														// bien composé
														// uniquement de nombre
														// entre 2 et 6 digits

switch(in_typeFormulaire){
	case "sinistres":
		var champMandatory = ["numero_adherent","nom", "prenom", "adresse", "telephone", "message"];
		var intitulechampMandatory = ["numero d'adherent","nom", "prénom", "adresse", "téléphone", "message"]; 
	break;
	case "contact":
		var champMandatory = ["nom", "telephone", "message"];
		var intitulechampMandatory = ["nom", "téléphone", "message"];
	break;
	case "modification":
		var champMandatory = ["numero_adherent","nom", "prenom", "adresse", "code_postal", "ville", "pays", "telephone"];
		var intitulechampMandatory = ["numero d'adherent","nom", "prénom", "adresse", "code postal", "ville", "pays", "téléphone"];
	break;
case "actualiser_coordonnees":
		var champMandatory = ["numero_adherent","nom", "prenom", "adresse", "code_postal", "ville", "pays", "telephone"];
		var intitulechampMandatory = ["numero d'adherent", "nom", "prénom", "adresse", "code postal", "ville", "pays", "téléphone"];
	break;	
	default:
	break;
}
	// controle des champs obligatoires
	for(i=0; i<champMandatory.length ; i++){
		in_formulaire[champMandatory[i]].className="champ_formulaire";
		mettreLabelErreur(champMandatory[i],false);
		if(in_formulaire[champMandatory[i]].value == ""){
			retour_utilisateur=alert("Vous n'avez pas renseigné le champs obligatoire : "+intitulechampMandatory[i]+".\n");
			in_formulaire[champMandatory[i]].focus();
			in_formulaire[champMandatory[i]].className="champ_erreur";
			mettreLabelErreur(champMandatory[i],true);
			return -1;	
		}
	}
	
	/*
	 * if(in_typeFormulaire == "modification"){ if(
	 * (in_formulaire.cotisation.value == "") || (in_formulaire.cotisation.value ==
	 * "0")){ retour_utilisateur=alert("Vous n'avez pas de matériel à
	 * assurer.\n"); in_formulaire.prix1.focus();
	 * in_formulaire.prix1.className="champ_erreur"; return -1; } }
	 */
	genererDocument('actualisation');
}

var time = 3000;
var numofitems = 7;

// menu constructor
function menu(allitems,thisitem,startstate){ 
  callname= "gl"+thisitem;
  divname="subglobal"+thisitem;  
  this.numberofmenuitems = allitems;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

// menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
	if(shutdiv != null){
    	// shutdiv.style.visibility="hidden";
	}
  }
  // theobj.thediv.style.visibility="visible";
}
				
function closesubnav(event){
  if ((event.clientY <48)||(event.clientY > 107)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
	  if(shutdiv != null){
      	shutdiv.style.visibility='hidden';
	   }
    }
  }
}
// -->

function MM_openBrWindow(theURL,winName,features) { // v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { // v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MarquerYahoo(){
	var cc_tagVersion = "1.0";
	var cc_accountID = "1165335553";
	var cc_marketID =  "3";
	var cc_protocol="http";
	var cc_subdomain = "convctr";
	if(location.protocol == "https:")
	{
		cc_protocol="https";
		 cc_subdomain="convctrs";
	}
	var cc_queryStr = "?" + "ver=" + cc_tagVersion + "&aID=" + cc_accountID + "&mkt=" + cc_marketID +"&ref=" + escape(document.referrer);
	var cc_imageUrl = cc_protocol + "://" + cc_subdomain + ".overture.com/images/cc/cc.gif" + cc_queryStr;
	var cc_imageObject = new Image();
	cc_imageObject.src = cc_imageUrl;	
}
function MarquerGoogle(){
	var google_conversion_id = 1070456241;
	var google_conversion_language = "fr";
	var google_conversion_format = "1";
	var google_conversion_color = "FFFFFF";
	if (1) {
  		var google_conversion_value = 1;
	}
	var google_conversion_label = "PURCHASE";
	if (window.google_conversion_format == null) {
	  google_conversion_format = 0;
	} else if (window.google_conversion_format > 2 ||
			   window.google_conversion_format < 0 ) {
	  google_conversion_format = 1;
	}
	if (window.google_conversion_type == 'landing') {
	  var url = document.location + "";
	  google_conversion_domain = document.domain + "";
	  var ref = google_get_domain(document.referrer);
	  if (ref && (ref.indexOf(google_conversion_domain) > -1 || 
				  google_conversion_domain.indexOf(ref) > -1)) {
		url = "";
	  }
  		google_conversion_ad = google_get_param(url, "gad");
	  if (window.google_conversion_ad) {
		(google_conversion_key = google_get_param(url, "gkw")) ||
		(google_conversion_key = google_get_param(url, "ovkey"));
		google_conversion_mtc = google_get_param(url, "ovmtc");
		google_conversion_raw = google_get_param(url, "ovraw");
	  }
	}

	google_handle_conversion();

	var cc_imageObjectGoogle = new Image();
	cc_imageObjectGoogle.src = "http://www.googleadservices.com/pagead/conversion/1070456241/?value=1&label=PURCHASE&script=0";
	

                                    	
}









// *************************GOOOOGLE****************************************
function google_get_filename() {
  var validLangs = Array("da", "de", "en_US", "en_GB", "es", "fi",
                         "fr", "it", "ja", "ko", "nl", "no", "pt_BR", "sv",
                         "zh_CN", "zh_TW");
  var lang = window.google_conversion_language;
  if (lang) {
    for (var i=0; i < validLangs.length; i++) {
      if (validLangs[i] == lang) return lang + ".html";
    }
  }
  return "en_US.html";
}

function google_language_code() {
  var lang = window.google_conversion_language;
  if (!lang) return "";
  if (2 == lang.length) return "&hl=" + escape(lang);
  if (5 == lang.length) {
    return ("&hl=" + escape(lang.substring(0,2)) +
      "&gl=" + escape(lang.substring(3,5)));
  }
  return "";
}

function google_handle_conversion() {
  var w = window;

  if (w.google_conversion_snippets) {
    w.google_conversion_snippets = w.google_conversion_snippets + 1;
  } else {
    w.google_conversion_snippets = 1;
  }

  if (w.google_conversion_id) {
    var proto = w.location.protocol.toLowerCase();
    if ('http:' != proto && 'https:' != proto) {
      proto = 'http:';
    }
    var path = "/?";
    if (w.google_conversion_type == 'landing') {
      path = "/extclk?";
    }
    var url = proto +
              "//www.googleadservices.com/pagead/conversion/" + 
              escape(w.google_conversion_id) + path +
              "random=" + (new Date()).getTime();
    if (w.google_conversion_value) {
      url = url + "&value=" + escape(w.google_conversion_value);
    }
    if (w.google_conversion_label) {
      url = url + "&label=" + escape(w.google_conversion_label);
    }
    if (w.google_conversion_ad) {
      url = url + "&gad=" + w.google_conversion_ad;
    }
    if (w.google_conversion_key) {
      url = url + "&gkw=" + w.google_conversion_key;
    }
    if (w.google_conversion_mtc) {
      url = url + "&gmtc=" + w.google_conversion_mtc;
    }
    if (w.google_conversion_raw) {
      url = url + "&graw=" + w.google_conversion_raw;
    }
    if (w.google_conversion_domain) {
      url = url + "&dom=" + w.google_conversion_domain;
    }
    url = url + google_language_code();
    var link = proto + "//services.google.com/sitestats/" +
               google_get_filename() + "?cid=" + escape(w.google_conversion_id);   
    
    if (w.google_conversion_format == 0) {
      document.write('<a href="' + link + '" target="_blank">' +
                     ' <img border=0 height=27 width=135 src="'
                     + url + '"></a>');
    } else if (w.google_conversion_snippets > 1) {
      url = url + '&num=' + w.google_conversion_snippets;
      document.write('<i' + 'mg height="1" width="1" border="0" ' + 
                     'src="' + url + '" />');
    } else {
      url = url + '&fmt=' + w.google_conversion_format;
      if (w.google_conversion_color) {
	url = url + '&bg=' + w.google_conversion_color;
      }
      var width = 300;
      var height = 13;
      if (w.google_conversion_format == 2) {
	width = 200;
	height = 26;
      }
      document.write('<ifr' + 'ame' +
                     ' name="google_conversion_frame"' +
		     ' width="' + width + '"' +
		     ' height="' + height + '"' +
		     ' src="' + url + '"' +
		     ' frameborder="0"' +
                     ' marginwidth="0"' +
                     ' marginheight="0"' +
                     ' vspace="0"' +
                     ' hspace="0"' +
                     ' allowtransparency="true"' +
                     ' scrolling="no">');
      document.write('<i' + 'mg height="1" width="1" border="0" ' + 
                     'src="' + url + '&ifr' + 'ame=0"' +
                     ' />');
      document.write('</ifr' + 'ame>');
    }
  }

  w.google_conversion_id = null;
  w.google_conversion_value = null;
  w.google_conversion_label = null;
  w.google_conversion_language = null;
  w.google_conversion_format = null;
  w.google_conversion_color = null;
}



function google_get_param(url, param) {
  var i;
  var val;
  if ((i = url.indexOf("?" + param + "=")) > -1 ||
      (i = url.indexOf("?" + param.toUpperCase() + "=")) > -1 ||
      (i = url.indexOf("&" + param + "=")) > -1 ||
      (i = url.indexOf("&" + param.toUpperCase() + "=")) > -1) {
    val = url.substring(i + param.length + 2, url.length);
    if ((i = val.indexOf("&")) > -1) {
      val = val.substring(0, i);
    }
  }
  return val;
}

function google_get_domain(url) {
   if (url) {
     domain = url.match(".?://(www\.)?([^/:]+)");
     if (domain && domain.length >= 3) {
       return domain[2] ? domain[2] : '';
     }
   }
   return "";
}
// *************************FIN GOOOOGLE****************************************


// espace photo
function changer_photo(photo, titre){
	document.getElementById("photo_grand_format").src=photo;
	document.getElementById("titre").innerHTML=titre;

}

dom=false; ie4=false; nn4=false; 

docall=false; ie56=false; nn6=false;

if (document.getElementById)  

  dom=true;

else if (document.layers) 

  nn4=true;

if (document.all)  

  docall=true; 

if (!dom && docall) 

  ie4=true;

if (dom && docall)

  ie56=true;

if (dom && !docall)

  nn6=true;
  
function animer_fleche(in_y_fin) {
	var delai1=400; // temps d'affichage du texte exprimé en millisecondes (ici
					// 0.5 seconde)
	var delai2=400; // temps d'affichage du bouton vide
	var fleche=document.getElementById("animation_fleche"); // ici on récupère
															// le bouton
															// concerné
	var outCompteur=0;
	var delai=400;
	
	if(in_y_fin < fleche.offsetTop){
		// on efface la fleche
		fleche.style.visibility=hidden;
		
	}
	else{
			if (ie56 || nn6) { 
             document.getElementById("animation_fleche").style.left=document.getElementById("animation_fleche").style.left+20 +'px';
           } else if (ie4 || ie56) {
             document.all.animation_fleche.style.left=document.all.animation_fleche.style.left+20 +'px';
           } else if (nn4) {
             document.animation_fleche.left=document.animation_fleche.left + 20;
           }
		// fleche.style.top="200";
		// fleche.moveTo(100,100);
		// var x=10;
		// fleche.setY(fleche.offsetTop + 40);
		var chaine_appel="animer_fleche(\""+in_y_fin+"\")";
		setTimeout(chaine_appel,delai);
		/*
		 * if (bouton.style.visibility=="visible") {
		 * bouton.style.visibility="hidden"; delai=delai1; } else {
		 * bouton.style.visibility="visible"; bouton.value=""; delai=delai2; }
		 * outCompteur=parseInt(inCompteur)+1;
		 */
	}
	// var chaine_appel="GoClignoter(\""+inObjet+"\",\""+outCompteur+"\")";
	
}
function changer_type_cotisation(){
	if(document.getElementById("typeCotisationUnAnSansVol").checked == true ){
		document.getElementById("cotisationUnAnSansVol").style.backgroundColor="#10FFFF";
		document.getElementById("cotisationUnAnAvecVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationDeuxAnsSansVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationDeuxAnsAvecVol").style.backgroundColor="#f2f2f2";
	}
	if(document.getElementById("typeCotisationUnAnAvecVol").checked == true ){
		document.getElementById("cotisationUnAnSansVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationUnAnAvecVol").style.backgroundColor="#10FFFF";
		document.getElementById("cotisationDeuxAnsSansVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationDeuxAnsAvecVol").style.backgroundColor="#f2f2f2";
	}
	if(document.getElementById("typeCotisationDeuxAnsSansVol").checked == true ){
		document.getElementById("cotisationUnAnSansVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationUnAnAvecVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationDeuxAnsSansVol").style.backgroundColor="#10FFFF";
		document.getElementById("cotisationDeuxAnsAvecVol").style.backgroundColor="#f2f2f2";
	}
	if(document.getElementById("typeCotisationDeuxAnsAvecVol").checked == true ){
		document.getElementById("cotisationUnAnSansVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationUnAnAvecVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationDeuxAnsSansVol").style.backgroundColor="#f2f2f2";
		document.getElementById("cotisationDeuxAnsAvecVol").style.backgroundColor="#10FFFF";
	}
		
}
