/**
* index
*/

	function login(param, target) {
	    var req = new JsHttpRequest();
	    req.onreadystatechange = function() {
	        if (req.readyState == 4) {
		        if ((response=req.responseJS)) {
							if (response.logged=='1'&& response.reload=='1') {
								if (target=='' || target==null) {
									target='/index.php';
								}
								window.location=target;
							}
							setValue('challenge', response.challenge);	//hidden
							if (response.message) {
								messagePopupId(
									'Login:'+getValue("username")+"<br />"+
									'Mot de passe:'+getValue("passwd")+"<br />"+
									response.message, 'loginForm', 1, 1, 5000);
							}
						}
						setHTML('debug',req.responseText);
	        }
	    }

	   	var r = MD5(getValue("username").toUpperCase()+":"+getValue("passwd")+":"+getValue("challenge"));
		setValue("passwd", '');
	    req.open(null, '/weblib/php/login_ajax.php'+'?response='+r+(param==null?'':'&'+param), true);
	    req.send( { q: getObject('loginForm') } );

	}

