
var DefaultErrors=$H({'name':$H({"The Name field is blank.":"!field('name').present()",'The Name field appears to be incorrectly formed. ':"!cf_isName($F(field('name')))"}),'firstName':$H({"The First Name field is blank.":"!field('firstName').present()",'The First Name field appears to be incorrectly formed. ':"!cf_isName($F(field('firstName')))"}),'lastName':$H({"The Last Name field is blank.":"!field('lastName').present()",'The Last Name field appears to be incorrectly formed. ':"!cf_isName($F(field('lastName')))"}),'email':$H({'The Email Address field is blank. ':"!field('email').present()",'The Email Address appears to be incorrectly formed. ':"!cf_isEmailAddr($F(field('email')))"}),'sender':$H({'The Email Address field is blank. ':"!field('sender').present()",'The Email Address appears to be incorrectly formed. ':"!cf_isEmailAddr($F(field('sender')))"}),'streetAddress1':$H({'The Address fields are blank. At least one address field needs to be completed.':"!field('streetAddress1').present() && !field('streetAddress2').present()",'The Address Line 1 field appears to be incorrectly formed. ':"!cf_isAddress($F(field('streetAddress1')))"}),'streetAddress2':$H({'The Address Line 2 field appears to be incorrectly formed. ':"field('streetAddress2').present() && !cf_isAddress($F(field('streetAddress2')))"}),'city':$H({'The City field is blank. ':"!field('city').present()",'The City field appears to be incorrectly formed. ':"!cf_isCity($F(field('city')))"}),'state1':$H({'Please select a State from the list. ':"field('state1').selectedIndex == 0 || field('state1').value == -1 "}),'subject':$H({'Please select a Subject from the list. ':"field('subject').selectedIndex == 0"}),'zip':$H({'The Zip Code field is blank. ':"!field('zip').present()",'The Zip Code field appears to be incorrectly formed. ':"!cf_isZip($F(field('zip')))"}),'country1':$H({'Please select a Country from the list. ':"field('country1').selectedIndex == 0"}),'phone':$H({'The Phone field is blank. ':"!field('phone').present()",'The Phone field appears to be incorrectly formed. ':"!cf_isPhone($F(field('phone')))"}),'phoneNumber':$H({'The Phone Number field is blank. ':"!field('phoneNumber').present()",'The Phone Number field appears to be incorrectly formed. ':"!cf_isPhone($F(field('phoneNumber')))"}),'quantity':$H({'The Quantity field may not be zero.':"$F(field('quantity')) == 0",'The Quantity you have entered is not valid. Please enter a positive quantity. ':"!cf_isQuantity($F(field('quantity')))"}),'password':$H({'The Password field is blank. ':"!field('password').present()",'A password may consist of 6-20 letters and/or numbers without spaces. ':"!cf_isPassword($F(field('password')))"}),'newPassword':$H({'The New Password field is blank. ':"!field('newPassword').present()",'A password may consist of 6-20 letters and/or numbers without spaces. ':"field('newPassword').present() && !cf_isPassword($F(field('newPassword')))",'The New Password and Confirm New Password fields must match exactly. ':"field('newPasswordConfirm').present() && $F(field('newPassword')) != $F(field('newPasswordConfirm'))"}),'newPasswordConfirm':$H({'The New Password Confirm field is blank. ':"!field('newPasswordConfirm').present() && field('newPassword').present()"}),'newCreditCardNumber':$H({'The Credit Card Number field is blank. ':" !field('newCreditCardNumber').present() && (!field('newCC') || $F(field('newCC') ) )  ",'The Credit Card Number field may contain 13-17 numbers, with or without spaces. ':"!cf_isCCNumber($F(field('newCreditCardNumber') ) ) && "+"( !field('newCC')|| $F(field('newCC') )  ) "}),'newCreditCardName':$H({'The Cardholder\'s Name field is blank. ':" !field('newCreditCardName').present() &&  ( !field('newCC')  || $F(field('newCC') ) ) ",'The Cardholder\'s Name field appears to be incorrectly formed. ':"!cf_isCCName($F(field('newCreditCardName') ) ) && "+" ( !field('newCC')  || $F(field('newCC') ) ) "}),'message':$H({'The Comment textarea is blank. ':"!field('message').present()","Looks like you have entered a Credit Card number in the Comments or Question field. For security reasons we strongly urge you not to send banking information in an email.":"isCreditCardInfo(formName)"})});var IntlAddressErrors=$H({'name':$H({"The Name field is blank.":"!field('name').present()",'The Name field appears to be incorrectly formed. ':"!cf_isName($F(field('name')))"}),'streetAddress1':$H({'The Address fields are blank. At least one address field needs to be completed.':"!field('streetAddress1').present() && !field('streetAddress2').present()",'The Address Line 1 field appears to be incorrectly formed. ':"!cf_isAddress($F(field('streetAddress1')))"}),'streetAddress2':$H({'The Address Line 2 field appears to be incorrectly formed. ':"field('streetAddress2').present() && !cf_isAddress($F(field('streetAddress2')))"}),'city':$H({'The City field is blank. ':"!field('city').present()",'The City field appears to be incorrectly formed. ':"!cf_isCity($F(field('city')))"}),'country1':$H({'Please select a Country from the list. ':"field('countryDropDown').selectedIndex == 0 "}),'phone':$H({'The Phone field is blank. ':"!field('phone').present()"})});function checkform(formName){var errorList=new Array();errorDisplay=$('clientSideError');errorMessage=$('errorList');if(!document.getElementById||!document.createTextNode){return;}
var errorID='errorMessage';var errorClass='errorText';var errorMsg='Please correct the error below: ';var errorImg='/images/global/alert.gif';var errorAlt='Error';var errorTitle='This field has an error!';if(errorMessage){$(errorMessage).update();}
document.getElementsByClassName(errorClass).map(Element.extend).invoke('removeClassName',errorClass);document.getElementsByClassName('errorIcon').map(Element.extend).invoke('remove');var result=false;var errs=(typeof Errors!='undefined'&&Errors)?Errors:DefaultErrors;if($('intlRadioBtn')&&$('intlRadioBtn').checked)
errs=IntlAddressErrors;errs.each(function(elem){if(elem.key=='_strip'){$A(elem.value).each(function(el){field(el).value=field(el).value.strip();});}
else{var el=field(elem.key);if(el){if(!el.hasClassName("doNotValidate")){$H(elem.value).each(function(err){if(eval(err.value)){errorList.push(err.key);markInvalid(elem.key,errorList[errorList.length-1]);throw $break;}});}}}});if(errorList.length){displayErrors(errorList,errorMessage,errorDisplay);}
return(errorList.length==0);function field(fieldName){if(formName!=''&&$(formName+':'+fieldName))return $(formName+':'+fieldName);else if(document.forms[formName].elements[fieldName])return document.forms[formName].elements[fieldName];return $(fieldName);}
function markInvalid(element,errText){Element.addClassName(field(element),errorClass);var errIcon=$('err'+element);if(errIcon){var errorIcon=document.createElement('img');errorIcon.alt=errText;errorIcon.title=errText;errorIcon.src=errorImg;errorIcon.className='errorIcon';errIcon.appendChild(errorIcon);}}
function displayErrors(errors,errorMessage,errorDisplay){errors.each(function(errString){var li=document.createElement('li');li.appendChild(document.createTextNode(errString));errorMessage.appendChild(li);});errorDisplay.style.display='block';}
function isBrowserSafari(){if(navigator.userAgent.indexOf('Safari')!=-1){return true;}
return false;}
function cf_isName(str){if(isBrowserSafari()){return str.match(/^[a-zA-Z'\-.,\#]{0,}[a-zA-Z0-9'\-.,\#\s]+$/);}
return str.match(/^[a-zA-Z'.\-\u0080-\uFFFF]{1,}[a-zA-Z0-9'.\-\u0080-\uFFFF\s]+$/);}
function cf_isEmailAddr(str){return str.match(/^[^\]\[()<>+@,;:\\"]+@([^\]\[()<>+@,;:\\".]+\.)+(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/);}
function cf_isAddress(str){if(isBrowserSafari()){return str.match(/^[a-zA-Z0-9'\-.,\#\/]{0,}[a-zA-Z0-9'\-.,\#\/\s]+$/);}
return str.match(/^[a-zA-Z0-9'\-.,\#\/\u0080-\uFFFF]{0,}[a-zA-Z0-9'\-.,\#\/\u0080-\uFFFF\s]+$/);}
function cf_isCity(str){if(isBrowserSafari()){return str.match(/^[a-zA-Z0-9'\-.,\#]{1,}[a-zA-Z0-9'\-.,\#\s]+$/);}
return str.match(/^[a-zA-Z0-9'\-.,\#\u0080-\uFFFF]{1,}[a-zA-Z0-9'\-.,\#\u0080-\uFFFF\s]+$/);}
function cf_isZip(str){return str.match(/(^\d{5}$)|(^\d{5}(-|\s|\+)\d{4}$)/);}
function cf_isPhone(str){return str.match(/^\(?\d{3}\)?[\s\-.]*\d{3}[\s\-.]*\d{4}(\s*[x]\s*\d*)?$/);}
function cf_isPassword(str){return str.match(/^[a-zA-Z0-9\/\.]{6,20}$/);}
function cf_isPasswordForCReps(str){return str.match(/^.{6,1024}$/);}
function cf_isCCNumber(str){return str.match(/^[0-9\s]{13,19}$/);}
function cf_isCCName(str){if(isBrowserSafari()){return str.match(/^[a-zA-Z'.\-][a-zA-Z0-9.'\-\s]+$/);}
return str.match(/^[a-zA-Z'.\-\u0080-\uFFFF][a-zA-Z0-9.'\-\u0080-\uFFFF\s]+$/);}
function cf_isQuantity(str){return str.match(/^[\d]{1,2}$/);}
function cf_isEmailAddrList(str){var addrArray=str.split(/\s*,\s*/);if(!addrArray||addrArray.length==0)return false;for(var i=0;i<addrArray.length;i++){if(!cf_isEmailAddr(addrArray[i]))return false;}
return true;}
return true;}
function cf_set(fieldName,fieldValue){if($(fieldName)&&fieldValue){$(fieldName).value=fieldValue;return true;}
return false;}
function loadItemQuantity(){var qtyIndex='qty';$(qtyIndex).value=1;}
function checkPaymentPlan(formName){var result=true;var theForm=document.forms[formName];var radioButtons=theForm.elements['selectedCC'];for(var i=0;i<radioButtons.length;i++){if(radioButtons[i].checked){if(radioButtons[i].value=='NewCard'){result=checkform(formName);}}}
return result;}
function trapEnter(){}
function checkAddressForm(formName){if($('intlRadioBtn')&&$('intlRadioBtn').checked){$('country1').value=$('countryDropDown').value;$('state1').value=$('stateTextBox').value;}else if($('usRadioBtn')&&$('usRadioBtn').checked){$('country1').value=$('domesticCountryName').innerHTML;$('state1').value=$('stateDropDown').value;}
if(checkform(formName)){if($('intlRadioBtn')&&!$('intlRadioBtn').checked){var voice=document.getElementById(formName).phone.value;voice=removeDashes(voice);voice=voice.substring(0,3)+"-"+voice.substring(3,voice.length);voice=voice.substring(0,7)+"-"+voice.substring(7,voice.length);document.getElementById(formName).phone.value=voice;}}else{return false;}}
function removeDashes(voice){index=voice.indexOf("-");result="";if(index!=-1){result+=voice.substring(0,index)+removeDashes(voice.substring(index+1));}else{return voice;}
return result;}
function checkGiftMessage(formId,giftMessageName){var giftMessages=Element.getElementsByClassName(formId,giftMessageName);giftMessages.each(function(messageField){newMessage=messageField.value.stripScripts().stripTags();giftMessages[giftMessages.indexOf(messageField)].value=newMessage;});return true;}
function checkformContactUs(formName){Errors=$H({'_strip':['message'],'message':$H({"Looks like you have entered a Credit Card number in the Comments or Question field. For security reasons we strongly urge you not to send banking information in an email.":"isCreditCardInfo(formName)"})});return checkform(formName);}
function isCreditCardInfo(formName){var message=$('message').value;message=message.replace(/\s/g,"");var regex1=/^\d{4}\d{4}\d{4}\d{4}/;var regex2=/^\d{4}-\d{4}-\d{4}-\d{4}/;return(regex1.test(message)||regex2.test(message));}