/* Copyright (c) 1995-2008 Choice Hotels International, Inc. All Rights Reserved. */
var CPLang={STATUS:"Status",BRANCH:"Branch of Service",RANK:"Rank",LASTNAME:"Last Name",FIRSTNAME:"First Name",HADDR1:"Home Address - Line 1",HADDR2:"Home Address - Line 2",HADDR3:"Home Address - Line 3",HCITY:"Home Address - City",HCOUNTRY:"Home Address - Country",BADDR1:"Business Address - Line 1",BADDR2:"Business Address - Line 2",BADDR3:"Business Address - Line 3",BCITY:"Business Address - City",BCOUNTRY:"Business Address - Country",HPHONE1:"Home Area Code",HPHONE2:"Home Phone Prefix",HPHONE3:"Home Phone Number",BPHONE1:"Business Area Code",BPHONE2:"Business Phone Prefix",BPHONE3:"Business Phone Number",BPHONE4:"Business Phone Extension",FPHONE1:"Fax Area Code",FPHONE2:"Fax Prefix",FPHONE3:"Fax Number",FPHONE4:"Fax Extension",CCCO:"Credit Card Company",CCNUM:"Credit Card Number",EXPMONTH:"Expiration Month",EXPYEAR:"Expiration Year",EMAIL:"E-Mail Address",BMONTH:"Birth Date (Month)",BDAY:"Birth Date (Day)",SIGNUPLOC:"Signup Location (Property Code)",SIGNUPEMP:"Signup Employee",ENTER_VALID_PCODE:"Please enter a valid postal code",CC_EXPIRED:"Credit Card has expired.",ENTER_INFO:"Please enter a valid:",INVALID_BDAY:"An invalid date was specified for your birth date.",APP_SUBMITTED:"Application already submitted",HOME:"Home",BUSINESS:"BUSINESS",HCOUNTRYCHECK:"Country - The country of the home primary address must be ",BCOUNTRYCHECK:"Country - The country of the business primary address must be ",IATA_ERROR:"Confirm IATA # does not match Agency IATA #. Please reenter your IATA#.",IATA:"Agency IATA Number",IATA_CONF:"Re-entered Agency IATA Number",ENTER_VALID_COUNTY_HOME:"Please select a valid county for your home address.",USERNAME:"Username",PASSWORD:"Password",CONFIRM_PASSWORD:"Confirm Password",PASSWORD_NO_MATCH:"The Confirm Password does not match the Password entered.  Correct the Password or Confirm Password and resubmit your profile.",ENTER_VALID_COUNTY_BUSINESS:"Please select a valid county for your business address.",HSUBURB:"Home Address - Suburb",BSUBURB:"Business Address - Suburb",EMAIL_NO_MATCH:"The Confirm E-mail Address does not match the E-mail Address entered.  Correct the E-mail Address or Confirm E-mail Address and resubmit your profile.",CPNUM_OR_ENROLL:"You must enter a valid CP number or check the box to enroll",ACCEPT:"You must accept the terms and conditions",CPFORMAT:"Incorrect Choice Privileges number"};function jsguestpriv_chk(form_flds){var error_msg;var field_name="";var haddr="";var baddr="";var error="";var si=form_flds.primary_addr.options.selectedIndex;var haddr_required=false;var baddr_required=false;var formSubmitted=false;var cp_program=form_flds.cp_program.value;var x=0;var haddr_fld=new Array(form_flds.haddr_1.value,form_flds.haddr_2.value,form_flds.haddr_3.value,form_flds.hcity.value,form_flds.hstate.selectedIndex,form_flds.hzip.value,form_flds.hcountry.selectedIndex,form_flds.pref_country.value);var baddr_fld=new Array(form_flds.baddr_1.value,form_flds.baddr_2.value,form_flds.baddr_3.value,form_flds.bcity.value,form_flds.bstate.selectedIndex,form_flds.bzip.value,form_flds.bcountry.selectedIndex,form_flds.pref_country.value);removeDispensableValues(Ext.getDom("hcountry").value,'hstate','hzip','hcounty');removeDispensableValues(Ext.getDom("bcountry").value,'bstate','bzip','bcounty');if(form_flds.Status&&form_flds.Status.value=="")error+="\n"+CPLang.STATUS;if(form_flds.Branch&&form_flds.Branch.value=="")error+="\n"+CPLang.BRANCH;var rankDisabledAttr=$("#rank_id").attr("disabled");if(form_flds.rank_id&&form_flds.rank_id.value==""&&!rankDisabledAttr)error+="\n"+CPLang.RANK;if(si==0){for(i=0;i<6;i++){if((haddr_fld[i]!=""))haddr_required=true}if(form_flds.hcountry[haddr_fld[6]].value!=form_flds.pref_country.value){field_name=CPLang.HCOUNTRYCHECK;haddr=countryName[form_flds.pref_country.value];field_name+=haddr;error+="\n"+field_name}for(x=0;x<6;x++){if((baddr_fld[x]!=""))baddr_required=true}if((!haddr_required)&&(baddr_required)){form_flds.primary_addr.options.selectedIndex=1;form_flds.primary_addr.options[si].value=CPLang.BUSINESS}else haddr_required=true}else if(si==1){for(i=0;i<6;i++){if((baddr_fld[i]!=""))baddr_required=true}if((!baddr_required)&&(haddr_required)){form_flds.primary_addr.options.selectedIndex=0;form_flds.primary_addr.options[si].value=CPLang.HOME}else baddr_required=true;if(form_flds.bcountry[baddr_fld[6]].value!=form_flds.pref_country.value){field_name=CPLang.BCOUNTRYCHECK;baddr=countryName[form_flds.pref_country.value];field_name+=baddr;error+="\n"+field_name}for(x=0;x<6;x++){if((haddr_fld[x]!=""))haddr_required=true}}var form_field="";form_field=$.trim($("input[@name=last_name]").val());if(!validLastName(form_field)||form_field==""||form_field==null)error+="\n"+CPLang.LASTNAME;form_field=$.trim($("input[@name=frst_name]").val());if(!validFirstName(form_field)||form_field==""||form_field==null)error+="\n"+CPLang.FIRSTNAME;if(haddr_required==true){form_field=$.trim($("input[@name=haddr_1]").val());if(!validAddress(form_field)||form_field==null||form_field=="")error+="\n"+CPLang.HADDR1;form_field=$.trim($("input[@name=haddr_2]").val());if((form_field!=null)&&(form_field!="")){if(!validAddress(form_field))error+="\n"+CPLang.HADDR2}form_field=$.trim($("input[@name=haddr_3]").val());if((form_field!=null)&&(form_field!="")){if(!validAddress(form_field))error+="\n"+CPLang.HADDR3}form_field=$.trim($("input[@name=hcity]").val());if(form_field==""||!validAddressChars(form_field)){if(Ext.getDom("hcountry").value=='PG'){error+="\n"+CPLang.HSUBURB}else {error+="\n"+CPLang.HCITY}}}form_field=$.trim($("input[@name=corp_client_id]").val());if((form_field!=null)&&(form_field!="")){field_name=CPLang.CORP_CLIENT_ID;if((form_field.length!=0)&&(!validNumbers(form_field.value)||(form_field.value.length!=8)))error+="\n"+field_name}if(baddr_required==true){form_field=$.trim($("input[@name=baddr_1]").val());if(!validAddress(form_field)||form_field==null||form_field=="")error+="\n"+CPLang.BADDR1;form_field=$.trim($("input[@name=baddr_2]").val());if((form_field!=null)&&(form_field!="")){if(!validAddress(form_field))error+="\n"+CPLang.BADDR2}form_field=$.trim($("input[@name=baddr_3]").val());if((form_field!=null)&&(form_field!="")){if(!validAddress(form_field))error+="\n"+CPLang.BADDR3}form_field=$.trim($("input[@name=bcity]").val());if(form_field==""||!validAddressChars(form_field)){if(Ext.getDom("bcountry").value=='PG'){error+="\n"+CPLang.BSUBURB}else {error+="\n"+CPLang.BCITY}}}form_field=$.trim($("input[@name=hphone_number]").val());if((form_field!=null)&&(form_field!="")){if((!validPhone(form_field)))error+="\n"+CPLang.HPHONE3}form_field=$.trim($("input[@name=bphone_number]").val());if((form_field!=null)&&(form_field!="")){if((!validPhone(form_field)))error+="\n"+CPLang.BPHONE3}form_field=$.trim($("input[@name=bext]").val());if((form_field!=null)&&(form_field!="")){if(!validNumbers(form_field))error+="\n"+CPLang.BPHONE4}form_field=$.trim($("input[@name=fax_number]").val());if((form_field!=null)&&(form_field!="")){if((!validPhone(form_field)))error+="\n"+CPLang.FPHONE3}form_field=$.trim($("input[@name=fax_ext]").val());if((form_field!=null)&&(form_field!="")){if(!validNumbers(form_field))error+="\n"+CPLang.FPHONE4}form_field=$.trim($("input[@name=email_addr]").val());if($("input[@name=appl_src]").val()=="HOTEL"){if(!validEmail(form_field))error+="\n"+CPLang.EMAIL}else {if((form_field==null)||(form_field=="")||!validEmail(form_field))error+="\n"+CPLang.EMAIL}if(document.GPApplication.username){form_field=$.trim(form_flds.username.value);if((form_field==null)||(form_field==""))error+="\n"+CPLang.USERNAME;form_field=$.trim(form_flds.password.value);if((form_field==null)||(form_field==""))error+="\n"+CPLang.PASSWORD;form_field=$.trim($("input[@name=confirm_password]").val());if((form_field==null)||(form_field==""))error+="\n"+CPLang.CONFIRM_PASSWORD}birthMonth=$("#birth_month").find("option:selected").val();birthDay=$("#birth_day").find("option:selected").val();if((birthMonth==0)&&(birthDay>0)){error+="\n"+CPLang.BMONTH}if((birthDay==0)&&(birthMonth>0)){error+="\n"+CPLang.BDAY}if($("input[@name=signup_loc]").index($("#signup_loc")[0])==0){form_field=$.trim($("input[@name=signup_loc]").val());if((!validInputChars(form_field,true))||(form_field.length<5))error+="\n"+CPLang.SIGNUPLOC}if($("input[@name=signup_emp]").index($("#signup_emp")[0])==0){form_field=$.trim($("input[@name=signup_emp]").val());if((form_field==null)||(form_field==""))error+="\n"+CPLang.SIGNUPEMP}if($("input[@name=IATA_num]").index($("#iata1")[0])==0){form_field=$.trim($("input[@name=IATA_num]").val());if((form_field==null)||(form_field==""))error+="\n"+CPLang.IATA;form_field=$.trim($("input[@name=IATA_num2]").val());if((form_field==null)||(form_field==""))error+="\n"+CPLang.IATA_CONF}if(!error){if(form_flds.email_addr.value!=form_flds.confirm_email.value){alert(CPLang.EMAIL_NO_MATCH);return false}if(document.GPApplication.username){if(!validUserName(form_flds.username.value)){return false}if(!validPassword(form_flds.password.value)){return false}if(form_flds.password.value!=form_flds.confirm_password.value){alert(CPLang.PASSWORD_NO_MATCH);return false}}if($("input[@name=IATA_num]").index($("#iata1")[0])==0){if(!($.trim($("input[@name=IATA_num]").val())==$.trim($("input[@name=IATA_num2]").val()))){alert(CPLang.IATA_ERROR);return false}}if(haddr_required==true){if(!basicStateVerify("hstate","hcountry",form_flds))return false;hzip=$.trim($("input[@name=hzip]").val());hcountry=$("#hcountry").find("option:selected").val();if(!isValidPostalCode(hzip,hcountry)){alert(CPLang.ENTER_VALID_PCODE);return false}if(!isValidCounty(document.getElementById("hcounty").value,document.getElementById("hcountry").value)){alert(CPLang.ENTER_VALID_COUNTY_HOME);return false}}if(baddr_required==true){if(!basicStateVerify("bstate","bcountry",form_flds))return false;bzip=$.trim($("input[@name=bzip]").val());bcountry=$("#bcountry").find("option:selected").val();if(!isValidPostalCode(bzip,bcountry)){alert(CPLang.ENTER_VALID_PCODE);return false}if(!isValidCounty(document.getElementById("bcounty").value,document.getElementById("bcountry").value)){alert(CPLang.ENTER_VALID_COUNTY_BUSINESS);return false}}}else {error_msg=CPLang.ENTER_INFO+"\n";error_msg+=error+"\n";alert(error_msg);return false}disableForm(form_flds);return true};function jsathomesweeps_chk(form_flds){var error_msg;var error="";var form_field="";form_field=$.trim($("input[@name=cpNum]").val());if(form_field==""||form_field==null){if(form_flds.enrollBox.checked==false){alert(CPLang.CPNUM_OR_ENROLL);return false}}else {var cp_template=/^([a-zA-Z]{2}-)?[a-zA-Z]{3}\d{4}/;if(!cp_template.test(form_field)){alert(CPLang.CPFORMAT);return false}}form_field=$.trim($("input[@name=first_name]").val());if(!validFirstName(form_field)||form_field==""||form_field==null)error+="\n"+CPLang.FIRSTNAME;form_field=$.trim($("input[@name=last_name]").val());if(!validLastName(form_field)||form_field==""||form_field==null)error+="\n"+CPLang.LASTNAME;form_field=$.trim($("input[@name=email]").val());if((form_field==null)||(form_field=="")||!validEmail(form_field))error+="\n"+CPLang.EMAIL;form_field=$.trim($("input[@name=address]").val());if(form_field==null||form_field=="")error+="\n"+CPLang.HADDR1;form_field=$.trim($("input[@name=city]").val());if(form_field==""||form_field==null)error+="\n"+CPLang.HCITY;stateIndex=$("#state").find("option:selected").val();if(stateIndex==0)error+="\nPlease select a state";form_field=$.trim($("input[@name=zip]").val());if(form_field.length!=5)error+="\n"+CPLang.ENTER_VALID_PCODE;form_field=$.trim($("input[@name=phone]").val());form_field.replace(/-/,"");form_field.replace(/ /,"");if((form_field!=null)&&(form_field!="")){if((!validPhone(form_field)))error+="\n"+CPLang.HPHONE3}birthMonth=$("#birth_month").find("option:selected").val();birthDay=$("#birth_day").find("option:selected").val();if((birthMonth==0)&&(birthDay>0)){error+="\n"+CPLang.BMONTH}if((birthDay==0)&&(birthMonth>0)){error+="\n"+CPLang.BDAY}if(error){error_msg=CPLang.ENTER_INFO+"\n";error_msg+=error+"\n";alert(error_msg);return false}if(form_flds.accept.checked==false){alert(CPLang.ACCEPT);return false}disableForm(form_flds);return true};function displayForm(answer){switch(answer.value){case "Y":;showElement('SignInForm');maskElement('CountryForm');break;case "N":;default: ;maskElement('SignInForm');showElement('CountryForm');break}};function displayDefaults(){showElement('OPYesNoSection');showElement('CPCountrySelectTxtBox');maskElement('SignInForm');maskElement('spaceCountryForm');maskElement('CountryForm');maskElement('CPCountrySelectTxtBoxNoJs')};function onChangeStatus(status){$("#rank_id, #title_id").removeAttr("disabled");if(status.value=="")return ;if(status.value=="Spouse/Dependent"){$("#rank_id").attr("disabled","disabled");return }$("#title_id").attr("disabled","disabled")};function filterRank(branch){var showAllRanks=$("option:selected",branch).val()=="";$("#rank_id option[@value!='']").remove();var branchId=branchIdByValue[branch.value];var options=[];for(var i=0;i<ranks.length;i++)if(showAllRanks||ranks[i].id==branchId)options.push(ranks[i].asOption());$("#rank_id").append(options.join(""));$("#rank_id option[@value='']").attr("selected","selected")};var Rank=function(id,value,text){this.id=id;this.value=value;this.text=text};Rank.prototype.asOption=function(){return "<option value='"+this.value+"'>"+this.text+"</option>"};function displayForm(answer){switch(answer.value){case "Y":;showElement('SignInForm');maskElement('CountryForm');break;case "N":;default: ;maskElement('SignInForm');showElement('CountryForm');break}};function displayDefaults(){showElement('OPYesNoSection');showElement('CPCountrySelectTxtBox');maskElement('SignInForm');maskElement('spaceCountryForm');maskElement('CountryForm');maskElement('CPCountrySelectTxtBoxNoJs')};function onChangeStatus(status){$("#rank_id, #title_id").removeAttr("disabled");if(status.value=="")return ;if(status.value=="Spouse/Dependent"){$("#rank_id").attr("disabled","disabled");return }$("#title_id").attr("disabled","disabled")};function filterRank(branch){var showAllRanks=$("option:selected",branch).val()=="";$("#rank_id option[@value!='']").remove();var branchId=branchIdByValue[branch.value];var options=[];for(var i=0;i<ranks.length;i++)if(showAllRanks||ranks[i].id==branchId)options.push(ranks[i].asOption());$("#rank_id").append(options.join(""));$("#rank_id option[@value='']").attr("selected","selected")};var Rank=function(id,value,text){this.id=id;this.value=value;this.text=text};Rank.prototype.asOption=function(){return "<option value='"+this.value+"'>"+this.text+"</option>"};