function setPaymentInfo(isChecked) { with (window.document.frmCheckout) { if (isChecked) { txtPaymentFirstName.value = txtShippingFirstName.value; txtPaymentLastName.value = txtShippingLastName.value; txtPaymentAddress1.value = txtShippingAddress1.value; txtPaymentAddress2.value = txtShippingAddress2.value; txtPaymentPhone.value = txtShippingPhone.value; txtPaymentState.value = txtShippingState.value; txtPaymentCity.value = txtShippingCity.value; txtPaymentPostalCode.value = txtShippingPostalCode.value; /* txtPaymentFirstName.readOnly = true; txtPaymentLastName.readOnly = true; txtPaymentAddress1.readOnly = true; txtPaymentAddress2.readOnly = true; txtPaymentPhone.readOnly = true; txtPaymentState.readOnly = true; txtPaymentCity.readOnly = true; txtPaymentPostalCode.readOnly = true; */ } else { txtPaymentFirstName.readOnly = false; txtPaymentLastName.readOnly = false; txtPaymentAddress1.readOnly = false; txtPaymentAddress2.readOnly = false; txtPaymentPhone.readOnly = false; txtPaymentState.readOnly = false; txtPaymentCity.readOnly = false; txtPaymentPostalCode.readOnly = false; } } } function checkShippingAndPaymentInfo() { with (window.document.frmCheckout) { var str=email.value var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i if (!filter.test(str)){ alert("Please input a valid email address"); return false; } else if (isEmpty(email, 'Enter email address')) { return false; } else if (isEmpty(email2, 'Repeat Email Address')) { return false; } else if (window.document.frmCheckout.email.value != window.document.frmCheckout.email2.value) { alert ("You did not enter the same EMAIL address twice. Please double check the accuracy of your email address."); return false; } else if (isEmpty(pass1, 'Enter password')) { return false; } else if (isEmpty(pass2, 'Repeat password')) { return false; } else if (window.document.frmCheckout.pass1.value.length < 4){ alert ("Password must be at least 4 characters long"); return false; } else if (window.document.frmCheckout.pass1.value != window.document.frmCheckout.pass2.value) { alert ("You did not enter the same password twice. Please re-enter your password."); return false; } else if (isEmpty(txtShippingFirstName, 'Enter first name')) { return false; } else if (isEmpty(txtShippingLastName, 'Enter last name')) { return false; } else if (isEmpty(txtShippingAddress1, 'Enter shipping address')) { return false; } else if (isEmpty(txtShippingPhone, 'Enter phone number')) { return false; } else if (isEmpty(txtShippingState, 'Enter shipping address state')) { return false; } else if (isEmpty(txtShippingCity, 'Enter shipping address city')) { return false; } else if (window.document.frmCheckout.txtShippingPostalCode.value.length < 5){ alert ("Shipping zipcode must be at least 5 digits"); return false; } else if (isEmpty(txtShippingPostalCode, 'Enter the shipping address postal/zip code')) { return false; } else { return true; } } } function editShippingAndPaymentInfo() { with (window.document.updateInfo) { if (isEmpty(email, 'Enter email address')) { return false; } else if (window.document.updateInfo.pass1.value != window.document.updateInfo.pass2.value) { alert ("You did not enter the same password twice. Please re-enter your password."); return false; } else if (isEmpty(txtShippingFirstName, 'Enter first name')) { return false; } else if (isEmpty(txtShippingLastName, 'Enter last name')) { return false; } else if (isEmpty(txtShippingAddress1, 'Enter shipping address')) { return false; } else if (isEmpty(txtShippingPhone, 'Enter phone number')) { return false; } else if (isEmpty(txtShippingState, 'Enter shipping address state')) { return false; } else if (isEmpty(txtShippingCity, 'Enter shipping address city')) { return false; } else if (window.document.updateInfo.txtShippingPostalCode.value.length < 5){ alert ("Shipping zipcode must be at least 5 digits"); return false; } else if (isEmpty(txtShippingPostalCode, 'Enter the shipping address postal/zip code')) { return false; } else if (isEmpty(txtPaymentFirstName, 'Enter billing first name')) { return false; } else if (isEmpty(txtPaymentLastName, 'Enter billing last name')) { return false; } else if (isEmpty(txtPaymentAddress1, 'Enter billing payment address')) { return false; } else if (isEmpty(txtPaymentPhone, 'Enter billing phone number')) { return false; } else if (isEmpty(txtPaymentState, 'Enter billing address state')) { return false; } else if (isEmpty(txtPaymentCity, 'Enter billing address city')) { return false; } else if (window.document.updateInfo.txtPaymentPostalCode.value.length < 5){ alert ("Shipping zipcode must be at least 5 digits"); return false; } else if (isEmpty(txtPaymentPostalCode, 'Enter the billing address postal/zip code')) { return false; } else { return true; } } } /** * phone number validation so fedex doesn't get cranky */ // Declaring required variables var digits = "0123456789"; // non-digit characters which are allowed in phone numbers var phoneNumberDelimiters = "()-. "; // characters which are allowed in international phone numbers // (a leading + is OK) var validWorldPhoneChars = phoneNumberDelimiters + "+"; // Minimum no of digits in an international phone no. var minDigitsInIPhoneNumber = 10; function isInteger(s) { var i; for (i = 0; i < s.length; i++) { // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag) { var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++) { // Check that current character isn't whitespace. var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function checkInternationalPhone(strPhone){ s=stripCharsInBag(strPhone,validWorldPhoneChars); return (isInteger(s) && s.length >= minDigitsInIPhoneNumber); } function ValidatePhone(){ var Phone=document.frmCheckout.txtShippingPhone if ((Phone.value==null)||(Phone.value=="")){ alert("Please Enter your Phone Number") Phone.focus() return false } if (checkInternationalPhone(Phone.value)==false){ alert("Phone Number must be 10 digits") //Phone.value="" Phone.focus() return false } return true }