function afficherLCEN()
{
	document.getElementById("changementMail").value="true";
	document.getElementById("ouverture").submit();
}
function cacher(element){
	var elt = document.getElementById(element);
	if (elt != null) {
		elt.style.display="none";
	}
}
function montrer(element){
	var elt = document.getElementById(element);
	if (elt != null) {
		elt.style.display="block";
	}
}
function cacherSsMenus(menuSel) {
        if (navigator.appName == "Microsoft Internet Explorer") {
            document.getElementById('subs').onmouseleave = function() {
                document.getElementById('subs').style.display = "none";
				if (menuSel == true){desactiverMenu('pret-personnel-thematique');}
            };
			document.getElementById('pret-personnel-thematique').onmouseleave = function() {
                document.getElementById('subs').style.display = "none";
				if (menuSel == true){desactiverMenu('pret-personnel-thematique');}
            };
        } else {
            document.getElementById('subs').onmouseout = function() {
                document.getElementById('subs').style.display = "none";
				if (menuSel == true){desactiverMenu('pret-personnel-thematique');}
            };
			document.getElementById('pret-personnel-thematique').onmouseout = function() {
                document.getElementById('subs').style.display = "none";
				if (menuSel == true){desactiverMenu('pret-personnel-thematique');}
            };
        }
}

function activerLien(element){
	document.getElementById("lien"+element).className="active";
}
function desactiverLien(element){
	document.getElementById("lien"+element).className=null;
}
function activerMenu(menu) {
	document.getElementById(menu).style.backgroundPosition='bottom right';
}
function desactiverMenu(menu) {
	document.getElementById(menu).style.backgroundPosition='top right';
}
//change the className property of the element with the given id
function changeClass(id, className){
	var elmt = document.getElementById(id);
	if(elmt != null){
		if(elmt.oldClassName == null){
			elmt.oldClassName=elmt.className;
		}
		elmt.className=className;
	}
}
function changerImageSource(vElement,vChemin){
	document.getElementById(vElement).src=vChemin;
}
function montrerSurLaSourie(element){
	document.getElementById(element).style.display="block";
/*	alert(positionSouriY);*/
	document.getElementById(element).style.top=parseInt(positionSouriY-20)+"px";
	document.getElementById(element).style.left=parseInt(positionSouriX-30)+"px";
}

function detecterFlash(){
	var flashinstalled = 0;
	var flashversion = 0;
	MSDetect = "false";
	if (navigator.plugins && navigator.plugins.length)
	{
		x = navigator.plugins["Shockwave Flash"];
		if (x)
		{
			flashinstalled = 2;
			if (x.description)
			{
				y = x.description;
				flashversion = y.charAt(y.indexOf('.')-1);
			}
		}
		else
			flashinstalled = 1;
		if (navigator.plugins["Shockwave Flash 2.0"])
		{
			flashinstalled = 2;
			flashversion = 2;
		}
	}
	else if (navigator.mimeTypes && navigator.mimeTypes.length)
	{
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin)
			flashinstalled = 2;
		else
			flashinstalled = 1;
	}
	else
		MSDetect = "true";
	if (MSDetect == "true")
	{
		for(var i=10; i>2; i--){
			try{
				var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
				flashVersion = i;
				flashinstalled = 2
				break;
			}
			catch(e){
			}
		}
	}
	return flashinstalled;
}

/***********************    Onglet assistance   *******************************/
function selectionOngletAssistance(element){
	document.getElementById('onglet-contact').className="onglet-contact";
	document.getElementById('onglet-assistant').className="onglet-assistant";
	document.getElementById(element).className=element+"-active";
	if(element=="onglet-contact"){
		cacher("assistant");
		montrer("contact");
	}
	if(element=="onglet-assistant"){
		cacher("contact");
		montrer("assistant");
	}
}

/***********************    Nos solutions       *******************************/
function initialiserNosSolutionsEnUnCoupOeil(){
	masquerNosSolutionsEnUnCoupOeil();
	activerLien("reservecredit");
	montrer("reservecredit");
}
function masquerNosSolutionsEnUnCoupOeil() {
	cacher("reservecredit");
	cacher("pretpersonnel");
	cacher("rachatcredit");
	cacher("cartes");
	cacher("assurances");
	cacher("epargne");
	desactiverLien("reservecredit");
	desactiverLien("pretpersonnel");
	desactiverLien("rachatcredit");
	desactiverLien("cartes");
	desactiverLien("assurances");
	desactiverLien("epargne");
}
function afficherResumeNosSolutionsEnUnCoupOeil(element){
	masquerNosSolutionsEnUnCoupOeil();
	activerLien(element);
	montrer(element);
}

/***********************    Page macro          *******************************/
function afficherPageMacro(element1, element2, nb, numero){
	masquerPageMacro(element1, element2, nb);
	document.getElementById(element1+numero).className="ouvert";
	montrer(element2+numero);
}
function masquerPageMacro(element1, element2, nb){
	for(i=1;i<=nb;i++){
		cacher(element2+i);
		document.getElementById(element1+i).className="fermer";
	}
}

/***********************  Page réseau   **********************************/
function afficheResume(velement,caseH,caseV){
	if((positionSouriX>(positionXCaseHautGauche+(124*caseV)))&&(positionSouriX<(positionXCaseHautGauche+(124*(caseV+1))))){
		if(document.getElementById(velement).style.top = parseInt(-5000)+"px"){
			effacerReseau();
				document.getElementById(velement).style.top=parseInt((positionYCaseHautGauche+(66*caseH))-8)+"px";
			if(caseV>3){
				document.getElementById(velement).style.left=((positionXCaseHautGauche+(124*caseV))-233)+"px";
			}else{
				document.getElementById(velement).style.left=((positionXCaseHautGauche+(124*caseV))-8)+"px";
			}
		}
	}
}
function position(e) {
	positionSouriX = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x/*+document.body.scrollLeft*/;
	positionSouriY = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y/*+document.body.scrollTop*/;
	/*Position X et y de la premiere case haut gauche*/
	if(detecterFlash()){
	positionYCaseHautGauche=430;/*on ajoute 124 par case */
	}else{
		positionYCaseHautGauche=320;/*on ajoute 124 par case */
	}
	positionXCaseHautGauche=250;/*on ajoute 66 par case*/
	/*Position X et y de la derniere case bas droite*/
	//positionYCaseBasDroite=722;/*on ajoute 124 par case */
	//positionXCaseBasDroite=996;/*on ajoute 66 par case*/
	/*Position X et y de la premiere case haut gauche pour les cartes*/
	//positionYCaseHautColonne1Carte=503;/*on ajoute 63 par case */
	positionXCaseHautColonne1Carte=382;/*on ajoute 118 par case*/
	//positionYCaseHautColonne2Carte=503;/*on ajoute 63 par case */
	positionXCaseHautColonne2Carte=757;/*on ajoute 118 par case*/
	positionSouriXnoScroll = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	positionSouriYnoScroll = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
}
function afficheResume2(velement,zone){
	//alert("X = "+positionSouriX+" Y ="+positionSouriY+" scroll="+window.scrollTop  );
}
/***********************    Partenaires    ************************************/
function preparationDonneesSimulationPPR(p, montant) {

	var chaineret = "";
	var nbmontant = p.length;
	chaineret += "&m="+montant;
	chaineret += "&nbmo="+nbmontant;

	for (i=0; i<nbmontant; i++) {

		//montant
		chaineret += "&mo_"+i+"="+p[i][0];
		if (p[i][1] != null)
			nbmens = p[i][1].length;
		else
			nbmens = p[i][2].length;

		chaineret += "&nbme_"+i+"="+nbmens;
		for (j=0; j<nbmens; j++) {

			//mensualite
			if (p[i][1] != null)
				chaineret += "&m_"+i+"_"+j+"="+(p[i][1])[j];
			else
				chaineret += "&m_"+i+"_"+j+"=-";

			//teg tranche 1
			if (p[i][2] != null)
				chaineret += "&t_"+i+"_"+j+"="+(p[i][2])[j];
			else
				chaineret += "&t_"+i+"_"+j+"=-";

			//teg tranche 2
			if (p[i][3] != null)
				chaineret += "&t2_"+i+"_"+j+"="+(p[i][3])[j];
			else
				chaineret += "&t2_"+i+"_"+j+"=-";

			//Montant pivot pour la seconde tranche
			if (p[i][4] != null)
				chaineret += "&plr_"+i+"_"+j+"="+(p[i][4])[j];
			else
				chaineret += "&plr_"+i+"_"+j+"=-";

			//Nombre de mensualites
			if (p[i][5] != null)
				chaineret += "&d_"+i+"_"+j+"="+(p[i][5])[j];
			else
				chaineret += "&d_"+i+"_"+j+"=-";

			//Montant de la derniere mensualite
			if (p[i][6] != null)
				chaineret += "&dm_"+i+"_"+j+"="+(p[i][6])[j];
			else
				chaineret += "&dm_"+i+"_"+j+"=-";

			//Montant total du
			if (p[i][7] != null)
				chaineret += "&mtd_"+i+"_"+j+"="+(p[i][7])[j];
			else
				chaineret += "&mtd_"+i+"_"+j+"=-";

			//Taux d'assurance
			if (p[i][8] != null)
				chaineret += "&af_"+i+"_"+j+"="+(p[i][8])[j];
			else
				chaineret += "&af_"+i+"_"+j+"=-";

			//Montant d'assurance de la 1ere mensualite
			if (p[i][9] != null)
				chaineret += "&capm_"+i+"_"+j+"="+(p[i][9])[j];
			else
				chaineret += "&capm_"+i+"_"+j+"=-";

			//Montant total de l'assurance
			if (p[i][10] != null)
				chaineret += "&cat_"+i+"_"+j+"="+(p[i][10])[j];
			else
				chaineret += "&cat_"+i+"_"+j+"=-";

		}
	}

	return chaineret;
}

