/**
 * This javascript file define the javascripts for Nokia Connection 2007 website.
 *
 * @author Jeffrey Tan (jeffrey@amcasia.com)
 * @version 1.0 on 07 April 2007
 * @copyright the audience motivation company asia pte ltd. all rights reserved.
 */


/* Registration site pre-login */
function checkLoginForm(theForm){
    theForm.submitButton.disabled = true;
    
    if((theForm.email.value == "")||(trim(theForm.email.value)== "")){
        alert("Please enter your Email");
        theForm.submitButton.disabled = false;
        theForm.email.focus();
        return false;
    }
    if((theForm.password.value == "")||(trim(theForm.password.value)== "")){
        alert("Please enter your Password");
        theForm.submitButton.disabled = false;
        theForm.password.focus();
        return false;
    }
    return true;
}

function checkCreateAccountForm(theForm){
  	theForm.submitButton.disabled = true;
  
  	if((theForm.email.value == "")||(trim(theForm.email.value)== "")){
    		alert("Please enter your Email");
    		theForm.submitButton.disabled = false;
    		theForm.email.focus();
    		return false;
  	}
  	return true;
}

function checkResetAccountForm(theForm){
  	theForm.submitButton.disabled = true;
	
  	if((theForm.email.value == "")||(trim(theForm.email.value)== "")){
    		alert("Please enter your Email");
    		theForm.submitButton.disabled = false;
    		theForm.email.focus();
    		return false;
  	}
  	return true;
}


/* Registration site post-login */
function toggleSalutation(theForm){
  if(theForm.salutation.value == "Others"){
		theForm.salutation_others.value = "";
		theForm.salutation_others.disabled = false;
		document.getElementById("salutation_span").innerHTML = "<font color='#333333'><i>Others, please specify</i></font>";
	  theForm.salutation_others.focus();
	  
	} else {
	  theForm.salutation_others.value = "";
	  theForm.salutation_others.disabled = true;
		document.getElementById("salutation_span").innerHTML = "<font color='#999999'><i>Others, please specify</i></font>";
	  
	}
}

function toggleVisa(theForm){
  if(theForm.visa_letter.value == "Yes"){
		theForm.nationality.value = "";
		theForm.nationality.disabled = false;
		document.getElementById("nationality_span").innerHTML = "<font color='#333333'>Nationality</font>";
	  theForm.nationality.focus();
	  
	  theForm.passport_number.value = "";
	  theForm.passport_number.disabled = false;
		document.getElementById("passport_number_span").innerHTML = "<font color='#333333'>Passport Number</font>";
	  
	  theForm.issue_day.value = "00";
	  theForm.issue_day.disabled = false;
	  theForm.issue_month.value = "00";
	  theForm.issue_month.disabled = false;
	  theForm.issue_year.value = "0000";
	  theForm.issue_year.disabled = false;
		document.getElementById("issue_date_span").innerHTML = "<font color='#333333'>Passport Issue Date</font>";
	  
	  theForm.expiry_day.value = "00";
	  theForm.expiry_day.disabled = false;
	  theForm.expiry_month.value = "00";
	  theForm.expiry_month.disabled = false;
	  theForm.expiry_year.value = "0000";
	  theForm.expiry_year.disabled = false;
		document.getElementById("expiry_date_span").innerHTML = "<font color='#333333'>Passport Expiry Date</font>";
	  
	  theForm.issue_place.value = "";
	  theForm.issue_place.disabled = false;
		document.getElementById("issue_place_span").innerHTML = "<font color='#333333'>Passport Issue Place</font>";
	  
	  
	} else {
	  theForm.nationality.value = "";
	  theForm.nationality.disabled = true;
		document.getElementById("nationality_span").innerHTML = "<font color='#999999'>Nationality</font>";
	  
	  theForm.passport_number.value = "";
	  theForm.passport_number.disabled = true;
		document.getElementById("passport_number_span").innerHTML = "<font color='#999999'>Passport Number</font>";
	  
	  theForm.issue_day.value = "00";
	  theForm.issue_day.disabled = true;
	  theForm.issue_month.value = "00";
	  theForm.issue_month.disabled = true;
	  theForm.issue_year.value = "0000";
	  theForm.issue_year.disabled = true;
		document.getElementById("issue_date_span").innerHTML = "<font color='#999999'>Passport Issue Date</font>";
	  
		theForm.expiry_day.value = "00";
	  theForm.expiry_day.disabled = true;
	  theForm.expiry_month.value = "00";
	  theForm.expiry_month.disabled = true;
	  theForm.expiry_year.value = "0000";
	  theForm.expiry_year.disabled = true;
		document.getElementById("expiry_date_span").innerHTML = "<font color='#999999'>Passport Expiry Date</font>";
	  
	  theForm.issue_place.value = "";
	  theForm.issue_place.disabled = true;
		document.getElementById("issue_place_span").innerHTML = "<font color='#999999'>Passport Issue Place</font>";
	  
	}
}


