var altfarm_aei_subscription = '<img src="http://altfarm.mediaplex.com/ad/bk/17781-123543-3840-0?Subscription=1&amp;mpuid=&amp;rnd='+Math.random()+'" height="1" width="1" alt="Mediaplex_tag" />';

// message box
var agMsgBox =
	new Class(
	{
		initialize:
			function()
			{
				this.overlay = new Overlay({ onClick:this.hide.bind(this) });
				this.moduleSize = "H"; //Big box
				this.h = 100;
				this.w = 600;
			},

		preload:
			function()
			{
				this.background = new Image();
				this.background.src = "/images/msgbox/msgbox.png";
			},

		getDimensions:
			function()
			{
				//h = 100;
				//w = 600;
				h = this.h;
				w = this.w;

				t = ((window.getHeight() - h) / 2) + window.getScrollTop();
				l = (window.getWidth() - w) / 2;

				return { "height" : h, "width" : w, "top" : t, "left" : l };
			},

		setDimension:
			function(type)
			{
				this.moduleSize = type;
				if (type=="S")
				{
					this.h = 100;
					this.w = 500;
				}
			},


		setDimensions:
			function(height,width)
			{
				this.h = height;
				this.w = width;
			},


		closeParentOnExit:
			function(parent) {
				if(parent) {
					if($('msgBoxOkOpt')) $('msgBoxOkOpt').cloneEvents(parent);
					if($('msgBoxButton')) $('msgBoxButton').cloneEvents(parent);
				}
			},

		setContent:
			function(html_data)
			{
				if(this.box) this.box.set('html',html_data);
			},

		show:
			function(label, mode, obj, method)
			{
				if (this.overlay.open == true)
				{
					return;
				}

				switch (mode)
				{
					// information
					case 1 :
						title = LABEL["COMMON_INFORMATION"];

						break;

					// confirmation
					case 2 :
						title = LABEL["COMMON_CONFIRMATION"];

						break;

					// warning
					case 3 :
					case 4 :
						title = LABEL["COMMON_WARNING"];

						break;

					case 5 :
					case 6 :
						title = "- ALERTE EMAIL GRATUITE";
					break;

					case 7 :
					case 8 :
						title = "- CONTACTER L'AGENCE";
					break;

					case 12 :
					case 13 :
						title = "- ALERTE EMAIL GRATUITE";
					break;

					//default
					default :
						title = LABEL["COMMON_INFORMATION"];

						break;
				}

				var box = this.getDimensions();

				if (this.moduleSize == "S")
				{

					this.box = new Element("div", { "id" : "msgBox" });
					this.box.setStyle("height", box.height + "px");
					this.box.setStyle("width", box.width + "px");
					this.box.setStyle("top", box.top + "px");
					this.box.setStyle("left", box.left + "px");
					this.box.setStyle("z-index", 101000);

					this.icon = new Element("div", { "id" : "msgBoxIcon" + mode }).injectInside(this.box);
					this.icon.setStyle("height", box.height + "px");
					this.icon.setStyle("width", 80 + "px");
					this.icon.setStyle("z-index", 101000);

					this.title = new Element("div", { "id" : "msgBoxTitle"}).injectInside(this.box);
					this.title.setStyle("height", 20 + "px");
					//this.title.setStyle("width", 520 + "px");
					this.title.setStyle("width", 400 + "px");
					this.title.setStyle("z-index", 101000);
					this.title.set("html",title);

					this.label = new Element("div", { "id" : "msgBoxLabel"}).injectInside(this.box);
					this.label.setStyle("height", 70 + "px");
					//this.label.setStyle("width", 520 + "px");
					this.label.setStyle("width", 400 + "px");
					this.label.setStyle("z-index", 101000);
					this.label.set("html",label);

					this.button = new Element("div", { "id" : "msgBoxButton" });
					this.button.setStyle("top", (box.top - 6) + "px");
					this.button.setStyle("left", (box.left + 522) + "px");
					this.button.setStyle("z-index", 101001);
					this.button.addEvent("click", this.hide.bind(this));

					switch (mode)
					{
						// information
						case 1 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 420) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

						// confirmation
						case 2 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 300) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { obj.proceed(method); this.hide() }.bind(this));

							this.btnCancel = new Element("div", { "id" : "msgBoxCancel" });
							this.btnCancel.setStyle("top", (box.top + 97) + "px");
							this.btnCancel.setStyle("left", (box.left + 420) + "px");
							this.btnCancel.setStyle("z-index", 101001);
							this.btnCancel.set("text",LABEL["COMMON_CANCEL"]);
							this.btnCancel.addEvent("click", function() { this.hide() }.bind(this));

							$$("body")[0].adopt(this.btnCancel);

							break;

						// warning
						case 3 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 420) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

						//Special Action
						//Creer pour récuperer un ID spécifique sur le BT OK pour interragir avec d'autre éléments ou objet en amont
						case 11 :
							this.btnOk = new Element("div", { "id" : "msgBoxOkOpt" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 420) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

					}
				}
				else
				{
					this.box = new Element("div", { "id" : "msgBox" });
					this.box.setStyle("height", box.height + "px");
					this.box.setStyle("width", box.width + "px");
					this.box.setStyle("top", box.top + "px");
					this.box.setStyle("left", box.left + "px");
					this.box.setStyle("z-index", 101001);

					this.icon = new Element("div", { "id" : "msgBoxIcon" + mode }).injectInside(this.box);
					this.icon.setStyle("height", box.height + "px");
					this.icon.setStyle("width", 80 + "px");
					this.icon.setStyle("z-index", 101001);

					this.title = new Element("div", { "id" : "msgBoxTitle"}).injectInside(this.box);
					this.title.setStyle("height", 20 + "px");
					this.title.setStyle("width", 520 + "px");
					this.title.setStyle("z-index", 101001);
					this.title.set("html",title);

					this.label = new Element("div", { "id" : "msgBoxLabel"}).injectInside(this.box);
					this.label.setStyle("height", 70 + "px");
					this.label.setStyle("width", 520 + "px");
					this.label.setStyle("z-index", 101001);
					this.label.set("html",label);

					this.button = new Element("div", { "id" : "msgBoxButton" });
					this.button.setStyle("top", (box.top - 6) + "px");
					if (mode == 1) {
                  this.button.setStyle("left", (box.left + 622) + "px");
					} else {
                  this.button.setStyle("left", (box.left + 642) + "px");
					}
					this.button.setStyle("z-index", 101001);
					this.button.addEvent("click", this.hide.bind(this));

					switch (mode)
					{
						// information
						case 1 :
						    /*
						    if ((_univ == 1 || _univ == 17) && (_page != 'contact_us.php')) {
						      
    						   //change the popup size and label size for adaptation to BNP button
    						   this.box.setStyle("height", box.height + 55 + "px");
    						   this.label.setStyle("height", 90 + "px");

    							this.btnOk = new Element("img", { "id" : "msgBoxOk"});
    							this.btnOk.set('src', _urlmmf+'static/BNP/bouton-demandePret.jpg');
    							this.btnOk.set('alt', 'Faîtes une demande de prêt');
    							this.btnOk.set('title', 'Faîtes une demande de prêt');
    							this.btnOk.setStyle("top", (box.top + 142) + "px");
    							this.btnOk.setStyle("left", (box.left + 230) + "px");
    							this.btnOk.setStyle("width", "212px");
    							this.btnOk.setStyle("height", "38px");
    							this.btnOk.setStyle("padding", "0px");
    							this.btnOk.setStyle("border", "0px");
    							this.btnOk.setStyle("z-index", 101001);
    							this.btnOk.addEvent("click", function() { this.hide(); window.open('https://bnpparibasnet.solution.weborama.fr/fcgi-bin/performance.fcgi?ID=144092&A=1&L=497535&C=7354&f=&P=15066&T=E&URL');}.bind(this));
    							
    							//Deplacer le bouton X à la bonne position
    							this.button.setStyle("left", (box.left + 626) + "px");

						    } else {
						    */
						      this.btnOk = new Element("div", { "id" : "msgBoxOk" });
    							this.btnOk.setStyle("top", (box.top + 97) + "px");
    							this.btnOk.setStyle("left", (box.left + 520) + "px");
    							this.btnOk.setStyle("z-index", 101001);
    							this.btnOk.set("text",LABEL["COMMON_OK"]);
    							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));
    					    /*
						    }
						    */
						    break;

						// confirmation
						case 2 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 400) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { obj.proceed(method); this.hide() }.bind(this));

							this.btnCancel = new Element("div", { "id" : "msgBoxCancel" });
							this.btnCancel.setStyle("top", (box.top + 97) + "px");
							this.btnCancel.setStyle("left", (box.left + 520) + "px");
							this.btnCancel.setStyle("z-index", 101011);
							this.btnCancel.set("text",LABEL["COMMON_CANCEL"]);
							this.btnCancel.addEvent("click", function() { this.hide() }.bind(this));

							$$("body")[0].adopt(this.btnCancel);

							break;

						// warning
						case 3 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

						/*  WARNING BIS  */
						case 4 :
							/* TITLE */
							this.title.setStyle("height", 35 +"px");
							this.title.setStyle("width", 98 +"%");
							this.title.setStyle("float", "left");
							this.title.setStyle("border", "none");
							this.title.setStyle("font-size", 18 +"px");
							this.title.setStyle("text-align", "center");
							this.title.setStyle("color", "#f1f1f1");
							this.title.setStyle("font-weight", "bold");
							this.title.setStyle("background-color", "#008DCF");
							this.title.set("text","INFORMATION");

							/* LABEL */
							this.label.setStyle("height", 40 +"px");
							this.label.setStyle("width", 98 +"%");
							this.label.setStyle("float", "left");
							this.label.setStyle("text-align", "center");
							this.label.setStyle("font-size", 14 +"px");
							this.label.setStyle("color", "#f1f1f1");
							this.label.setStyle("font-weight", "bold");
							this.label.setStyle("background-color", "#008DCF");

							/* ICON */
							this.icon.setStyle("float", "left");
							this.icon.setStyle("width", 0 +"px");

							/* BOX */
							this.box.setStyle("font-size", 16 +"px");
							this.box.setStyle("background-color", "#008DCF");
							this.box.setStyle("border", "#000 solid 1px");
							this.box.setStyle("padding", 2 +"px");
							this.box.setStyle("width", 630 +"px");
							this.box.setStyle("height", 110 +"px");
							this.box.setStyle("position", "absolute");

							/* BTN OK */
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							/*this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");*/
							this.btnOk.setStyle("height", 20 + "px");
							this.btnOk.setStyle("width", 69 + "px");
							this.btnOk.setStyle("background-color", "#000");
							this.btnOk.setStyle("color", "#fff");
							this.btnOk.setStyle("border", "#008DCF solid 3px");
							this.btnOk.setStyle("top", (box.top + box.height - 21) + "px");
							this.btnOk.setStyle("left", (box.left + box.width - 50) + "px");
							this.btnOk.setStyle("font-size", 16 + "px");
							this.btnOk.setStyle("font-weight", "bold");
							this.btnOk.setStyle("cursor", "pointer");
							this.btnOk.setStyle("position", "absolute");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));
							break;

						case 5 :
							/* TITLE */
							this.title.setStyle("height", 15 +"px");
							this.title.setStyle("width", 90 +"%");
							this.title.setStyle("float", "left");
							this.title.setStyle("border", "none");
							this.title.setStyle("font-size", 14 +"px");
							this.title.setStyle("text-align", "left");
							this.title.setStyle("padding", "4px");
							this.title.setStyle("color", "#fff");
							this.title.setStyle("font-weight", "bold");
							this.title.setStyle("background-color", "#008DCF");
							this.title.set("text","- ALERTE ! NE RATEZ PAS VOTRE BIEN");

							/* LABEL*/
							this.label.destroy();

							/* ICON */
							this.icon.setStyle("float", "left");
							this.icon.setStyle("width", 0 +"px");

							/* BOX */
							this.box.setStyle("font-size", 16 +"px");
							this.box.setStyle("background-color", "#EFEFEF");
							this.box.setStyle("border", "#008DCF solid 1px");
							this.box.setStyle("padding", 2 +"px");
							this.box.setStyle("width", 400 +"px");
							this.box.setStyle("height", 220 +"px");
							this.box.setStyle("position", "absolute");

							this.button.setStyle("left", (box.left + 390) + "px");

							this.ulFormulaire = new Element("ul").injectInside(this.box);
							this.ulFormulaire.setStyle("width",98+"%");
							this.ulFormulaire.setStyle("list-style","none");
							this.ulFormulaire.setStyle("float","left");

							// Accroche
                     this.accroche = new Element("label", { "id" : "accroche"}).injectInside(this.ulFormulaire);
                     this.accroche.setStyles({ "float" : "left", "text-align" : "left", "width" : "320px", "font-size" : "11px", "color" : "#000", "margin" : "10px 0 10px 30px", "font-weight" : "lighter" });
                     this.accroche.set('text',"Recevez automatiquement par e-mail tous les nouveaux biens correspondant à votre recherche immobilière.");

		          		//	this.inputEmail.setStyle("clear","left");
							this.limailFormulaire = new Element("li", { "id" : "limail" }).injectInside(this.ulFormulaire);
							this.limailFormulaire.setStyles({"margin" : "5px 0 2px 0", "width" : "270px", "float" : "left"});
							this.inputEmail = new Element("input", { "id" : "mail", "type" : "texte", "value" : "Votre email", "class" : "html-input-blue-155"}).injectInside(this.limailFormulaire);
							new agReset(this.inputEmail, "Votre email");
							this.inputEmail.setStyles({"background-color" : "#CCE8F5", "font-size" : "11px", "padding" : "2px", "margin" : "0 0 0 30px", "height" : "15px", "width" : "250px", "float" : "left", "font-weight" : "lighter"});

							/* BTN OK */
							this.btnOk = new Element("img", { "id" : "msgBoxOk"}).injectInside(this.box);
							this.btnOk.set("src", "http://mmf.logic-immo.com/mmf/fr/static/common/ok.gif");
							this.btnOk.setStyles({"height" : "25px", "width" : "35px", "border" : "0", "cursor" : "pointer", "background" : "transparent", "position" : "absolute"});
							this.btnOk.setStyle("top", (box.top + 76) + "px");
							this.btnOk.setStyle("left", (box.left + 300) + "px");
							this.btnOk.setStyle("z-index", 101001);
							/*this.btnOk.setStyle("background", "transparent");
							this.btnOk.setStyle("border", "0");
							this.btnOk.set("src", "http://mmf.logic-immo.com/mmf/fr/static/common/ok.gif");
							this.btnOk.setStyle("position", "absolute");*/

							// Inscription newsletter
							this.licheck2Formulaire = new Element("li", { "id" : "licheck2"}).injectInside(this.ulFormulaire);
							this.licheck2Formulaire.setStyles({"width" : "300px", "margin" : "0 0 0 30px", "padding" : "5px 5px", "background-color" : "#EFEFEF", "float" : "left"});
							this.inputCheck2 = new Element("input", { "id" : "checkmail2", "name" : "checkmail2", "type" : "checkbox", "value" : "1" }).injectInside(this.licheck2Formulaire);
							this.inputCheck2.setStyles({"float" : "left"});
							this.labelCheck2 = new Element("label",{"for" : "checkmail2"}).injectInside(this.licheck2Formulaire);
							this.labelCheck2.setStyles({ "float" : "left", "text-align" : "left", "width" : "270px", "font-size" : "11px", "cursor" : "pointer", "color" : "#3A8ECF", "margin" : "0 0 0 10px", "font-weight" : "lighter" });
							this.labelCheck2.set("text","Je m'inscris à la newsletter Logic-immo.com (prix de l'immo, guide pratique...)");

							// Partenaires
							this.licheck1Formulaire = new Element("li", { "id" : "licheck1"}).injectInside(this.ulFormulaire);
							this.licheck1Formulaire.setStyles({"width" : "300px", "margin" : "0 0 0 30px", "padding" : "5px 5px", "background-color" : "#EFEFEF", "float" : "left"});
							this.inputCheck1 = new Element("input", { "id" : "checkmail1", "name" : "checkmail1", "type" : "checkbox", "value" : "1"}).injectInside(this.licheck1Formulaire);
							this.inputCheck1.setStyles({"float" : "left"});
							this.labelCheck1 = new Element("label",{"for" : "checkmail1"}).injectInside(this.licheck1Formulaire);
							this.labelCheck1.setStyles({ "float" : "left", "text-align" : "left", "width" : "270px", "font-size" : "11px", "cursor" : "pointer", "color" : "#3A8ECF", "margin" : "0 0 0 10px", "font-weight" : "lighter" });
							this.labelCheck1.set("text","Je souhaite recevoir les offres commerciales des partenaires et des agences clientes de Logic-immo.com");


							// Mentions légales
                     this.mentions = new Element("label", { "id" : "div_cnil"}).injectInside(this.ulFormulaire);
                     this.mentions.setStyles({ "float" : "left", "text-align" : "left", "width" : "320px", "font-size" : "11px", "color" : "#000", "margin" : "2px 0 10px 30px", "font-weight" : "lighter" });
                     this.mentions.set('text',"Logic-immo s'engage sur la protection de vos données personelles en respect de la ");

                     // CNIL
                     this.cnil = new Element("a", { "id" : "link_cnil", "target" : "_blank", "href" : "http://www.logic-immo.com/conditions-generales-d-utilisation.html#protection"}).injectInside(this.mentions);
                     this.cnil.setStyles({"font-size" : "11px", "color" : "#000", "font-style" : "italic", "text-decoration" :"underline", "font-weight" : "lighter"});
                     this.cnil.set('text', "CNIL");

							this.btnOk.addEvent("click", function() {
								if(check_eml($('mail').value)){

									if($('checkmail1').checked==true){
										tempCheckBoxProm = '&alertProm=' + encodeURIComponent($('checkmail1').value);
									}else tempCheckBoxProm = '';

									if($('checkmail2').checked==true){
										tempCheckBoxNews = '&alertNews=' + encodeURIComponent($('checkmail2').value);
									}else tempCheckBoxNews = '';

									var chaine =  'alertMail=' + encodeURIComponent($('mail').value)
												+ tempCheckBoxProm + tempCheckBoxNews
												+ '&alertFreq=' + encodeURIComponent($('alertFreq24').value)
												+ '&site=' + encodeURIComponent($('site').value)
												+ '&lang=' + encodeURIComponent($('lang').value)
												+ '&univers=' + encodeURIComponent($('univers').value)
												+ '&uri=' + encodeURIComponent($('uri').value)
												+ '&filesearch=' + encodeURIComponent($('filesearch').value)
												+ '&from_the_page=' + encodeURIComponent($('from_the_page').value)
												+ '&locname=' + encodeURIComponent($('locname').value)
												+ '&gdmAlerteEtape1=true';

									var boxAlertMail = this;

									var mail_value  = $('mail').value;

									//envoi formulaire en POST
									new Request({
										url: "/alerte_email_confirmation.php",
										method: 'post',
										onSuccess:
											function(data){
												
												    if (obj == 1) {
												    	xt_med('F', '19', 'Inscription_alertes::Inscription_alertes_haut_lst_results');
												    }else {
												    	xt_med('F', '19', 'Inscription_alertes::Inscription_alertes_bas_lst_results');
												    }
												    
												    xitiLabelNewletter = (obj == 1) ? 'Inscription_newsletter_haut_lst_results' : 'Inscription_newsletter_bas_lst_results';
													xitiLabelPartner = (obj == 1) ? 'Inscription_OptIn_Part_haut_lst_results' : 'Inscription_OptIn_Part_bas_lst_results';
												    if($('checkmail1').checked==true){
														xt_med('F', '19', 'Inscription_OptIn_Partenaires::'+xitiLabelPartner);
												    }
				
													if($('checkmail2').checked==true){
														xt_med('F', '19', 'Inscription_newsletter::'+xitiLabelNewletter);
													}
												    
													boxAlertMail.hide();
												//	boxAlertMail.overlay = new Overlay();
												//	boxAlertMail.show(data,7,obj);
												    var s_params = ReadCookie("s_params");

												    popup_multi_contact_agency_interstitiel(s_params, data, obj, mail_value);

													$('alert_email_middle_block').dispose();
												//	$('alert_email_middle_block').set('html',data);
													$('alert_email_middle_block2').dispose();
											}

									}).send(chaine);
								}
								else{
									if(!$("pError")){
										this.mailError = new Element("p",{"id" : "pError"}).injectInside(this.box);
										this.mailError.setStyles({"position" : "absolute","top" : "65px", "height" : "20px", "clear" : "left", "text-align" : "left", "width" : "300px", "margin" : "0 0 0 30px", "color" : "red", "font-size" : "11px"});
										this.mailError.set("text","> Merci de saisir un email valide.");
									}
								}
							}.bind(this));


						break;

						case 6 :
							/* TITLE */
							this.title.setStyle("height", 15 +"px");
							this.title.setStyle("width", 90 +"%");
							this.title.setStyle("float", "left");
							this.title.setStyle("border", "none");
							this.title.setStyle("font-size", 14 +"px");
							this.title.setStyle("text-align", "left");
							this.title.setStyle("padding", "4px");
							this.title.setStyle("color", "#f1f1f1");
							this.title.setStyle("font-weight", "bold");
							this.title.setStyle("background-color", "#008DCF");
							this.title.set("text",title);

							/* LABEL*/
							this.label.destroy();

							/* ICON */
							this.icon.setStyle("float", "left");
							this.icon.setStyle("width", 0 +"px");

							/* BOX */
							this.box.setStyle("font-size", 16 +"px");
							this.box.setStyle("background-color", "#EFEFEF");
							this.box.setStyle("border", "#008DCF solid 1px");
							this.box.setStyle("padding", 2 +"px");
							this.box.setStyle("width", 500 +"px");
							this.box.setStyle("height", 300 +"px");
							this.box.setStyle("position", "absolute");

							this.button.setStyle("left", (box.left + 490) + "px");
							/* BTN OK */
							this.btnOk = new Element("img", { "id" : "msgBoxOk", "onclick" : "xt_med('C','1','alerte_pr_interstitiel_ic"+obj+"','N')" }).injectInside(this.box);
							this.btnOk.setStyle("height", 25 + "px");
							this.btnOk.setStyle("width", 35 + "px");
							this.btnOk.setStyle("top", (box.top + 250) + "px");
							this.btnOk.setStyle("left", (box.left + (box.width/2) - 105) + "px");
							this.btnOk.setStyle("background", "transparent");
							this.btnOk.setStyle("border", "0");
							this.btnOk.set("src", "http://mmf.logic-immo.com/mmf/fr/static/common/ok.gif");
							this.btnOk.setStyle("cursor", "pointer");
							this.btnOk.setStyle("position", "absolute");
							this.btnOk.setStyle("z-index", 101001);

							this.ulFormulaire = new Element("ul").injectInside(this.box);
							this.ulFormulaire.setStyle("width",98+"%");
							this.ulFormulaire.setStyle("list-style","none");
							this.ulFormulaire.setStyle("float","left");

							this.limailFormulaire = new Element("li", { "id" : "limail"}).injectInside(this.ulFormulaire);
							this.limailFormulaire.setStyles({"margin" : "20px 0 2px 0", "float" : "left"});
							this.txtAlert = new Element("p").injectInside(this.limailFormulaire);
							this.txtAlert.setStyles({"text-align" : "left", "font-weight" : "bold", "width" : "430px", "margin" : "0 0 0 30px", "font-size" : "11px"});
							var tabLabel = label.split('-'); //On récupère le retour de l'enregistrement gdm(tabLabel[0]) et la chaine à afficher(tabLabel[1]) dans la seconde fenêtre

							if(tabLabel[1]=='OK'){
								var tabRequestId = tabLabel[0].split('='); //On récupère le type(tabRequestId[0]) et le request_id(tabRequestId[1])
								this.txtAlert.set("html",tabLabel[2]+altfarm_aei_subscription);

								this.licheck1Formulaire = new Element("li", { "id" : "licheck1"}).injectInside(this.ulFormulaire);
								this.licheck1Formulaire.setStyles({"width" : "300px", "margin" : "6px 0 0 50px", "padding" : "1px 5px", "float" : "left"});
								//this.licheck1Formulaire.set("html",'<label for="civilite" style="">Civilité</label><select id="civilite" class="html-input-blue-155"><option value="Madame" selected="selected>Madame</option></select>');
								this.label1 = new Element("label",{"for" : "civilite"}).injectInside(this.licheck1Formulaire);
								this.label1.setStyles({ "float" : "left", "text-align" : "left", "width" : "70px", "font-size" : "11px", "cursor" : "pointer", "color" : "#3A8ECF", "margin" : "8px 0 0 10px" });
								this.label1.set("text","Civilité");
								this.input1 = new Element("select", { "id" : "civilite", "name" : "civilite","value" : "Madame" }).injectInside(this.licheck1Formulaire);
								this.input1.setStyles({"float" : "left", "width" : "165px", "heigth" : "14px", "background-color" : "#CCE8F5", "padding" : "2px", "border" :"#CCE8F5 solid 2px", "margin" : "5px 0 0 0", "font-size" : "11px"});
								this.opt1 = new Element("option", { "value" : "Mme", "selected" : "selected" }).injectInside(this.input1);
								this.opt1.set("text","Madame");
								this.opt2 = new Element("option", { "value" : "Mlle" }).injectInside(this.input1);
								this.opt2.set("text","Mademoiselle");
								this.opt3 = new Element("option", { "value" : "Mr" }).injectInside(this.input1);
								this.opt3.set("text","Monsieur");

								this.licheck2Formulaire = new Element("li", { "id" : "licheck2"}).injectInside(this.ulFormulaire);
								this.licheck2Formulaire.setStyles({"width" : "300px", "margin" : "0 0 0 50px", "padding" : "1px 5px", "float" : "left"});
								this.label2 = new Element("label",{"for" : "nom"}).injectInside(this.licheck2Formulaire);
								this.label2.setStyles({ "float" : "left", "text-align" : "left", "width" : "70px", "font-size" : "11px", "cursor" : "pointer", "color" : "#3A8ECF", "margin" : "8px 0 0 10px" });
								this.label2.set("text","Nom");
								this.input2 = new Element("input", { "id" : "nom", "type" : "texte", "value" : "Nom", "class" : "html-input-blue-155" }).injectInside(this.licheck2Formulaire);
								this.input2.setStyles({"float" : "left"});
								new agReset(this.input2, "Nom");
								this.input2.setStyles({"background-color" : "#CCE8F5", "font-size" : "11px"});

								this.licheck3Formulaire = new Element("li", { "id" : "licheck2"}).injectInside(this.ulFormulaire);
								this.licheck3Formulaire.setStyles({"width" : "300px", "margin" : "0 0 0 50px", "padding" : "1px 5px", "float" : "left"});
								this.label3 = new Element("label",{"for" : "prenom"}).injectInside(this.licheck3Formulaire);
								this.label3.setStyles({ "float" : "left", "text-align" : "left", "width" : "70px", "font-size" : "11px", "cursor" : "pointer", "color" : "#3A8ECF", "margin" : "8px 0 0 10px" });
								this.label3.set("text","Prénom");
								this.input3 = new Element("input", { "id" : "prenom", "type" : "texte", "value" : "Prénom", "class" : "html-input-blue-155" }).injectInside(this.licheck3Formulaire);
								this.input3.setStyles({"float" : "left"});
								new agReset(this.input3, "Prénom");
								this.input3.setStyles({"background-color" : "#CCE8F5", "font-size" : "11px"});

								this.licheck4Formulaire = new Element("li", { "id" : "licheck2"}).injectInside(this.ulFormulaire);
								this.licheck4Formulaire.setStyles({"width" : "300px", "margin" : "0 0 0 50px", "padding" : "1px 5px", "float" : "left"});
								this.label4 = new Element("label",{"for" : "tel"}).injectInside(this.licheck4Formulaire);
								this.label4.setStyles({ "float" : "left", "text-align" : "left", "width" : "70px", "font-size" : "11px", "cursor" : "pointer", "color" : "#3A8ECF", "margin" : "8px 0 0 10px" });
								this.label4.set("text","Téléphone");
								this.input4 = new Element("input", { "id" : "tel", "type" : "texte", "value" : "Téléphone", "class" : "html-input-blue-155" }).injectInside(this.licheck4Formulaire);
								this.input4.setStyles({"float" : "left"});
								new agReset(this.input4, "Téléphone");
								this.input4.setStyles({"background-color" : "#CCE8F5", "font-size" : "11px"});

								this.btnOk.addEvent("click", function() {
									var chaine =  'civilite=' + encodeURIComponent($('civilite').value)
													+ '&nom=' + encodeURIComponent($('nom').value)
													+ '&prenom=' + encodeURIComponent($('prenom').value)
													+ '&tel=' + encodeURIComponent($('tel').value)
													+ '&requestId=' + tabRequestId[1]
													+ '&gdmAlerteEtape2=true';

									new Request({
										url: "/alerte_email_confirmation.php",
										method: 'post'
									}).send(chaine);
									this.hide();
								}.bind(this));
							}
							else{
								this.txtAlert.set("html","Cher internaute, nous n'avons malheureusement pas pu donner suite à votre demande. Veuillez essayer ultérieurement");
									this.btnOk.addEvent("click", function() {
										this.hide();
									}.bind(this));
							}
						break;



						//Special Action
						//Creer pour récuperer un ID spécifique sur le BT OK pour interragir avec d'autre éléments ou objet en amont
						case 11 :
							this.btnOk = new Element("div", { "id" : "msgBoxOkOpt" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));
							break;

						// alerte-email
						case 12 :
						   /*
							if (_univ == 1) {
							   
    						   this.btnOk = new Element("img", { "id" : "msgBoxOk"});
    							this.btnOk.set('src', _urlmmf+'static/BNP/bouton-demandePret.jpg');
    							this.btnOk.set('alt', 'Faîtes une demande de prêt');
    							this.btnOk.set('title', 'Faîtes une demande de prêt');
    							this.btnOk.setStyle("top", (box.top + 262) + "px");
    							this.btnOk.setStyle("left", (box.left + 230) + "px");
    							this.btnOk.setStyle("width", "212px");
    							this.btnOk.setStyle("height", "38px");
    							this.btnOk.setStyle("padding", "0px");
    							this.btnOk.setStyle("border", "0px");
    							this.btnOk.setStyle("z-index", 101001);
    							this.btnOk.addEvent("click", function() { this.hide(); window.open('https://bnpparibasnet.solution.weborama.fr/fcgi-bin/performance.fcgi?ID=144092&A=1&L=497533&C=7354&f=&P=15066&T=E&URL');}.bind(this));
    							
    							//Deplacer le bouton X à la bonne position
    							this.button.setStyle("left", (box.left + 646) + "px");
    							
							} else {
							*/
						   /*
						      // Ce bouton ne fonctionne pas sous IE => désactivé
							   this.btnOk = new Element("div", { "id" : "msgBoxOk" });
                        //this.btnOk.setStyle("top", (box.top + 218) + "px");
                        //this.btnOk.setStyle("left", (box.left + 530) + "px");
                        this.btnOk.setStyle("top", (box.top + 258) + "px");
                        this.btnOk.setStyle("left", (box.left + 510) + "px");
							   this.btnOk.setStyle("text-align", "center");
                        this.btnOk.setStyle("z-index", 101001);
                        this.btnOk.set("text",LABEL["COMMON_OK"]);
                        this.btnOk.set("onclick", "window.parent.location.reload();");
                        //this.btnOk.addEvent("click", function() { this.hide(); }.bind(this));
                     */
                     /*
							}
							*/
							break;

						case 13:
							// Deplacer le bouton X à la bonne position
							this.button.setStyle("left", (box.left + 646) + "px");
							break;
				    }

				}
				this.effect = new Fx.Tween(this.box).set("opacity",1);
				this.effect.start(0, 1);

				this.overlay.show();
                
				$$("body")[0].adopt(this.box);
				$$("body")[0].adopt(this.btnOk);
				$$("body")[0].adopt(this.button);
			},

		show2:
			function(label, mode, obj, method, h)
			{
				if (this.overlay.open == true)
				{
					return;
				}

				switch (mode)
				{
					// information
					case 1 :
						title = LABEL["COMMON_INFORMATION"];

						break;

					// confirmation
					case 2 :
						title = LABEL["COMMON_CONFIRMATION"];

						break;

					// warning
					case 3 :
						title = LABEL["COMMON_WARNING"];

						break;

					//default
					default :
						title = LABEL["COMMON_INFORMATION"];

						break;
				}

				var box = this.getDimensions();

				if (this.moduleSize == "S")
				{

					this.box = new Element("div", { "id" : "msgBox" });
					this.box.setStyle("height", h + "px");
					this.box.setStyle("width", box.width + "px");
					this.box.setStyle("top", box.top + "px");
					this.box.setStyle("left", box.left + "px");
					this.box.setStyle("z-index", 101000);

					this.icon = new Element("div", { "id" : "msgBoxIcon" + mode }).injectInside(this.box);
					this.icon.setStyle("height", box.height + "px");
					this.icon.setStyle("width", 80 + "px");
					this.icon.setStyle("z-index", 101000);

					this.title = new Element("div", { "id" : "msgBoxTitle"}).injectInside(this.box);
					this.title.setStyle("height", 20 + "px");
					//this.title.setStyle("width", 520 + "px");
					this.title.setStyle("width", 400 + "px");
					this.title.setStyle("z-index", 101000);
					this.title.set("html",title);

					this.label = new Element("div", { "id" : "msgBoxLabel"}).injectInside(this.box);
					this.label.setStyle("height", 70 + "px");
					//this.label.setStyle("width", 520 + "px");
					this.label.setStyle("width", 400 + "px");
					this.label.setStyle("z-index", 101000);
					this.label.set("html",label);

					this.button = new Element("div", { "id" : "msgBoxButton" });
					this.button.setStyle("top", (box.top - 6) + "px");
					this.button.setStyle("left", (box.left + 522) + "px");
					this.button.setStyle("z-index", 101001);
					this.button.addEvent("click", this.hide.bind(this));

					switch (mode)
					{
						// information
						case 1 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 420) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

						// confirmation
						case 2 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 300) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { obj.proceed(method); this.hide() }.bind(this));

							this.btnCancel = new Element("div", { "id" : "msgBoxCancel" });
							this.btnCancel.setStyle("top", (box.top + 97) + "px");
							this.btnCancel.setStyle("left", (box.left + 420) + "px");
							this.btnCancel.setStyle("z-index", 101001);
							this.btnCancel.set("text",LABEL["COMMON_CANCEL"]);
							this.btnCancel.addEvent("click", function() { this.hide() }.bind(this));

							$$("body")[0].adopt(this.btnCancel);

							break;

						// warning
						case 3 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 420) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

						//Special Action
						//Creer pour récuperer un ID spécifique sur le BT OK pour interragir avec d'autre éléments ou objet en amont
						case 11 :
							this.btnOk = new Element("div", { "id" : "msgBoxOkOpt" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 420) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

					}
				}
				else if(this.moduleSize=='P') {
					this.box = new Element("div", { "id" : "msgBox" });
					this.box.setStyle("height", h + "px");
					this.box.setStyle("width", 538 + "px");
					this.box.setStyle("top", 80 + "px");
					this.box.setStyle("left", 20 + "px");
					this.box.setStyle("z-index", 101001);

					this.icon = new Element("div", { "id" : "msgBoxIcon" + mode }).injectInside(this.box);
					this.icon.setStyle("height", box.height + "px");
					this.icon.setStyle("width", 80 + "px");
					this.icon.setStyle("z-index", 101001);

					this.title = new Element("div", { "id" : "msgBoxTitle"}).injectInside(this.box);
					this.title.setStyle("height", 20 + "px");
					this.title.setStyle("width", 400 + "px");
					this.title.setStyle("z-index", 101001);
					this.title.setStyle("float", 'left');
					this.title.set("html",title);

					this.label = new Element("div", { "id" : "msgBoxLabel"}).injectInside(this.box);
					this.label.setStyle("height", 70 + "%");
					this.label.setStyle("width", 400 + "px");
					this.label.setStyle("z-index", 101001);
					this.label.setStyle("float", 'left');
					this.label.set("html",label);

					this.button = new Element("div", { "id" : "msgBoxButton" });
					this.button.setStyle("top", 67 + "px");
					this.button.setStyle("left", 585 + "px");
					this.button.setStyle("z-index", 101001);
					this.button.addEvent("click", this.hide.bind(this));

					switch (mode)
					{
						// information
						case 1 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

						// confirmation
						case 2 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 400) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { obj.proceed(method); this.hide() }.bind(this));

							this.btnCancel = new Element("div", { "id" : "msgBoxCancel" });
							this.btnCancel.setStyle("top", (box.top + 97) + "px");
							this.btnCancel.setStyle("left", (box.left + 520) + "px");
							this.btnCancel.setStyle("z-index", 101011);
							this.btnCancel.set("text",LABEL["COMMON_CANCEL"]);
							this.btnCancel.addEvent("click", function() { this.hide() }.bind(this));

							$$("body")[0].adopt(this.btnCancel);

							break;

						// warning
						case 3 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;


						//Special Action
						//Creer pour récuperer un ID spécifique sur le BT OK pour interragir avec d'autre éléments ou objet en amont
						case 11 :
							this.btnOk = new Element("div", { "id" : "msgBoxOkOpt" });
							this.btnOk.setStyle("top", 230 + "px");
							this.btnOk.setStyle("left", 485 + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

					}
				}
				else
				{
					this.box = new Element("div", { "id" : "msgBox" });
					this.box.setStyle("height", h + "px");
					this.box.setStyle("width", box.width + "px");
					this.box.setStyle("top", box.top + "px");
					this.box.setStyle("left", box.left + "px");
					this.box.setStyle("z-index", 101001);

					this.icon = new Element("div", { "id" : "msgBoxIcon" + mode }).injectInside(this.box);
					this.icon.setStyle("height", box.height + "px");
					this.icon.setStyle("width", 80 + "px");
					this.icon.setStyle("z-index", 101001);

					this.title = new Element("div", { "id" : "msgBoxTitle"}).injectInside(this.box);
					this.title.setStyle("height", 20 + "px");
					this.title.setStyle("width", 520 + "px");
					this.title.setStyle("z-index", 101001);
					this.title.set("html",title);

					this.label = new Element("div", { "id" : "msgBoxLabel"}).injectInside(this.box);
					this.label.setStyle("height", "70%");
					this.label.setStyle("width", 520 + "px");
					this.label.setStyle("z-index", 101001);
					this.label.set("html",label);

					this.button = new Element("div", { "id" : "msgBoxButton" });
					this.button.setStyle("top", (box.top - 6) + "px");
					this.button.setStyle("left", (box.left + 622) + "px");
					this.button.setStyle("z-index", 101001);
					this.button.addEvent("click", this.hide.bind(this));

					switch (mode)
					{
						// information
						case 1 :
						   /*
							this.btnOk = new Element("img", { "id" : "msgBoxOk"});
							this.btnOk.set('src', _urlmmf+'static/BNP/bouton-demandePret.jpg');
							this.btnOk.set('alt', 'Faîtes une demande de prêt');
							this.btnOk.set('title', 'Faîtes une demande de prêt');
							this.btnOk.setStyle("top", (box.top + 134) + "px");
							this.btnOk.setStyle("left", (box.left + 230) + "px");
							this.btnOk.setStyle("width", "212px");
							this.btnOk.setStyle("height", "38px");
							this.btnOk.setStyle("padding", "0px");
							this.btnOk.setStyle("border", "0px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.addEvent("click", function() { this.hide(); window.open('https://bnpparibasnet.solution.weborama.fr/fcgi-bin/performance.fcgi?ID=144092&A=1&L=497534&C=7354&f=&P=15066&T=E&URL');}.bind(this));
							
							//Deplacer le bouton X à la bonne position
							this.button.setStyle("left", (box.left + 626) + "px");
							*/
						   
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));
						   
							break;

						// confirmation
						case 2 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 400) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { obj.proceed(method); this.hide() }.bind(this));

							this.btnCancel = new Element("div", { "id" : "msgBoxCancel" });
							this.btnCancel.setStyle("top", (box.top + 97) + "px");
							this.btnCancel.setStyle("left", (box.left + 520) + "px");
							this.btnCancel.setStyle("z-index", 101011);
							this.btnCancel.set("text",LABEL["COMMON_CANCEL"]);
							this.btnCancel.addEvent("click", function() { this.hide() }.bind(this));

							$$("body")[0].adopt(this.btnCancel);

							break;

						// warning
						case 3 :
							this.btnOk = new Element("div", { "id" : "msgBoxOk" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;


						//Special Action
						//Creer pour récuperer un ID spécifique sur le BT OK pour interragir avec d'autre éléments ou objet en amont
						case 11 :
							this.btnOk = new Element("div", { "id" : "msgBoxOkOpt" });
							this.btnOk.setStyle("top", (box.top + 97) + "px");
							this.btnOk.setStyle("left", (box.left + 520) + "px");
							this.btnOk.setStyle("z-index", 101001);
							this.btnOk.set("text",LABEL["COMMON_OK"]);
							this.btnOk.addEvent("click", function() { this.hide() }.bind(this));

							break;

					}
				}
				this.effect = new Fx.Tween(this.box).set("opacity",1);
				this.effect.start(0, 1);

				this.overlay.show();

				$$("body")[0].adopt(this.box);
				$$("body")[0].adopt(this.btnOk);
				$$("body")[0].adopt(this.button);
			},

		hide:
			function(mode)
			{
					this.overlay.hide();
               $("OverlayContainer").style.display = 'none';

					this.effect.start(1, 0);

					if ($("msgBox"))
					{
					    this.box.dispose();
						//$("msgBox").dispose();
					}

					if ($("msgBoxButton"))
					{
						this.button.dispose();
					    //$("msgBoxButton").dispose();
					}

					if ($("msgBoxOk"))
					{
					    this.btnOk.dispose();
						//$("msgBoxOk").dispose();
					}

					if ($("msgBoxOkOpt"))
					{
						$("msgBoxOkOpt").dispose();
					}

					if ($("msgBoxCancel"))
					{
					    this.btnCancel.dispose();
						//$("msgBoxCancel").dispose();
					}
			}
	});

// global
var myMsgBox = "";

// loader
window.addEvent("domready",
	function()
	{
		myMsgBox = new agMsgBox;
	}
);

