/*		Author:			Andrea Fonsati
*		Create Date:	Wed May  7 16:03:30 CEST 2008
*		Last Modify:	
*
*		Notes:
*		This module contains all the functions for Logout
*/
//Ext.onReady(function() {
//	alert('Installazione riuscita!');
//});

function ReturnToFrontEnd()
{
	window.location.href = document.getElementById('doorman-return-value').value;
}

function LogoutMe()
{
	document.getElementById('act').value ='logout';
	document.getElementById('login-form').action = 'logout';
	document.getElementById('login-form').submit();
}

function goLogin(event)
{
	key = event.keyCode;
	if ( key == 13 ) {
		LoginMe();
	}
}

function LoginMe()
{
	f= document.getElementById('login-form');
	
	msg='';
	user = document.getElementById('username').value.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length;
	pwd = document.getElementById('password').value.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length;

	if (pwd == 0) {
		msg = 'Inserire una password!';
		 document.getElementById('password').focus();
	}
	if (user == 0) {
		msg = 'Inserire uno username!';
		 document.getElementById('username').focus();
	}

	if (msg.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length != 0){
		alert(msg);
	}else{

		document.getElementById('login-form').action = 'login';
		document.getElementById('act').value = null;
		document.getElementById('act').value = 'login';

		document.getElementById('login-form').submit();
	}
}

