function DateCheck(a,b,c){if(a.length==10){if(a.substring(2,3)==b&&a.substring(5,6)==b){var d=a.substring(0,2);var e=a.substring(3,5);var f=a.substring(6,10);var g=new Date(f,d-1,e);if(f==y2k(g.getYear())&&d-1==g.getMonth()&&e==g.getDate()){return true}else{alert("Please enter the correct format for the "+c+" field.");error_occurred=true;return false}}else{alert("Please enter the correct format for the "+c+" field.");error_occurred=true;return false}}else{if(a.length==9){if(a.substring(2,3)==b&&a.substring(4,5)==b){var d=a.substring(0,2);var e=a.substring(3,4);var f=a.substring(5,9);var g=new Date(f,d-1,e);if(f==y2k(g.getYear())&&d-1==g.getMonth()&&e==g.getDate()){return true}else{alert("Please enter the correct format for the "+c+" field.");a.focus;error_occurred=true;return false}}else{if(a.substring(1,2)==b&&a.substring(4,5)==b){var d=a.substring(0,1);var e=a.substring(2,4);var f=a.substring(5,9);var g=new Date(f,d-1,e);if(f==y2k(g.getYear())&&d-1==g.getMonth()&&e==g.getDate()){return true}else{alert("Please enter the correct format for the "+c+" field.");error_occurred=true;return false}}else{alert("Please enter the correct format for the "+c+" field.");error_occurred=true;return false}}}else{if(a.length==8){if(a.substring(1,2)==b&&a.substring(3,4)==b){var d=a.substring(0,1);var e=a.substring(2,3);var f=a.substring(4,8);var g=new Date(f,d-1,e);if(f==y2k(g.getYear())&&d-1==g.getMonth()&&e==g.getDate()){return true}else{alert("Please enter the correct format for the "+c+" field.");error_occurred=true;return false}}else{alert("Please enter the correct format for the "+c+" field.");error_occurred=true;return false}}else{if(a.length==0){return true}else{alert("Please enter the correct format for the "+c+" field.");error_occurred=true;return false}}}}}function y2k(a){return a<1e3?a+1900:a}function determineSelectedCountry(a){if(a.options[a.selectedIndex].value=="USA"){bUSAIsSelected=true}else if(a.options[a.selectedIndex].value=="CAN"){bCanadaIsSelected=true}}function checkStateZipBasedOnCountry(a,b,c,d){determineSelectedCountry(c);if(bUSAIsSelected||bCanadaIsSelected){if(a.options[a.selectedIndex].value==""){alert("Please select a state/province for the "+d+" State/Province field.");a.focus();error_occurred=true}if(!error_occurred){sSelectedState=a.options[a.selectedIndex].text;sUSStatesList="Alabama|American Samoa|Alaska|Arizona|Arkansas|Armed Forces Africa|Armed Forces Americas|Armed Forces Canada|Armed Forces Europe|Armed Forces Middle East|Armed Forces Pacific|California|Colorado|Connecticut|Delaware|District of Columbia|Federated States of Micronesia|Florida|Georgia|Guam|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Marshall Islands|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Northern Mariana Islands|Ohio|Oklahoma|Oregon|Palau|Pennsylvania|Puerto Rico|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virgin Islands|Virginia|Washington|West Virginia|Wisconsin|Wyoming";USStatesArray=sUSStatesList.split("|");bUSStateFound=false;for(i=0;i0){alert("You have not selected the United States or Canada, so please do not select a state/province for the "+d+" State/Province field.");a.focus();error_occurred=true}}}function checkForDecimal(a,b){if(isNaN(trim(a.value))){validDecimalNumber=false}else{validDecimalNumber=true}if(!validDecimalNumber){alert("Please provide a valid value for the "+b+" field.\nBe sure it is a number.");a.select();error_occurred=true}}function checkCodeNumber(a,b){switch(b){case"coupon":sCodeDisplay="Coupon Number";iCodeNumberLength=8;break;case"giftcert":sCodeDisplay="Gift Certificate Number";iCodeNumberLength=6;break;default:sCodeDisplay="Code Number";iCodeNumberLength=8}if(a.value.length!=iCodeNumberLength||isNaN(a.value)){validCodeNumber=false}else{validCodeNumber=true}if(!validCodeNumber){alert("Please provide a valid "+sCodeDisplay+".\nBe sure it is a(n) "+iCodeNumberLength+"-digit number.");a.select();error_occurred=true}}function checkSSN(a){if(a.value.length!=9||isNaN(a.value)){validSSN=false}else{validSSN=true}if(!validSSN){alert("Please provide a valid Social Security Number.\nBe sure not to include any dashes.");a.select();error_occurred=true}}function checkPhone(a,b){rExp=/^\(?\d{3}\)?[\-\.\s]?\d{3}[\-\.\s]?\d{4}$/;results=a.value.match(rExp);if(a.value.length>0&&results==null){alert("Please provide a valid phone number for the "+b+" field. (xxx) xxx-xxxx");a.select();error_occurred=true}}function checkZip(a){rExp=/^\d{5}(-\d{4})?$/;results=a.value.match(rExp);if(results==null){alert("Please provide a valid Zip/Postal Code.");a.select();error_occurred=true}}function checkEmail(a,b){if(b==null){b="Email Address"}if(trim(a.value)!="")if(!isEmail(a.value)){alert("Please enter a correctly formatted "+b+".");a.select();error_occurred=true;return false}return true}function isEmail(a){var b=a.indexOf("@");var c=a.substring(b+1);var d=c.indexOf(".");var e="*|,\":<>[]{}`'()&$#% !^+=\\/;?";for(var f=0;f[]{}`'()&$#% @!^+=\\/;?";for(var f=b+1;f0&&trim(b).length==0){return 1}else if(trim(a).length==0&&trim(b).length>0){return-1}return 0}function arePDFFieldsAndPDFHeadingValid(f,num_pdfs){bAllPDFFieldsEmpty=true;for(i=1;i<=num_pdfs;i++){fldDisplay=eval("f.S_UPLOAD_PDF_DISPLAY_TEXT_"+i);if(trim(fldDisplay.value).length){bAllPDFFieldsEmpty=false;break}}value2="";if(!bAllPDFFieldsEmpty)value2="STRINGWITHLENGTH";msg="";result=isEitherStringEmpty(f.S_PROD_PDF_HDNG.value,value2);if(result>0){msg="A 'Related File' is required to be selectted since the 'Related File Heading' field has a value."}else if(result<0){msg="The 'Related File Heading' field must have a value to be able to select files.";f.S_PROD_PDF_HDNG.select()}if(msg.length){alert(msg);return false}return true}function isUploadPDFFieldPairValid(f,i){fldFile=eval("f.UPLOAD_PDF_"+i);fldDisplay=eval("f.S_UPLOAD_PDF_DISPLAY_TEXT_"+i);value1=fldFile.options[fldFile.selectedIndex].value;value2=fldDisplay.value;msg="";result=isEitherStringEmpty(value1,value2);if(result>0){msg="The display text field is required for 'Related File #"+i+"'.";fldDisplay.select()}else if(result<0){msg="A file must be selected for 'Related File "+i+"' to be able to enter a value for its display text field.";fldFile.focus()}if(msg.length){alert(msg);return false}return true}function areTextFieldsValidTogether(a,b,c,d){msg="";result=isEitherStringEmpty(a.value,b.value);if(result>0){msg="The '"+d+"' field is required since the '"+c+"' field has a value.";b.select()}else if(result<0){msg="The '"+c+"' field must have a value to be able to enter a value for the '"+d+"' field.";a.select()}if(msg.length){alert(msg);return false}return true}function requiredFound(a,b){if(a.value.length==0){alert("Please complete the "+b+" field.");a.focus();return true}}function passwordsMatch(a,b){if(a.value!=b.value){alert("The passwords you have entered are not the same. Please re-enter the passwords.");a.focus();error_occurred=true}}function areYouSure(a){if(!a||trim(a).length==0)a="Are you sure you want to do this?";bAreYouSure=confirm(a);if(!bAreYouSure)return false;return true}function isValidDate(a){if(!/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}$/.test(a))return false;var b=a.split("/");var c=parseInt(b[0],10)-1;var d=parseInt(b[1],10);var e=parseInt(b[2],10);var f=new Date(e,c,d);return!(isNaN(f)||f.getMonth()!=c||f.getDate()!=d||f.getYear()!=e)}function isDate(a,b,c,d){if(!d)d="";d+=" ";var e="";e+="The "+d+"date is not a valid date. Please select a valid date.";a--;var f=new Date(c,a,b);var g=f.getFullYear()==c&&f.getMonth()==a&&f.getDate()==b;if(!g)alert(e);return g}