var helpWindow;

function callKeyHitCustomer() {
		document.getElementById('customerLoginForm:customerNumberButton').click();
}

function callKeyHitPreReg() {
		document.getElementById('preregLoginForm:confirmationNumberButton').click();
}

function loadMain()	{
	document.getElementById('customerLoginForm:customerNumber').focus();
	if(helpWindow)
		helpWindow.focus();
	return false;
}

function loadCustomers()	{
	document.getElementById('addCustomerForm:customerUnit').focus();
	if(helpWindow != null)
		helpWindow.focus();	
	return false;
}

function loadGuests()	{
	document.getElementById('registrationForm:firstName').focus();
	if(helpWindow != null)
		helpWindow.focus();	
	return false;
}

function loadPromotions()	{
	document.getElementById('prePromotionOptions:deliveryPeriod').focus();
	if(helpWindow != null)
		helpWindow.focus();	
	return false;
}

function loadEvent()	{
	var eventId = getURLParam('eventId');
	document.getElementById('eventForm:hiddenEventId').value = eventId;
	document.getElementById('eventForm:goButton').click();
}
					
function invokeCustomerLogin(){
	if (event.keyCode == 13){
		document.getElementById('loginForm:customerNumberButton').click();
		return false;
	}
	return true;
}

function addCustomer(){
	if (event.keyCode == 13){
		document.getElementById('addCustomerForm:addCustomerButton').click();
		return false;
	}
	return true;
}

function invokePreRegLogin(){
	if (event.keyCode == 13){
		document.getElementById('loginForm:confirmationNumberButton').click();
		return false;
	}
	return true;
}

function invokeAddGuest(){
	if (event.keyCode == 13){
		document.getElementById('registrationForm:addGuestButton').click();
		return false;
	}
	return true;
}

function getURLParam(strParamName){
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ){
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    	if (strQueryString.indexOf(strParamName.toLowerCase() + "=") > -1 ){
        	var aParam = strQueryString.split("=");
        	strReturn = aParam[1];
      	}
  	}
  return unescape(strReturn);
}

function showHelpWindow() {
	 helpWindow = window.open('http://test.gfs.com/content_us/events/help.html', 'helpWindow', 'toolbar=no, menubar=no, location=no, statusbar=no, scrollbars=yes, resizable=yes, width=800, height=600'); 
	 helpWindow.focus();
	 return false;
}
	
      			
				
