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.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.form2.HEARDFROM.options.length;i++){if(document.form2.HEARDFROM.options[i].value==a){document.form2.HEARDFROM.options[i].selected=true;break}}}function submitLogin(){document.form2.action="checkoutexp2.asp";document.form2.submit()}function submitLoginNew(){document.getElementById("tagValidating").innerHTML="<img src='images/indicator.gif' /><b> Validating...</b><br>";document.form2.action="returningCustomer.asp";document.form2.submit()}function submitLoginSavings(){if(document.form2.showNoMemberMessage.value==1){alert("You need to become a member to log in here");return}document.form2.action="../savingsLogin.asp";document.form2.submit()}function submitPaypal(a){document.form2.action=a;document.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.form2.ccname)!="undefined"){document.form2.ccname.value=document.form2.fname.value+" "+document.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.style.visibility=="visible"){var a=document.getElementById("eqanswr");a.style.backgroundColor="#FFFFFF";a.style.borderColor="#000000"}}function CopyValues(){if(document.form2.shipinfo.checked==true){document.form2.shipadd1.value=document.form2.billadd1.value;document.form2.shipadd2.value=document.form2.billadd2.value;document.form2.shipcity.value=document.form2.billcity.value;document.form2.shipstate.selectedIndex=document.form2.billstate.selectedIndex;document.form2.shipphone.value=document.form2.billphone.value;document.form2.shipfax.value=document.form2.billfax.value;document.form2.shipotherprovence.selectedIndex=document.form2.otherprovence.selectedIndex;document.form2.shipcountry.selectedIndex=document.form2.billcountry.selectedIndex;document.form2.shipattn.value=document.form2.fname.value+" "+document.form2.lname.value;if(document.form2.billcountry.value=="USA"||document.form2.billcountry.value=="Canada"){document.form2.shipzip1.value=document.form2.billzip1.value}else{document.form2.shipzip1.value=""}}else{document.form2.shipotherprovence.selectedIndex=0;document.form2.shipadd1.value="";document.form2.shipadd2.value="";document.form2.shipzip1.value="";document.form2.shipcity.value="";document.form2.shipstate.selectedIndex=0;document.form2.shipcountry.selectedIndex=0;document.form2.shipphone.value="";document.form2.shipfax.value="";document.form2.shipattn.value=""}calculatedSalesSet=false;setSalesTax()}function CopyValuesNew(a,b,c){calculatedSalesSet=false;if(document.form2.shipinfo.checked==true){document.form2.shipadd1.value=document.form2.billadd1.value;document.form2.shipadd2.value=document.form2.billadd2.value;document.form2.shipcity.value=document.form2.billcity.value;document.form2.shipstate.selectedIndex=document.form2.billstate.selectedIndex;document.form2.shipphone.value=document.form2.billphone.value;document.form2.shipfax.value=document.form2.billfax.value;document.form2.shipotherprovence.selectedIndex=document.form2.otherprovence.selectedIndex;document.form2.shipcountry.selectedIndex=document.form2.billcountry.selectedIndex;document.form2.shipattn.value=document.form2.fname.value+" "+document.form2.lname.value;secureURL=b;shipCarrier=c;if(document.form2.billcountry.value=="USA"||document.form2.billcountry.value=="Canada"){document.form2.shipzip1.value=document.form2.billzip1.value;loadXMLDoc(a+document.form2.shipzip1.value,"ship")}else{document.form2.shipzip1.value=""}}else{document.form2.shipotherprovence.selectedIndex=0;document.form2.shipadd1.value="";document.form2.shipadd2.value="";document.form2.shipzip1.value="";document.form2.shipcity.value="";document.form2.shipstate.selectedIndex=0;document.form2.shipcountry.selectedIndex=0;document.form2.shipphone.value="";document.form2.shipfax.value="";document.form2.shipattn.value="";setSalesTax()}}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(){if(reqShip.readyState==4){if(reqShip.status==200){document.getElementById("ShipOptionsTable").innerHTML=reqShip.responseText;if(document.getElementById("dEstShipCost")!="undefined"&&document.getElementById("dEstShipMethod")!="undefined"){if(document.getElementById("dEstShipCost")!=null&&document.getElementById("dEstShipMethod")!=null){var g=parseFloat(document.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 a=document.getElementById("TaxVal");if(a!="undefined"&&a!=null){calculatedSalesTax=response.getElementsByTagName("TaxVal")[0].firstChild.data;calculatedSalesSet=true}if(country=="CA"){document.form2.billcity.value=city;document.form2.billstate.selectedIndex=1;document.form2.otherprovence.value=state;document.form2.billcountry.value="Canada";setSalesTax()}else{if(country=="US"){document.form2.billcity.value=city;document.form2.billstate.value=state;document.form2.billcountry.value="USA";document.form2.otherprovence.selectedIndex=0;setSalesTax()}}}catch(b){document.form2.billcity.value="";document.form2.billstate.selectedIndex=0;document.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(country=="CA"){document.form2.shipcity.value=city;document.form2.shipstate.selectedIndex=1;document.form2.shipotherprovence.value=state;document.form2.shipcountry.value="Canada";setSalesTax();loadShipxml(document.form2,secureURL,shipCarrier,"OPTION")}else{if(country=="US"){document.form2.shipcity.value=city;document.form2.shipstate.value=state;document.form2.shipcountry.value="USA";document.form2.shipotherprovence.selectedIndex=0;loadShipxml(document.form2,secureURL,shipCarrier,"OPTION");setSalesTax()}else{}}}catch(a){document.form2.shipcity.value="";document.form2.shipstate.value="--US State--";document.form2.shipcountry.value="USA";document.form2.shipotherprovence.selectedIndex=0;loadShipxml(document.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 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.form2.USD.value;c+="&newCurrency="+document.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.form2.shipcountry.selectedIndex!=0){if(document.form2.shipcountry.value!="USA"){if(document.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.form2.taxStates.value;var g=parseFloat(document.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.form2.shipstate.value==l[0]){var b=(document.form2.subTotal.value-parseFloat(document.form2.coupon.value)*g)*l[1];document.getElementById("tax").innerHTML="$"+CurrencyFormatted(b);j=parseFloat(document.form2.subTotal.value)*g+parseFloat(b)+parseFloat(d)-parseFloat(document.form2.coupon.value)*g;var f=setShipInsurance();j=j+f*g;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=CurrencyFormattedll(Total);return}}document.getElementById("tax").innerHTML=document.form2.originalTax.value;j=(parseFloat(document.form2.subTotal.value)*g)+parseFloat(d)-(parseFloat(document.form2.coupon.value)*g);var f=setShipInsurance();j=j+f*g;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.form2.originalTax.value}}function setCheckoutShipCostRadio(){var d=document.getElementsByName("optShip");var c=0;var q=0;var m=0;var u=0;var p=0;if(document.form2==null){return}if(document.form2=="undefined"){return}var t=parseFloat(document.form2.rateMultiplier.value);q=(parseFloat(document.form2.subTotal.value)*t)-(parseFloat(document.form2.coupon.value)*t);var b=setShipInsurance();q=q+b*t;m=q;if(d!="undefined"){for(u=0;u<d.length;u++){if(d[u].checked){var l=d[u].value;var e=l.split("|");c=parseFloat(e[1].replace("$","")*t);q=q+c}}}var g=document.getElementsByName("optShipFreight");if(g!="undefined"){var j=false;for(u=0;u<g.length;u++){if(g[u].checked){j=true;var r=g[u].value;var a=r.split("|");c=parseFloat(a[1].replace("$","")*t);q=q+c}}if(j==true){p=setShipWhiteGlove();c=c+p;q=q+p}}var n=document.form2.taxShipping.value;var f=false;if(calculatedSalesSet==false){var k=document.form2.calculatedSalesTax.value;if(k!="undefined"&&k!=null){calculatedSalesTax=k;calculatedSalesSet=true}}if(n!="undefined"&&n!=null){if(n.indexOf(document.form2.shipstate.value)>-1){document.getElementById("tax").innerHTML="$"+CurrencyFormatted(parseFloat(calculatedSalesTax)*q)}else{document.getElementById("tax").innerHTML="$"+CurrencyFormatted(parseFloat(calculatedSalesTax)*m)}}else{document.getElementById("tax").innerHTML="$"+CurrencyFormatted(parseFloat(calculatedSalesTax)*m)}q=q+parseFloat((document.getElementById("tax").innerHTML.replace("$",""))*t);var o=document.getElementById("txtGiftCardAmount");if(o!=null&&o.value!=null){if(o.value==""){o.value=0}q=q-(parseFloat(o.value)*t);if(q<0){q=0}}document.getElementById("total").innerHTML="$"+CurrencyFormatted(q);document.getElementById("totalBottom").innerHTML="$"+CurrencyFormatted(q);document.getElementById("txtTotal").value=CurrencyFormatted(q)}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 w=1;var u=0;var v=document.form2.rateMultiplier.value;var t=document.getElementById("txtGiftCardAmount");if(typeof(document.form2.chargeTax)!="undefined"){w=document.form2.chargeTax.value}else{return}if(typeof(document.form2.shipstate)=="undefined"){return}if(document.form2.shipstate.selectedIndex==0){if(w!="1"){document.getElementById("tax").innerHTML=document.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 p=f[c].value;var j=p.split("|");e=parseFloat(j[1].replace("$",""));break}}var m=document.getElementsByName("optShipFreight");if(m!="undefined"){var n=false;for(c=0;c<m.length;c++){if(m[c].checked){n=true;var q=m[c].value;var b=q.split("|");e=e+parseFloat(b[1].replace("$",""));break}}if(n==true){WhiteGloveTotal=setShipWhiteGlove();e=e+parseFloat(WhiteGloveTotal)}}if(calculatedSalesSet==true){if(w=="1"){document.getElementById("tax").innerHTML="$"+CurrencyFormatted(0)}else{u=parseFloat(document.form2.subTotal.value)*v;u=u-(parseFloat(document.form2.coupon.value)*v);var d=setShipInsurance();u=u+d*v;var r=document.form2.taxShipping.value;var l=false;if(r!="undefined"&&r!=null){if(r.indexOf(document.form2.shipstate.value)>-1){document.getElementById("tax").innerHTML="$"+CurrencyFormatted(parseFloat(calculatedSalesTax)*(u+e))}else{document.getElementById("tax").innerHTML="$"+CurrencyFormatted(parseFloat(calculatedSalesTax)*u)}}else{document.getElementById("tax").innerHTML="$"+CurrencyFormatted(parseFloat(calculatedSalesTax)*u)}u=u+(parseFloat(calculatedSalesTax)*u);u=u+e;t=document.getElementById("txtGiftCardAmount");if(t!=null&&t.value!=null){if(t.value==""){t.value=0}u=u-(parseFloat(t.value)*v);if(u<0){u=0}}document.getElementById("total").innerHTML="$"+CurrencyFormatted(u);document.getElementById("totalBottom").innerHTML="$"+CurrencyFormatted(u);document.getElementById("txtTotal").value=CurrencyFormatted(u)}}else{var o=document.form2.taxStates.value;if(o!=""){var g=o.split(",");for(i=0;i<g.length;i++){var a=g[i].split(";");if(document.form2.shipstate.value==a[0]){var k=(document.form2.subTotal.value-(parseFloat(document.form2.coupon.value)*v))*a[1];if(w=="1"){k=0}k=k*v;document.getElementById("tax").innerHTML="$"+CurrencyFormatted(k);u=(parseFloat(document.form2.subTotal.value)*v)+parseFloat(k)+e-(parseFloat(document.form2.coupon.value)*v);var d=setShipInsurance();u=u+d*v;document.getElementById("total").innerHTML="$"+CurrencyFormatted(u);document.getElementById("totalBottom").innerHTML=document.getElementById("total").innerHTML;t=document.getElementById("txtGiftCardAmount");if(t!=null&&t.value!=null){if(t.value==""){t.value=0}u=u-((parseFloat(t.value))*v);if(u<0){u=0}document.getElementById("totalBottom").innerHTML="$"+CurrencyFormatted(u)}document.getElementById("txtTotal").value=CurrencyFormatted(u);return}}if(w=="1"){document.getElementById("tax").innerHTML="$"+CurrencyFormatted(0)}else{if(document.getElementById("tax").innerHTML!=document.form2.originalTax.value){document.getElementById("tax").innerHTML=document.form2.originalTax.value;u=(parseFloat(document.form2.subTotal.value)*v)+e-(parseFloat(document.form2.coupon.value)*v);var d=setShipInsurance();u=u+d*v;document.getElementById("total").innerHTML="$"+CurrencyFormatted(u);document.getElementById("totalBottom").innerHTML=document.getElementById("total").innerHTML;t=document.getElementById("txtGiftCardAmount");if(t!=null&&t.value!=null){if(t.value==""){t.value=0}u=u-(parseFloat(t.value)*v);if(u<0){u=0}document.getElementById("totalBottom").innerHTML="$"+CurrencyFormatted(u)}document.getElementById("txtTotal").value=CurrencyFormatted(u)}}}else{if(w=="1"){document.getElementById("tax").innerHTML="$"+CurrencyFormatted(0)}else{document.getElementById("tax").innerHTML=document.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.form2.email.value!=""){a="applyEmailToCart.asp?email="+document.form2.email.value;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)}}}};