function ajaxLogin(url) { 
	if($("j_username").value == '' || $("j_password").value == ''){
		Element.update('bad_credential', 'Login/Mdp manquant');
		Element.show('bad_credential'); 
	 }else{
	 	Element.update('bad_credential', 'V&eacute;rification ...'); 
	    Element.show('bad_credential'); 
	    
	    var opt = { 
	        method: 'post', 
	        postBody: Form.serialize($('loginForm')) + '&'+'ajax=true', 
	        onSuccess: function(response) { 
	            var msg = response.responseText; 
	            
	            if ("error:" == msg.substr(0, 6)) { 
	                Element.update('bad_credential', '<'+'font color="red"'+'>'+'Identifiants incorrects' + '<'+'/font>'); 
	            } else if ("url:" == msg.substr(0, 4)) { 
			jar = new CookieJar({
				expires:315360000,
				path:'/'
	
			});

			elmts = {pseudo: $("j_username").value, password: $("j_password").value};
			jar.put('RED20_autologin', elmts);

	            	location.href = msg.substring(4, msg.length); 
	            } else if ("message:" == msg.substr(0, 8)) { 
	                Element.update('bad_credential', 'Identifiants incorrects'); 
	            } 
	        } 
	    } 
		new Ajax.Request(url, opt);  
	 }
}

