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; txtPaymentState.value = txtShippingState.value; txtPaymentCity.value = txtShippingCity.value; txtPaymentPostalCode.value = txtShippingPostalCode.value; txtPaymentPhone1.value = txtShippingPhone1.value; txtPaymentPhone2.value = txtShippingPhone2.value; txtPaymentPhone3.value = txtShippingPhone3.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; txtPaymentState.readOnly = false; txtPaymentCity.readOnly = false; txtPaymentPostalCode.readOnly = false; txtPaymentPhone1.readOnly = false; txtPaymentPhone2.readOnly = false; txtPaymentPhone3.readOnly = false; } } } function checkShippingAndPaymentInfo(form) { var str=form.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(form.email, 'Enter email address')) { return false; } else if (isEmpty(form.email2, 'Repeat Email Address')) { return false; } else if (form.email.value != form.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(form.pass1, 'Enter password')) { return false; } else if (isEmpty(form.pass2, 'Repeat password')) { return false; } else if (form.pass1.value.length < 4){ alert ("Password must be at least 4 characters long"); return false; } else if (form.pass1.value != form.pass2.value) { alert ("You did not enter the same password twice. Please re-enter your password."); return false; } else if (form.txtShippingFirstName.value.length < 1) { alert ("Enter first name."); return false; } else if (form.txtShippingLastName.value.length < 1) { alert ("Enter last name."); return false; } else if (form.txtShippingAddress1.value.length < 1) { alert ("Enter shipping address"); return false; } else if (form.txtShippingCity.value.length < 1) { alert ("Enter shipping address city"); return false; //} else if (isEmpty(form.txtShippingState, 'Enter shipping address state')) { // return false; } else if (form.txtShippingPostalCode.value.length != 5){ alert ("Shipping zipcode must be 5 digits"); return false; } else if (form.txtShippingPhone1.value.length < 3 || form.txtShippingPhone2.value.length < 3 || form.txtShippingPhone3.value.length < 4 ) { alert ("Enter phone number"); return false; //} else if (isEmpty(form.txtShippingPhone2, 'Enter phone number')) { //return false; //} else if (isEmpty(form.txtShippingPhone3, 'Enter phone number')) { //return false; //} else if (isEmpty(form.txtShippingPostalCode, 'Enter the shipping address postal/zip code')) { //return false; } else if (form.txtPaymentFirstName.value.length < 1) { alert ("Enter billing first name."); return false; } else if (form.txtPaymentLastName.value.length < 1) { alert ("Enter billing last name."); return false; } else if (form.txtPaymentAddress1.value.length < 1) { alert ("Enter billing payment address."); return false; //} else if (isEmpty(form.txtPaymentState, 'Enter billing address state')) { //return false; } else if (form.txtPaymentCity.value.length < 1) { alert ("Enter billing address city."); return false; } else if (form.txtPaymentPostalCode.value.length != 5){ alert ("Billing zipcode must be 5 digits"); return false; //} else if (isEmpty(form.txtPaymentPostalCode, 'Enter the billing address postal/zip code')) { //return false; } else if (form.txtPaymentPhone1.value.length < 3 || form.txtPaymentPhone2.value.length < 3 || form.txtPaymentPhone3.value.length < 4 ) { alert ("Enter billing phone number"); return false; //} else if (isEmpty(form.txtPaymentPhone1, 'Enter billing phone number')) { //return false; //} else if (isEmpty(form.txtPaymentPhone2, 'Enter billing phone number')) { //return false; //} else if (isEmpty(form.txtPaymentPhone3, 'Enter billing phone number')) { //return false; } else { return true; } } function editShippingAndPaymentInfo(form) { if (isEmpty(form.email, 'Enter email address')) { return false; } else if (form.pass1.value != form.pass2.value) { alert ("You did not enter the same password twice. Please re-enter your password."); return false; } else if (isEmpty(form.txtShippingFirstName, 'Enter first name')) { return false; } else if (isEmpty(form.txtShippingLastName, 'Enter last name')) { return false; } else if (isEmpty(form.txtShippingAddress1, 'Enter shipping address')) { return false; } else if (isEmpty(form.txtShippingPhone1, 'Enter phone number')) { return false; } else if (isEmpty(form.txtShippingPhone2, 'Enter phone number')) { return false; } else if (isEmpty(form.txtShippingPhone3, 'Enter phone number')) { return false; } else if (isEmpty(form.txtShippingState, 'Enter shipping address state')) { return false; } else if (isEmpty(form.txtShippingCity, 'Enter shipping address city')) { return false; } else if (form.txtShippingPostalCode.value.length != 5){ alert ("Shipping zipcode must be 5 digits"); return false; } else if (isEmpty(form.txtShippingPostalCode, 'Enter the shipping address postal/zip code')) { return false; } else if (isEmpty(form.txtPaymentFirstName, 'Enter billing first name')) { return false; } else if (isEmpty(form.txtPaymentLastName, 'Enter billing last name')) { return false; } else if (isEmpty(form.txtPaymentAddress1, 'Enter billing payment address')) { return false; } else if (isEmpty(form.txtPaymentPhone1, 'Enter billing phone number')) { return false; } else if (isEmpty(form.txtPaymentPhone2, 'Enter billing phone number')) { return false; } else if (isEmpty(form.txtPaymentPhone3, 'Enter billing phone number')) { return false; } else if (isEmpty(form.txtPaymentState, 'Enter billing address state')) { return false; } else if (isEmpty(form.txtPaymentCity, 'Enter billing address city')) { return false; } else if (form.txtPaymentPostalCode.value.length != 5){ alert ("Shipping zipcode must be 5 digits"); return false; } else if (isEmpty(form.txtPaymentPostalCode, 'Enter the billing address postal/zip code')) { return false; } else { return true; } } function editPaymentInfoOnly(form) { if (isEmpty(form.txtPaymentFirstName, 'Enter billing first name')) { return false; } else if (isEmpty(form.txtPaymentLastName, 'Enter billing last name')) { return false; } else if (isEmpty(form.txtPaymentAddress1, 'Enter billing payment address')) { return false; } else if (isEmpty(form.txtPaymentPhone1, 'Enter billing phone number')) { return false; } else if (isEmpty(form.txtPaymentPhone2, 'Enter billing phone number')) { return false; } else if (isEmpty(form.txtPaymentPhone3, 'Enter billing phone number')) { return false; } else if (isEmpty(form.txtPaymentState, 'Enter billing address state')) { return false; } else if (isEmpty(form.txtPaymentCity, 'Enter billing address city')) { return false; } else if (form.txtPaymentPostalCode.value.length != 5){ alert ("Shipping zipcode must be 5 digits"); return false; } else if (isEmpty(form.txtPaymentPostalCode, 'Enter the billing address postal/zip code')) { return false; } else { return true; } } function editShippingInfoOnly(form) { if (isEmpty(form.txtShippingFirstName, 'Enter first name')) { return false; } else if (isEmpty(form.txtShippingLastName, 'Enter last name')) { return false; } else if (isEmpty(form.txtShippingAddress1, 'Enter shipping address')) { return false; } else if (isEmpty(form.txtShippingPhone1, 'Enter phone number')) { return false; } else if (isEmpty(form.txtShippingPhone2, 'Enter phone number')) { return false; } else if (isEmpty(form.txtShippingPhone3, 'Enter phone number')) { return false; } else if (isEmpty(form.txtShippingState, 'Enter shipping address state')) { return false; } else if (isEmpty(form.txtShippingCity, 'Enter shipping address city')) { return false; } else if (form.txtShippingPostalCode.value.length != 5){ alert ("Shipping zipcode must be 5 digits"); return false; } else if (isEmpty(form.txtShippingPostalCode, 'Enter the shipping 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 }