//  ############################################################## LOGIN

function loginUser(  )
{
//	alert( "Root: " + root_path ) ;
	
	if ( document.getElementById('reg_labels') ) 
	{
		if (document.getElementById('reg_labels').style.display != 'block') 
		{
			document.getElementById('reg_labels').style.display = 'block';
			document.getElementById('ff_user').focus();
		}
		else 
		{
			user = document.getElementById('ff_user').value;
			pass = hex_md5(document.getElementById('ff_pass').value);
			ajax.requestFile = root_path + 'application/ajax/www/authenticateUser.php?ff_user=' + user + '&ff_pass=' + pass;
			ajax.onCompletion = authenticationResponse; // Specify function that will be executed after file has been found
			ajax.runAJAX(); // Execute AJAX function		
		}
	}
	else 
	{
		user = document.getElementById('ff_user').value;
		pass = hex_md5(document.getElementById('ff_pass').value);
		ajax.requestFile = root_path + 'application/ajax/www/authenticateUser.php?ff_user=' + user + '&ff_pass=' + pass;
		ajax.onCompletion = authenticationResponse; // Specify function that will be executed after file has been found
		ajax.runAJAX(); // Execute AJAX function		
	}
}

function authenticationResponse()
{
//	alert( ajax.response );
	if( ajax.response == 'ok' )
	{
		document.location = root_path + 'index.html';
	}
	else
	{
		alert( 'Authentication has failed !' );	
	}
}