function toggleIndustryType(theForm){
  if(theForm.industry_type.value == "Others"){
    theForm.industry_type_others.value = "";
	  theForm.industry_type_others.disabled = false;
	  document.getElementById("industry_type_span").innerHTML = "<font color='#333333'><i>Others, please specify</i></font>";
	  theForm.industry_type_others.focus();
	} else {
	  theForm.industry_type_others.value = "";
	  theForm.industry_type_others.disabled = true;
	  document.getElementById("industry_type_span").innerHTML = "<font color='#999999'><i>Others, please specify</i></font>";
	  
	}
}


function checkPublicForm(theForm){
  theForm.submitButton.disabled = true;
  
  if(theForm.salutation.value == "NA"){
    alert("Please select Salutation");
    theForm.submitButton.disabled = false;
    theForm.salutation.focus();
    return false; 
  }
  
  if((theForm.last_name.value == "")||(trim(theForm.last_name.value)== "")){
    alert("Please enter your Last Name");
    theForm.submitButton.disabled = false;
    theForm.last_name.focus();
    return false;
  } else if(!IsAlphabetic(theForm.last_name.value)){
	  alert("You have enter an invalid character for Last Name");
	  theForm.submitButton.disabled = false;
	  theForm.last_name.focus();
	  return false;
	}
	
  if((theForm.first_name.value == "")||(trim(theForm.first_name.value)== "")){
    alert("Please enter your First Name");
    theForm.submitButton.disabled = false;
    theForm.first_name.focus();
    return false;
  
  } else if(!IsAlphabetic(theForm.first_name.value)){
	  alert("You have enter an invalid character for First Name");
	  theForm.submitButton.disabled = false;
  	theForm.first_name.focus();
	  return false;	      
	}
  
  if((theForm.company.value == "")||(trim(theForm.company.value)== "")){
    alert("Please enter your Company");
    theForm.submitButton.disabled = false;
    theForm.company.focus();
    return false;
  
  } else if(IsNumeric(theForm.company.value)){
	  alert("You have enter an invalid character for Company");
	  theForm.submitButton.disabled = false;
  	theForm.company.focus();
	  return false;
	  
	} else if(!IsAlphanumeric(theForm.company.value)){
	  alert("You have enter an invalid character for Company");
	  theForm.submitButton.disabled = false;
  	theForm.company.focus();
	  return false;
	}
	
	if((theForm.designation.value == "")||(trim(theForm.designation.value)== "")){
    alert("Please enter your Designation");
    theForm.submitButton.disabled = false;
    theForm.designation.focus();
    return false;
  
  } else if(IsNumeric(theForm.designation.value)){
	  alert("You have enter an invalid character for Designation");
	  theForm.submitButton.disabled = false;
  	theForm.designation.focus();
	  return false;
	  
	} else if(!IsAlphanumeric(theForm.designation.value)){
	  alert("You have enter an invalid character for Designation");
	  theForm.submitButton.disabled = false;
  	theForm.designation.focus();
	  return false;
	}
	
	if((theForm.industry_type.value == "NA")||(trim(theForm.industry_type.value)== "")){
    alert("Please select your Industry Type");
    theForm.submitButton.disabled = false;
    theForm.industry_type.focus();
    return false;
  
  } else if(theForm.industry_type.value == "Others"){
		
		if((theForm.industry_type_others.value == "")||(trim(theForm.industry_type_others.value)== "")){
	    alert("Please enter your Industry Type");
	    theForm.submitButton.disabled = false;
	    theForm.industry_type_others.focus();
	    return false;
	  
	  } else if(!IsAlphanumeric(theForm.industry_type_others.value)){
		  alert("You have enter an invalid character for Industry Type");
		  theForm.submitButton.disabled = false;
	  	theForm.industry_type_others.focus();
		  return false;
		}
		
	}
	
	if(theForm.country.value == "NA"){
    alert("Please select Country");
    theForm.submitButton.disabled = false;
    theForm.country.focus();
    return false;
  }
  
  if((theForm.email.value == "")||(trim(theForm.email.value)== "")){
    alert("Please enter your Email Address");
    theForm.submitButton.disabled = false;
    theForm.email.focus();
    return false;
  }
	
	if((theForm.contact_number.value == "")||(trim(theForm.contact_number.value)== "")){
	 	alert("Please enter your Contact Number");
		theForm.submitButton.disabled = false;
  	theForm.contact_number.focus();
		return false;
	} else if (IsNumeric(theForm.contact_number.value) == false){
		alert("You have entered non-numerical value for Contact Number");
		theForm.submitButton.disabled = false;
  	theForm.contact_number.focus();
		return false;
	}
  
  if(theForm.regulator_ws.value == "NA"){
    alert("Please select Workshop Session");
    theForm.submitButton.disabled = false;
    theForm.regulator_ws.focus();
    return false;
  }
  
}

