var sent = 0; var buttonHtml; var req; var reqShip; var response; var city; var state; var secureURL; var shipCarrier; var calculatedSalesTax = 0; var calculatedSalesSet = false; function forceCalculateShipping() { if (setIntlShipping() == 0) { loadShipxml(document.getElementById("form2"), "/", "", "OPTION") } setCheckoutShipCostRadio(); return false; document.getElementById("ShipOptionsTable").innerHTML = "<img src='images/indicator.gif' /><br><b>Loading Rates...</b><br>" } function setHeardFrom(a) { for (i = 0; i < document.getElementById("form2").HEARDFROM.options.length; i++) { if (document.getElementById("form2").HEARDFROM.options[i].value == a) { document.getElementById("form2").HEARDFROM.options[i].selected = true; break } } } function submitLogin() { document.getElementById("form2").action = "checkoutexp2.asp"; document.getElementById("form2").submit() } function submitLoginNew() { document.getElementById("tagValidating").innerHTML = "<img src='images/indicator.gif' /><b> Validating...</b><br>"; document.getElementById("form2").action = "returningCustomer.asp"; document.getElementById("form2").submit() } function submitLoginSavings() { if (document.getElementById("form2").showNoMemberMessage.value == 1) { alert("You need to become a member to log in here"); return } document.getElementById("form2").action = "../savingsLogin.asp"; document.getElementById("form2").submit() } function submitPaypal(a) { document.getElementById("form2").action = a; document.getElementById("form2").submit() } function showPrivateLabelInformation(companyName, phone, fax, address) { h = eval("'height=" + (330 + (1 * 10)) + ",width=380'"); detail = open("", "Alert", h); detail.document.writeln("<html>\n<title>" + companyName + " Private Label Credit Card</title>"); detail.document.writeln("\n<body bgcolor='#ffffff'>\n<font face='verdana,arial' size=2 color=#5f8cc7><b>" + companyName + " Private Label Credit Card</b></font>\n<br>"); detail.document.writeln("\n<font face='verdana,arial,sans-serif' size='2'>"); detail.document.writeln("If you select this option, you must send a copy of your GE Capital confirmation page and 2 forms of identification to " + companyName + " to complete your transaction.<BR><BR>You can fax this information to " + companyName + " at " + fax + " or mail it to " + companyName + ", " + address + ".<BR><BR>Please reference your " + companyName + " order number on any correspondence. Forms of ID must include one picture ID (Driver�s License, Passport, or Military ID) and one major Credit Card. Your order will not ship until " + companyName + " has this information on file. Thank you and congratulations on your new " + companyName + " Credit Card!</font>"); detail.document.write("\n<form>\n<input type='button' value='close window'onClick='self.close()'>\n</form>\n</body>\n</html>") } function setCCBillingName() { if (typeof (document.getElementById("form2").ccname) != "undefined") { document.getElementById("form2").ccname.value = document.getElementById("form2").fname.value + " " + document.getElementById("form2").lname.value } } function setCountry(country, theForm, field) { if (country == "Canada") { if (field.indexOf("ship") >= 0) { eval(theForm + ".shipstate.selectedIndex = 1") } else { eval(theForm + ".billstate.selectedIndex = 1") } eval(theForm + "." + field + ".value = '" + country + "'") } else { if (country == "USA") { if (field.indexOf("ship") >= 0) { eval(theForm + ".shipotherprovence.selectedIndex = 0"); if (eval(theForm + ".shipstate.selectedIndex != 1")) { eval(theForm + "." + field + ".value = '" + country + "'") } } else { eval(theForm + ".otherprovence.selectedIndex = 0"); if (eval(theForm + ".billstate.selectedIndex != 1")) { eval(theForm + "." + field + ".value = '" + country + "'") } } } else { if (field.indexOf("ship") >= 0) { eval(theForm + ".shipotherprovence.selectedIndex = 0"); eval(theForm + ".shipstate.selectedIndex =1") } else { eval(theForm + ".otherprovence.selectedIndex = 0"); eval(theForm + ".billstate.selectedIndex = 1") } eval(theForm + "." + field + ".value = '" + country + "'") } } } function resetTextboxes(c) { c.fname.style.backgroundColor = "#FFFFFF"; c.fname.style.borderColor = "#000000"; c.lname.style.backgroundColor = "#FFFFFF"; c.lname.style.borderColor = "#000000"; c.shipadd1.style.backgroundColor = "#FFFFFF"; c.shipadd1.style.borderColor = "#000000"; c.shipzip1.style.backgroundColor = "#FFFFFF"; c.shipzip1.style.borderColor = "#000000"; c.shipcity.style.backgroundColor = "#FFFFFF"; c.shipcity.style.borderColor = "#000000"; c.shipstate.style.backgroundColor = "#FFFFFF"; c.shipstate.style.borderColor = "#000000"; c.shipphone.style.borderColor = "#000000"; c.shipphone.style.backgroundColor = "#FFFFFF"; c.shipotherprovence.style.borderColor = "#000000"; c.shipotherprovence.style.backgroundColor = "#FFFFFF"; c.shipcountry.style.backgroundColor = "#FFFFFF"; c.shipcountry.style.borderColor = "#000000"; c.shipattn.style.borderColor = "#000000"; c.shipattn.style.backgroundColor = "#FFFFFF"; c.email.style.backgroundColor = "#FFFFFF"; c.email.style.borderColor = "#000000"; c.pass1.style.backgroundColor = "#FFFFFF"; c.pass1.style.borderColor = "#000000"; c.pass2.style.backgroundColor = "#FFFFFF"; c.pass2.style.borderColor = "#000000"; c.shipphone.style.backgroundColor = "#FFFFFF"; c.shipphone.style.borderColor = "#000000"; c.billadd1.style.backgroundColor = "#FFFFFF"; c.billadd2.style.backgroundColor = "#FFFFFF"; c.billzip1.style.backgroundColor = "#FFFFFF"; c.billcity.style.backgroundColor = "#FFFFFF"; c.billstate.style.backgroundColor = "#FFFFFF"; c.billphone.style.backgroundColor = "#FFFFFF"; c.billcountry.style.backgroundColor = "#FFFFFF"; c.otherprovence.style.backgroundColor = "#FFFFFF"; c.billadd1.style.borderColor = "#000000"; c.billadd2.style.borderColor = "#000000"; c.billzip1.style.borderColor = "#000000"; c.billcity.style.borderColor = "#000000"; c.billcountry.style.borderColor = "#000000"; c.billstate.style.borderColor = "#000000"; c.billphone.style.borderColor = "#000000"; c.otherprovence.style.borderColor = "#000000"; if (document.getElementById("termsAndConditionsDiv") != null) { if (typeof (document.getElementById("termsAndConditionsDiv")) != "undefined") { document.getElementById("termsAndConditionsDiv").style.borderColor = "#000000"; document.getElementById("termsAndConditionsDiv").style.backgroundColor = "#FFFFFF" } } if (typeof (c.ccnumber) != "undefined") { c.ccnumber.style.backgroundColor = "#FFFFFF"; c.ccnumber.style.borderColor = "#000000"; c.cctype.style.backgroundColor = "#FFFFFF"; c.cctype.style.borderColor = "#000000"; c.cccode.style.backgroundColor = "#FFFFFF"; c.cccode.style.borderColor = "#000000"; c.ccname.style.backgroundColor = "#FFFFFF"; c.ccname.style.borderColor = "#000000" } if (typeof (c.POnum) != "undefined") { c.POnum.style.backgroundColor = "#FFFFFF"; c.POnum.style.borderColor = "#000000"; c.corpnum.style.backgroundColor = "#FFFFFF"; c.corpnum.style.borderColor = "#000000" } if (typeof (c.bankName) != "undefined") { c.bankName.style.backgroundColor = "#FFFFFF"; c.bankName.style.borderColor = "#000000"; c.bankAccount.style.backgroundColor = "#FFFFFF"; c.bankAccount.style.borderColor = "#000000"; c.ABARouting.style.backgroundColor = "#FFFFFF"; c.ABARouting.style.borderColor = "#000000" } var b = document.getElementById("eqdiv"); if (b!=null && b.style.visibility == "visible") { var a = document.getElementById("eqanswr"); a.style.backgroundColor = "#FFFFFF"; a.style.borderColor = "#000000" } } function CopyValues() { if (document.getElementById("form2").shipinfo.checked == true) { document.getElementById("form2").shipadd1.value = document.getElementById("form2").billadd1.value; document.getElementById("form2").shipadd2.value = document.getElementById("form2").billadd2.value; document.getElementById("form2").shipcity.value = document.getElementById("form2").billcity.value; document.getElementById("form2").shipstate.selectedIndex = document.getElementById("form2").billstate.selectedIndex; document.getElementById("form2").shipphone.value = document.getElementById("form2").billphone.value; document.getElementById("form2").shipfax.value = document.getElementById("form2").billfax.value; document.getElementById("form2").shipotherprovence.selectedIndex = document.getElementById("form2").otherprovence.selectedIndex; document.getElementById("form2").shipcountry.selectedIndex = document.getElementById("form2").billcountry.selectedIndex; document.getElementById("form2").shipattn.value = document.getElementById("form2").fname.value + " " + document.getElementById("form2").lname.value; document.getElementById("form2").shipzip1.value = document.getElementById("form2").billzip1.value; if (form.shipcountry.value != "USA" && form.shipcountry.value != "Canada" && form.shipcountry.value != "United States") { form.shipotherprovence.selectedIndex = 0; form.shipstate.selectedIndex = 1 } } else { document.getElementById("form2").shipotherprovence.selectedIndex = 0; document.getElementById("form2").shipadd1.value = ""; document.getElementById("form2").shipadd2.value = ""; document.getElementById("form2").shipzip1.value = ""; document.getElementById("form2").shipcity.value = ""; document.getElementById("form2").shipstate.selectedIndex = 0; document.getElementById("form2").shipcountry.selectedIndex = 0; document.getElementById("form2").shipphone.value = ""; document.getElementById("form2").shipfax.value = ""; document.getElementById("form2").shipattn.value = "" } calculatedSalesSet = false; setSalesTax() } function CopyValuesNew(a, b, c) { calculatedSalesSet = false; if (document.getElementById("form2").shipinfo.checked == true) { document.getElementById("form2").shipadd1.value = document.getElementById("form2").billadd1.value; document.getElementById("form2").shipadd2.value = document.getElementById("form2").billadd2.value; document.getElementById("form2").shipcity.value = document.getElementById("form2").billcity.value; document.getElementById("form2").shipstate.selectedIndex = document.getElementById("form2").billstate.selectedIndex; document.getElementById("form2").shipphone.value = document.getElementById("form2").billphone.value; document.getElementById("form2").shipfax.value = document.getElementById("form2").billfax.value; document.getElementById("form2").shipotherprovence.selectedIndex = document.getElementById("form2").otherprovence.selectedIndex; document.getElementById("form2").shipcountry.selectedIndex = document.getElementById("form2").billcountry.selectedIndex; document.getElementById("form2").shipattn.value = document.getElementById("form2").fname.value + " " + document.getElementById("form2").lname.value; secureURL = b; shipCarrier = c; document.getElementById("form2").shipzip1.value = document.getElementById("form2").billzip1.value; if (document.getElementById("form2").shipcountry.value != "USA" && document.getElementById("form2").shipcountry.value != "Canada" && document.getElementById("form2").shipcountry.value != "United States") { document.getElementById("form2").shipotherprovence.selectedIndex = 0; document.getElementById("form2").shipstate.selectedIndex = 1 } if (document.getElementById("form2").billcountry.value == "USA" || document.getElementById("form2").billcountry.value == "Canada") { loadXMLDoc(a + document.getElementById("form2").shipzip1.value, "ship") } } else { document.getElementById("form2").shipotherprovence.selectedIndex = 0; document.getElementById("form2").shipadd1.value = ""; document.getElementById("form2").shipadd2.value = ""; document.getElementById("form2").shipzip1.value = ""; document.getElementById("form2").shipcity.value = ""; document.getElementById("form2").shipstate.selectedIndex = 0; document.getElementById("form2").shipcountry.selectedIndex = 0; document.getElementById("form2").shipphone.value = ""; document.getElementById("form2").shipfax.value = ""; document.getElementById("form2").shipattn.value = ""; setSalesTax() } calculateEWaste = document.getElementById("calculateEWaste"); if (calculateEWaste != null && calculateEWaste.value != null) { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = "none"; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "none"; if (calculateEWaste.value == "1") { if (document.getElementById("form2").totalEWaste.value > 0 && document.getElementById("form2").shipstate.value == "CA") { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = ""; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "" } } } } function loadXMLDoc(a, b) { if (window.ActiveXObject) { isIE = true; try { req = new ActiveXObject("Microsoft.XMLHTTP") } catch (c) { req = new ActiveXObject("Msxml2.XMLHTTP") } if (req) { if (b == "ship") { req.onreadystatechange = processReqChangeShip } else { req.onreadystatechange = processReqChange } req.open("GET", a, true); req.send() } } else { if (window.XMLHttpRequest) { req = new XMLHttpRequest(); if (b == "ship") { req.onreadystatechange = processReqChangeShip } else { req.onreadystatechange = processReqChange } req.open("GET", a, true); req.send(null) } } } function loadShipXMLDoc(a) { if (window.ActiveXObject) { isIE = true; try { reqShip = new ActiveXObject("Microsoft.XMLHTTP") } catch (b) { reqShip = new ActiveXObject("Msxml2.XMLHTTP") } if (reqShip) { reqShip.onreadystatechange = processReqChangeFunctionality; reqShip.open("GET", a, true); reqShip.send() } } else { if (window.XMLHttpRequest) { reqShip = new XMLHttpRequest(); reqShip.onreadystatechange = processReqChangeFunctionality; reqShip.open("GET", a, true); reqShip.send(null) } } } function processReqChangeFunctionality() { document.getElementById("divCalculate").style.display = "block"; if (reqShip.readyState == 4) { if (reqShip.status == 200) { document.getElementById("ShipOptionsTable").innerHTML = reqShip.responseText; document.getElementById("divCalculate").style.display = "none"; if (document.getElementById("dEstShipCost") != "undefined" && document.getElementById("dEstShipMethod") != "undefined") { if (document.getElementById("dEstShipCost") != null && document.getElementById("dEstShipMethod") != null) { var g = parseFloat(document.getElementById("form2").rateMultiplier.value); var d = reqShip.responseText; var a = d.indexOf("Shipping Fee"); if (a > -1) { var k = d.indexOf("<TD>", a); k += 4; d = d.substring(k); var l = d.indexOf("</TD>"); document.getElementById("dEstShipMethod").innerHTML = d.substring(0, l); l += 5; d = d.substring(l); k = d.indexOf("$"); l = d.indexOf("</TD>"); document.getElementById("dEstShipCost").innerHTML = d.substring(k, l); var f = document.getElementById("dSubTotal").innerHTML; a = f.indexOf("$"); f = f.substring(a + 1); var j = parseFloat(f) * g; var c = parseFloat(document.getElementById("dEstShipCost").innerHTML.substring(1)); var e = j; if (document.getElementById("dCoupon") !== "undefined" && document.getElementById("dCoupon") != null) { var b = document.getElementById("dCoupon").innerHTML; a = b.indexOf("$"); b = b.substring(a + 1).toUpperCase(); l = b.indexOf("</FONT>"); b = b.substring(0, l); e = e - (parseFloat(b) * g) } e += c; document.getElementById("dtotal").innerHTML = "$" + e } } } setCheckoutShipCostRadio() } } } function processReqChange() { if (req.readyState == 4) { if (req.status == 200) { response = req.responseXML.documentElement; try { city = response.getElementsByTagName("city")[0].firstChild.data; state = response.getElementsByTagName("state")[0].firstChild.data; country = response.getElementsByTagName("CountryCode")[0].firstChild.data; var c = document.getElementById("TaxVal"); if (c != "undefined" && c != null) { calculatedSalesTax = response.getElementsByTagName("TaxVal")[0].firstChild.data; calculatedSalesSet = true } if (response.getElementsByTagName("city")[0] != null) { if (response.getElementsByTagName("city").length > 1) { var a = new Array(); var b = 0; for (var d = 0; d < response.getElementsByTagName("city").length; d++) { if (d == 0) { city = response.getElementsByTagName("city")[d].firstChild.data } a[b] = response.getElementsByTagName("city")[d].firstChild.data; b = b + 1 } alertSelectCity(b, a, "Select Desired City:", "bill") } } if (country == "CA") { document.getElementById("form2").billcity.value = city; document.getElementById("form2").billstate.selectedIndex = 1; document.getElementById("form2").otherprovence.value = state; document.getElementById("form2").billcountry.value = "Canada"; setSalesTax() } else { if (country == "US") { document.getElementById("form2").billcity.value = city; document.getElementById("form2").billstate.value = state; document.getElementById("form2").billcountry.value = "USA"; document.getElementById("form2").otherprovence.selectedIndex = 0; setSalesTax() } } } catch (e) { document.getElementById("form2").billcity.value = ""; document.getElementById("form2").billstate.selectedIndex = 0; document.getElementById("form2").billcountry.selectedIndex = 0; setSalesTax() } } else { alert("Please enter a valid zip code:\n" + req.statusText) } } } function processReqChangeShip() { if (req.readyState == 4) { if (req.status == 200) { response = req.responseXML.documentElement; try { city = response.getElementsByTagName('city')[0].firstChild.data; state = response.getElementsByTagName("state")[0].firstChild.data; country = response.getElementsByTagName("CountryCode")[0].firstChild.data; calculatedSalesTax = response.getElementsByTagName("TaxVal")[0].firstChild.data; calculatedSalesSet = true; if (response.getElementsByTagName("city")[0] != null) { if (response.getElementsByTagName("city").length > 1) { var a = new Array(); var b = 0; for (var c = 0; c < response.getElementsByTagName("city").length; c++) { if (c == 0) { city = response.getElementsByTagName("city")[c].firstChild.data } a[b] = response.getElementsByTagName("city")[c].firstChild.data; b = b + 1 } alertSelectCity(b, a, "Select Desired City:", "ship") } } if (country == "CA") { document.getElementById("form2").shipcity.value = city; document.getElementById("form2").shipstate.selectedIndex = 1; document.getElementById("form2").shipotherprovence.value = state; document.getElementById("form2").shipcountry.value = "Canada"; setSalesTax(); loadShipxml(document.getElementById("form2"), secureURL, shipCarrier, "OPTION") } else { if (country == "US") { document.getElementById("form2").shipcity.value = city; document.getElementById("form2").shipstate.value = state; document.getElementById("form2").shipcountry.value = "USA"; document.getElementById("form2").shipotherprovence.selectedIndex = 0; loadShipxml(document.getElementById("form2"), secureURL, shipCarrier, "OPTION"); setSalesTax() } else { } } } catch (d) { document.getElementById("form2").shipcity.value = ""; document.getElementById("form2").shipstate.value = "--US State--"; document.getElementById("form2").shipcountry.value = "USA"; document.getElementById("form2").shipotherprovence.selectedIndex = 0; loadShipxml(document.getElementById("form2"), secureURL, shipCarrier, "OPTION"); setSalesTax() } } else { alert("Please enter a valid zip code:\n" + req.statusText) } } } function loadxml(b, a) { if (b.billzip1.value != "") { loadXMLDoc(a + b.billzip1.value, "bill") } } function alertSelectCity(b, a, d, e) { var c = '<FORM NAME="CityForm"><font size=2>'; for (i = 0; i < b; i++) { if (i == 0) { c += ('<input checked id="optSelectCity" name="optSelectCity" type="radio" value="' + a[i] + '" />' + a[i] + "<br>") } else { c += ('<input id="optSelectCity" name="optSelectCity" type="radio" value="' + a[i] + '" />' + a[i] + "<br>") } } c += "</font></form>"; var f = jQuery("<div></div>").html(c).dialog({ autoOpen: true, dialogClass: "popup", title: d, width: 300, height: 350, closeOnEscape: true, modal: true, buttons: { "Select City": function () { var g = ""; jQuery("input:radio[name=optSelectCity]").each(function () { if (this.checked) { g = jQuery(this).val() } }); if (e == "ship") { jQuery("#ctl00_mainContent_shippCity").val(g) } if (e == "bill") { jQuery("#billcity").val(g); jQuery("#shippCity").val(g) } jQuery(this).dialog("close") } } }) } function loadxmlShipFields(c, b, a, d) { secureURL = a; shipCarrier = d; loadXMLDoc(b + c.shipzip1.value, "ship") } function loadShipxml(d, c, f, a) { var b = document.getElementsByName("chkAcc"); var g; var e = ""; if (b != "undefined") { g = b.length; for (i = 0; i < g; i++) { if (b[i].checked) { e = e + b[i].value + "|" } } } if (a == "OPTION") { if ((d.shipzip1.value != "" && (d.shipcountry.value == "USA")) || (d.shipcountry.value != "USA")) { if (d.shipcountry.selectedIndex != 0) { document.getElementById("ShipOptionsTable").innerHTML = "<img src='" + c + "secure/images/indicator.gif' /><br><b>Loading Rates...</b><br>"; d.PrevShipZip.value = d.shipzip1.value; d.PrevShipCountry.value = d.shipcountry.value; loadShipXMLDoc(c + "estimatedshipping.asp?SID=" + d.sid.value + "&ReturnFormat=" + a + "&ZipCodeFrom=" + d.shipzip1.value + "&CountryFrom=" + d.shipcountry.value + "&CarrierCode=" + f + "&OrderFreightAcc=" + e); if (e != "") { if (b != "undefined") { g = b.length; for (i = 0; i < g; i++) { if (e.indexOf(b[i].value + "|") >= 0) { b[i].checked = true } } } } } else { document.getElementById("ShipOptionsTable").innerHTML = "<span style='color:red;text-align:left'>Not Able to Calculate Shipping With Given Shipping Address. Try Again.</span>"; d.PrevShipZip.value = ""; d.PrevShipCountry.value = "" } } else { if (d.isCustomShippingMessage.value == "" || (d.shipcountry.value == "USA")) { document.getElementById("ShipOptionsTable").innerHTML = "<span style='color:red;text-align:left'>Not Able to Calculate Shipping With Given Shipping Address. Try Again.</span>" } else { document.getElementById("ShipOptionsTable").innerHTML = "<font color=red>" + d.isCustomShippingMessage.value + "</font>" } d.PrevShipZip.value = ""; d.PrevShipCountry.value = "" } if (d.shipcountry.value != "USA" && d.shipcountry.value != "Canada" && d.shipcountry.value != "United States") { d.shipotherprovence.selectedIndex = 0; d.shipstate.selectedIndex = 1 } } else { if (d.txtEstShipZip.value != "") { document.getElementById("ShipOptionsTable").innerHTML = "<img src='" + c + "secure/images/indicator.gif' /><br><b>Loading Rates...</b><br>"; d.PrevShipZip.value = d.txtEstShipZip.value; d.PrevShipCountry.value = d.cboEstCountry.value; loadShipXMLDoc(c + "estimatedshipping.asp?SID=" + d.sid.value + "&ReturnFormat=" + a + "&ZipCodeFrom=" + d.txtEstShipZip.value + "&CountryFrom=" + d.cboEstCountry.value + "&CarrierCode=" + f) } else { if (document.getElementById("isCustomShippingMessage").value == "" || (d.cboEstCountry.value == "USA" || d.cboEstCountry.value == "United States")) { document.getElementById("ShipOptionsTable").innerHTML = "<font color=red>Enter a valid Shipping Zip/Postal Code and/or Country to see Shipping options & fees.</font>" } else { document.getElementById("ShipOptionsTable").innerHTML = "<font color=red>" + document.getElementById("isCustomShippingMessage").value + "</font>" } d.PrevShipZip.value = ""; d.PrevShipCountry.value = "" } } } function getCurrency(d) { var c = "?amount=" + d; c += "&originalCurrency=" + document.getElementById("form2").USD.value; c += "&newCurrency=" + document.getElementById("form2").CountryCode.value; url = "https://www.shopvisible.com/currencyProcessor.asmx/convertCurrency" + c; if (window.ActiveXObject) { isIE = true; try { req = new ActiveXObject("Microsoft.XMLHTTP") } catch (e) { req = new ActiveXObject("Msxml2.XMLHTTP") } if (req) { req.open("GET", url, false); req.send() } } else { if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.open("GET", url, false); req.send(null) } } var b = req.responseXML.getElementsByTagName("string"); var a = d; if (b != null) { a = b[0].firstChild.data } return a } function CurrencyFormatted(c) { var b = parseFloat(c); if (isNaN(b)) { b = 0 } var a = ""; if (b < 0) { a = "-" } b = Math.abs(b); b = parseInt((b + 0.005) * 100); b = b / 100; s = new String(b); if (s.indexOf(".") < 0) { s += ".00" } if (s.indexOf(".") == (s.length - 2)) { s += "0" } s = a + s; return s } function setIntlShipping() { if (document.getElementById("form2").shipcountry.selectedIndex != 0) { if (document.getElementById("form2").shipcountry.value != "USA") { if (document.getElementById("form2").intlship.value == -1) { alert("You have selected international delivery, unfortuantely, at least 1 item in your cart is not designated as available for international shipping at this time.  Please return to the shopping cart and remove these items.  Thank you."); document.getElementById("ShipOptionsTable").innerHTML = "At least 1 item in your cart is not designated as available for international shipping at this time.<br><br>Cannot calculate shipping until this issue is fixed."; return -1 } } } return 0 } function resetTaxandTotal(d, k) { var a = document.getElementById("form2").taxStates.value; var g = parseFloat(document.getElementById("form2").rateMultiplier.value); var e = document.getElementById("txtGiftCardAmount"); var j = 0; if (a != "") { var c = a.split(","); for (i = 0; i < c.length; i++) { var l = c[i].split(";"); if (document.getElementById("form2").shipstate.value == l[0]) { var b = 0; if (typeof (document.getElementById("form2").subTotalToTax) != "undefined") { b = (document.getElementById("form2").subTotalToTax.value - (parseFloat(document.getElementById("form2").coupon.value) * g)) * l[1] } else { b = (document.getElementById("form2").subTotal.value - (parseFloat(document.getElementById("form2").coupon.value) * g)) * l[1] } document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(b); j = parseFloat(document.getElementById("form2").subTotal.value) * g + parseFloat(b) + parseFloat(d) - parseFloat(document.getElementById("form2").coupon.value) * g; var f = setShipInsurance(); j = j + f * g; document.getElementById("total").innerHTML = "$" + CurrencyFormatted(j); document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(j); calculateEWaste = document.getElementById("calculateEWaste"); if (calculateEWaste != null && calculateEWaste.value != null) { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = "none"; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "none"; if (calculateEWaste.value == "1") { if (document.getElementById("form2").totalEWaste.value > 0 && document.getElementById("form2").shipstate.value == "CA") { j = j + parseFloat(document.getElementById("form2").totalEWaste.value); showDiv = document.getElementById("showEWaste1"); showDiv.style.display = ""; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = ""; document.getElementById("total").innerHTML = "$" + CurrencyFormatted(j); document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(j) } } } e = document.getElementById("txtGiftCardAmount"); if (e != null && e.value != null) { if (e.value == "") { e.value = 0 } j = j - (parseFloat(e.value) * g); if (j < 0) { j = 0 } } document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(j); document.getElementById("txtTotal").value = CurrencyFormatted(j); return } } document.getElementById("tax").innerHTML = document.getElementById("form2").originalTax.value; j = (parseFloat(document.getElementById("form2").subTotal.value) * g) + parseFloat(d) - (parseFloat(document.getElementById("form2").coupon.value) * g); var f = setShipInsurance(); j = j + f * g; document.getElementById("total").innerHTML = "$" + CurrencyFormatted(j); document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(j); calculateEWaste = document.getElementById("calculateEWaste"); if (calculateEWaste != null && calculateEWaste.value != null) { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = "none"; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "none"; if (calculateEWaste.value == "1") { if (document.getElementById("form2").totalEWaste.value > 0 && document.getElementById("form2").shipstate.value == "CA") { j = j + parseFloat(document.getElementById("form2").totalEWaste.value); showDiv = document.getElementById("showEWaste1"); showDiv.style.display = ""; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = ""; document.getElementById("total").innerHTML = "$" + CurrencyFormatted(j); document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(j) } } } e = document.getElementById("txtGiftCardAmount"); if (e != null && e.value != null) { if (e.value == "") { e.value = 0 } j = j - (parseFloat(e.value) * g); if (j < 0) { j = 0 } } document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(j); document.getElementById("txtTotal").value = CurrencyFormatted(j) } else { document.getElementById("tax").innerHTML = document.getElementById("form2").originalTax.value } } function setCheckoutShipCostRadio() { var e = document.getElementsByName("optShip"); var d = 0; var r = 0; var b = 0; var n = 0; var v = 0; var q = 0;  var os = document.getElementById("form2").taxShipping.value; var shippingTaxed = true; if (os != "undefined") { if (os == "") { shippingTaxed = false; } } if (document.getElementById("form2") == null) { return } if (document.getElementById("form2") == "undefined") { return } var u = parseFloat(document.getElementById("form2").rateMultiplier.value); r = (parseFloat(document.getElementById("form2").subTotal.value) * u) - (parseFloat(document.getElementById("form2").coupon.value) * u); var c = setShipInsurance(); r = r + c * u; n = r; if (typeof (document.getElementById("form2").subTotalToTax) != "undefined") { b = (parseFloat(document.getElementById("form2").subTotalToTax.value) * u) - (parseFloat(document.getElementById("form2").coupon.value) * u); b = b + c * u } else { b = r } if (e != "undefined") { for (v = 0; v < e.length; v++) { if (e[v].checked) { var m = e[v].value; var f = m.split("|"); d = parseFloat(f[1].replace("$", "").replace(",", "") * u); r = r + d; if (shippingTaxed){ b = b + d; } } } } var j = document.getElementsByName("optShipFreight"); if (j != "undefined") { var k = false; for (v = 0; v < j.length; v++) { if (j[v].checked) { k = true; var t = j[v].value; var a = t.split("|"); d = parseFloat(a[1].replace("$", "").replace(",", "") * u); r = r + d; if (shippingTaxed){ b = b + d; } } } if (k == true) { q = setShipWhiteGlove(); d = d + q; r = r + q; if (shippingTaxed){ b = b + d; } } } var o = document.getElementById("form2").taxStates.value; var g = false; if (calculatedSalesSet == false) { var l = document.getElementById("form2").calculatedSalesTax.value; if (l != "undefined" && l != null) { calculatedSalesTax = l; calculatedSalesSet = true } } if (o != "undefined" && o != null) { if (o.indexOf(document.getElementById("form2").shipstate.value) > -1) { if (typeof (document.getElementById("form2").chargeTax) != "undefined") { if (document.getElementById("form2").chargeTax.value == "1") { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(0) } else {if (b < 0) {document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(0); } else { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(parseFloat(calculatedSalesTax) * b) }  } } else { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(parseFloat(calculatedSalesTax) * b) } } else { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(parseFloat(calculatedSalesTax) * n) } } else { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(parseFloat(calculatedSalesTax) * n) } r = r + parseFloat((document.getElementById("tax").innerHTML.replace("$", "")) * u); calculateEWaste = document.getElementById("calculateEWaste"); if (calculateEWaste != null && calculateEWaste.value != null) { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = "none"; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "none"; if (calculateEWaste.value == "1") { if (document.getElementById("form2").totalEWaste.value > 0 && document.getElementById("form2").shipstate.value == "CA") { r = r + parseFloat(document.getElementById("form2").totalEWaste.value); showDiv = document.getElementById("showEWaste1"); showDiv.style.display = ""; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "" } } } document.getElementById("total").innerHTML = "$" + CurrencyFormatted(r); var p = document.getElementById("txtGiftCardAmount"); if (p != null && p.value != null) { if (p.value == "") { p.value = 0 } r = r - (parseFloat(p.value) * u); if (r < 0) { r = 0 } } document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(r); document.getElementById("txtTotal").value = CurrencyFormatted(r) } function setShipWhiteGlove() { var a = document.getElementById("chkWhiteGlove"); var b = document.getElementById("txtWhiteGlove"); var c = 0; if (a != "undefined") { if (a != null) { if (a.checked == false) { c = 0 } else { c = parseFloat(b.value) } } } return c } function setShipInsurance() { var a = document.getElementById("chkShipIns"); var b = document.getElementById("shipIns"); var c = 0; if (a != "undefined") { if (a != null) { if (a.checked == false) { c = 0 } else { c = parseFloat(b.value) } } } return c } function setSalesTax() { var y = 1; var v = 0; var n = 0; var w = document.getElementById("form2").rateMultiplier.value; var u = document.getElementById("txtGiftCardAmount"); if (typeof (document.getElementById("form2").chargeTax) != "undefined") { y = document.getElementById("form2").chargeTax.value } else { return } if (typeof (document.getElementById("form2").shipstate) == "undefined") { return } if (document.getElementById("form2").shipstate.selectedIndex == 0) { if (y != "1") { document.getElementById("tax").innerHTML = document.getElementById("form2").originalTax.value } else { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(0) } } else { var e = 0; var f = document.getElementsByName("optShip"); for (var c = 0; c < f.length; c++) { if (f[c].checked) { var q = f[c].value; var j = q.split("|"); e = parseFloat(j[1].replace("$", "").replace(",", "")); break } } var m = document.getElementsByName("optShipFreight"); if (m != "undefined") { var o = false; for (c = 0; c < m.length; c++) { if (m[c].checked) { o = true; var r = m[c].value; var b = r.split("|"); e = e + parseFloat(b[1].replace("$", "").replace(",", "")); break } } if (o == true) { WhiteGloveTotal = setShipWhiteGlove(); e = e + parseFloat(WhiteGloveTotal) } } if (calculatedSalesSet == true) { if (y == "1") { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(0) } else { v = parseFloat(document.getElementById("form2").subTotal.value) * w; v = v - (parseFloat(document.getElementById("form2").coupon.value) * w); if (typeof (document.getElementById("form2").subTotalToTax) != "undefined") { n = parseFloat(document.getElementById("form2").subTotalToTax.value) * w } else { n = v } var d = setShipInsurance(); v = v + d * w; var t = document.getElementById("form2").taxShipping.value; var l = false; if (t != "undefined" && t != null) { if (t.indexOf(document.getElementById("form2").shipstate.value) > -1) { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(parseFloat(calculatedSalesTax) * (n + e)) } else { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(parseFloat(calculatedSalesTax) * n) } } else { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(parseFloat(calculatedSalesTax) * n) } v = v + (parseFloat(calculatedSalesTax) * v); v = v + e; calculateEWaste = document.getElementById("calculateEWaste"); if (calculateEWaste != null && calculateEWaste.value != null) { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = "none"; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "none"; if (calculateEWaste.value == "1") { if (document.getElementById("form2").totalEWaste.value > 0 && document.getElementById("form2").shipstate.value == "CA") { v = v + parseFloat(document.getElementById("form2").totalEWaste.value); showDiv = document.getElementById("showEWaste1"); showDiv.style.display = ""; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "" } } } document.getElementById("total").innerHTML = "$" + CurrencyFormatted(v); u = document.getElementById("txtGiftCardAmount"); if (u != null && u.value != null) { if (u.value == "") { u.value = 0 } v = v - (parseFloat(u.value) * w); if (v < 0) { v = 0 } } document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(v); document.getElementById("txtTotal").value = CurrencyFormatted(v) } } else { var p = document.getElementById("form2").taxStates.value; if (p != "") { var g = p.split(","); for (i = 0; i < g.length; i++) { var a = g[i].split(";"); if (document.getElementById("form2").shipstate.value == a[0]) { var k = 0; if (typeof (document.getElementById("form2").subTotalToTax) != "undefined") { k = (document.getElementById("form2").subTotalToTax.value - (parseFloat(document.getElementById("form2").coupon.value) * w)) * a[1] } else { k = (document.getElementById("form2").subTotal.value - (parseFloat(document.getElementById("form2").coupon.value) * w)) * a[1] } if (y == "1") { k = 0 } k = k * w; document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(k); v = (parseFloat(document.getElementById("form2").subTotal.value) * w) + parseFloat(k) + e - (parseFloat(document.getElementById("form2").coupon.value) * w); var d = setShipInsurance(); v = v + d * w; document.getElementById("total").innerHTML = "$" + CurrencyFormatted(v); document.getElementById("totalBottom").innerHTML = document.getElementById("total").innerHTML; calculateEWaste = document.getElementById("calculateEWaste"); if (calculateEWaste != null && calculateEWaste.value != null) { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = "none"; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "none"; if (calculateEWaste.value == "1") { if (document.getElementById("form2").totalEWaste.value > 0 && document.getElementById("form2").shipstate.value == "CA") { v = v + parseFloat(document.getElementById("form2").totalEWaste.value); showDiv = document.getElementById("showEWaste1"); showDiv.style.display = ""; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = ""; document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(v); document.getElementById("total").innerHTML = "$" + CurrencyFormatted(v) } } } u = document.getElementById("txtGiftCardAmount"); if (u != null && u.value != null) { if (u.value == "") { u.value = 0 } v = v - ((parseFloat(u.value)) * w); if (v < 0) { v = 0 } document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(v) } document.getElementById("txtTotal").value = CurrencyFormatted(v); return } } if (y == "1") { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(0) } else { if (document.getElementById("tax").innerHTML != document.getElementById("form2").originalTax.value) { document.getElementById("tax").innerHTML = document.getElementById("form2").originalTax.value; v = (parseFloat(document.getElementById("form2").subTotal.value) * w) + e - (parseFloat(document.getElementById("form2").coupon.value) * w); var d = setShipInsurance(); v = v + d * w; document.getElementById("total").innerHTML = "$" + CurrencyFormatted(v); document.getElementById("totalBottom").innerHTML = document.getElementById("total").innerHTML; calculateEWaste = document.getElementById("calculateEWaste"); if (calculateEWaste != null && calculateEWaste.value != null) { showDiv = document.getElementById("showEWaste1"); showDiv.style.display = "none"; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = "none"; if (calculateEWaste.value == "1") { if (document.getElementById("form2").totalEWaste.value > 0 && document.getElementById("form2").shipstate.value == "CA") { v = v + parseFloat(document.getElementById("form2").totalEWaste.value); showDiv = document.getElementById("showEWaste1"); showDiv.style.display = ""; showDiv = document.getElementById("showEWaste2"); showDiv.style.display = ""; document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(v); document.getElementById("total").innerHTML = "$" + CurrencyFormatted(v) } } } u = document.getElementById("txtGiftCardAmount"); if (u != null && u.value != null) { if (u.value == "") { u.value = 0 } v = v - (parseFloat(u.value) * w); if (v < 0) { v = 0 } document.getElementById("totalBottom").innerHTML = "$" + CurrencyFormatted(v) } document.getElementById("txtTotal").value = CurrencyFormatted(v) } } } else { if (y == "1") { document.getElementById("tax").innerHTML = "$" + CurrencyFormatted(0) } else { document.getElementById("tax").innerHTML = document.getElementById("form2").originalTax.value } } } } } function validateGiftCard(b, a) { var c = document.getElementById("txtGiftCardNumber").value; var d = document.getElementById("tagApply"); buttonHtml = d.innerHTML; d.innerHTML = "<img src='" + b + "secure/images/indicator.gif' /><br><b>Validating...</b><br>"; if (window.ActiveXObject) { isIE = true; try { req = new ActiveXObject("Microsoft.XMLHTTP") } catch (e) { req = new ActiveXObject("Msxml2.XMLHTTP") } if (req) { req.onreadystatechange = processGiftCard; req.open("GET", b + c, true); req.send() } } else { if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = processGiftCard; req.open("GET", b + c, true); req.send(null) } } } function processGiftCard() { document.getElementById("tagGiftCardMessage").innerHTML = ""; if (req.readyState == 4) { if (req.status == 200) { response = req.responseText; try { var e = req.responseXML.getElementsByTagName("string"); if (e != null) { var d = e[0].firstChild.data; var a = d.split(";"); var c = document.getElementById("btnApply"); c.value = "Update"; var f; if (a[0] == "Active") { f = document.getElementById("divCurrentAmount"); f.style.display = ""; document.getElementById("tagApply").innerHTML = ""; var b = document.getElementById("txtGiftCardAmount"); b.value = a[1]; document.getElementById("tagLabel").innerHTML = "Selected Gift Card Information"; setCheckoutShipCostRadio() } else { document.getElementById("tagGiftCardMessage").innerHTML = "<font color=red>Your Gift Card status is " + a[0] + ". Please enter an Active Gift Card"; document.getElementById("tagApply").innerHTML = ""; document.getElementById("tagLabel").innerHTML = "Enter a valid Gift Card Number and click Update"; document.getElementById("txtGiftCardAmount").value = 0; setCheckoutShipCostRadio() } } else { document.getElementById("tagGiftCardMessage").innerHTML = "<font color=red>No response received" } } catch (g) { alert("Error " + g) } } else { alert("Error") } } } function applyEmail() { var a = ""; if (document.getElementById("form2").email.value != "") { a = "applyEmailToCart.asp?email=" + document.getElementById("form2").email.value; if (window.ActiveXObject) { isIE = true; try { reqShip = new ActiveXObject("Microsoft.XMLHTTP") } catch (b) { reqShip = new ActiveXObject("Msxml2.XMLHTTP") } if (reqShip) { reqShip.open("GET", a, true); reqShip.send() } } else { if (window.XMLHttpRequest) { reqShip = new XMLHttpRequest(); reqShip.open("GET", a, true); reqShip.send(null) } } } };
