 $(document).ready(function(){
	//On remplace le formulaire
	if ($('#extranetForm').length) {
		if ($('#extranetForm').hasClass('anglais')) {
			$('#extranetForm').html('<p><label for="leuser">Name</label> <input type="text" name="leuser" id="leuser"  /></p><p><label for="lepassword">Password</label> <input type="password" name="lepassword" id="lepassword"  /></p><p><label for="extranet">Extranet</label> <select id="extranetSelect"><option value="1">Mica Capital</option><option value="2">Mica services financiers</option></select></p><p><input type="hidden" name="logg" value="Submit" /><input type="button" value="Open your session" onclick="submitForm();" /></p>');
		} else {
			$('#extranetForm').html('<p><label for="leuser">Nom d’usager</label> <input type="text" name="leuser" id="leuser"  /></p><p><label for="lepassword">Mot de passe</label> <input type="password" name="lepassword" id="lepassword"  /></p><p><label for="extranet">Extranet</label> <select id="extranetSelect"><option value="1">Mica Capital</option><option value="2">Mica services financiers</option></select></p><p><input type="hidden" name="logg" value="Soumettre" /><input type="button" value="Ouvrez votre session" onclick="submitForm();" /></p>');
		};
	};
})

function submitForm() {
	var myExtranet = parseInt($('#extranetSelect').val());
	var url = "";
	
	switch(myExtranet) {
		case 1:
			url = "http://www.micasf.com/reps/login.php";
			break;
		case 2:
			url = "http://www.micasf.com/conseillers/login.php";
			break;
	}
	
	$('#extranetForm').attr('action',url);
	$('#extranetForm').attr('onsubmit','');
	
	$("#extranetForm").submit();
}