function checkStep1Form(theForm){
  theForm.submitButton.disabled = true;
  theForm.backButton.disabled = true;
  
  if(theForm.delegate_type.value == "NA"){
    alert("Please select Delegate Type");
    theForm.submitButton.disabled = false;
    theForm.backButton.disabled = false;
    theForm.delegate_type.focus();
    return false;
  }
  
  if(theForm.salutation.value == "NA"){
    alert("Please select Salutation");
    theForm.submitButton.disabled = false;
    theForm.backButton.disabled = false;
    theForm.salutation.focus();
    return false;
    
  } else if(theForm.salutation.value == "Others"){
  	if((theForm.salutation_others.value == "")||(trim(theForm.salutation_others.value)== "")){
	    alert("Please enter your Salutation");
	    theForm.submitButton.disabled = false;
	    theForm.backButton.disabled = false;
	    theForm.salutation_others.focus();
	    return false;
	    
	  } else if(!IsAlphabetic(theForm.salutation_others.value)){
		  alert("You have enter an invalid character for Salutation");
		  theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
		  theForm.salutation_others.focus();
		  return false;
		}  	
  }
	
  if((theForm.last_name.value == "")||(trim(theForm.last_name.value)== "")){
    alert("Please enter your Last Name");
    theForm.submitButton.disabled = false;
    theForm.backButton.disabled = false;
    theForm.last_name.focus();
    return false;
  } else if(!IsAlphabetic(theForm.last_name.value)){
	  alert("You have enter an invalid character for Last Name");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
	  theForm.last_name.focus();
	  return false;
	}
	
  if((theForm.first_name.value == "")||(trim(theForm.first_name.value)== "")){
    alert("Please enter your First Name");
    theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.first_name.focus();
    return false;
  
  } else if(!IsAlphabetic(theForm.first_name.value)){
	  alert("You have enter an invalid character for First Name");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.first_name.focus();
	  return false;	      
	}
	
	if(trim(theForm.preferred_name.value) != ""){
	  if(!IsAlphabetic(theForm.preferred_name.value)){
	    alert("You have enter an invalid character for Preferred Name");
	    theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
  		theForm.preferred_name.focus();
	    return false;
	  }
	}
  
  if((theForm.company.value == "")||(trim(theForm.company.value)== "")){
    alert("Please enter your Company");
    theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.company.focus();
    return false;
  
  } else if(IsNumeric(theForm.company.value)){
	  alert("You have enter an invalid character for Company");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.company.focus();
	  return false;
	  
	} else if(!IsAlphanumeric(theForm.company.value)){
	  alert("You have enter an invalid character for Company");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.company.focus();
	  return false;
	}
  
  if((theForm.designation.value == "")||(trim(theForm.designation.value)== "")){
    alert("Please enter your Designation");
    theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.designation.focus();
    return false;
  
  } else if(IsNumeric(theForm.designation.value)){
	  alert("You have enter an invalid character for Designation");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.designation.focus();
	  return false;
	  
	} else if(!IsAlphanumeric(theForm.designation.value)){
	  alert("You have enter an invalid character for Designation");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.designation.focus();
	  return false;
	}
  
  if((theForm.business_group.value == "")||(trim(theForm.business_group.value)== "")){
    alert("Please enter your Business Group/Unit");
    theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.business_group.focus();
    return false;
  
  } else if(IsNumeric(theForm.business_group.value)){
	  alert("You have enter an invalid character for Business Group/Unit");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.business_group.focus();
	  return false;
	  
	} else if(!IsAlphanumeric(theForm.business_group.value)){
	  alert("You have enter an invalid character for Business Group/Unit");
	  theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.business_group.focus();
	  return false;
	}
  
  
  if((theForm.address.value == "")||(trim(theForm.address.value)== "")){
    alert("Please enter your Address");
    theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.address.focus();
    return false;
  }
  
  if(theForm.country.value == "NA"){
    alert("Please select Country");
    theForm.submitButton.disabled = false;
    theForm.backButton.disabled = false;
    theForm.country.focus();
    return false;
  }
  
  if((theForm.email.value == "")||(trim(theForm.email.value)== "")){
    alert("Please enter your Email Address");
    theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.email.focus();
    return false;
  }
  
  if((theForm.country_code.value == "")||(trim(theForm.country_code.value)== "")){
		alert("Please enter Country Code");
		theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.country_code.focus();
		return false;
	} else if (IsNumeric(theForm.country_code.value) == false){
		alert("You have entered non-numerical value for Country Code");
		theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
    theForm.country_code.focus();
		return false;
	}
		
	if((theForm.area_code.value == "")||(trim(theForm.area_code.value)== "")){
	 	alert("Please enter Area Code\nEnter '0' where not applicable");
		theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.area_code.focus();
		return false;
	} else if (IsNumeric(theForm.area_code.value) == false){
		alert("You have entered non-numerical value for Area Code");
		theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.area_code.focus();
		return false;
	}
		
	if((theForm.contact_number.value == "")||(trim(theForm.contact_number.value)== "")){
	 	alert("Please enter your Contact Number");
		theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.contact_number.focus();
		return false;
	} else if (IsNumeric(theForm.contact_number.value) == false){
		alert("You have entered non-numerical value for Contact Number");
		theForm.submitButton.disabled = false;
  	theForm.backButton.disabled = false;
  	theForm.contact_number.focus();
		return false;
	}
	
	if(theForm.visa_letter.value == "NA"){
    alert("Please select whether you require Travel Visa application letter");
    theForm.submitButton.disabled = false;
    theForm.backButton.disabled = false;
    theForm.visa_letter.focus();
    return false;
  }
	
  if(theForm.visa_letter.value == "Yes"){	
		if((theForm.nationality.value == "")||(trim(theForm.nationality.value)== "")){
      alert("Please enter your Nationality");
      theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
      theForm.nationality.focus();
      return false;
      
    } else if(!IsAlphabetic(theForm.nationality.value)){
		  alert("You have enter an invalid character for Nationality");
	    theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
    	theForm.nationality.focus();
	    return false;
		}
		
		if((theForm.passport_number.value == "")||(trim(theForm.passport_number.value) == "")){
		  alert("Please enter your Passport Number");
			theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
    	theForm.passport_number.focus();
			return false;
		}
		
		/* Check passport issue date and expiry date */    
    if(theForm.issue_day.value == "00"){
    	alert('Please select Passort Issue Day');
    	theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.issue_day.focus();
		  return false;    		
    }
    
    if(theForm.issue_month.value == "00"){
    	alert('Please select Passort Issue Month');
    	theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.issue_month.focus();
		  return false;    		
    }
    
    if(theForm.issue_year.value == "0000"){
    	alert('Please select Passort Issue Year');
    	theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.issue_year.focus();
		  return false;    		
    }
    
    if(theForm.expiry_day.value == "00"){
    	alert('Please select Passort Expiry Day');
    	theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.expiry_day.focus();
		  return false;    		
    }
    
    if(theForm.expiry_month.value == "00"){
    	alert('Please select Passort Expiry Month');
    	theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.expiry_month.focus();
		  return false;    		
    }
    
    if(theForm.expiry_year.value == "0000"){
    	alert('Please select Passort Expiry Year');
    	theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.expiry_year.focus();
		  return false;    		
    }
    
    if((theForm.issue_place.value == "")||(trim(theForm.issue_place.value) == "")){
		  alert("Please enter your Passport Issue Place");
			theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
    	theForm.issue_place.focus();
			return false;
		}    
		
	}
  
  return true;
}

