function Authenticate()
{
	//var loc = $('input#loc').val();
	var hexkey = $('input#hexk').val();
	var login = $('input#email_login').val();
	var pwd = $('input#pwd_login').val();
	if(login!='' && pwd!='')
	{
		//login = login.replace(/@/,':');
		var deslogin = des(hexToString(hexkey),login,1,0,null);
		var despwd = des(hexToString(hexkey),pwd,1,0,null);
		
		var hexlogin = stringToHex(deslogin);
		var hexpwd = stringToHex(despwd);
		/*
		$('form#login div.connection_response').empty();
		$('form#login div.connection_response').append('<div>login = '+login+'<br />pwd = '+pwd+'</div>');
		$('form#login div.connection_response').append('<div>deslogin = '+deslogin+'<br />despwd = '+despwd+'</div>');
		$('form#login div.connection_response').append('<div>hexc_login = '+hexlogin+'<br />hexc_password = '+hexpwd+'</div>');
		*/
		addToUrl = '';
		$('form#logintofutex span.logerror').empty();
		if(document.location.search!='' && document.location.search!=undefined && document.location.search!=null)
			addToUrl = document.location.search;
		var varpost = {
			v1: hexlogin,
			v2: hexpwd,
			//v3: loc,
			v4: hexkey
		}
		$.ajax({
			type: "POST",
			url: '/forum/js/get_script.php?obj=authenticate/authenticate',
			dataType: 'xml',
			data: varpost,
			success: function(xml) {
				//$('form#login div.connection_response').empty();
				if($('response',xml).attr('successlog')==0)
					$('form#logintofutex span.logerror').append($('response',xml).text());
				else
				{
					document.location.href='forums.php';
				}
			}
		});
	}
	else
	{
		$('form#logintofutex span.logerror').text('Adresse mail ou mot de passe vide.');
	}
}
function Disconnect()
{
	//document.location.href="/admin/deconnexion";
	$.getScript('/forum/js/get_script.php?obj=authenticate/logout');
}
