	window.onload = function() {	
		document.getElementById("select_input2").value == "2";
		document.getElementById("formcontact_utilisateur_nom").value == "";
		document.getElementById("formcontact_utilisateur_prenom").value == "";
		document.getElementById("formcontact_utilisateur_email").value == "";
		document.getElementById("select_input3").value == "";
		document.getElementById("formcontact_utilisateur_telephone").value == "";
		document.getElementById("formcontact_utilisateur_adresse").value == "";
		document.getElementById("formcontact_utilisateur_codepostal").value == "";
		document.getElementById("formcontact_utilisateur_ville").value == "";
	}

	var _XMLconn = 0;
	
	function show_form(type, top){
		hide_form();
		document.getElementById("div_contenu_speed_contact").className = "contenu_speed_"+type;
		document.getElementById("div_contenu_speed_contact").style.top = top+"px";
		document.getElementById("speed_"+type+"_intro").className = "texte";
		if(type == "simu"){
			xt_med('F','11','FORMULAIRE::FINANCEMENT_CAPACITE_EMPRUNT');
			document.getElementById("valider_rdv_ajax").innerHTML = "<input type='submit' class='bt_valider' name='valider_rdv' id='valider_rdv' value=''/>";
		}
		document.getElementById("speed_contact").className = "popinhome_designer";
		document.getElementById('dimmer').style.visibility = "visible";
		document.getElementById('dimmer').style.height = "1400px";
		
		//désactiver le filtre de #global
		document.getElementById('global').style.zIndex = "0";
		document.getElementById('global').style.position = "static";
		hideFlash();
	}
	
	function hide_form(){
		document.getElementById('dimmer').style.visibility = "hidden";
		document.getElementById("speed_contact").className = "invisible";
		document.getElementById("speed_simu_intro").className = "invisible";
		
		//réactiver le filtre de #global
		document.getElementById('global').style.zIndex = "10";
		document.getElementById('global').style.position = "relative";
		showFlash();
	}
	
	function go_Simulation(top){
		show_form("simu", top);
	}
	
	function test_confirmation(XMLconn){
		if(typeof XMLconn == "object"){
			_XMLconn = XMLconn;
		}else{
			if(typeof _XMLconn == "object"){
				hide_form();
			}
		}
		
		if(typeof _XMLconn == "object"){
			_XMLconn = 0;
		}
	}
	
	function valid_form (p_prg_id, p_fil_id){
		var _form_err;
		
		_form_err = "";
		if(document.getElementById("img_utilisateur_nom").src.indexOf("form_valide") < 0 && document.getElementById("formcontact_utilisateur_nom").value.length > 1){
			check_form_alpha('utilisateur_nom');check_form_alpha('utilisateur_prenom');check_form_telephone('utilisateur_telephone');check_form_alpha_num('utilisateur_adresse');
			check_form_email('utilisateur_email');check_form_alpha_num('utilisateur_codepostal');check_form_alpha('utilisateur_ville');
		}

		if(document.getElementById("img_utilisateur_prenom").src.indexOf("form_valide") < 0){
			_form_err += "- Prénom invalide\n";
		}
		if(document.getElementById("img_utilisateur_email").src.indexOf("form_valide") < 0){
			_form_err += "- Email invalide\n";
		}
		if(document.getElementById("img_utilisateur_telephone").src.indexOf("form_valide") < 0){
			_form_err += "- Téléphone invalide\n";
		}
		if(document.getElementById("img_utilisateur_adresse").src.indexOf("form_valide") < 0){
			_form_err += "- Adresse invalide\n";
		}
		if(document.getElementById("img_utilisateur_codepostal").src.indexOf("form_valide") < 0){
			_form_err += "- Code postal invalide\n";
		}
		if(document.getElementById("img_utilisateur_ville").src.indexOf("form_valide") < 0){
			_form_err += "- Ville invalide\n";
		}
		
		if( (document.getElementById("formcontact_optin_partenaire1").checked == false) && (document.getElementById("formcontact_optin_partenaire2").checked == false) ){
			_form_err += "- Offres de nos partenaires (oui/non)\n";
		}
		
		
		if(_form_err != ""){
			alert("Des problèmes ont été rencontrés :\n\n" + _form_err);
		} else {
			if(document.getElementById("speed_simu_intro").className == "invisible"){
				document.getElementById("valider_rdv_ajax").innerHTML = "<img src='/skins/fr/img/commun/form-ajax-loader.gif' alt='Vérification des données' />";
				comXhrObj1 = new XHRConnection();
				// Données à transmettre
				comXhrObj1.appendData('formcontact_utilisateur_civilite', document.getElementById("select_input2").value);
				comXhrObj1.appendData('formcontact_utilisateur_nom', document.getElementById("formcontact_utilisateur_nom").value);
				comXhrObj1.appendData('formcontact_utilisateur_prenom', document.getElementById("formcontact_utilisateur_prenom").value);
				comXhrObj1.appendData('formcontact_utilisateur_email', document.getElementById("formcontact_utilisateur_email").value);
				comXhrObj1.appendData('formcontact_pay_id', document.getElementById("select_input3").value);
				comXhrObj1.appendData('formcontact_utilisateur_telephone', document.getElementById("formcontact_utilisateur_telephone").value);
				comXhrObj1.appendData('formcontact_utilisateur_adresse', document.getElementById("formcontact_utilisateur_adresse").value);
				comXhrObj1.appendData('formcontact_utilisateur_codepostal', document.getElementById("formcontact_utilisateur_codepostal").value);
				comXhrObj1.appendData('formcontact_utilisateur_ville', document.getElementById("formcontact_utilisateur_ville").value);
				if( (document.getElementById("formcontact_optin_partenaire1").checked == true)) {
					comXhrObj1.appendData('formcontact_optin_partenaire', 'oui');
				} else {
					comXhrObj1.appendData('formcontact_optin_partenaire', 'non');
				}
				comXhrObj1.appendData('formcontact_priorite', 1);
				//Lancement
				comXhrObj1.sendAndLoad("/contact/demande_infos/"+p_prg_id+"_"+p_fil_id+".php", "POST", test_confirmation);
			} else {
				xt_med('F','11','CONFIRMATION::FINANCEMENT_CAPACITE_EMPRUNT');
				window.open("http://www.solutionscles.com/credit/outils/emprunt.html?xtor=AL-2");
				return true;
			}
		}
		
		return false;
	}
	