function toggleAccommodation(theForm){
	if(theForm.require_accommodation.value == "Yes"){
		//document.getElementById("accommodation_span").innerHTML = "<font color='#333333'><i>Please fill in the details below</i></font>";
	  
	  if(theForm.type.value == "NSN"){
		    theForm.category.disabled = false;
		}
	  
		theForm.checkin_date.value = "0000-00-00";
		theForm.checkin_date.disabled = false;
		document.getElementById("checkin_span").innerHTML = "<font color='#333333'>Check-in Date</font>";
	  theForm.checkin_date.focus();
	  
	  theForm.checkout_date.value = "0000-00-00";
		theForm.checkout_date.disabled = false;
		document.getElementById("checkout_span").innerHTML = "<font color='#333333'>Check-out Date</font>";
		
		theForm.room_type.value = "NA";
		theForm.room_type.disabled = false;
		document.getElementById("room_type_span").innerHTML = "<font color='#333333'>Room Type</font>";
		
		theForm.room_preference.value = "NA";
		theForm.room_preference.disabled = false;
		document.getElementById("room_preference_span").innerHTML = "<font color='#333333'>Room Preference</font>";
		
		document.getElementById("room_category_span").innerHTML = "<font color='#333333'>Room Category</font>";
		if(theForm.type.value == "Nokia"){
				//theForm.room_category.value = "NA";
				//theForm.room_category.disabled = false;
			  document.getElementById("room_category_span2").innerHTML = "<font color='#333333'><b>" + theForm.hiddenCategory.value + "</b></font>";	
		}
		
	} else {
	  //document.getElementById("accommodation_span").innerHTML = "";
	  
	  if(theForm.type.value == "NSN"){
	    	theForm.category.value = "NA";
		    theForm.category.disabled = true;
		}
		
	  theForm.checkin_date.value = "0000-00-00";
		theForm.checkin_date.disabled = true;
		document.getElementById("checkin_span").innerHTML = "<font color='#999999'>Check-in Date</font>";
	  
	  theForm.checkout_date.value = "0000-00-00";
		theForm.checkout_date.disabled = true;
		document.getElementById("checkout_span").innerHTML = "<font color='#999999'>Check-out Date</font>";
		
		theForm.room_type.value = "NA";
		theForm.room_type.disabled = true;
		document.getElementById("room_type_span").innerHTML = "<font color='#999999'>Room Type</font>";
		
		theForm.room_preference.value = "NA";
		theForm.room_preference.disabled = true;
		document.getElementById("room_preference_span").innerHTML = "<font color='#999999'>Room Preference</font>";
		
		document.getElementById("room_category_span").innerHTML = "<font color='#999999'>Room Category</font>";
		if(theForm.type.value == "Nokia"){
				//theForm.room_category.value = "NA";
				//theForm.room_category.disabled = true;
				document.getElementById("room_category_span2").innerHTML = "<font color='#999999'><b>" + theForm.hiddenCategory.value + "</b></font>";	
		}
		
	}
	
}