function trouverBaremeLPRpourMontant(p, montant, p2) {
	var nbmontant = p.length;
	for (i=0; i<nbmontant; i++) {
		if (parseInt(p[i][0])>=parseInt(montant))
			return p[i][0];
	}
	if (p2){
		var nbmontant2 = p2.length;
		for (i=0; i<nbmontant2; i++) {
			if (parseInt(p2[i][0])>=parseInt(montant))
				return p2[i][0];
		}
	}
	return p[5][0];
}

function preparationDonneesSimulationLPR(p, montant,suffixe) {
	if (!suffixe){
		suffixe='';
	}
	var chaineret = "";
	var nbmontant = p.length;
	chaineret += "&m="+montant;
	chaineret += "&nbmo"+suffixe+"="+nbmontant;

	for (i=0; i<nbmontant; i++) {
		chaineret += "&mo"+suffixe+"_"+i+"="+p[i][0];
		if (p[i][1] != null)
			nbmens = p[i][1].length;
		else
			nbmens = p[i][7].length;

		chaineret += "&nbme"+suffixe+"_"+i+"="+nbmens;
		for (j=0; j<nbmens; j++) {
			if (p[i][1] != null)
				chaineret += "&d"+suffixe+"_"+i+"_"+j+"="+(p[i][1])[j];
			else
				chaineret += "&d"+suffixe+"_"+i+"_"+j+"=-";


			if (p[i][2] != null)
				chaineret += "&t"+suffixe+"_"+i+"_"+j+"="+(p[i][2])[j];
			else
				chaineret += "&t"+suffixe+"_"+i+"_"+j+"=-";

			if (p[i][7] != null)
				chaineret += "&m"+suffixe+"_"+i+"_"+j+"="+(p[i][7])[j];
			else
				chaineret += "&m"+suffixe+"_"+i+"_"+j+"=-";

			if (p[i][10] != null)
				chaineret += "&f"+suffixe+"_"+i+"_"+j+"="+(p[i][10])[j];
			else
				chaineret += "&f"+suffixe+"_"+i+"_"+j+"=-";

			if (p[i][9] != null)
				chaineret += "&c"+suffixe+"_"+i+"_"+j+"="+(p[i][9])[j];
			else
				chaineret += "&c"+suffixe+"_"+i+"_"+j+"=-";

			if (p[i][11] != null)
				chaineret += "&tdfa"+suffixe+"_"+i+"_"+j+"="+(p[i][11])[j];
			else
				chaineret += "&tdfa"+suffixe+"_"+i+"_"+j+"=-";

			if (p[i][12] != null)
				chaineret += "&ta"+suffixe+"_"+i+"_"+j+"="+(p[i][12])[j];
			else
				chaineret += "&ta"+suffixe+"_"+i+"_"+j+"=-";

			if (p[i][13] != null)
				chaineret += "&ca"+suffixe+"_"+i+"_"+j+"="+(p[i][13])[j];
			else
				chaineret += "&ca"+suffixe+"_"+i+"_"+j+"=-";
		}
	}

	return chaineret;
}

function preparationDonneesSimulationRAC(p, montantAvecTreso, montantCredit ,tresorerie,mens) {
	var chaineret = "";
	var nbmontant = p.length;
	chaineret += "&imprimerActif=N";
	chaineret += "&emailActif=N";
	chaineret += "&m="+montantAvecTreso;
	chaineret += "&mens="+mens;
	chaineret += "&nbmo="+nbmontant;
	chaineret += "&tresorSupp="+tresorerie;
	chaineret += "&totalCredits="+montantCredit;
	for (i=0; i<nbmontant; i++) {
		chaineret += "&mo_"+i+"="+p[i][0];
		if (p[i][1] != null)
			nbmens = p[i][1].length;
		else
			nbmens = p[i][7].length;

		chaineret += "&nbme_"+i+"="+nbmens;
		for (j=0; j<nbmens; j++) {
			if (p[i][1] != null)
				chaineret += "&d_"+i+"_"+j+"="+(p[i][1])[j];
			else
				chaineret += "&d_"+i+"_"+j+"=-";


			if (p[i][2] != null)
				chaineret += "&t_"+i+"_"+j+"="+(p[i][2])[j];
			else
				chaineret += "&t_"+i+"_"+j+"=-";

			if (p[i][7] != null)
				chaineret += "&m_"+i+"_"+j+"="+(p[i][7])[j];
			else
				chaineret += "&m_"+i+"_"+j+"=-";

			if (p[i][10] != null)
				chaineret += "&f_"+i+"_"+j+"="+(p[i][10])[j];
			else
				chaineret += "&f_"+i+"_"+j+"=-";

			if (p[i][9] != null)
				chaineret += "&c_"+i+"_"+j+"="+(p[i][9])[j];
			else
				chaineret += "&c_"+i+"_"+j+"=-";

			if (p[i][11] != null)
				chaineret += "&tdaf_"+i+"_"+j+"="+(p[i][11])[j];
			else
				chaineret += "&tdaf_"+i+"_"+j+"=-";

			if (p[i][12] != null)
				chaineret += "&taf_"+i+"_"+j+"="+(p[i][12])[j];
			else
				chaineret += "&taf_"+i+"_"+j+"=-";

			if (p[i][13] != null)
				chaineret += "&cmpa_"+i+"_"+j+"="+(p[i][13])[j];
			else
				chaineret += "&cmpa_"+i+"_"+j+"=-";
		}
	}


	return chaineret;
}

