function doLogin() {
	
	var formValidation = checkForm();
	
	if ( formValidation == true ) {
		getLoginZone().innerHTML = 	'<center><img src="'+ getSecureBaseUrl() +'templates/images/loader.gif" ' + 
									'alt="Login in Progress" ' + 
									'title="Login in Progress" '+
									'style="margin-top : 10px ; margin-bottom 10px;" ' +
									'/></center>';
				
		
		getForm().submit();
		return;
	}
	
	alert( formValidation );
}

function checkForm() {
	
	if ( trim( getUsername().value ) == '' ) {
		return 'The Username/Email Address are empty.';
	}
	
	if ( trim( getPassword().value ) == '' ) {
		return 'The Password are empty.';
	}
	
	return true ;
	
}

function getUsername() {
	return getForm().elements['Username'] ;
}

function getPassword() {
	return getForm().elements['Password'] ;
}

function getLoginZone() {
	return document.getElementById('loginButtonZone') ;
}

function getForm() {
	return document.forms['Login'];
}

function trim(str) {
	return str.replace('/^\s+|\s+$/g','');
}