function checkStep2Form(theForm){
  theForm.submitButton.disabled = true;
  theForm.backButton.disabled = true;
  
  if(theForm.require_accommodation.value == "NA"){
    alert("Please select whether you require accommodation");
    theForm.submitButton.disabled = false;
    theForm.backButton.disabled = false;
    theForm.require_accommodation.focus();
    return false;
  }
  
  if((theForm.type.value == "NSN")&&(theForm.require_accommodation.value == "Yes")){  
  	if(theForm.category.value == "NA"){
		    alert("Please select Room Category");
		    theForm.submitButton.disabled = false;
		    theForm.backButton.disabled = false;
		    theForm.category.focus();
		    return false;
		}  
  }
  
  if(theForm.require_accommodation.value == "Yes"){
    var s = -1;
	  for (i=0;i<theForm.airport_transfer.length;i++){
	    if (theForm.airport_transfer[i].checked==true){
	      s=i;
	      break; //exist for loop, as target acquired.
	    }
	  }
		if(s < 0){
		    alert("Please indicate whether you require Airport Transfer");
				theForm.submitButton.disabled = false;
    		theForm.backButton.disabled = false;
    		theForm.airport_transfer[0].focus();
				return false;
		}
		
  }
  
  return true;
}


function toggleTradeProgram(theForm){
  //alert(theForm.currentSelection.value);
	if(theForm.currentSelection.value == "trade_breakout_1"){
	  if(theForm.trade_breakout_1.checked == true){
		    theForm.trade_breakout_2.checked = false;
		}
	}
	if(theForm.currentSelection.value == "trade_breakout_2"){
	  if(theForm.trade_breakout_2.checked == true){
		    theForm.trade_breakout_1.checked = false;
		}
	}
}