/***********************    Flashs (methodes standards)   **********************/
function flashNavigation(action) {
	if (action == "formulaire-rac-info") {
		xt_med('C','1','P SIMU SHP','N');
		if (typeof racFMP != "undefined"){
			window.open('../../../pages/en-savoir-plus-rac.html','Sondage', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=250,top=100,width=800,height=400');
		} else {
			window.document.location = "../../../ba/rachat-credit/rachat-de-credits.html";
		}
	} else if (action == "rac-exemple-utilisation") {
		xt_med('C','1','P SIMU SHP','N');
		if (typeof racFMP != "undefined"){
			window.open('../../../pages/en-savoir-plus-rac.html','Sondage', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=250,top=100,width=800,height=400');
		} else {
			window.document.location = "../../../ba/rachat-credit/rachat-de-credits.html#example";
		}
	} else	if (action == "formulaire-rac-info-public") {
		window.document.location = "../rachat-credit/rachat-de-credits.html";
	} else	if (action == "Cvisa") {
		window.document.location = "../cartes/carte-visa.html";
	}
	  else	if (action == "Cpremier") {
		window.document.location = "../cartes/carte-visa-premier.html";
	}
	  else	if (action == "Cmastercard") {
		window.document.location = "../cartes/carte-mastercard.html";
	}
    	else if (action == "rac-exemple-utilisation-public") {
		window.document.location = "../rachat-credit/rachat-de-credits.html#example";
	} else	if (action == "push_pperso") {
		window.document.location = "../pret-personnel/pret-personnel.html";
	} else	if (action == "rac-exemple-utilisation-2") {
		window.document.location = "../../ba/rachat-credit/rachat-de-credits.html#example";
	} else if (action == "AssuAutoEte") {
		window.document.location = "../assurance/assurance-auto.html";
		xt_med('C','1','HP02AAUTOHAB100610','N');
	} else if (action == "shp-assurance-auto") {
		window.document.location = "../assurance/assurance-auto.html";
		xt_med('C','1','SHPAAAUTOHAB100610','N');
	} else if (action == "reseau") {
		window.document.location = "../reseau/reseau.html";
	} else if (action == "dossier_du_mois") {
		window.document.location = "../nos-conseils/article-0053.html";
	} else if (action == "article1") {
		window.document.location = "../nos-conseils/article-0074.html";
	} else if (action == "article2") {
		window.document.location = "../nos-conseils/article-0075.html";
	} else if (action == "article3") {
		window.document.location = "../nos-conseils/article-0076.html";
	} else if (action == "AssSanté") {
		window.document.location = "../assurance/complementaire-sante.html";
	} else if (action == "accueil-rachat-demande-simu") {
		xt_med('C','1','P SIMU HP','N');
		window.document.location = "../../p/ba/rachat-credit/identification.html";
	} else if (action == "RAC") {
		xt_med('C','1','P HP RAC','N');
		window.document.location = "../../p/ba/rachat-credit/identification.html";
	} else if (action == "rac-tableau") {
		try{
			window.document.location = contextePublicNonSecu + "ba/rachat-credit/rachat-de-credits.html#racTable";
		} catch (e){
		}
	} else if (action == "Avenir") {
		xt_med('C','1','HP02AA40610','N');
		window.document.location = "../epargne/assurance-vie.html";
	} else if (action == "4profils") {
		xt_med('C','1','baShp202aa410','N');
		window.document.location = "../epargne/assurance-vie-profil-investissement.html#4profils";
	} else if (action == "PPviaSimuACL") {
		xt_med('C','1','PPviaSimuACL','N');
		window.document.location = "../pret-personnel/pret-tresorerie.html";
	}  else if (action == "Pret") {
		window.document.location = "../pret-personnel/pret-personnel.html";
	} else if (action=='financer-projets-accueil-reserve-credit' || action == 'Alibre') {
		window.document.location = contexteClientSecu + "b/ba/reserve-credit/reserve-argent.html";
	} else if (action == 'accordlibre') {
		window.document.location = contexteClientSecu + "b/ba/reserve-credit/reserve-argent.html?xtatc=INT-4-[simuhp]";
	} else if (action == 'ALIbre') {
		window.document.location = "../reserve-credit/reserve-argent.html";
	} else if (action == "AssHab") {
		xt_med('C','1','P SHP ASS Flash HAB','N');
		window.document.location = "../assurance/assurance-habitation.html";
	} else if (action == "AssSecu") {
		xt_med('C','1','P SHP ASS Flash SECU','N');
		window.document.location = "../assurance/assurance-securite.html?xtatc=INT-34-[hpevent]";
	} else if (action == "AssSecu-hp2") {
		window.document.location = "../assurance/assurance-securite.html";
	} else if (action == "AssSecuClose") {
		fermerOverlay();
	} else if (action == "AssSecuHPEvent") {
		xt_click(document.getElementById("HPEvent"),'C','1','P_GMP_hpevent2','N');
		window.document.location = "../assurance/assurance-securite.html?xtatc=INT-34-[hpevent]";
	} else if (action == "AssAuto") {
		xt_med('C','1','P SHP ASS Flash AUTO','N');
		window.document.location = "../assurance/assurance-auto.html";
	} else if (action == "AssurancesCallback") {
		xt_med('C','1','C CALLBACK','N');
		windowOptions = 'menubar=no,toolbar=noresizable=yes,width='+550+',height='+350;
		windowOptions += ',scrollbars=no';
		window.open('http://www3.nexx.fr/WCB/index.asp?val=3','Callback', windowOptions);
	} else if (action == "imprimeReduction-evt") {
		window.open('http://www.jimprimemesreductions.com');
	}else if (action == "Ventes") {
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if (action == "Home") {
		window.document.location = "../accueil/accueil.html?evt=no";
	} else if (action == "DemandeAccord") {
		window.document.location = "../../p/ba/accordavenir/documentation.html";
	} else if (action == 'Accordlibre') {
		window.document.location = "../reserve-credit/reserve-argent.html";
	} else if (action == "Sante") {
		xt_med('C','1','P HP SANTE','N');
		window.document.location = "../assurance/complementaire-sante.html";
	} else if (action == "pperso") {
		window.document.location = "../pret-personnel/pret-personnel.html";
	} else if (action == "cbvisa") {
		window.document.location = "../cartes/carte-visa-premier.html";
	} else if (action == "habitation") {
		xt_med('C','1','HP02AAUTOHAB100610','N');
		window.document.location = "../assurance/assurance-habitation.html";
	} else if (action == "shp-assurance-habitation") {
		xt_med('C','1','SHPAAAUTOHAB100610','N');
		window.document.location = "../assurance/assurance-habitation.html";
	} else if (action == "auto") {
		xt_med('C','1','P SIMU SHP','N');
		window.document.location = "../assurance/assurance-auto.html";
	} else if (action == "alibre") {
		window.document.location = "../reserve-credit/reserve-argent.html";
	} else if (action == "home") {
		window.document.location = "../accueil/accueil.html?evt=no";
	} else if (action == "voeux") {
		window.document.location = "../voeux/voeux-2009.html";
	} else if (action == "DmdeAA") {
		window.document.location = "../../p/ba/accordavenir/documentation.html";
	} else if (action == "ETUDE_RAC_BPC") {
		window.document.location = "../../p/ba/bons-plans-credits/rachat-credit.html";
	} else if (action == "BPC_budget") {
		xt_med('C','1','P HP BPC Flash PPR','N');
	} else if (action == "BPC_projet") {
		xt_med('C','1','P HP BPC Flash LPR','N');
	} else if (action == "BPC_RAC") {
		xt_med('C','1','P HP BPC Flash RAC','N');
	} else if (action == "sondage_webzine") {
		window.open('http://netetudes.com/Questionnaires/etude1285/index.php','Sondage', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=250,top=100,width=1030,height=670');
	} else if (action == "Assurances") {
		window.document.location = "../../ba/assurance/assurance.html";
	} else if (action == "push_e_releve_2") {
		try {
			xt_med('C','1','P HP1','N', adresseAbonnementEReleve);
		} catch(e) { }
	} else if (action == "erdcthonHP1") {
		try {
			xt_med('C','1','P HP1','N', adresseAbonnementEReleve);
		} catch(e) { }
	} else if (action == "erdcthonSimuHP") {
		try {
			xt_med('C','1','P SIMU HP','N', adresseAbonnementEReleve);
		} catch(e) { }
	} else if (action == "accueil-virement-demande") {
		try {
			xt_med('C','1','P HP1','N', adresseDemandeVirementPlus);
		} catch(e) { }
	} else if (action == "AA") {
		try {
			if (destFlash!=null && destFlash=='demandeDoc') {
				window.document.location = "../../p/ba/accordavenir/documentation.html";
			}
		} catch (e) {
			window.document.location = "../../ba/epargne/assurance-vie.html";
		}
	} else if (action == 'recompensesAccordAvenir') {
		window.document.location = "../../ba/epargne/assurance-vie-recompense.html";
	} else if (action == "accueil-service-client-2009") {
		xt_med('C','1','P HP Service client 2009 Flash','N');
		window.document.location = "../../ba/qui-sommes-nous/service-client.html";
	} else if (action == "accueil-qui-sommes-nous-video") {
		xt_med('C','1','P Page Service client 2009 Flash','N');
		window.document.location = "../../ba/qui-sommes-nous/video.html";
	} else if (action == 'accueil-vnf-demande-tg') {
		try {
			//alert(adresseDemandeVirementNFois);
			xt_med('C','1','P OFFRE VNF ACC','N', adresseDemandeVirementNFois);
		} catch(e) { }
	}  else if (action == 'accueil-assurance-auto-habitation') {
		xt_med('C','1','P HP1','N','../assurance/assurance.html');
	} else if (action == 'hp-event-jeu-concours-avril-2009') {
		xt_med('C','1','P HP Event','N');
		try {
			window.document.location = adresseJeuConcoursClient ;
		} catch(e) { }
	} else if (action == 'home-hp2-jeu-concours-avril-2009') {
		xt_med('C','1','P HP1','N');
		try {
			window.document.location = adresseJeuConcoursClient ;
		} catch(e) { }
	} else if (action == 'changements_carte_auchan_contact'){
		xt_med('C','1','P Contact Faq Carte Auchan','N','../../p/ba/contact/formulaire.html');
	}  else if (action == 'changements_carte_auchan_contact_tel'){
		xt_med('C','1','P Contact Faq Carte Auchan Tel','N','../contact/contact-par-tel.html');
	} else if (action == 'home-281x162-assuranceVie-hp2gris') {
		window.document.location = '../../ba/epargne/assurance-vie.html?xtatc=INT-13-[HP2]' ;
	}else if (action == 'home-shhp-assurance-fauteuil') {
		xt_med('C','1','SHPC_AA_0511','N');
		window.document.location = '../../ba/epargne/assurance-vie.html' ;
	} else if (action == 'home-shp-assurance-vie0910') {
		xt_med('C','1','bahp203aa50%','N');
		window.document.location = '../../ba/epargne/assurance-vie.html' ;
	} else if (action == 'home-shp-assurance-vie') {
		window.document.location = '../../ba/epargne/assurance-vie.html?xtatc=INT-AA-GEN' ;
	} else if (action == 'assurance-vie') {
	 xt_med('C','1','SHPAA0710','N');
	 window.document.location = '../../ba/epargne/assurance-vie-profil-investissement.html#lien' ;
	}
	else if (action == "carte_auchan_mastercard") {
		window.document.location = "../cartes/carte-mastercard.html";
	} else if (action == "carte_auchan_visa") {
		window.document.location = "../cartes/carte-visa.html";
	} else if (action == "carte_auchan_visa_premier") {
		window.document.location = "../cartes/carte-visa-premier.html";
	} else if (action == "carte_auchan") {
		window.document.location = "../cartes/carte-auchan.html";
	} else if (action == "carte_auchan_fidelite") {
		window.document.location = "../cartes/changementsfidelite.html";
	} else if (action == "hp_event_carte_auchan") {
		window.document.location = "../cartes/cartes-auchan.html";
	} else if (action == "home-hp2-carte-auchan") {
		window.document.location = "../cartes/cartes-auchan.html";
	} else if (action == "vente-flash-home-evt") {
		xt_med('C','1','P HP EVENT VFPP','N');
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if (action == "vente-flash-home") {
		xt_med('C','1','P HP VFPP','N');
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if (action == "vente-flash-en-cours") {
		xt_med('C','1','P HP NAV VFPP on','N');
		document.forms['ouverture-lpr'].submit();
	} else if (action == "vente-flash-terminee") {
		xt_med('C','1','P HP NAV VFPP off','N');
		window.document.location = "../../../ba/pret-personnel/pret-personnel.html";
	} else if (action == "racpphp2pret"){
		window.document.location = "../../ba/pret-personnel/pret-personnel.html";
	} else if (action == "racpphp2rac"){
		xt_med('C','1','P HP HP2RAC61','N');
		window.document.location = "../../ba/rachat-credit/rachat-de-credits.html";
	} else if (action == "rachp2rac"){
		xt_med('C','1','P HP HP2RAC61','N');
		window.document.location = "../../ba/rachat-credit/rachat-de-credits.html?xtatc=INT-HP2RAC-GEN";
	} else if (action == "hp2_ass_securite"){
		xt_med('C','1','GMP_HP2P','N');
		window.document.location = "../assurance/assurance-securite.html";
	} else if (action == "simu_ass_securite"){
		xt_med('C','1','GMP_simuHP','N');
		window.document.location = "../assurance/assurance-securite.html";
	} else if (action == "jmreduction-hp2") {
		xt_med('C','1','P HP2','N');
		window.open('http://www.jimprimemesreductions.com','JMR', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=250,top=100,width=1024,height=620');
	} else if (action == "jeuErdc-HP2") {
		xt_med('C','1','HP2jeuerdc','N');
		window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
	} else if (action == "jeuErdc-HP3") {
		xt_med('C','1','HP3jeuerdc','N');
		window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
	} else if (action == "jeuErdc-SIMU") {
		xt_med('C','1','SimuHPjeuerdc','N');
		window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
	} else if (action == "jeuErdc-EVENT") {
		xt_med('C','1','HPEventjeuerdc','N');
		window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
	}else if (action == "hp2mag"){
		xt_med('C','1','P HP2 MAG','N');
		try{
			window.document.location = contexteClientSecu + "s/ba/magazines/magazines.html";
		} catch (e){
		}
	} else if (action == "elu2010") {
		xt_med('C','1','P elu2010','N');
		window.open('../../ressources/commun/html/avis.html','Je_donne_mon_avis', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=250,top=100,width=680,height=640');
	} else if (action == "hp_promo_pret_perso") {
		xt_med('C','1','SimuHP_PP_SOLDES','N');
		window.document.location = "../pret-personnel/pret-personnel.html";
	} else if (action == "hp2_pret_perso") {
		xt_med('C','1','HP2PretPerso','N');
		window.document.location = "../pret-personnel/pret-personnel.html";
	} else if(action == 'e-releves_2') {
		xt_med('C','1','P HP ERDC','N');
		try{
			window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
		} catch (e){
		}
	} else if(action == 'vente-privilege-HPE') {
		xt_med('C','1','P HP EVT VENTE PRIVILEGE','N');
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if(action == 'hp-no-evt') {
		xt_med('C','1','P HP EVT NO EVT','N');
		window.document.location = "accueil.html?evt=no";
	}  else if(action == 'vente-privilege-HPE-fini') {
		xt_med('C','1','P HP EVT VENTE PRIVILEGE FIN','N');
		window.document.location = "../pret-personnel/pret-personnel.html";
	} else if(action == 'hp2venteprivilege') {
		xt_med('C','1','P HP2 VENTE PRIVILEGE','N');
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if(action == 'jeu-concours-evt') {
		xt_med('C', '1', 'P HP EVT JEU CONCOURS', 'N');
		try{
			window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
		} catch (e){
		}
	} else if (action == "carte-boulanger"){
		window.document.location = "../../ba/cartes/carte-boulanger.html";
	} else if (action == "amr"){
		try{
			window.document.location = contexteClientSecu + "s/ba/amonrythme/amonrythme.html?xtatc=INT-8-[simuhp]";
		} catch (e){
		}
	} else if (action == "home-shp-assurance-auto") {
		window.document.location = "../assurance/assurance-auto-devis.html";
	}else if (action == "home-shp-sec-refNat") {
		window.document.location = "../assurance/assurance-securite.html";
	}else if (action == "hp-pp-travaux"){
		xt_med('C', '1', 'SimuHPPP041010TRA', 'N');
		window.document.location = "../../ba/pret-personnel/pret-personnel-travaux-decoration.html";
	} else if (action == "hp-pp-auton"){
		xt_med('C', '1', 'SimuHPPP041010AN', 'N');
		window.document.location = "../../ba/pret-personnel/pret-personnel-auto-neuve.html";
	} else if (action == "hp-pp-autoo"){
		xt_med('C', '1', 'SimuHPPP041010AO', 'N');
		window.document.location = "../../ba/pret-personnel/pret-personnel-auto-occasion.html";
	} else if (action == "hp-pp-loisir"){
		xt_med('C', '1', 'SimuHPPP041010LE', 'N');
		window.document.location = "../../ba/pret-personnel/pret-personnel-loisirs.html";
	} else if (action == "hp-pp-treso"){
		xt_med('C', '1', 'SimuHPPP041010TRE', 'N');
		window.document.location = "../../ba/pret-personnel/pret-personnel-tresorerie.html";
	} else if (action == "hp-pp-econrj"){
			xt_med('C', '1', 'SimuHPPP041010ECO', 'N');
		window.document.location = "../../ba/pret-personnel/pret-personnel-economies-energie.html";
	}else if (action == "hp-pp"){
		xt_med('C', '1', 'SimuHPPP041010HP', 'N');
		window.document.location = "../../ba/pret-personnel/pret-personnel.html";
	} else if (action == "anniv-carte-auchan"){
		xt_med('C', '1', 'HP02CBJ0610', 'N');
		window.document.location = "../../ba/cartes/anniversaire-carte-auchan.html";
	} else if (action == "shp-mastercard-anniv-carte-auchan"){
		xt_med('C', '1', 'SHPCAMJ0610', 'N');
		window.document.location = "../../ba/cartes/anniversaire-carte-auchan.html";
	} else if (action == "shp-visa-anniv-carte-auchan"){
		xt_med('C', '1', 'SHPCAVJ0610', 'N');
		window.document.location = "../../ba/cartes/anniversaire-carte-auchan.html";
	} else if (action == "shp-premier-anniv-carte-auchan"){
		xt_med('C', '1', 'SHPCAVPJ0610', 'N');
		window.document.location = "../../ba/cartes/anniversaire-carte-auchan.html";
	} else if (action == "hp-event-mobile-aide"){
		window.document.location = "../../ba/aide/aide-mobile.html";
	} else if (action == "hp-event-mobile-skip"){
		window.document.location = "../../ba/accueil/accueil.html?evt=no";
	} else if (action == "hp-annonce-mobile-aide"){
		window.document.location = "../../ba/aide/aide-mobile.html";
	} else if (action == "hp-annonce-mobile-evt"){
		window.document.location = "../../ba/accueil/evenement.html";
	} else if (action == "hp-annonce-erdc"){
	
	}




	else if (action.indexOf("hp2-aa-0111") == 0) {
		var num = action.split("-")[3];
		window.document.location = "../../ba/epargne/assurance-vie.html?xtatc=INT-"+num+"-[HP2]";
	} else if (action.indexOf("hp2-assu-auto-habitation-0112")==0) {
		var num = action.split("-")[5];
		window.document.location = "../../ba/assurance/assurance.html?xtatc=INT-"+num+"-[HP2]";
	} else if (action == "hp2-auto-0111") {
		xt_med('C', '1', 'HP02AAUTOHAB0111', 'N');
		window.document.location = "../../ba/assurance/assurance.html";
	} else if (action == "home-shp-assurance-vie-0-versement") {
		xt_med('C', '1', 'SHPAA01010', 'N');
		window.document.location = "../../ba/epargne/assurance-vie.html";
	} else if (action == "hp2-auto-habitat-3-mois-offerts") {
		xt_med('C', '1', 'HP02AAUTOHAB0710', 'N');
		window.document.location = "../../ba/assurance/assurance.html";
	}  else if (action == "hp2-rac-0111") {
		xt_med('C', '1', 'HP02RC0111', 'N');
		window.document.location = "../../ba/rachat-credit/rachat-de-credits.html?xtatc=INT-27-[HP2]";
	}  else if (action == "hp2_aa_1011") {
		xt_med('C', '1', 'HP2_AA_1011', 'N');
		window.document.location = "../../ba/epargne/assurance-vie.html?xtatc=HP2_AA_1011";
	} else if (action == "nav-banniere-rac") {
		xt_med('C', '1', 'SHPRC00111', 'N');
		window.document.location = "../../p/ba/rachat-credit/identification.html";
	} else if (action == "shp-assurance-vie-1010") {
		xt_med('C', '1', 'SHPAA500111', 'N');
		window.document.location = "../../ba/epargne/assurance-vie.html";
	} else if (action == "abo-erdcthon-event") {
		xt_med('C','1','EVENT ABO ERDCTHON','N');
		window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
	} else if (action == "abo-erdcthon-HP1") {
		xt_med('C','1','SIMUHP ABO ERDCTHON','N');
		window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
	}else if (action == "abo-erdcthon-HP2") {
		xt_med('C','1','HP2 ABO ERDCTHON','N');
		window.document.location = contexteClientSecu + "s/ba/releveabonnement/formulaireclassique.html";
	}else if (action == "pret-perso-event") {
		xt_med('C','1','EVENT PRET PERSO','N');
		window.document.location = "../pret-personnel/pret-personnel.html";
	}else if (action == "pret-perso-hp2") {
		window.document.location = "../pret-personnel/pret-personnel.html?xtatc=INT-HP2PP-GEND";
	} else if (action == "hp-simu-pp-test") {
		window.document.location = "../../ba/pret-personnel/pret-personnel.html?xtatc=INT-1-[simuhp]";
	} else if (action =='facebook_home'){
		window.open('http://www.facebook.com/home.php?#!/pages/Oney-Banque-Accord/303310411570?v=app_162956107080396','facebook', 'menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,width=1024,height=768');
	} else if (action =='home-shp-assurance-auto'){
		xt_med('C','1','SHP_AUTO_DEVIS','N');
		window.document.location = "../../ba/assurance/assurance-auto-devis.html";
	} else if (action =='aide-mobile'){
		window.document.location="../../ba/aide/aide-mobile.html?xtatc=INT-25-[HP2]";
	} else if (action == 'accordlibre_accueil') {
		xt_med('C','1','PCC_simuhp_ACL','N');
		window.document.location = contexteClientSecu + "b/ba/reserve-credit/reserve-argent.html";
	}  else if(action =="HP-annonce"){
		xt_med('C','2','hpgbanipad','N');
		window.document.location ="../jeuconcours/jeuconcours.html";
	} else if(action =="HP-event-BA"){
		xt_med('C','2','flashbanpiad','N');
		window.document.location ="../jeuconcours/jeuconcours.html";
	}  else if(action =="entete-assuranceSecurite"){
		window.document.location = debutUrlAsurranceSecu + "s/ba/assuranceGMP/assuranceGMP.html";
	} else if(action == 'hp2VentePrivilege') {
		xt_med('C','1','P HP2 VENTE PRIVILEGE','N');
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if(action =="accueilNoEvt"){
		window.document.location = "../../ba/accueil/accueil.html?evt=no";
	} else if(action =="hp2VentePrivilege"){
		xt_med('C','1','HP2PPVP0507','N');
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if(action =="hpAnnonceVentePrivilege"){
		xt_med('C','1','HP2PPVP0507','N');
		window.document.location = "../../p/ba/ventesflash/ventesflash.html";
	} else if(action =="accueilNoEvt"){
		window.document.location = "../../ba/accueil/accueil.html?evt=no";
	} else if (action == "assur-shp-auto") {
		window.document.location = "../assurance/assurance-auto.html?xtatc=INT-AUTO-GEN";
	} else if (action == "assur-shp-habitation") {
		window.document.location = "../assurance/assurance-habitation.html?xtatc=INT-HAB-GEN";
	} else if (action == "HPEventClose") {
		fermerOverlay();
	} else if (action == "annonce-auto") {
		xt_med('C','1','JVUNV_ANNP_1011','N');
		window.open("../../minisite/accueil/home.html?siteid=0003125352&assistid=0002125352");
	} else if (action == "autoHP2_201110") {
		window.document.location = "../assurance/assurance-auto.html?xtatc=INT-HP2AUTOP-GEN";
	} else if (action == "hp3_noel") {
		window.document.location = "../../../b/ba/noel/solutions-de-noel.html?xtatc=HP3NOEL";
	} else if (action == "dopNoel") {
		window.document.location = "../../../b/ba/noel/solutions-de-noel.html?xtatc=DOPNOEL";
	} else if (action.indexOf("simuHpnouvelAn") == 0) {
		var num = action.split("-")[1];
		window.document.location = "../nos-engagements/engagements.html?xtatc=INT-"+num+"-[Hpgauche]";
	} else {
		window.status = action;
	}
}

function flashnavigation(action) {
	if (action == "pretperso") {
		xt_med('C','1','P HP PP','N');
		window.document.location = "../pret-personnel/pret-personnel.html";
	} else if (action == "reglement") {
		window.open('../../ressources/commun/pdf/reglement-jeu-assurance.pdf','reglement', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=800,height=600');
	}
}


function flashSimulateurAction(id, action) {
	if (id == "LPR") {
		if (action == "DEMANDE") {
			xt_med('C','1','P HP SIM PP','N');
			document.forms['ouverture-lpr'].submit();
		} else if (action == "DOCUMENTATION") {
			xt_med('C','1','P HP PP DMD DOC','N');
			document.forms['documentation-lpr'].submit();
		}
	} else if (id == "PPR") {
		if (action == "DEMANDE") {
			xt_med('C','1','P HP SIM AL','N');
			document.forms['ouverture-ppr'].submit();
		} else if (action == "DOCUMENTATION") {
			xt_med('C','1','P HP AL DMD DOC','N');
			document.forms['documentation-ppr'].submit();
		}
	} else if (id == "PPR2") {
		if (action == "DEMANDE") {
			xt_med('C','1','P SIMU SHP','N');
			document.forms['ouverture-ppr'].submit();
		} else if (action == "DOCUMENTATION") {
			xt_med('C','1','P SHP AL DMD DOC','N');
			document.forms['documentation-ppr'].submit();
		}
	} else if (id == "LPR2") {
		if (action == "DEMANDE") {
			xt_med('C','1','SimuSHP_PP_SOLDES','N');
			document.forms['ouverture-lpr'].submit();
		} else if (action == "DOCUMENTATION") {
			xt_med('C','1','P SHP PP DMD DOC','N');
			document.forms['documentation-lpr'].submit();
		}
		} else if (id == "PPR3") {
		if (action == "DEMANDE") {
			xt_med('C','1','P BPC SIM AL','N');
			document.forms['ouverture-ppr'].submit();
		} else if (action == "DOCUMENTATION") {
			xt_med('C','1','P BPC AL DMD DOC','N');
			document.forms['documentation-ppr'].submit();
		}
	} else if (id == "LPR3") {
		if (action == "DEMANDE") {

			//Taggage selon le type de pret
			if (document.forms['ouverture-lpr'].elements['page'] != null
					&& document.forms['ouverture-lpr'].elements['page'].value != null) {
				document.forms['ouverture-lpr'].elements['page'].value=document.forms['ouverture-lpr'].elements['page'].value+"_S";
				var typePret = document.forms['ouverture-lpr'].elements['page'].value;
				if (typePret == 'Travaux') {
					xt_med('C','1','SHPTRADDLI25','N');
				} else if (typePret == 'AutoNeuve') {
					xt_med('C','1','SHPANDDLI25','N');
				} else if (typePret == 'AutoOccasion') {
					xt_med('C','1','SHPAODDLI25','N');
				} else if (typePret == 'Loisirs') {
					xt_med('C','1','SHPLEDDLI25','N');
				} else if (typePret == 'Tresorerie') {
					xt_med('C','1','SHPTREDDLI25','N');
				} else if (typePret == 'FLASH_S'){
					xt_med('C','1','P HP NAV VFPP on','N');
				}
			}

			document.forms['ouverture-lpr'].submit();
		} else if (action == "DEMANDEAVECJUSTIF") {
			//Taggage selon le type de pret
			if (document.forms['ouverture-lpr'].elements['page'] != null
					&& document.forms['ouverture-lpr'].elements['page'].value != null) {
				document.forms['ouverture-lpr'].elements['page'].value=document.forms['ouverture-lpr'].elements['page'].value+"_A";
				var typePret = document.forms['ouverture-lpr'].elements['page'].value;
				if (typePret == 'Travaux') {
					xt_med('C','1','SHPTRADDLI25','N');
				} else if (typePret == 'AutoNeuve') {
					xt_med('C','1','SHPANDDLI25','N');
				} else if (typePret == 'AutoOccasion') {
					xt_med('C','1','SHPAODDLI25','N');
				} else if (typePret == 'Loisirs') {
					xt_med('C','1','SHPLEDDLI25','N');
				} else if (typePret == 'Tresorerie') {
					xt_med('C','1','SHPTREDDLI25','N');
				}
			}
			document.forms['ouverture-lpr'].submit();
		}else if (action == "EMAIL") {
			document.forms['ouverture-rac'].submit();
		} else if (action == "IMPRIMER") {
			window.print();
		}
	} else if (id=='GEN3') {
		try {
			xt_med('C','1','P SimuHPPret','N');
			if (accueilBA) {
				if (document.forms['ouverture-fmp'].elements['codeProjet'].value=='RAC') {
					window.document.location = "../../p/ba/rachat-credit/identification.html";
				} else {
					document.forms['ouverture-fmp'].action='../pret-personnel/pret-personnel.html'
					document.forms['ouverture-fmp'].submit();
				}
			} else {
				document.forms['ouverture-fmp'].submit();
			}
		} catch(e) {
			document.forms['ouverture-fmp'].submit();
		}
	} else if (id=='RAC2') {
		if (action == "DEMANDE") {
			xt_med('C','1','P RAC2 SIM PP','N');
			document.forms['ouverture-rac'].submit();
		} else if (action == "EMAIL") {
			xt_med('C','1','P RAC2 PP AMI','N');
			document.forms['ouverture-rac'].submit();
		} else if (action == "IMPRIMER") {
			xt_med('C','1','P RAC2 PP IMP','N');
			window.print();
		}
	} else {
		// alert("flashSimulateurAction2 : " + id + "/" + action);
	}
}

function flashSimulateurSimulation(id, montant, mensualite) {
	if (id == "LPR" || id == "LPR2" || id == "LPR3") {
		document.forms['ouverture-lpr'].elements['montant'].value = montant;
		document.forms['ouverture-lpr'].elements['mensualite'].value = mensualite;
		document.forms['documentation-lpr'].elements['montant'].value = montant;
		document.forms['documentation-lpr'].elements['mensualite'].value = mensualite;
	} else if (id == "PPR" || id == "PPR2" || id == "PPR3") {
		document.forms['ouverture-ppr'].elements['montant'].value = montant;
		document.forms['ouverture-ppr'].elements['mensualite'].value = mensualite;
		document.forms['documentation-ppr'].elements['montantCredit'].value = montant;
		document.forms['documentation-ppr'].elements['montantMensualite'].value = mensualite;
	} else {/*
		alert("flashSimulateurSimulation3 : " + id + "/" + montant + "/" + mensualite);
		*/
	}
}

function flashSimulateurProjet(action,valeur)
{
	if (action=='GEN3')
		document.forms['ouverture-fmp'].elements['codeProjet'].value = valeur;
	/*else
		alert("flashSimulateurProjet : " + action + "/" + valeur );
	*/
}

function flashSimulateurMontant(action,valeur)
{
	if (action=='GEN3')
		document.forms['ouverture-fmp'].elements['montant'].value = valeur;
	/*else
		alert("flashSimulateurMontant : " + action + "/" + valeur );
		*/
}


/************************    Moteur de recherche    ************************/

/*
 * affecte le texte contenu dans span d'index 'spanNum' au champ texte 'mot'
 */
function setResult(div, spanNum, hideBlock){

	// recup du span et affectation du texte
	var spans = div.getElementsByTagName("div");
	document.getElementById("motClef").value = spans[spanNum].getElementsByTagName("span")[0].innerHTML;
	if (hideBlock && hideBlock == "true") {
		// disparition de la liste d'aide
		div.style.display = "none";
	}
	// postionnement du curseur sur le champ texte
	document.getElementById("motClef").focus();

}

/*
 * met le div/span dont l'index est 'spanNum' en surbrillance (dans la zone d'aide de saisie)
 */
function setSelectedSpan (div, spanNum) {
	var count = -1;
	var thisSpan;
	var spans = div.getElementsByTagName("div");
	if (spans) {
		// on parcours les entrees dans la liste d'aide
		for (var i = 0; i < spans.length; i++) {
			if (++count == spanNum) {
			 	// on change simplement la classe de style pour mettre en surbrillance (cf. style)
				spans[i].className = "highlight";
		        thisSpan = spans[i];
			} else {
				spans[i].className = "";
			}
		}
	}
	return thisSpan;
}

/*
 * retourne le numéro du div/span qui est en surbrillance (dans la zone d'aide de saisie)
 */
function getSelectedSpanNum(div) {
	var count = -1;
	var spans = div.getElementsByTagName("div");
	if (spans) {
		// on parcours les entrees dans la liste d'aide
		for (var i = 0; i < spans.length; i++) {
			count++;
			// on reconnait le div/span selectionne au nom de la classe de style
			if (spans[i].className == "highlight") {
				return count;
			}
		}
	}
	return -1;
}

/*
 *
 */
function keypressHandler(evt, prefixeURL) {

	var div = document.getElementById("autocomplete");
	var nbSpan = div.getElementsByTagName("div").length;
	var key;

	var KEYUP = 38;
	var KEYDOWN = 40;
	var KEYENTER = 13;
	var MAXLENGTH = 3;


	if (evt && evt.which) {
		evt = evt;
		key = evt.which;
	} else {
		 evt = event;
		 key = evt.keyCode;
	}

	// 1er cas : touche haut, bas ou entree et presence de l'aide a la saisie
	if ((key == KEYUP || key == KEYDOWN || key == KEYENTER) && (div.style.display == "block")) {
		// dans ce cas on se "promene" dans les differents reponses proposees
		// on commence par recuperer le span qui est actuellement selectionne
		var indexSpan = getSelectedSpanNum(div);

		if (key == KEYUP) { // on "monte" dans la liste des resultat
			if (indexSpan > 0) {
				setSelectedSpan(div, indexSpan - 1);
				setResult(div, indexSpan - 1, "false");
			}
		} else if (key == KEYDOWN) { // on "descent" dans la liste des resultat
			if (indexSpan < nbSpan - 1) {
				setSelectedSpan(div, indexSpan + 1);
				setResult(div, indexSpan + 1, "false");
			} else {
				setSelectedSpan(div, indexSpan);
				setResult(div, indexSpan, "false");
			}
		} else if (key == KEYENTER) { // on affecte la valeur selectionnee au champ texte 'motClef'
			if (indexSpan >= 0) {
				setResult(div, indexSpan, "true");
			}
			/*document.forms['form-rechercher'].submit();*/
		}
	} else if (key == KEYENTER){ // la zone d'aide a la saisie n'est pas visible, cela correspond
	    // a une validation de formulaire
		/*document.forms['form-rechercher'].submit();*/
	} else { // on fait l'appel serveur pour mettre a jour la liste d'aide a la saisie
		// celui-ci n'est fait que si le mot fait 3 caracteres
		var curLength = document.getElementById("motClef").value.length;
		if (curLength <= MAXLENGTH && curLength > 0) {
			getMots(prefixeURL);
		} else if (curLength == 0) {
			div.style.display = "none";
		}
	}
}

/*
 * execute l'appel serveur pour recuperer la liste des mots apparente au champ texte associe
 */
function getMots(prefixeURL) {
	var motClef = document.getElementById("motClef").value;
	// creation de l'objet xmlHttpRequest
	var req = newXMLHttpRequest();
	if (!req) { // ajax non supporte par le navigateur
		return;
	}
	// lancement du thread qui va attendre la reponse a la requete ci-apres.
	// une fois la reponse recue, la fonction javascript de callback "popupResult" sera appelee
	req.onreadystatechange = getReadyStateHandler(req, popupResult);
	// preparation et envoi de la requete avec les parametres qui vont bieng
 	req.open("POST", prefixeURL + "../p/ba/recherche/autocompletion.html", true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	req.send("prefixe=" + motClef);
}

/*
 * Fonction de callback qui met a jour de l'etat du bloc (html) suite au traitement cote serveur
 */
function popupResult(resultXML) {

	// recuperation du flux xml genere cote serveur
	var htmlContent = "";
	var nbMots = resultXML.getElementsByTagName("mot").length;
	if (nbMots > 0) {
		// on va creer le contenu du bloc d'aide en html a l'aide de balise <div>
		for (var i = 0; i < nbMots; i++) {
			htmlContent += "<div><span>" + resultXML.getElementsByTagName("mot")[i].firstChild.nodeValue + "</span></div>";
		}
		// une fois que le code html est genere, on remplit le block avec le code que l'on
		// vient de generer...
		remplir(htmlContent);
		// ...et on affiche le block
    	document.getElementById("autocomplete").style.display = "block";
   	} else { // aucun mot trouve, on cache le bloc d'aide
	   	document.getElementById("autocomplete").style.display = "none";
   	}
}

/*
 * rempli le bloc avec du code html
 */
function remplir(sHTML){

	document.getElementById("autocomplete").innerHTML = sHTML;
	var nodes = document.getElementById("autocomplete").childNodes;
	// on en profite pour gerer les evenements "souris"
	for(var i = 0; i < nodes.length; i++){
		// sur le onmouseover, on met le <div> en surbrillance
		nodes[i].onmouseover = function(){ this.className = "highlight"; }
		// sur le onmouseout, on ne fait rien
		nodes[i].onmouseout = function(){ this.className = ""; }
		// sur le onclick, on affecte le texte courant au champ texte et on cache la zone d'aide
		nodes[i].onclick = function(){
			document.getElementById("motClef").value = this.getElementsByTagName("span")[0].innerHTML;
			document.getElementById("motClef").focus();
			document.getElementById("autocomplete").style.display = "none";
		}
	}
}

/**
 * Affiche le contrat dans une popup
 */
var hrefContrat;
function ouvrirPopupContrat(lienId){
	//alert('ouvrirPopup');
	lien = document.getElementById(lienId);
	href = lien.getAttributeNode('href');
	valHref = href.nodeValue;
	if (valHref != 'javascript:void(0)'){
		hrefContrat = valHref;
	} else {
		valHref = hrefContrat;
	}
	lien.removeAttributeNode(href);

	href = document.createAttribute('href');
	href.nodeValue='javascript:void(0)';
	lien.setAttributeNode(href);

	target = lien.getAttributeNode('target');
	if (target){
		lien.removeAttributeNode(target);
	}

	window.open(valHref,'contratpdf', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=660,height=570');

}

function prepareAutocomplete(champId) {
	champ = document.getElementById(champId);
	if (champ) {
		autocompl = champ.getAttributeNode('autocomplete');
		if (autocompl){
			champ.removeAttributeNode(autocompl);
		}
		autocompl = document.createAttribute('autocomplete');
		autocompl.nodeValue = 'off';
		champ.setAttributeNode(autocompl);
	}
}
function goDevis() {
	var newWindow = window.open("bamdocs/http/html/assuranceauto.html","AssuranceAuto", "menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=650,height=450");
}
var hrefDevis;
function ouvrirPopupDevis(lienId,titrefenetre,hauteur,largeur,scroll){
	//alert('ouvrirPopup');
	lien = document.getElementById(lienId);
	href = lien.getAttributeNode('href');
	valHref = href.nodeValue;
	if (valHref != 'javascript:void(0)'){
		hrefDevis = valHref;
	} else {
		valHref = hrefDevis;
	}
	lien.removeAttributeNode(href);

	href = document.createAttribute('href');
	href.nodeValue='javascript:void(0)';
	lien.setAttributeNode(href);

	target = lien.getAttributeNode('target');
	if (target){
		lien.removeAttributeNode(target);
	}
	windowOptions = 'menubar=no,toolbar=noresizable=yes,width='+largeur+',height='+hauteur;
	if (scroll){
		windowOptions += ',scrollbars='+scroll;
	} else {
		windowOptions += ',scrollbars=yes';
	}
	window.open(valHref,'Devis', windowOptions);

}
var hrefPopup = new Array();
function ouvrirPopup(lienId,titrefenetre,hauteur,largeur){
	//alert('ouvrirPopup');
	lien = document.getElementById(lienId);
	href = lien.getAttributeNode('href');
	valHref = href.nodeValue;
	if (valHref != 'javascript:void(0)'){
		var lienExiste = false;
    for (i=0;i<hrefPopup.length;i++){
      if ((hrefPopup[i])[0]==lienId){
        lienExiste = true;
      }
    }
    //alert('lienExiste ? '+lienExiste);
    if (!lienExiste){
      hrefPopup.push(new Array(lienId,valHref));
      //alert(hrefPopup.join());
    }
	} else {
		for (i=0;i<hrefPopup.length;i++){
      if ((hrefPopup[i])[0]==lienId){
        valHref = (hrefPopup[i])[1];
      }
    }
    //alert('valHref = '+valHref);
	}
	lien.removeAttributeNode(href);

	href = document.createAttribute('href');
	href.nodeValue='javascript:void(0)';
	lien.setAttributeNode(href);

	target = lien.getAttributeNode('target');
	if (target){
		lien.removeAttributeNode(target);
	}

	window.open(valHref,'Devis', 'menubar=no,toolbar=no,scrollbars=yes,resizable=yes,left=250,top=100,width='+largeur+',height='+hauteur);

}

/***********************  Demande doc AccordAvenir  *******************************/
function afficherNumeroCarte(ligneId, blocId, champId, lignePrecId){

	bloc = document.getElementById(blocId);
	var ligneNumCarte = document.getElementById(ligneId);

	if (!ligneNumCarte){
		ligne = document.createElement('p');
		idLigne = document.createAttribute('id');
		idLigne.nodeValue = ligneId;
		ligne.setAttributeNode(idLigne);

		label = document.createElement('label');
		forLabel = document.createAttribute('for');
		forLabel.nodeValue = champId;
		textLabel = document.createTextNode('Numéro de carte ');
		spanTag = document.createElement('span');
		spanTag.className = 'rouge';
		spanTag.innerHTML = '*';
		label.setAttributeNode(forLabel);
		label.appendChild(textLabel);
		label.appendChild(spanTag);

		input = document.createElement('input');
		typeInput = document.createAttribute('type');
		typeInput.nodeValue = 'text';
		idInput = document.createAttribute('id');
		idInput.nodeValue = champId;
		nameInput = document.createAttribute('name');
		nameInput.nodeValue = champId;
		valueInput = document.createAttribute('value');
		valueInput.nodeValue = '';
		mxlInput = document.createAttribute('maxlength');
		mxlInput.nodeValue='50';
		sizeInput = document.createAttribute('size');
		sizeInput.nodeValue='40';

		input.setAttributeNode(typeInput);
		input.setAttributeNode(idInput);
		input.setAttributeNode(nameInput);
		input.setAttributeNode(valueInput);
		input.setAttributeNode(mxlInput);
		input.setAttributeNode(sizeInput);

		ligne.appendChild(label);
		ligne.appendChild(input);

		lignePrec = document.getElementById(lignePrecId);
		bloc.insertBefore(ligne,lignePrec.nextSibling);
	}

}

function masquerNumeroCarte(idLigne, idBloc){
	bloc = document.getElementById(idBloc);
	var ligneNumCarte = document.getElementById(idLigne);

	if (ligneNumCarte){
		bloc.removeChild(ligneNumCarte);
	}
}

function visibilite(d) {
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}

function disableBt(id) {
if(document.getElementById(id)){document.getElementById(id).disable();}
}
//--></script>

function preparerDonneeSimuMontant(p){
	var chaineret = "";
	var nbprojet = p.length;

	chaineret += '&nbpr='+nbprojet;

	for (i=0; i<nbprojet; i++) {
		chaineret += '&l_'+i+'='+p[i][0];
		chaineret += '&c_'+i+'='+p[i][1];
		chaineret += '&md'+i+'='+p[i][2];
		chaineret += '&mlMt'+i+'='+p[i][3];
		chaineret += '&mlNb'+i+'='+p[i][4];
		chaineret += '&mlMens'+i+'='+p[i][5];
		chaineret += '&mlTAEG'+i+'='+p[i][6];
		chaineret += '&mlmtd'+i+'='+p[i][7];

		var nbmontant = p[i][8].length;
		chaineret += '&nbmo_'+i+'='+ nbmontant;
		for (j=0; j<nbmontant; j++){
			chaineret += '&m_'+i+'_'+j+'='+p[i][8][j];
		}
	}

	return chaineret ;
}

function redirectionPretSimu(code, montant, idformulaire, idChampMontant, idChampNature, tableauUrl ){
	if (document.forms[idformulaire] && document.forms[idformulaire].elements[idChampMontant] && document.forms[idformulaire].elements[idChampNature]){
		document.forms[idformulaire].elements[idChampMontant].value=montant;

		trouve = false;
		for (i=0; i< tableauUrl.length && !trouve; i++){
			if (tableauUrl[i][0] == code){
				document.forms[idformulaire].action = tableauUrl[i][2];
				document.forms[idformulaire].elements[idChampNature].value=tableauUrl[i][1];
				trouve = true;
			}
		}

		if (trouve){
			document.forms[idformulaire].submit();
		}
	}
}

/* Assurance : Afficher masquer les rubriques d'aide */

function findPosition(aObject) {
    var posX = 0,
        posY = 0;
    do {
        posX += aObject.offsetLeft;
        posY += aObject.offsetTop;
        aObject = aObject.offsetParent;
    } while (aObject != null);
    var pos = [];
    pos['X'] = posX;
    pos['Y'] = posY;
    return pos;
}
function placerIndicateur(index, ligne, colonne) {
    if (ligne != undefined && colonne != undefined) {
        var positionImg = findPosition(document.getElementById('imagePinpad'));
        document.getElementById('indicateur').style.top = '' + (parseInt(positionImg['Y']) + (10 + ligne * 36)) + 'px';

    }
}

function assuranceDetail(element, ligne) {
	for (i=0; i < 20; i++){
		cacher('fiche'+i);
	}
	montrer(element);
	
	document.getElementById('indicateur').style.display = "block";
	if (ligne){
		pos = findPosition(document.getElementById(ligne));
		document.getElementById('indicateur').style.top = (pos['Y']-5)+"px";
		document.getElementById(element).style.position = 'absolute';
		document.getElementById(element).style.top = (pos['Y']-520-document.getElementById(element).clientHeight/2)+"px";
	}
}

function assuranceDetailBottom(element, ligne) {
	for (i=0; i < 20; i++){
		cacher('fiche'+i);
	}
	montrer(element);
	
	document.getElementById('indicateur').style.display = "block";
	if (ligne){
		pos = findPosition(document.getElementById(ligne));
		document.getElementById('indicateur').style.top = (pos['Y']-5)+"px";
	}
}

function assuranceDetailTop(element, ligne) {
	for (i=0; i < 20; i++){
		cacher('fiche'+i);
	}
	montrer(element);
	
	document.getElementById('indicateur').style.display = "block";
	if (ligne){
		pos = findPosition(document.getElementById(ligne));
		document.getElementById('indicateur').style.top = (pos['Y']-5)+"px";
	}
}

