var emailAddressPattern=/^[a-zA-Z0-9\+_\.\-]+@[a-zA-Z0-9]+([_\.\-][a-zA-Z0-9]+)*\.([a-zA-Z]{2,4}|[a-zA-Z]{6})$/;var yearOfBirthPattern=/^[1-2][0-9]{3}$/;var usernamePattern=/^[a-zA-Z0-9]{6,127}$/;var passwordPattern=/^[a-zA-Z0-9]{6,127}$/;var zipCodePatternUS=/^[0-9]{5}$/;var zipCodePatternCA=/[a-zA-Z][0-9][a-zA-Z][/\s/|-]?[0-9][a-zA-Z][0-9]/;var zipCodePatternAU=/^((0[289][0-9]{2})|([1345689][0-9]{3})|(2[0-8][0-9]{2})|(290[0-9])|(291[0-4])|(7[0-4][0-9]{2})|(7[8-9][0-9]{2}))$/;var zipCodePatternUK=/^([a-zA-Z]){1}([0-9][0-9]|[0-9]|[a-zA-Z][0-9][a-zA-Z]|[a-zA-Z][0-9][0-9]|[a-zA-Z][0-9]){1}([/\s/|-]?)([0-9][a-zA-z][a-zA-z]){1}$/;var currentYear=(new Date()).getFullYear();function validateSurveyForm(l){var k=Array("gender","yearOfBirth","addressZip");var h=Array("Gender","Year of Birth","Zip/Postal Code");var b="Please complete the following fields:\n\n";var m=b.length;for(var f=0;f<k.length;f++){var d=l.elements[k[f]];if(d){if(d.type==null){var n=false;for(var c=0;c<d.length;c++){if(d[c].checked){n=true}}if(!n){b+=" - "+h[f]+"\n"}continue}switch(d.type){case"select-one":if(d.selectedIndex==-1||d.options[d.selectedIndex].text==""||d.options[d.selectedIndex].text.indexOf("Select")!=-1){b+=" - "+h[f]+"\n"}break;case"select-multiple":if(d.selectedIndex==-1){b+=" - "+h[f]+"\n"}break;case"text":case"textarea":if(d.value==""||d.value==null){b+=" - "+h[f]+"\n"}break;default:}}}if(b.length==m){b="Please enter valid data for the following fields:\n\n";m=b.length;try{if(yearOfBirthPattern.exec(l.elements.yearOfBirth.value)==null){b+=" - Year of Birth\n\nPlease use four numbers, ex. 1979\n\n"}else{if(currentYear-l.elements.yearOfBirth.value<18){b="We are unable to honor your sign-up request at this time. We apologize for the inconvenience."}else{if(currentYear-l.elements.yearOfBirth.value>150){b+=" - The year of birth you entered makes you the oldest living person on earth.\n\nPlease enter your correct year of birth.\n\n"}}}}catch(g){}try{var a=l.elements.addressZip.value;if(checkZipCodePatternError(a)){b+=" - Zip Code\n\nPlease enter a valid zip code."}}catch(g){}}if(b.length==m){return checkForAOL(l)}else{alert(b);return false}}function validateJoin3Form(a){if(a.elements.email.value==""||emailAddressPattern.exec(a.elements.email.value)==null){alert("Please enter a valid email address.");try{a.elements.email.focus()}catch(b){}return false}else{if(!a.elements.acceptTerms.checked){alert("You must accept the terms and conditions in order to sign up.");return false}}return true}function validateJoin2Form(a){if(a.elements.name.value==""){alert("Please enter your name.");return false}else{if(a.elements.name.value.indexOf(" ")==-1){alert("Please enter your first and last name.");return false}else{if(a.elements.email.value==""||emailAddressPattern.exec(a.elements.email.value)==null){alert("Please enter a valid email address.");return false}else{if(!a.elements.acceptTerms.checked){alert("You must accept the terms and conditions in order to sign up.");return false}}}}return true}function validateJoinForm(b){if(getFormFieldValue(b,"email")==""||emailAddressPattern.exec(getFormFieldValue(b,"email"))==null){alert("Please enter a valid email address.");return false}else{if(getFormFieldValue(b,"firstName")==""){alert("Please enter your first name.");return false}else{if(getFormFieldValue(b,"lastName")==""){alert("Please enter your last name.");return false}else{if(getFormFieldValue(b,"acceptTerms")==""){alert("You must accept the terms and conditions in order to sign up.");return false}else{if(getFormFieldValue(b,"addressCountry")==""){alert("Please select your country.");return false}else{if(getFormFieldValue(b,"gender")==""){alert("Please select your gender.");return false}else{if(getFormFieldValue(b,"password")!=getFormFieldValue(b,"password2")){alert("Both passwords must match.");return false}else{var a=getFormFieldValue(b,"password");if(a==null||passwordPattern.exec(a)==null){alert("Password must be at least six characters in length and may contain only numbers and letters.");return false}}}}}}}}return true}function validateForm1(k){var h=Array("gender","yearOfBirth","addressZip","addressCountry");var g=Array("Gender","Year of Birth","Zip/Postal Code","Country");var a="Please complete the following fields:\n\n";var l=a.length;for(var d=0;d<h.length;d++){var c=k.elements[h[d]];if(c){if(c.type==null){var m=false;for(var b=0;b<c.length;b++){if(c[b].checked){m=true}}if(!m){a+=" - "+g[d]+"\n"}continue}switch(c.type){case"select-one":if(c.selectedIndex==-1||c.options[c.selectedIndex].text==""||c.options[c.selectedIndex].text.indexOf("Select")!=-1){a+=" - "+g[d]+"\n"}break;case"select-multiple":if(c.selectedIndex==-1){a+=" - "+g[d]+"\n"}break;case"text":case"textarea":if(c.value==""||c.value==null){a+=" - "+g[d]+"\n"}break;default:}}}if(a.length==l){a="Please enter valid data for the following fields:\n\n";l=a.length;try{if(yearOfBirthPattern.exec(k.elements.yearOfBirth.value)==null){a+=" - Year of Birth\n\nPlease use four numbers, ex. 1979\n\n"}else{if(currentYear-k.elements.yearOfBirth.value<18){a="We are unable to honor your sign-up request at this time. We apologize for the inconvenience."}else{if(currentYear-k.elements.yearOfBirth.value>150){a+=" - The year of birth you entered makes you the oldest living person on earth.\n\nPlease enter your correct year of birth.\n\n"}}}}catch(f){}try{if(zipCodePattern.exec(k.elements.addressZip.value)==null){a+=" - Zip Code\n\nPlease do not include letters, spaces or dashes."}}catch(f){}}if(a.length==l){return checkForAOL(k)}else{alert(a);return false}}function validateForm2(k){var h=Array("name","from");var g=Array("Full Name","Email Address");var a="Please complete the following fields:\n\n";var l=a.length;for(var d=0;d<h.length;d++){var c=k.elements[h[d]];if(c){if(c.type==null){var m=false;for(var b=0;b<c.length;b++){if(c[b].checked){m=true}}if(!m){a+=" - "+g[d]+"\n"}continue}switch(c.type){case"select-one":if(c.selectedIndex==-1||c.options[c.selectedIndex].text==""||c.options[c.selectedIndex].text.indexOf("Select")!=-1){a+=" - "+g[d]+"\n"}break;case"select-multiple":if(c.selectedIndex==-1){a+=" - "+g[d]+"\n"}break;case"text":case"textarea":if(c.value==""||c.value==null){a+=" - "+g[d]+"\n"}break;default:}}}if(a.length==l){a="Please enter valid data for the following fields:\n\n";l=a.length;try{if(emailAddressPattern.exec(k.elements.email.value)==null){a+=" - Email Address\n"}}catch(f){}}if(a.length==l){return checkForAOL(k)}else{alert(a);return false}}function validateContactForm(g){var f=Array("__subject","__message");var e=Array("Topic","Message");var a="Please complete the following required fields:\n\n";var h=a.length;for(var d=0;d<f.length;d++){var c=g.elements[f[d]];if(c){if(c.type==null){var k=false;for(var b=0;b<c.length;b++){if(c[b].checked){k=true}}if(!k){a+=" - "+e[d]+"\n"}continue}switch(c.type){case"select-one":if(c.selectedIndex==-1||c.options[c.selectedIndex].text==""||c.options[c.selectedIndex].text.indexOf("Select")!=-1){a+=" - "+e[d]+"\n"}break;case"select-multiple":if(c.selectedIndex==-1){a+=" - "+e[d]+"\n"}break;case"text":case"textarea":if(c.value==""||c.value==null){a+=" - "+e[d]+"\n"}break;default:}}}if(a.length==h){return true}else{alert(a);return false}}function validateCreditInquiryForm(h){var g=Array("surveyId","evaluationName","accessMethod","orderMethod","orderEmail","orderedProductBeforeSomewhereElse","waited3BusinessDays");var f=Array("Survey ID","Product/Survey Name","How you accessed the survey","How you ordered the product being evaluated","What email address you used when ordering","Whether you orderered the product somewhere else","Whether you have waited 3 business days");var a="Please complete the following required fields/questions:\n\n";var k=a.length;for(var e=0;e<g.length;e++){var d=h.elements[g[e]];if(d){if(d.type==null){var l=false;for(var c=0;c<d.length;c++){if(d[c].checked){l=true}}if(!l){a+=" - "+f[e]+"\n"}continue}switch(d.type){case"select-one":if(d.selectedIndex==-1||d.options[d.selectedIndex].text==""||d.options[d.selectedIndex].text.toLowerCase().indexOf("select")!=-1){a+=" - "+f[e]+"\n"}break;case"select-multiple":if(d.selectedIndex==-1){a+=" - "+f[e]+"\n"}break;case"text":case"textarea":if(d.value==""||d.value==null){a+=" - "+f[e]+"\n"}break;default:}}}var b=h.elements.completionProofPasted.checked||h.elements.completionProofFaxed.checked||h.elements.completionProofMailed.checked;if(a.length==k&&!b){a="Please select how you will be providing proof of completion. You must select at least one method."}if(a.length==k){return true}else{alert(a);return false}}function verifyUser(){var c=(document.location.href.indexOf("paypal=true")!=-1);var b=false;if(c){var a=new Date();a.setTime(a.getTime()+(24*60*60*1000*365));SetCookie("paypal","true",a,"/",null,false)}else{var d=GetCookie("paypal");b=(d!=null&&d=="true")}if(!c&&!b){document.location.href="/"}}function getCookieVal(b){var a=document.cookie.indexOf(";",b);if(a==-1){a=document.cookie.length}return unescape(document.cookie.substring(b,a))}function GetCookie(d){var b=d+"=";var f=b.length;var a=document.cookie.length;var e=0;while(e<a){var c=e+f;if(document.cookie.substring(e,c)==b){return getCookieVal(c)}e=document.cookie.indexOf(" ",e)+1;if(e==0){break}}return null}function SetCookie(c,e){var a=SetCookie.arguments;var h=SetCookie.arguments.length;var b=(2<h)?a[2]:null;var g=(3<h)?a[3]:null;var d=(4<h)?a[4]:null;var f=(5<h)?a[5]:false;document.cookie=c+"="+escape(e)+((b==null)?"":("; expires="+b.toGMTString()))+((g==null)?"":("; path="+g))+((d==null)?"":("; domain="+d))+((f==true)?"; secure":"")}var aolEmailPattern=/^[a-zA-Z0-9_\.\-]+@(aol|aim|netscape|wmconnect|cs).(com|net)$/;function isAOL(a){return(aolEmailPattern.exec(a)!=null)}var _performAOLCheck=false;function checkForAOL(a){if(_performAOLCheck&&isAOL(a.elements.email.value)){alert("ERROR 421: Your email address is currently not supported.\n\n\nAt this time, AOL email addresses are not able to receive survey invitations from Vindale Research. Please specify an email address that does not include @aol.com, @aim.com, @netscape.net, @netscape.com, @wmconnect.com or @cs.com. If you need a free email account, we recommend Yahoo.com");return false}return true}function checkForAOLEmail(a){if(_performAOLCheck&&isAOL(a.value)){}}function getTop(a,b){var c=0;if(a!=null){if(b&&a.offsetParent!=null){c+=getTop(a.offsetParent,b,true)}c+=a.offsetTop}return c}function getLeft(a,b){var c=0;if(a!=null){if(b&&a.offsetParent!=null){c+=getLeft(a.offsetParent,b,true)}c+=a.offsetLeft}return c}function getWidth(a){return a.offsetWidth}function getHeight(a){return a.scrollHeight}function doSubmit(b){if(b!=null){for(var a=0;a<b.elements.length;a++){if(b.elements[a].type=="submit"){b.elements[a].disabled=true}}b.submit()}return true}function checkZipCodePatternError(b){var a=zipCodePatternUS.exec(b);var e=zipCodePatternUK.exec(b);var d=zipCodePatternCA.exec(b);var c=zipCodePatternAU.exec(b);return((a||e||d||c)==null)};