function toggleAnalystProgram(theForm){
  //alert(theForm.currentSelection.value);
	if(theForm.currentSelection.value == "analyst_breakout_1a"){
	  if(theForm.analyst_breakout_1a.checked == true){
		    theForm.analyst_breakout_2a.checked = false;
		    theForm.analyst_breakout_3a.checked = false;
		}
	}
	if(theForm.currentSelection.value == "analyst_breakout_2a"){
	  if(theForm.analyst_breakout_2a.checked == true){
		    theForm.analyst_breakout_1a.checked = false;
		    theForm.analyst_breakout_3a.checked = false;
		}
	}
	if(theForm.currentSelection.value == "analyst_breakout_3a"){
	  if(theForm.analyst_breakout_3a.checked == true){
		    theForm.analyst_breakout_1a.checked = false;
		    theForm.analyst_breakout_2a.checked = false;
		}
	}
	
	if(theForm.currentSelection.value == "analyst_breakout_1b"){
	  if(theForm.analyst_breakout_1b.checked == true){
		    theForm.analyst_breakout_2b.checked = false;
		    theForm.analyst_breakout_3b.checked = false;
		}
	}
	if(theForm.currentSelection.value == "analyst_breakout_2b"){
	  if(theForm.analyst_breakout_2b.checked == true){
		    theForm.analyst_breakout_1b.checked = false;
		    theForm.analyst_breakout_3b.checked = false;
		}
	}
	if(theForm.currentSelection.value == "analyst_breakout_3b"){
	  if(theForm.analyst_breakout_3b.checked == true){
		    theForm.analyst_breakout_1b.checked = false;
		    theForm.analyst_breakout_2b.checked = false;
		}
	}
}

function toggleMgmtProgram(theForm){
    toggleTradeProgram(theForm);
    
    if(theForm.currentSelection.value == "analyst_mtg"){
		  if(theForm.analyst_mtg.checked == true){
			    theForm.media_ws.checked = false;
			}
		}
		if(theForm.currentSelection.value == "media_ws"){
		  if(theForm.media_ws.checked == true){
			    theForm.analyst_mtg.checked = false;
			}
		}
}

function toggleOthersProgram(theForm){
    if(theForm.currentSelection.value == "analyst_mtg"){
		  if(theForm.analyst_mtg.checked == true){
			    theForm.media_ws.checked = false;
			}
		}
		if(theForm.currentSelection.value == "media_ws"){
		  if(theForm.media_ws.checked == true){
			    theForm.analyst_mtg.checked = false;
			}
		}
}

function toggleDemoProgram(theForm){
    if(theForm.currentSelection.value == "analyst_mtg"){
		  if(theForm.analyst_mtg.checked == true){
			    theForm.media_ws.checked = false;
			}
		}
		if(theForm.currentSelection.value == "media_ws"){
		  if(theForm.media_ws.checked == true){
			    theForm.analyst_mtg.checked = false;
			}
		}
}

function toggleGolf(theForm){
  //if((theForm.golf_day_1.value != "NA")||(theForm.golf_day_2.value != "NA")||(theForm.golf_day_3.value != "NA")){
	if((theForm.golf_day_1.value != "NA")||(theForm.golf_day_2.value != "NA")){
	  document.getElementById("rental_span").innerHTML = "<font color='#333333'>Please indicate if you require rental of the following items.</font>";
	  document.getElementById("shoe_rental_span").innerHTML = "<font color='#333333'>Golf Shoe Rental?</font>";
	  document.getElementById("club_rental_span").innerHTML = "<font color='#333333'>Golf Club Rental?</font>";
	  document.getElementById("handicap_span").innerHTML = "<font color='#333333'>Golf Handicap</font>";
	  
		//theForm.shoe_rental.value = "NA";
	  theForm.shoe_rental.disabled = false;
	  theForm.club_rental.disabled = false;
	  theForm.golf_handicap.disabled = false;
	  
	  if(theForm.shoe_rental.value == "Yes"){
	      document.getElementById("shoe_size_span").innerHTML = "<font color='#333333'>Shoe Size (US Size)</font>";
				theForm.shoe_size.disabled = false;
				
		} else {
		    document.getElementById("shoe_size_span").innerHTML = "<font color='#999999'>Shoe Size (US Size)</font>";
		    theForm.shoe_size.value = "NA";
		    theForm.shoe_size.disabled = true;
		}
		
		if(theForm.club_rental.value == "Yes"){
	      document.getElementById("club_preference_span").innerHTML = "<font color='#333333'>Club Preference</font>";
				theForm.club_preference.disabled = false;
				
		} else {
		    document.getElementById("club_preference_span").innerHTML = "<font color='#999999'>Club Preference</font>";
		    theForm.club_preference.value = "NA";
		    theForm.club_preference.disabled = true;
		}
	  
	} else {
	  document.getElementById("rental_span").innerHTML = "<font color='#999999'>Please indicate if you require rental of the following items.</font>";
	  document.getElementById("shoe_rental_span").innerHTML = "<font color='#999999'>Golf Shoe Rental?</font>";
	  document.getElementById("club_rental_span").innerHTML = "<font color='#999999'>Golf Club Rental?</font>";
	  document.getElementById("handicap_span").innerHTML = "<font color='#999999'>Golf Handicap</font>";
	  
		theForm.shoe_rental.value = "NA";
	  theForm.shoe_rental.disabled = true;
	  theForm.club_rental.value = "NA";
	  theForm.club_rental.disabled = true;
	  theForm.golf_handicap.value = "";
	  theForm.golf_handicap.disabled = true;
	  
	  document.getElementById("shoe_size_span").innerHTML = "<font color='#999999'>Shoe Size (US Size)</font>";
	  theForm.shoe_size.value = "NA";
		theForm.shoe_size.disabled = true;
		document.getElementById("club_preference_span").innerHTML = "<font color='#999999'>Club Preference</font>";
	  theForm.club_preference.value = "NA";
		theForm.club_preference.disabled = true;
		
	}
}

