
// browser

	var varPRM = Request.QueryString("PRM");
	
	function CheckPRM()
	{
		var varbrowserType = GetBrowserType();
	
		if (varPRM != null && varPRM != "" && varPRM != "undefined")
		{
			if (varbrowserType == "NN4")
			{
				document.frmStep1.PRM.value = varPRM;
				//document.PromotionDiv.visibility="hidden";
			}
			else if (varbrowserType == "NN6")
			{
				document.frmStep1.PRM.value = varPRM;
				//document.getElementById("PromotionDiv").style.visibility="hidden";
			}
			else //ie 
			{
				document.frmStep1.PRM.value = varPRM;
				//document.all.PromotionDiv.style.visibility = "hidden";	
			}
			
		}
	}
	
	function GetBrowserType()
	{
        if(document.layers)
        {
            return "NN4";
        }
        if(document.all)
        {
             return "ie";
        }
        if(!document.all && document.getElementById)
        {
             return "NN6";
        }
	}



// validation

var blnAbortValidation = false;
function validateFormfrmStep1() {
 if (blnAbortValidation == true) {
  blnAbortValidation = false;
  return true;
 }
	var vfrmStep1selGenderID = document.frmStep1.GenderID;
	var vfrmStep1selSeekingGenderID = document.frmStep1.SeekingGenderID;
	var vfrmStep1txtUserName = document.frmStep1.UserName;
	var vfrmStep1dteBirthDate_month = document.frmStep1.BirthDate_month[document.frmStep1.BirthDate_month.selectedIndex].value;
	var vfrmStep1dteBirthDate_day = document.frmStep1.BirthDate_day[document.frmStep1.BirthDate_day.selectedIndex].value;
	var vfrmStep1dteBirthDate_year = document.frmStep1.BirthDate_year[document.frmStep1.BirthDate_year.selectedIndex].value;
	var vfrmStep1txtEmail = document.frmStep1.Email;
	var vfrmStep1pasPassword = document.frmStep1.Password;
	var vfrmStep1txtEmail2 = document.frmStep1.Email2;
	var vfrmStep1selCountryRegionID = document.frmStep1.CountryRegionID;
	var vfrmStep1txtPostalCode = document.frmStep1.PostalCode;
	if(IsEmpty(vfrmStep1selGenderID, 'select')) {
		ModalBox(false,"Your Gender is required");
		return false;
	}
	if(IsEmpty(vfrmStep1selSeekingGenderID, 'select')) {
		ModalBox(false,"Seeking Gender is required");
		return false;
	}
	if(IsEmpty(vfrmStep1txtUserName, 'text')) {
		ModalBox(false,"User Name is required");
		return false;
	}
	if ( IsAlphaNumeric(vfrmStep1txtUserName.value) == false) {
		ModalBox(false,"User Name must be alphanumeric (i.e. jsmith33)");
		vfrmStep1txtUserName.focus();
		return false;
	}
	if ( InLengthRange(vfrmStep1txtUserName.value, 2, 25) == false) {
		ModalBox(false,"User Name must be between 2 and 25 characters");
		vfrmStep1txtUserName.focus();
		return false;
	}
	if (vfrmStep1dteBirthDate_month == "") {
		ModalBox(false,"Birthday is required");
		document.frmStep1.BirthDate_month.focus();
		return false;
	}
	if (vfrmStep1dteBirthDate_day == "") {
		ModalBox(false,"Birthday is required");
		document.frmStep1.BirthDate_day.focus();
		return false;
	}
	if (vfrmStep1dteBirthDate_year == "") {
		ModalBox(false,"Birthday is required");
		document.frmStep1.BirthDate_year.focus();
		return false;
	}
	if (!IsValidDate(vfrmStep1dteBirthDate_month, vfrmStep1dteBirthDate_day, vfrmStep1dteBirthDate_year) ){
		ModalBox(false,"Birthday is required");
		document.frmStep1.BirthDate_day.focus();
		return false;
	}
	if(IsEmpty(vfrmStep1txtEmail, 'text')) {
		ModalBox(false,"Your email address is required");
		return false;
	}
	if ( IsEmail(vfrmStep1txtEmail.value, 3) == false) {
		ModalBox(false,"Your email address is not a valid email address");
		vfrmStep1txtEmail.focus();
		return false;
	}
	if ( InLengthRange(vfrmStep1txtEmail.value, null , 255) == false) {
		ModalBox(false,"Your email address can not have more than 255 characters");
		vfrmStep1txtEmail.focus();
		return false;
	}
	if(IsEmpty(vfrmStep1pasPassword, 'password')) {
		ModalBox(false,"Password is required");
		return false;
	}
	if ( InLengthRange(vfrmStep1pasPassword.value, 4, 16) == false) {
		ModalBox(false,"Password must be between 4 and 16 characters");
		vfrmStep1pasPassword.focus();
		return false;
	}
	if(IsEmpty(vfrmStep1txtEmail2, 'email')) {
		ModalBox(false,"Re-enter your email is required");
		return false;
	}
	if(vfrmStep1txtEmail2.value != vfrmStep1txtEmail.value) {
		ModalBox(false,"The value of Re-enter your email doesn't match the value of email");
		return false;
	}
	if(IsEmpty(vfrmStep1selCountryRegionID, 'select')) {
		ModalBox(false,"Region is required");
		return false;
	}
	if(IsEmpty(vfrmStep1txtPostalCode, 'text')) {
		ModalBox(false,"Zip Code is required");
		return false;
	}
	if ( IsAlphaNumeric(vfrmStep1txtPostalCode.value) == false) {
		ModalBox(false,"Zip Code must be alphanumeric (i.e. jsmith33)");
		vfrmStep1txtPostalCode.focus();
		return false;
	}
	if ( InLengthRange(vfrmStep1txtPostalCode.value, 5, 6) == false) {
		ModalBox(false,"Zip Code must be between 5 and 6 characters");
		vfrmStep1txtPostalCode.focus();
		return false;
	}
}