var rqs = "" //---------------------------------------------------------------------------------------------------- function shipsubmit() { // insurance if (document.frmIns.isinsured[0].checked == true) { document.frm_ship.isinsured.value="yes"; } else { document.frm_ship.isinsured.value="no"; } if (document.frmGS.isguarship[0].checked == true) { document.frm_ship.isguarship.value="yes"; } else { document.frm_ship.isguarship.value="no"; } document.frm_ship.billing_firstname.value=document.frm_Info.billing_firstname.value; document.frm_ship.billing_lastname.value=document.frm_Info.billing_lastname.value; document.frm_ship.email_address.value=document.frm_Info.email_address.value; document.frm_ship.billing_address1.value=document.frm_Info.billing_address1.value; document.frm_ship.billing_address2.value=document.frm_Info.billing_address2.value; document.frm_ship.billing_city.value=document.frm_Info.billing_city.value; document.frm_ship.billing_state.value=document.frm_Info.billing_state.value; document.frm_ship.billing_country.value=document.frm_Info.billing_country.value; document.frm_ship.billing_zip.value=document.frm_Info.billing_zip.value; document.frm_ship.billing_phone.value=document.frm_Info.billing_phone.value; document.frm_ship.shipping_firstname.value=document.frm_Info.shipping_firstname.value; document.frm_ship.shipping_lastname.value=document.frm_Info.shipping_lastname.value; document.frm_ship.shipping_company.value=document.frm_Info.shipping_company.value; document.frm_ship.shipping_address1.value=document.frm_Info.shipping_address1.value; document.frm_ship.shipping_address2.value=document.frm_Info.shipping_address2.value; document.frm_ship.shipping_city.value=document.frm_Info.shipping_city.value; document.frm_ship.shipping_state.value=document.frm_Info.shipping_state.value; document.frm_ship.shipping_country.value=document.frm_Info.shipping_country.value; document.frm_ship.shipping_zip.value=document.frm_Info.shipping_zip.value; document.frm_ship.shipping_phone.value=document.frm_Info.shipping_phone.value; document.frm_ship.card_type.value=document.frm_Paymentinfo.card_type.value; document.frm_ship.card_number.value=document.frm_Paymentinfo.card_number.value; document.frm_ship.cvv2.value=document.frm_Paymentinfo.cvv2.value; document.frm_ship.card_month.value=document.frm_Paymentinfo.card_month.value; document.frm_ship.card_year.value=document.frm_Paymentinfo.card_year.value; document.frm_ship.couponcode.value = document.frm_Coupon.couponcode.value; document.frm_ship.couponcode_new.value = document.frm_Coupon.couponcode.value; // gift cert if (document.frm_Giftcard.storeid.value != -1) { if (document.frm_Giftcard.storeid[0].checked == true) { document.frm_ship.storeid.value="Barnes & Noble"; } if (document.frm_Giftcard.storeid[1].checked == true) { document.frm_ship.storeid.value="Best Buy"; } if (document.frm_Giftcard.storeid[2].checked == true) { document.frm_ship.storeid.value="Gap"; } if (document.frm_Giftcard.storeid[3].checked == true) { document.frm_ship.storeid.value="Home Depot"; } if (document.frm_Giftcard.storeid[4].checked == true) { document.frm_ship.storeid.value="Staples"; } if (document.frm_Giftcard.storeid[5].checked == true) { document.frm_ship.storeid.value="Target"; } if (document.frm_Giftcard.storeid[6].checked == true) { document.frm_ship.storeid.value="WalMart"; } } if (document.frm_Info.sameasbilling[0].checked == true) { document.frm_ship.sameasbilling.value = "yes"; } else { document.frm_ship.sameasbilling.value = "no"; } document.frm_ship.submit(); } function countrychange(country) { if (document.frm_Info.billing_country.value!="US" && document.frm_Info.sameasbilling[0].checked == true) { document.frm_Info.sameasbilling[0].checked = false; document.frm_Info.sameasbilling[1].checked = true; checkboxchange(); } else { document.frm_Info.sameasbilling[0].checked = true; document.frm_Info.sameasbilling[1].checked = false; checkboxchange(); } } function statechange(statevar) { shipsubmit(); } function choosecctype(ccnumber) { if (ccnumber.substring(0,1)=="4") { document.frm_Paymentinfo.card_type.value="V"; } if (ccnumber.substring(0,1)=="5") { document.frm_Paymentinfo.card_type.value="M"; } if (ccnumber.substring(0,1)=="6") { document.frm_Paymentinfo.card_type.value="D"; } if (ccnumber.substring(0,1)=="3") { document.frm_Paymentinfo.card_type.value="A"; } } function readterms() { document.getElementById('divterms').style.position = "static"; document.getElementById('divterms').style.visibility = "visible"; } function confirmpage(actionvar) { if (actionvar=="open") { if (document.frm_Info.billing_firstname.value!="" && document.frm_Info.billing_lastname.value!="" && document.frm_Info.billing_address1.value!="" && document.frm_Info.billing_city.value!="" && document.frm_Info.billing_state.value!="" && document.frm_Info.billing_zip.value!="") { document.getElementById('confirmpage').style.position = "static"; document.getElementById('confirmpage').style.visibility = "visible"; var billConfirm = "" var shipConfirm = "" billConfirm = document.frm_Info.billing_firstname.value + " " + document.frm_Info.billing_lastname.value + "\n"; billConfirm += document.frm_Info.billing_address1.value + "\n"; if (document.frm_Info.billing_address2.value.length>2) billConfirm += document.frm_Info.billing_address2.value + "\n"; billConfirm += document.frm_Info.billing_city.value + ' ' + document.frm_Info.billing_state.value + ' ' + document.frm_Info.billing_zip.value + "\n"; billConfirm += document.frm_Info.billing_country.value + "\n"; shipConfirm = document.frm_Info.shipping_firstname.value + " " + document.frm_Info.shipping_lastname.value + "\n"; if (document.frm_Info.shipping_company.value.length>2) shipConfirm += document.frm_Info.shipping_company.value + "\n"; shipConfirm += document.frm_Info.shipping_address1.value + "\n"; if (document.frm_Info.shipping_address2.value>2) shipConfirm += document.frm_Info.shipping_address2.value + "\n"; shipConfirm += document.frm_Info.shipping_city.value + ' ' + document.frm_Info.shipping_state.value + ' ' + document.frm_Info.shipping_zip.value + "\n"; shipConfirm += document.frm_Info.shipping_country.value + "\n"; document.frm_Questions.confirmbilling.value = billConfirm if (document.frm_Info.sameasbilling[0].checked==true) { document.frm_Questions.confirmshipping.value = billConfirm } else { document.frm_Questions.confirmshipping.value = shipConfirm } } else { alert('Please fill in required fields'); } } else { document.getElementById('confirmpage').style.position = "absolute"; document.getElementById('confirmpage').style.visibility = "hidden"; } } function shoppedhere(yesnovar) { if (yesnovar=="Yes") { document.getElementById('divfrequent').style.position = "static"; document.getElementById('divfrequent').style.visibility = "visible"; document.getElementById('divfrequent1').style.position = "absolute"; document.getElementById('divfrequent1').style.visibility = "hidden"; } else { document.getElementById('divfrequent').style.position = "absolute"; document.getElementById('divfrequent').style.visibility = "hidden"; document.getElementById('divfrequent1').style.position = "absolute"; document.getElementById('divfrequent1').style.visibility = "hidden"; document.getElementById('divfrequent2').style.position = "static"; document.getElementById('divfrequent2').style.visibility = "visible"; } } function checkboxchange() { if (document.frm_Info.sameasbilling[0].checked == true) { document.frm_Questions.sameasbilling.value="yes"; } else { document.frm_Questions.sameasbilling.value="no"; } // if ((document.frm_Info.billing_firstname.value == "") || (document.frm_Info.billing_lastname.value == "") || (document.frm_Info.billing_address1.value == "") || (document.frm_Info.billing_city.value == "") || (document.frm_Info.billing_state.value == "") || (document.frm_Info.billing_zip.value == "")) // { // d_validate() // } if (document.frm_Info.sameasbilling[0].checked == true) { document.getElementById('divshipping').style.position = "absolute"; document.getElementById('divshipping').style.visibility = "hidden"; document.frm_Info.shipping_firstname.value=document.frm_Info.billing_firstname.value document.frm_Info.shipping_lastname.value=document.frm_Info.billing_lastname.value document.frm_Info.shipping_address1.value=document.frm_Info.billing_address1.value document.frm_Info.shipping_address2.value=document.frm_Info.billing_address2.value document.frm_Info.shipping_city.value=document.frm_Info.billing_city.value document.frm_Info.shipping_state.value=document.frm_Info.billing_state.value document.frm_Info.shipping_zip.value=document.frm_Info.billing_zip.value document.frm_Info.shipping_country.value=document.frm_Info.billing_country.value document.frm_Info.shipping_phone.value=document.frm_Info.billing_phone.value //statechange(document.frm_Info.billing_state.value) } else if (document.frm_Info.sameasbilling[1].checked == true) { document.getElementById('divshipping').style.position = "static"; document.getElementById('divshipping').style.visibility = "visible"; document.frm_Info.shipping_firstname.value="" document.frm_Info.shipping_lastname.value="" document.frm_Info.shipping_address1.value="" document.frm_Info.shipping_address2.value="" document.frm_Info.shipping_city.value="" document.frm_Info.shipping_state.value="" document.frm_Info.shipping_zip.value="" // document.frm_Info.shipping_country.value=document.frm_Info.billing_country.value; // was US document.frm_Info.shipping_phone.value="" //statechange(document.frm_Info.shipping_state.value) } // INTLSHIP_checkboxchange(); } function applyCode() { updateTotal(); } function updateTotal() { if (document.frmIns.isinsured[0].checked == true) { document.frm_Cart.isinsured.value="yes"; } if (document.frmGS.isguarship[0].checked == true) { document.frm_Cart.isguarship.value="yes"; } document.frm_Cart.billing_firstname.value=document.frm_Info.billing_firstname.value; document.frm_Cart.billing_lastname.value=document.frm_Info.billing_lastname.value; document.frm_Cart.email_address.value=document.frm_Info.email_address.value; document.frm_Cart.billing_address1.value=document.frm_Info.billing_address1.value; document.frm_Cart.billing_address2.value=document.frm_Info.billing_address2.value; document.frm_Cart.billing_city.value=document.frm_Info.billing_city.value; document.frm_Cart.billing_state.value=document.frm_Info.billing_state.value; document.frm_Cart.billing_country.value=document.frm_Info.billing_country.value; document.frm_Cart.billing_zip.value=document.frm_Info.billing_zip.value; document.frm_Cart.billing_phone.value=document.frm_Info.billing_phone.value; document.frm_Cart.shipping_firstname.value=document.frm_Info.shipping_firstname.value; document.frm_Cart.shipping_lastname.value=document.frm_Info.shipping_lastname.value; document.frm_Cart.shipping_company.value=document.frm_Info.shipping_company.value; document.frm_Cart.shipping_address1.value=document.frm_Info.shipping_address1.value; document.frm_Cart.shipping_address2.value=document.frm_Info.shipping_address2.value; document.frm_Cart.shipping_city.value=document.frm_Info.shipping_city.value; document.frm_Cart.shipping_state.value=document.frm_Info.shipping_state.value; document.frm_Cart.shipping_country.value=document.frm_Info.shipping_country.value; document.frm_Cart.shipping_zip.value=document.frm_Info.shipping_zip.value; document.frm_Cart.shipping_phone.value=document.frm_Info.shipping_phone.value; document.frm_Cart.card_type.value=document.frm_Paymentinfo.card_type.value; document.frm_Cart.card_number.value=document.frm_Paymentinfo.card_number.value; document.frm_Cart.cvv2.value=document.frm_Paymentinfo.cvv2.value; document.frm_Cart.card_month.value=document.frm_Paymentinfo.card_month.value; document.frm_Cart.card_year.value=document.frm_Paymentinfo.card_year.value; document.frm_Cart.sameasbilling.value = document.frm_Questions.sameasbilling.value; document.frm_Cart.storeid.value=document.frm_Giftcard.storeid.value; document.frm_Cart.couponcode.value = document.frm_Coupon.couponcode.value; document.frm_Cart.couponcode_new.value = document.frm_Coupon.couponcode.value; document.frm_Cart.submit(); } function INSURE_checkboxchange() { shipsubmit(); } function GUARSHIP_checkboxchange() { shipsubmit(); } function INTLSHIP_checkboxchange() { document.getElementById('divshipdom').style.position = "static"; document.getElementById('divshipdom').style.visibility = "visible"; document.getElementById('divshipintl').style.position = "absolute"; document.getElementById('divshipintl').style.visibility = "hidden"; document.getElementById('divinsure').style.position = "absolute"; document.getElementById('divinsure').style.visibility = "hidden"; // document.getElementById('divguarship').style.position = "absolute"; // document.getElementById('divguarship').style.visibility = "hidden"; if (document.frm_ship.isshipdom[0].checked == true) { document.getElementById('divshipdom').style.position = "static"; document.getElementById('divshipdom').style.visibility = "visible"; document.getElementById('divinsure').style.position = "static"; document.getElementById('divinsure').style.visibility = "visible"; // document.getElementById('divguarship').style.position = "static"; // document.getElementById('divguarship').style.visibility = "visible"; document.frmGS.isguarship[0].checked = false; document.frmGS.isguarship[1].checked = true; document.getElementById('divshipintl').style.position = "absolute"; document.getElementById('divshipintl').style.visibility = "hidden"; document.frm_Info.shipping_firstname.value=document.frm_Info.billing_firstname.value document.frm_Info.shipping_lastname.value=document.frm_Info.billing_lastname.value document.frm_Info.shipping_address1.value=document.frm_Info.billing_address1.value document.frm_Info.shipping_address2.value=document.frm_Info.billing_address2.value document.frm_Info.shipping_city.value=document.frm_Info.billing_city.value document.frm_Info.shipping_state.value=document.frm_Info.billing_state.value document.frm_Info.shipping_zip.value=document.frm_Info.billing_zip.value document.frm_Info.shipping_country.value=document.frm_Info.billing_country.value document.frm_Info.shipping_phone.value=document.frm_Info.billing_phone.value document.frm_Info.couponcode.value = document.frm_Coupon.couponcode.value; document.frm_Info.couponcode_new.value = document.frm_Coupon.couponcode.value; // statechange(document.frm_ship.billing_state.value) shipsubmit(); } else if (document.frm_ship.isshipdom[1].checked == true) { document.getElementById('divshipintl').style.position = "static"; document.getElementById('divshipintl').style.visibility = "visible"; document.getElementById('divinsure').style.position = "static"; document.getElementById('divinsure').style.visibility = "visible"; document.getElementById('divshipdom').style.position = "absolute"; document.getElementById('divshipdom').style.visibility = "hidden"; // document.getElementById('divguarship').style.position = "absolute"; // document.getElementById('divguarship').style.visibility = "hidden"; document.frm_Info.shipping_firstname.value="" document.frm_Info.shipping_lastname.value="" document.frm_Info.shipping_address1.value="" document.frm_Info.shipping_address2.value="" document.frm_Info.shipping_city.value="" document.frm_Info.shipping_state.value="" document.frm_Info.shipping_zip.value="" // document.frm_Info.shipping_country.value=document.frm_Info.billing_country.value; // was US document.frm_Info.shipping_phone.value="" document.frm_Info.couponcode.value = document.frm_Coupon.couponcode.value; document.frm_Info.couponcode_new.value = document.frm_Coupon.couponcode.value; // statechange(document.frm_ship.shipping_state.value) shipsubmit(); } } function upop2(var1,var2) { window.open(var1,var2,'width=450,height=450,scrollbars=yes,resizable=no'); } function FrequentShopper() { var errormessage="" var errorcolor="#FCFCC2" var normalcolor="#FFFFFF" if (document.frm_Frequent.email_address.value.length < 5) { errormessage= errormessage + "ˇEmail Address Blank\n" ; document.frm_Frequent.email_address.style.backgroundColor=errorcolor; } else document.frm_Frequent.email_address.style.backgroundColor=normalcolor if (document.frm_Frequent.email_address.value.length < 5) { document.frm_Frequent.email_address.focus() ; } if (!errormessage=="") { var errormessage2="Fields Missing\n\n" errormessage = errormessage2 + errormessage alert(errormessage) return false } return true; } function CheckNum(cardnum) { if (cardnum == "1724999999991234") { return 1; } if (cardnum == '') { return 0; } if (isNaN(cardnum)) { return 0; } if (!CheckLUHN(cardnum)) { return 0; } return 1; } function CheckLUHN(cardnum) { var RevNum = new String(cardnum); RevNum = Reverse(RevNum); var total = new Number(0); for ( var i = 0; i < RevNum.length; i += 1 ) { var temp = 0; if (i % 2) { temp = RevNum.substr(i, 1) * 2; if (temp >= 10) { var splitstring = new String(temp); temp = parseInt(splitstring.substr(0, 1)) + parseInt(splitstring.substr(1, 1)); } } else { temp = RevNum.substr(i, 1); } total += parseInt(temp); } // if there's no remainder, we return 1 (true) return (total % 10) ? 0 : 1; } function Reverse(strToReverse) { var strRev = new String; var i = strToReverse.length; while (i--) { strRev += strToReverse.charAt(i); } return strRev; } //------------------------------------------------- function d_validate() { var errormessage="" var errorcolor="#FCFCC2" var normalcolor="#FFFFFF" // GETTING ALL THE CORRECT VALUES BEFORE CHECKING OUT document.frm_Questions.billing_firstname.value=document.frm_Info.billing_firstname.value; document.frm_Questions.billing_lastname.value=document.frm_Info.billing_lastname.value; document.frm_Questions.email_address.value=document.frm_Info.email_address.value; document.frm_Questions.billing_address1.value=document.frm_Info.billing_address1.value; document.frm_Questions.billing_address2.value=document.frm_Info.billing_address2.value; document.frm_Questions.billing_city.value=document.frm_Info.billing_city.value; document.frm_Questions.billing_state.value=document.frm_Info.billing_state.value; document.frm_Questions.billing_country.value=document.frm_Info.billing_country.value; document.frm_Questions.billing_zip.value=document.frm_Info.billing_zip.value; document.frm_Questions.billing_phone.value=document.frm_Info.billing_phone.value; document.frm_Questions.shipping_firstname.value=document.frm_Info.shipping_firstname.value; document.frm_Questions.shipping_lastname.value=document.frm_Info.shipping_lastname.value; document.frm_Questions.shipping_company.value=document.frm_Info.shipping_company.value; document.frm_Questions.shipping_address1.value=document.frm_Info.shipping_address1.value; document.frm_Questions.shipping_address2.value=document.frm_Info.shipping_address2.value; document.frm_Questions.shipping_city.value=document.frm_Info.shipping_city.value; document.frm_Questions.shipping_state.value=document.frm_Info.shipping_state.value; document.frm_Questions.shipping_country.value=document.frm_Info.shipping_country.value; document.frm_Questions.shipping_zip.value=document.frm_Info.shipping_zip.value; document.frm_Questions.shipping_phone.value=document.frm_Info.shipping_phone.value; document.frm_Questions.card_type.value=document.frm_Paymentinfo.card_type.value; document.frm_Questions.card_number.value=document.frm_Paymentinfo.card_number.value; document.frm_Questions.cvv2.value=document.frm_Paymentinfo.cvv2.value; document.frm_Questions.card_month.value=document.frm_Paymentinfo.card_month.value; document.frm_Questions.card_year.value=document.frm_Paymentinfo.card_year.value; // START OF VALIDATING BASIC FIELDS if (document.frm_Info.billing_firstname.value.length < 1) { errormessage= errormessage + "ˇBilling First Name\n" ; document.frm_Info.billing_firstname.style.backgroundColor=errorcolor; } else document.frm_Info.billing_firstname.style.backgroundColor=normalcolor if (document.frm_Info.billing_lastname.value.length < 2) { errormessage= errormessage + "ˇBilling Last Name\n" ; document.frm_Info.billing_lastname.style.backgroundColor=errorcolor; } else document.frm_Info.billing_lastname.style.backgroundColor=normalcolor if (document.frm_Info.email_address.value.length >= 5) { if ((document.frm_Info.email_address.value.indexOf("@") == -1 ) || (document.frm_Info.email_address.value.indexOf(".") == -1 )) { errormessage= errormessage + "ˇInvalid Email Address\n" ; document.frm_Info.email_address.style.backgroundColor=errorcolor; } else document.frm_Info.email_address.style.backgroundColor=normalcolor } if (document.frm_Info.email_address.value.length < 5) { errormessage= errormessage + "ˇEmail Address\n" ; document.frm_Info.email_address.style.backgroundColor=errorcolor; } else document.frm_Info.email_address.style.backgroundColor=normalcolor if (document.frm_Info.billing_address1.value.length < 3) { errormessage= errormessage + "ˇBilling Address\n" ; document.frm_Info.billing_address1.style.backgroundColor=errorcolor; } else document.frm_Info.billing_address1.style.backgroundColor=normalcolor if (document.frm_Info.billing_city.value.length < 3) { errormessage= errormessage + "ˇBilling City\n" ; document.frm_Info.billing_city.style.backgroundColor=errorcolor; } else document.frm_Info.billing_city.style.backgroundColor=normalcolor if (document.frm_Info.billing_state.value=="select") { errormessage= errormessage + "ˇBilling State\n" ; document.frm_Info.billing_state.style.backgroundColor=errorcolor; } else document.frm_Info.billing_state.style.backgroundColor=normalcolor if (document.frm_Info.billing_country.value=="US" && document.frm_Info.billing_zip.value.length < 5) { errormessage= errormessage + "ˇBilling Zip Length\n" ; document.frm_Info.billing_zip.style.backgroundColor=errorcolor; } else document.frm_Info.billing_zip.style.backgroundColor=normalcolor if (document.frm_Info.billing_phone.value.length < 3) { errormessage= errormessage + "ˇBilling Phone\n" ; document.frm_Info.billing_phone.style.backgroundColor=errorcolor; } else document.frm_Info.billing_phone.style.backgroundColor=normalcolor if (document.frm_Info.billing_country.value=="US" && document.frm_Info.billing_state.value=="Ot") { errormessage= errormessage + "ˇBilling State/Country mismatch\n" ; document.frm_Info.billing_country.style.backgroundColor=errorcolor; } else document.frm_Info.billing_country.style.backgroundColor=normalcolor // IF SAME AS SHIPPING ADDRESS IS NOT CHECKED.. VALIDATE SHIPPING FIELDS if (document.frm_Info.sameasbilling[1].checked == true ) { if (document.frm_Info.shipping_firstname.value.length < 1) { errormessage= errormessage + "ˇShipping First Name\n" ; document.frm_Info.shipping_firstname.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_firstname.style.backgroundColor=normalcolor if (document.frm_Info.shipping_lastname.value.length < 2) { errormessage= errormessage + "ˇShipping Last Name\n" ; document.frm_Info.shipping_lastname.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_lastname.style.backgroundColor=normalcolor if ((document.frm_Info.shipping_company.value) != "" && (document.frm_Info.shipping_company.value.length < 3)) { errormessage= errormessage + "ˇShipping Company (3 chars min)\n" ; document.frm_Info.shipping_company.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_company.style.backgroundColor=normalcolor if (document.frm_Info.shipping_address1.value.length < 3) { errormessage= errormessage + "ˇShipping Address\n" ; document.frm_Info.shipping_address1.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_address1.style.backgroundColor=normalcolor if (document.frm_Info.shipping_city.value.length < 3) { errormessage= errormessage + "ˇShipping City\n" ; document.frm_Info.shipping_city.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_city.style.backgroundColor=normalcolor if (document.frm_Info.shipping_state.value=="select") { errormessage= errormessage + "ˇShipping State\n" ; document.frm_Info.shipping_state.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_state.style.backgroundColor=normalcolor if (document.frm_Info.shipping_country.value=="US" && document.frm_Info.shipping_zip.value.length < 5) { errormessage= errormessage + "ˇShipping Zip Length\n" ; document.frm_Info.shipping_zip.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_zip.style.backgroundColor=normalcolor if (document.frm_Info.shipping_country.value=="US" && document.frm_Info.shipping_state.value=="Ot") { errormessage= errormessage + "ˇShipping State/Country mismatch\n" ; document.frm_Info.shipping_country.style.backgroundColor=errorcolor; } else document.frm_Info.shipping_country.style.backgroundColor=normalcolor } // END OF VALIDATING SHIPPING FIELDS // CHECKING CREDIT CARD EXPIRATION DATE var cDate = new Date(); var curMonth = cDate.getMonth() + 1; var curYear = cDate.getFullYear(); var frmMonth = document.frm_Paymentinfo.card_month.options[document.frm_Paymentinfo.card_month.selectedIndex].value; var frmYear = document.frm_Paymentinfo.card_year.options[document.frm_Paymentinfo.card_year.selectedIndex].value; // if(frmYear < curYear || (curMonth > frmMonth && frmYear == curYear)) { // errormessage= errormessage + "ˇInvalid Expiration Date\n" ; // } // J.R> 3-26 // END OF CREDIT CARD EXPIRATION DATE // CODE TO CHECK CREDIT CARD NUMBER ALGORITHM if (document.frm_Paymentinfo.card_number.value=="externalpayment") { //do nothing } else { if (CheckNum(document.frm_Paymentinfo.card_number.value) == 0){ errormessage= errormessage + "ˇInvalid Credit Card\n" ; document.frm_Paymentinfo.card_number.focus() ; document.frm_Paymentinfo.card_number.style.backgroundColor=errorcolor } else document.frm_Paymentinfo.card_number.style.backgroundColor=normalcolor } if (document.frm_Paymentinfo.cvv2.value.length < 3) { errormessage= errormessage + "ˇCard ID\n" ; document.frm_Paymentinfo.cvv2.style.backgroundColor=errorcolor; } else document.frm_Paymentinfo.cvv2.style.backgroundColor=normalcolor // END OF ALGORITHM //MAKE SURE AGREE CHECK BOX IS CHECKED //if (document.frm_Questions.Iagree.checked == false) //{ //errormessage = errormessage + "ˇAgree Checkbox Empty\n" ; //} // END OF AGREE CHECK BOX // ADDING MISSING QUESTIONS TO LIST OF REQUIREMENTS rqs="" d_questions() errormessage = errormessage + rqs // PLACING CURSOR IN RIGHT POSITION //if (document.frm_Questions.Iagree.checked == false) //{ //document.frm_Questions.Iagree.focus() ; //} if (document.frm_Paymentinfo.cvv2.value.length < 3) { document.frm_Paymentinfo.cvv2.focus() ; } if (document.frm_Paymentinfo.card_number.value.length < 3) { document.frm_Paymentinfo.card_number.focus() ; } if (document.frm_Info.sameasbilling[1].checked == true ) { if (document.frm_Info.shipping_country.value!="US" && document.frm_Info.shipping_state.value!="Ot" || document.frm_Info.shipping_country.value=="US" && document.frm_Info.shipping_state.value=="Ot") { document.frm_Info.shipping_country.focus() ; } if (document.frm_Info.shipping_country.value=="US" && document.frm_Info.shipping_zip.value.length < 5) { document.frm_Info.shipping_zip.focus() ; } if (document.frm_Info.shipping_state.value=="select") { document.frm_Info.shipping_state.focus() ; } if (document.frm_Info.shipping_city.value.length < 3) { document.frm_Info.shipping_city.focus() ; } if (document.frm_Info.shipping_address1.value.length < 3) { document.frm_Info.shipping_address1.focus() ; } if ((document.frm_Info.shipping_company.value!="") && (document.frm_Info.shipping_company.value.length<3)) { document.frm_Info.shipping_company.focus() ; } if (document.frm_Info.shipping_lastname.value.length < 2) { document.frm_Info.shipping_lastname.focus() ; } if (document.frm_Info.shipping_firstname.value.length < 1) { document.frm_Info.shipping_firstname.focus() ; } } if (document.frm_Info.billing_country.value!="US" && document.frm_Info.billing_state.value!="Ot" || document.frm_Info.billing_country.value=="US" && document.frm_Info.billing_state.value=="Ot") { document.frm_Info.billing_country.focus() ; } if (document.frm_Info.billing_phone.value.length < 3) { document.frm_Info.billing_phone.focus() ; } if (document.frm_Info.billing_country.value=="US" && document.frm_Info.billing_zip.value.length < 5) { document.frm_Info.billing_zip.focus() ; } if (document.frm_Info.billing_state.value=="select") { document.frm_Info.billing_state.focus() ; } if (document.frm_Info.billing_city.value.length < 3) { document.frm_Info.billing_city.focus() ; } if (document.frm_Info.billing_address1.value.length < 3) { document.frm_Info.billing_address1.focus() ; } if (document.frm_Info.email_address.value.length < 5) { document.frm_Info.email_address.focus() ; } if (document.frm_Info.email_address.value.length >= 5) { if ((document.frm_Info.email_address.value.indexOf("@") == -1 ) || (document.frm_Info.email_address.value.indexOf(".") == -1 )) { document.frm_Info.email_address.focus() ; } } if (document.frm_Info.billing_lastname.value.length < 2) { document.frm_Info.billing_lastname.focus() ; } if (document.frm_Info.billing_firstname.value.length < 1) { document.frm_Info.billing_firstname.focus() ; } // END OF PLACING CURSOR IN RIGHT POSITION if (document.frm_ship.shipmethod_DOM.value == 0 && document.frm_ship.shipmethod_INTL.value == 0) { errormessage = errormessage + "ˇChoose your Shipping Method\n" ; } if (!errormessage=="") { var errormessage2="-=Fields Missing=-\n" errormessage = errormessage2 + errormessage alert(errormessage) return false } document.getElementById('SubmitButton').style.display = "none"; document.getElementById('SubmitInProcess').style.display = "block"; return true; } //------------------------------------------------- function d_validate_qc() { var errormessage="" var errorcolor="#FCFCC2" var normalcolor="#FFFFFF" // GETTING ALL THE CORRECT VALUES BEFORE CHECKING OUT document.frm_Questions.billing_firstname.value=document.frm_Info.billing_firstname.value; document.frm_Questions.billing_lastname.value=document.frm_Info.billing_lastname.value; document.frm_Questions.email_address.value=document.frm_Info.email_address.value; document.frm_Questions.billing_address1.value=document.frm_Info.billing_address1.value; document.frm_Questions.billing_address2.value=document.frm_Info.billing_address2.value; document.frm_Questions.billing_city.value=document.frm_Info.billing_city.value; document.frm_Questions.billing_state.value=document.frm_Info.billing_state.value; document.frm_Questions.billing_country.value=document.frm_Info.billing_country.value; document.frm_Questions.billing_zip.value=document.frm_Info.billing_zip.value; document.frm_Questions.billing_phone.value=document.frm_Info.billing_phone.value; document.frm_Questions.shipping_firstname.value=document.frm_Info.shipping_firstname.value; document.frm_Questions.shipping_lastname.value=document.frm_Info.shipping_lastname.value; document.frm_Questions.shipping_company.value=document.frm_Info.shipping_company.value; document.frm_Questions.shipping_address1.value=document.frm_Info.shipping_address1.value; document.frm_Questions.shipping_address2.value=document.frm_Info.shipping_address2.value; document.frm_Questions.shipping_city.value=document.frm_Info.shipping_city.value; document.frm_Questions.shipping_state.value=document.frm_Info.shipping_state.value; document.frm_Questions.shipping_country.value=document.frm_Info.shipping_country.value; document.frm_Questions.shipping_zip.value=document.frm_Info.shipping_zip.value; document.frm_Questions.shipping_phone.value=document.frm_Info.shipping_phone.value; document.frm_Questions.card_type.value=document.frm_Paymentinfo.card_type.value; document.frm_Questions.card_number.value=document.frm_Paymentinfo.card_number.value; document.frm_Questions.cvv2.value=document.frm_Paymentinfo.cvv2.value; document.frm_Questions.card_month.value=document.frm_Paymentinfo.card_month.value; document.frm_Questions.card_year.value=document.frm_Paymentinfo.card_year.value; if (document.frm_Info.warned_qc.value==0) { alert("NOTE:\n\nTo use this payment method, you must first do the following:\n\n* Choose your Shipping type: U.S. or International\n* Choose your Country if not U.S.\n* Choose your Shipping State (6% Sales Tax in MI)\n* Choose your Shipping Method\n* Choose your Shipping Insurance\n\nThis will determine your Total Order amount.\n\nOnce you have reviewed your selections, please CLICK this button again."); document.frm_Info.warned_qc.value=1; return false; } else { return true; } } ///////////////////////////////////////////////////////////////////////////////////////////////// function altpay_paypal_validate() { if ( (document.frm_ship.shipmethod_DOM.value==0 && document.frm_ship.isshipdom[0].checked == true) || (document.frm_ship.shipmethod_INTL.value==0 && document.frm_ship.isshipdom[1].checked == true) ) { alert("Please choose a shipping method before hitting the PAYPAL button"); window.location = "cart.php#shippingoptions" return false; // return true; } else { return true; } } ///////////////////////////////////////////////////////////////////////////////////////////////// function altpay_google_validate() { // SALES TAX AUTOMATICALLY APPLIED BY GOOGLE if ( (document.frm_ship.shipmethod_DOM.value==0 && document.frm_ship.isshipdom[0].checked == true) || (document.frm_ship.shipmethod_INTL.value==0 && document.frm_ship.isshipdom[1].checked == true) ) { alert("Please choose a shipping method before hitting the GOOGLE CHECKOUT button"); window.location = "cart.php#shippingoptions" return false; // return true; } else { return true; } }