function checkStep3Form(theForm){
  theForm.submitButton.disabled = true;
  theForm.backButton.disabled = true;
  
  
  //theForm.submitButton.disabled = false;
  //theForm.backButton.disabled = false;
  
  return true;
}

function checkStep4Form(theForm){
  theForm.submitButton.disabled = true;
  theForm.backButton.disabled = true;
    
  if((theForm.require_accommodation.value == "Yes")||(theForm.require_golf.value == "Yes")||(theForm.require_spa.value == "Yes")){
	  var s = -1;
		  for (i=0;i<theForm.incidental_charge.length;i++){
		    if (theForm.incidental_charge[i].checked==true){
		      s=i;
		      break; //exist for loop, as target acquired.
		    }
		  }
			if(s < 0){
			    alert("Please indicate billing instruction");
					theForm.submitButton.disabled = false;
	    		theForm.backButton.disabled = false;
	    		theForm.incidental_charge[1].focus();
					return false;
			}
	  
	  if(theForm.creditcard_type.value == "NA"){
			alert("Please select Credit Card Type");
			theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
		  theForm.creditcard_type.focus();
	    return false;
		}
	  
	  if((theForm.creditcard_name.value == "")||(trim(theForm.creditcard_name.value)== "")){
	    alert("Please enter Credit Card Holder's Name");
	    theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
	    theForm.creditcard_name.focus();
	    return false;
	  
	  } else if(!IsAlphabetic(theForm.creditcard_name.value)){
		  alert("You have enter an invalid character for Credit Card Name");
		  theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
	  	theForm.creditcard_name.focus();
		  return false;
		}
	
		if((theForm.creditcard_number.value == "")||(trim(theForm.creditcard_number.value) == "")){
			alert("Please enter Credit Card Number");
			theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
			theForm.creditcard_number.focus();
	    return false;
		} else if (IsNumeric(theForm.creditcard_number.value) == false){
			alert("You have entered an invalid Credit Card Number");
			theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
			theForm.creditcard_number.focus();
			return false;
		} else if (IsValidCreditCard(theForm.creditcard_number.value) == false){
		  alert("You have entered an invalid Credit Card Number");
		  theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
			theForm.creditcard_number.focus();
			return false;
		}
	  
	  if(theForm.creditcard_expiry_month.value == "NA"){
			alert("Please select Credit Card Expiry Month");
			theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
			theForm.creditcard_expiry_month.focus();
	    return false;
		}
		if(theForm.creditcard_expiry_year.value == "NA"){
			alert("Please select Credit Card Expiry Year");
			theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
			theForm.creditcard_expiry_year.focus();
	    return false;
		}
		
		if((theForm.creditcard_expiry_year.value == "2007")&&(theForm.creditcard_expiry_month.value <= "06")){
		  alert("Your Credit Card has expired/is expiring soon. \n Please use another Credit Card.");
		  theForm.submitButton.disabled = false;
	  	theForm.backButton.disabled = false;
			theForm.creditcard_expiry_month.focus();
			return false;
		}
  
  }
  
  if((theForm.cc_name_1.value != "")&&(trim(theForm.cc_name_1.value) != "")){
	  if((theForm.cc_email_1.value == "")||(trim(theForm.cc_email_1.value) == "")){
	    alert("Please enter email for Recipient 1");
	    theForm.submitButton.disabled = false;
  	  theForm.backButton.disabled = false;
		  theForm.cc_email_1.focus();
		  return false;
		} else if (IsAlphabetic(theForm.cc_name_1.value) == false){
		  alert("You have entered an invalid Recipient Name 1");
		  theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
			theForm.cc_name_1.focus();
		  return false;
	  }
	}
	
	if((theForm.cc_email_1.value != "")&&(trim(theForm.cc_email_1.value) != "")){
	  if((theForm.cc_name_1.value == "")||(trim(theForm.cc_name_1.value) == "")){
	    alert("Please enter name for Recipient 1");
	    theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.cc_name_1.focus();
		  return false;
		} else if (IsAlphabetic(theForm.cc_name_1.value) == false){
		  alert("You have entered an invalid Recipient Name 1");
		  theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
			theForm.cc_name_1.focus();
		  return false;
	  }
	}
  
  if((theForm.cc_name_2.value != "")&&(trim(theForm.cc_name_2.value) != "")){
	  if((theForm.cc_email_2.value == "")||(trim(theForm.cc_email_2.value) == "")){
	    alert("Please enter email for Recipient 2");
	    theForm.submitButton.disabled = false;
  	  theForm.backButton.disabled = false;
		  theForm.cc_email_2.focus();
		  return false;
		} else if (IsAlphabetic(theForm.cc_name_2.value) == false){
		  alert("You have entered an invalid Recipient Name 2");
		  theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
			theForm.cc_name_2.focus();
		  return false;
	  }
	}
	
	if((theForm.cc_email_2.value != "")&&(trim(theForm.cc_email_2.value) != "")){
	  if((theForm.cc_name_2.value == "")||(trim(theForm.cc_name_2.value) == "")){
	    alert("Please enter name for Recipient 2");
	    theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.cc_name_2.focus();
		  return false;
		} else if (IsAlphabetic(theForm.cc_name_2.value) == false){
		  alert("You have entered an invalid Recipient Name 2");
		  theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
			theForm.cc_name_2.focus();
		  return false;
	  }
	}
	
	if((theForm.cc_name_3.value != "")&&(trim(theForm.cc_name_3.value) != "")){
	  if((theForm.cc_email_3.value == "")||(trim(theForm.cc_email_3.value) == "")){
	    alert("Please enter email for Recipient 3");
	    theForm.submitButton.disabled = false;
  	  theForm.backButton.disabled = false;
		  theForm.cc_email_3.focus();
		  return false;
		} else if (IsAlphabetic(theForm.cc_name_3.value) == false){
		  alert("You have entered an invalid Recipient Name 3");
		  theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
			theForm.cc_name_3.focus();
		  return false;
	  }
	}
	
	if((theForm.cc_email_3.value != "")&&(trim(theForm.cc_email_3.value) != "")){
	  if((theForm.cc_name_3.value == "")||(trim(theForm.cc_name_3.value) == "")){
	    alert("Please enter name for Recipient 3");
	    theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
		  theForm.cc_name_3.focus();
		  return false;
		} else if (IsAlphabetic(theForm.cc_name_3.value) == false){
		  alert("You have entered an invalid Recipient Name 3");
		  theForm.submitButton.disabled = false;
  		theForm.backButton.disabled = false;
			theForm.cc_name_3.focus();
		  return false;
	  }
	}
  
  return true;
}


/* Admin site pre-login */
function checkAdminLogin(theForm){
    theForm.submitButton.disabled = true;
    
    if((theForm.username.value == "")||(trim(theForm.username.value)== "")){
        alert("Please enter your Username");
        theForm.submitButton.disabled = false;
        theForm.username.focus();
        return false;
    }
    if((theForm.password.value == "")||(trim(theForm.password.value)== "")){
        alert("Please enter your Password");
        theForm.submitButton.disabled = false;
        theForm.password.focus();
        return false;
    }
    return true;
}

function checkEmailToolForm(theForm){
    if (theForm.email_type.value == "NA"){
		    alert('Please select type of email to send');
    		theForm.email_type.focus();
		    return false;
		} else{
		    theForm.submit();
		}
}
