var blk1 = "https://www.paypal.com/cgi-bin/webscr?cmd=_cart";
var blk1a = "&add=1";
var blk1d = "&display=1";
var blk1u = "&upload=1";
var blk2 = "&business=";
var blk2a = "&quantity=";
var blk2q = 0;
var blk3 = "&item_name=";
var blk3n = "";
var bcode = "";
var blkcc = "";
var blkhn = ""; // item handling charges
var blksh = ""; // item shipping charges
var bmisc = ""; // stuff not supported anywhere else.
var op1n = ""; // option name and value
var op1v = "";
var op2n = "";
var op2v = "";
var blk4 = "&amount=";
var blk4a = "6.66";
var imgx = "dummy.jpg"; // place for cart thumbnail image
var winpar = "scrollbars,location,resizable,status,menubar,toolbar";
var cartwin;
var cmax = 15; // max items in cart
var cats = 5; // max number of categories allowed
var pcat = 0; // item product category
var ctot = new Object (); // amt & qty totals by pcat
var stax = 0; // regional (state) tax percent
var ttxt = ""; // tax text.
var ttax = 0;
var thnd = 0; // item specific handling
var tshp = 0; // item specific shipping
var hand; // cart totals
var ship;
var tpkg; // total packages
var qtyd;
var tqty = 0; // the total quantity of items ordered
var cook; // place for item cookie object
var tprc = 0; // total price of items in cart
var tozs = 0; // total ounces of order
var bozs = 0; // subtotal for item
var gtot; // order grand total
var insx = 0; // insurance total
var ader = 0; // add a flat cost to an item
var adtx = ""; // text for flat add
var dqty = new Array (); // item discount qty breakpoint
var damt = new Array (); // percent discount
var dn = 0; // number of discount brkpts
var aqty = new Array (); // item quantity amt breakpoint
var aamt = new Array (); // price at breakpoint
var an = 0; // number of amt brkpts
var iqty = 0; // minimum item quantity to order
var xqty = 1000000; // maximum item quantity to order
var zn = 0; // count of zip/zone pairs
var zzip = new Array (); // zip code
var zone = new Array (); // zone for that zip
var cdis = 0; // percdnt coupon discount
var camt = 0; // amount coupon discount
var coupval = ""; // coupon value user entered
var coupons = new Array (); // coupon codes
var couponp = new Array (); // discount percent
var coupona = new Array (); // discount amount
var cval = ""; // recorded ocupon value
var ctxt = ""; // coupon text
var coup = -1; // cart discount coupon not active
// stuff for shipping support...
var zip; // shipping zip code
var wte; // total weight of order
var zne = 0; // shipping zone
var amt; // priority shipping charge
var usps = -1; // flag for USPS priority shipping
var uspp = -1; // flag for USPS parcel post
var ups = -1; // flag for UPS ground, lower 48
var ups2 = -1; // flag for UPS 2nd day air
var insu = -1; // flag for insurance
var gwtot = 0; // Gift wrapping total
// cart display options...
var on = 1; // on and off variables
var off = 0;
function AddDesc (strn) { // add to current description
var c = "";
if (strn.length < 1 || strn == " ") return;
if (blk3n.length > 0) c = ", ";
blk3n = blk3n + c + strn;
}
function AddFixed (amt, txt) { // add flat charge to item
ader = ader*1.0 + amt*1.0;
if (txt.length > 0) adtx = adtx + ", " + txt;
}
function AddMisc (strn) { // add extra stuff to PayPal params
var s = "&";
if (strn.substring(0,1) == "&") s = "";
bmisc = bmisc + s + escape (strn);
}
function AddOpt1 (val) { // add to the value in op1v
var c = "";
if (val.length == 0 || val == " ") return;
if (op1n.length == 0) op1n = "opt1";
if (op1v.length > 0) c = ", ";
op1v = op1v + c + val;
}
function AddOpt2 (val) { // add to the value in op2v
var c = "";
if (val.length == 0 || val == " ") return;
if (op2n.length == 0) op2n = "opt2";
if (op2v.length > 0) c = ", ";
op2v = op2v + c + val;
}
function AddPrcnt (strn) { // add a percent to the price
SetPrice (blk4a * (1.0 + strn/100.0)); // add the percent
}
function AddPrice (strn) { // add to current price
blk4a = Dollar (blk4a*1.0 + strn*1.0);
}
function AddWt (ozs) { // set the weight of an item
bozs = ozs*1.0 + bozs*1.0;
}
function CalcInsu (amt) { // calculate insurance on an amount
if (ups > 0 || ups2 > 0) {
if (amt <= 100) return 0;
return 0.35 * Math.floor ((amt - 100) / 100);
}
if (usps > 0 || uspp > 0) {
if (amt == 0) return 0;
if (amt <= 50) return 1.35;
return 2.30 + Math.floor ((amt - 0.01) / 100.0) * 1.05;
}
}
function CallView () { // call the local shopping cart view
cartwin = window.open ("cart.html", "local29", winpar);
// cartwin.focus ();
}
function ChkCoup () { // check for a discount coupon
var i;
coup = -1; // assume the worst
coupons = root.xx_cval.split (",");
couponp = root.xx_cdis.split (",");
coupona = root.xx_camt.split (",");
for (i=0; i<coupons.length; i++) {
if (coupval == coupons[i]) {
coup = 1; // user hit the coupon value
cdis = couponp[i]; // remember the discount percent
camt = coupona[i]; // discount amount
cval = coupval; // remember entered value
if (cdis > 0) {
alert ("Valid coupon number! \n\n" +
cdis + "% discount now in effect.");
ctxt = "COUPON-" + cdis + "%" + cval;
}
if (camt > 0) {
alert ("Valid coupon number! \n\n" +
"$" + camt + " discount now in effect.");
ctxt = "COUPON-$" + camt + "-" + cval;
}
root.cval = cval; // remember entered value
root.coup = coup;
root.cdis = cdis;
root.camt = camt;
root.ctxt = ctxt;
root.xx_coup = off; // suppress display
root.store ();
document.location.reload (); // show the latest info...
return;
}
}
alert ("'" + coupval + "' not a valid code!");
}
function ChkFlg (temp) { // check for special flag chars
var j,tok,val;
var ary = new Array (); // where we break down input
ary = temp.split (" "); // divide on spaces
for (j=0; j<ary.length; j++) {
// first we do single character tokens...
if (ary[j].length < 2) continue;
tok = ary[j].substring (0,1); // first character
val = ary[j].substring (1); // get data
if (tok == "@") SetPrice (parseFloat(val));
if (tok == "+") AddPrice (parseFloat(val));
if (tok == "%") AddPrcnt (parseFloat(val));
if (tok == "#") { // record weight
AddWt (parseFloat(val));
ary[j] = ""; // zap this array element
}
// Now we do 3-character tokens...
if (ary[j].length < 4) continue;
tok = ary[j].substring (0,3); // first 3 chars
val = ary[j].substring (3); // get data
if (tok == "cd=") { // value for part number
SetCode (val);
ary[j] = ""; // clear it out
}
}
return ary.join (" "); // rebuild val with what's left
}
function ChkOpts () { // check if user has selected everything
if (tprc < root.xx_mamt || tqty < root.xx_mqty) { // check minimums
alert ("You have not yet met the minimum order requirements!");
return false;
} else
if (root.xx_chkbx == on && root.chkby == off) { // agree checkbox
alert ('You must agree to terms!');
return false;
} else
if (root.xx_tax == on && ttxt.length == 0) { // tax selection
alert ('Select tax!');
return false;
} else
if (root.xx_ship == on && root.sv0 == 0) { // shipping selection
alert ('Select Shipping!');
return false;
}
return true;
}
function ClearAll () { // wipe out the last entry
blk2q = ""; // quantity
blk3n = ""; // name
blk4a = "0"; // price
bcode = ""; // item number
bmisc = ""; // extra data
blkhn = ""; // item handling charges
blksh = ""; // item shipping charges
op1n = ""; // clear options
op1v = "";
op2n = "";
op2v = "";
imgx = "dummy.jpg";
ader = 0;
adtx = "";
bozs = 0;
dn = 0;
an = 0;
pcat = 0;
iqty = 0; // minimum item quantity
xqty = 1000000; // max item quantity
}
function ClearCart () { // zap all the cookies
var i;
for (i=1; i<cmax; i++) { // the data cookies
ClearEntry (i);
}
}
function ClearEntry (i) { // knock out a specific entry
cook = new Cookie (document, "paycart" + i);
cook.load();
InitData ();
}
function Cookie(document, name, hours, path, domain, secure) {
this.$document = document; // required
this.$name = name; // required
if (hours) this.$expiration =
new Date((new Date()).getTime() + hours * 3600000);
else this.$expiration = null;
// if (path) this.$path = path; else this.$path = null;
this.$path = "/"; // force, for now
if (domain) this.$domain = domain; else this.$domain = null;
if (secure) this.$secure = true; else this.$secure = false;
}
function _Cookie_store() { // store method of cookie object
var cookieval = ""; // clear actual cookie value
for(var prop in this) { // Ignore "$" properties, and methods
if ((prop.charAt(0) == '$') ||
((typeof this[prop]) == 'function'))
continue;
if (cookieval != "") cookieval += '&';
cookieval += prop + ':' + escape(this[prop]);
}
var cookie = this.$name + '=' + cookieval;
if (this.$expiration)
cookie += '; expires=' + this.$expiration.toGMTString();
if (this.$path) cookie += '; path=' + this.$path;
if (this.$domain) cookie += '; domain=' + this.$domain;
if (this.$secure) cookie += '; secure';
if (root.xx_cdmp == on) // cookie diagnostic dump
alert(cookie.length + " chars - " + cookie);
this.$document.cookie = cookie; // store with magic property
}
function _Cookie_load() { // cookie load function
var i;
var allcookies = this.$document.cookie;
if (allcookies == "") return false;
// Now extract just the named cookie from that list.
var start = allcookies.indexOf(this.$name + '=');
if (start == -1) return false; // Cookie not defined for this page.
start += this.$name.length + 1; // Skip name and equals sign.
var end = allcookies.indexOf(';', start);
if (end == -1) end = allcookies.length;
var cookieval = allcookies.substring(start, end);
var a = cookieval.split('&'); // array of name/value pairs.
for(i=0; i < a.length; i++) // Break each pair into an array.
a[i] = a[i].split(':');
for(i=0; i<a.length; i++)
this[a[i][0]] = unescape(a[i][1]);
return true; // We're done, so return the success code.
}
function _Cookie_remove() { // the remove method
var cookie;
cookie = this.$name + '=';
if (this.$path) cookie += '; path=' + this.$path;
if (this.$domain) cookie += '; domain=' + this.$domain;
cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';
this.$document.cookie = cookie; // magic store
}
function Dollar (val) { // force to valid dollar amount
var str,pos,rnd=0;
if (val < .995) rnd = 1; // for old Netscape browsers
str = escape (val*1.0 + 0.005001 + rnd); // float, round, escape
pos = str.indexOf (".");
if (pos > 0) str = str.substring (rnd, pos + 3);
return str;
}
function GetTots (indx) { // return cart totals
root.load(); // get the cookie values
}
function InitData () { // zap a data cookie
cook.pcat = 0;
cook.qty = 0;
cook.cod = "";
cook.ihnd = 0;
cook.des = "";
cook.op1n = ""; // option name and value
cook.op1v = "";
cook.op2n = "";
cook.op2v = "";
cook.prc = 0;
cook.ozs = 0;
cook.imgx = "dummy.jpg";
cook.ader = 0; // add fixed amount
cook.adtx = ""; // text for fixed amount
cook.store(); // stash it off
}
function InitRoot () { // Build the base root cookie
var i;
root.stax = stax; // stuff all base values
root.ttxt = ttxt;
root.coup = coup;
root.cval = cval;
root.ctxt = ctxt;
root.cdis = cdis;
root.camt = camt;
root.chkby = off;
root.gwtot = gwtot;
root.stxt0 = "";
root.usps = usps; // USPS flag
root.uspp = uspp; // USPS pp flag
root.ups = ups; // UPS flag
root.ups2 = ups2; // UPS 2nd day air flag
root.insu = insu; // insurance flag
root.zne = zne; // destination zone
root.qty = 0;
root.tot = 0;
root.xx_bn = "";
root.xx_can = "";
root.xx_cbt = "";
root.xx_cc = off;
root.xx_cdis = "";
root.xx_camt = "";
root.xx_cdmp = off;
root.xx_chkbx= off;
root.xx_coup = off;
root.xx_cper = 0;
root.xx_cur = "USD";
root.xx_dadd = on;
root.xx_id = "";
root.xx_img = off;
root.xx_lc = "US";
root.xx_mamt = 0;
root.xx_mqty = 0;
root.xx_pc = off;
root.xx_prt = on;
root.xx_prtx = off;
root.xx_ret = "";
root.xx_ship = off;
root.xx_siz = on;
root.xx_sty = "";
root.xx_sum = off;
root.xx_tax = off;
root.xx_uas = off;
root.xx_uasp = 0;
root.xx_wt = off;
root.xx_wtent= "oz";
root.xx_wtrup= 10;
for (i=0; i<cats; i++) {
root["hn" + i] = 0; // qty-based handling brkpts
root["qd" + i] = 0; // qty-based percent dis brkpts
root["sn" + i] = 0; // qty-based shipping brkpts
root["pv" + 1] = 0; // cart-quantity charges
root["ad" + i] = 0; // amt-based percent dis brkpts
root["sv" + i] = 0; // amt-based shipping bkpts
root["wv" + i] = 0; // wgt-based shipping bkpts
}
root.store(); // record it all..
}
function LoadTots (obj1) { // get access to cart totals
var i;
for (i=0; i<obj1.length; i++) { // Look in all FORMs
if (obj1[i].ctot) obj1[i].ctot.value = "$" + Dollar (root.tot);
if (obj1[i].cqty) obj1[i].cqty.value = root.qty;
}
}
function PrintCart () { // print out entire cart, and get cart totals
var i,wt,p,tmp1,tmp2,s;
tprc = 0; // total price of cart
tozs = 0; // total ounces of order
gtot = 0; // Grand total
ttax = 0; // total cart tax
tqty = 0; // total qty of items
insx = 0; // insurance amount
thnd = 0; // item specific handling
tshp = 0; // item specific shipping
for (i=0; i<cats; i++) { // init pcat totals
ctot["a" + i] = 0; // amount in this cat
ctot["q" + i] = 0; // quantity in this cat
ctot["h" + i] = 0; // handling in this cat
ctot["s" + i] = 0; // shipping in this cat
ctot["d" + i] = 0; // discount in this cat
ctot["w" + i] = 0; // weight in this cat
}
for (i=1; i<cmax; i++) { // print all entries
cook = new Cookie (document, "paycart" + i);
cook.load();
if (cook.qty > 0) {
PrintItem (i);
}
}
tprc = Dollar (tprc)*1.0; // round, float
hand = 0; // line display totals
ship = 0;
tpkg = 1;
qtyd = 0;
for (p=0; p<cats; p++) { // run product categories
sh = 0; // local pcat tots
ha = 0;
qt = 0;
var q = ctot["q" + p]*1.0; // quantity this catagory
var a = ctot["a" + p]*1.0; // amount this category
var w = ctot["w" + p]*1.0; // weight this category
if (root.xx_wtent == "gm") // do we fix it?
w = Math.ceil(w / root.xx_wtrup) * root.xx_wtrup;
else
w = Math.ceil(w / 16);
ctot["w" + p] = w; // put back fixed version
if (root["hn" + p] > 0) {
tmp1 = root["hqty" + p].split(",");
tmp2 = root["hamt" + p].split(",");
for (i=root["hn" + p]-1; i>=0; i--) { // run the table
if (q >= tmp1[i]*1.0) { // Check the quantity
ha = tmp2[i]*1.0; // yep, set it
break; // a-dios, mo-fo
}
}
}
ctot["h" + p] = ha;
hand = hand + ha;
if (root["sn" + p] > 0) {
tmp1 = root["sqty" + p].split(",");
tmp2 = root["samt" + p].split(",");
for (i=root["sn" + p]-1; i>=0; i--) { // run the table
if (q >= tmp1[i]*1.0) { // Check the price
sh = tmp2[i]*1.0; // yep, set it
break;
}
}
}
if ((sh == 0) && root["sv" + p] > 0) { // amount-based shipping
tmp1 = root["sval" + p].split(",");
tmp2 = root["schg" + p].split(",");
for (i=root["sv" + p]-1; i>=0; i--) { // run the table (if one)
if (a >= tmp1[i]*1.0) { // Check the price
sh = tmp2[i]*1.0; // yep, set it
break;
}
}
}
if ((sh == 0) && root["pv" + p] > 0) { // percent-based shipping
tmp1 = root["pval" + p].split(",");
tmp2 = root["pper" + p].split(",");
for (i=root["pv" + p]-1; i>=0; i--) { // run the table (if one)
if (a >= tmp1[i]*1.0) { // Check the price
sh = a * tmp2[i]/100; // yep, set it
break;
}
}
}
if ((sh == 0) && root["wv" + p] > 0) { // only one shipping
tmp1 = root["wval" + p].split(","); // weight based shipping
tmp2 = root["wchg" + p].split(",");
for (i=root["wv" + p]-1; i>=0; i--) { // run the table (if one)
if (w >= tmp1[i]*1.0) { // Check the weight
sh = tmp2[i]*1.0; // yep, set it
break;
}
}
}
ctot["s" + p] = sh;
ship = ship + sh;
if (root["qd" + p] > 0) {
tmp1 = root["qqty" + p].split(","); // qty based, %discount
tmp2 = root["qamt" + p].split(",");
for (i=root["qd" + p]-1; i>=0; i--) {
if (q >= tmp1[i]*1.0) {
qt = a * tmp2[i]/100.0;
break;
}
}
}
if (root["ad" + p] > 0) {
tmp1 = root["aprc" + p].split(","); // amt based, %discount
tmp2 = root["adis" + p].split(",");
for (i=root["ad" + p]-1; i>=0; i--) {
if (a >= tmp1[i]*1.0) {
qt = a * tmp2[i]/100.0;
break;
}
}
}
if (coup > 0) {
qt = qt + a * cdis/100.0; // percent discount
qt = qt + q/tqty * camt; // amount discount
}
ctot["d" + p] = qt;
qtyd = qtyd + qt;
}
s = 0; // for special stuff...
wte = Math.floor ((tozs + 15.999) / 16.0);
var twte = wte;
if (usps > 0) { // usps priority mail
while (twte > pz2.length - 1) { // multiple packages?
tpkg = tpkg + 1;
twte = Math.floor ((tozs / tpkg + 15.999) / 16.0);
}
s = pzx[zne][twte] * tpkg; // USPS charges to that zone
} else
if (uspp > 0) { // usps parcel post
while (twte > pp2.length - 1) {
tpkg = tpkg + 1;
twte = Math.floor ((tozs / tpkg + 15.999) / 16.0);
}
s = ppx[zne][twte] * tpkg; // USPS charges
} else
if (ups > 0) { // ups ground
while (twte > uz2.length - 1) {
tpkg = tpkg + 1;
twte = Math.floor ((tozs / tpkg + 15.999) / 16.0);
}
s = uzx[zne][twte] * tpkg; // UPS ground charges
} else
if (ups2 > 0) { // ups ground
while (twte > uy2.length - 1) {
tpkg = tpkg + 1;
twte = Math.floor ((tozs / tpkg + 15.999) / 16.0);
}
s = uzy[zne][twte] * tpkg; // UPS 2nd day air charges
if (root.xx_uas == on) s = s * (1 + root.xx_uasp/100);
}
ship = ship + s; // only if wt shipping set
if (insu > 0) insx = CalcInsu (tprc - qtyd);
hand = hand + thnd;
ship = ship + tshp;
ttax = Dollar ((tprc + hand + gwtot*tqty - qtyd) * stax/100.0);
gtot = Dollar (tprc + hand + ship + ttax*1.0 + insx
- qtyd + gwtot*tqty);
// record global totals for ref on other pages
root.qty = tqty;
root.tot = gtot;
root.store (); // save it off
}
function PrintItem (i) { // make one entry in cart
var tm,t1,t2,wt;
document.writeln ('<tr valign = "top"');
document.writeln (' align = "right">');
document.writeln (' <td>');
document.writeln (' <input type = "checkbox" ');
document.writeln (' value = "BOX1"');
document.writeln (' onclick = "ClearEntry (', i, ');');
document.writeln (' document.location.reload ();" />');
document.writeln (' </td>');
document.writeln (' <td align = "right">',
cook.qty,'</td>');
if (root.xx_pc == on) {
document.writeln (' <td align = "right">',
cook.pcat,'</td>');
}
document.writeln (' <td align = "left">',
cook.cod,'</td>');
document.writeln (' <td align = "left">',
cook.des + cook.adtx);
if (cook.ihnd > 0) { // item-specific handling charges
document.writeln (', HND=' + Dollar (cook.ihnd));
thnd = thnd + cook.ihnd*1.0;
}
if (cook.ishp > 0) { // item-specific shipping charges
document.writeln (', SHP=' + Dollar (cook.ishp));
tshp = tshp + cook.ishp * cook.qty;
}
if (cook.op1n.length > 0) { // see if we append stuff
document.writeln (', ' +
cook.op1n + ' ' +
cook.op1v + ' ' +
cook.op2n + ' ' +
cook.op2v);
}
document.writeln ('</td>');
tm = Dollar (cook.prc);
t1 = cook.qty*1.0;
t2 = cook.pcat;
document.writeln (' <td>',
tm,'</td>');
tm = Dollar (t1*cook.prc + cook.ader*1.0);
tprc = tprc*1.0 + tm*1.0;
tqty = tqty + t1;
ctot["a" + t2] = ctot["a" + t2] + tm*1.0;
ctot["q" + t2] = ctot["q" + t2] + t1;
document.writeln (' <td>',
tm,'</td>');
wt = cook.ozs*1.0 * cook.qty;
tozs = tozs + wt;
ctot["w" + t2] = ctot["w" + t2] + wt;
if (root.xx_wt == on) { // do we show weight?
document.writeln (' <td>',
cook.ozs,'</td>');
document.writeln (' <td>',
wt,'</td>');
}
if (root.xx_img == on) { // display images?
document.writeln (' <td align = "center">',
'<img src = "',
cook.imgx,
'" border="0"');
if (root.xx_siz == on)
document.writeln (' width="80" height="80"');
document.writeln (' alt = "Image: Item" />',
'</td>');
}
document.writeln ('</tr>');
}
function ReadForm (obj1, tst) { //get form data for PayPal
var i,j,obj,temp,pos,val,nam3,nam4;
var qty = 0; // default value
var dis = 0; // quantity discount
for (i=0; i<obj1.length; i++) { // run whole form
obj = obj1.elements[i]; // ref particular element
if (obj.name == "tot" || // stkp some junk
obj.name == "cqty" ||
obj.name == "ctot") continue;
nam3 = obj.name.substring (0, 3); // 3-char name (maybe)
nam4 = obj.name.substring (3, 4); // where to store it
if (obj.type == "select-one") { // dropdowns
pos = obj.selectedIndex; // which option selected
val = obj.options[pos].value; // get selection
if (val == "@-1") continue; // skip the crap
if (obj.name == "qty") { // this is the quantity
qty = val; // get user input
if ((qty == "" || qty < 1 || isNaN (qty)) && tst) { // test
alert ("Enter a valid integer quantity!");
return false;
}
} else { // this was not qty
val = ChkFlg (val); // check for flag char
if (nam3 == "opt") { // user says where to store
Where (val, nam4); // stash it
} else {
AddDesc (val); // add to data
}
}
} else
if (obj.type == "select-multiple") { // one or more
for (j=0; j<obj.options.length; j++) { // run all options
if (obj.options[j].selected) {
val = obj.options[j].value;
val = ChkFlg (val); // flag chars?
if (nam3 == "opt") { // user says where to store
Where (val, nam4); // stash it
} else {
AddDesc (val); // add to data
}
}
}
} else
if (obj.type == "checkbox" || // boxes
obj.type == "radio") {
if (obj.checked) { // was selected
val = obj.value;
val = ChkFlg (val); // flag chars?
if (nam3 == "opt") { // user says where to store
Where (val, nam4); // stash it
} else if (val.length > 0) {
AddDesc (val); // add to data
}
}
} else
if (obj.type == "text" ||
obj.type == "textarea") { // user input fields
val = obj.value; // get input
if (obj.name == "qty") { // this is the quantity
qty = val; // get user input
if ((qty == "" || qty < 1 || isNaN (qty)) && tst) { // test
alert ("Enter a valid integer quantity!");
return false;
}
} else {
if (nam3 == "opt") { // user says where to store
Where (val, nam4); // stash it
} else {
AddDesc (val); // add to data
}
}
}
if (tst == false && obj.type == "hidden" && obj.name == "initer") {
val = obj.value;
ChkFlg (val);
}
} // end of loop
if (qty == 0) qty = 1; // make sure we have something
if (qty < iqty && tst) { // minimum items ordered?
alert ("You must order at least " + iqty + " of this item!");
return false;
}
if (qty > xqty && tst) { // maximum items that can be ordered
alert ("You cannot order more than " + xqty + " of this item!");
return false;
}
blk2q = qty; // record for posterity
for (i=an-1; i>=0; i--) { // qty amount?
if (qty >= aqty[i]) { // qty brkpt
SetPrice (aamt[i]); // force it
AddDesc ("AMT");
break; // get out, now
}
}
dis = 0; // any qty discounts?
for (i=dn-1; i>=0; i--) { // run backwards
if (qty >= dqty[i]) { // qty brkpt
dis = damt[i]; // set qty amount
break; // get out, now
}
}
if (dis > 0) { // there is an item discount, here
AddPrcnt (-dis); // apply the discount
AddDesc ("DIS=" + dis + "%"); // mark it
}
if (obj1.tot) obj1.tot.value = "$" + blk4a;
if (tst) {
StoreCart ();
if (root.xx_dadd == off) {
alert("Item has been aded to cart!");
return false; // hide cart display
}
}
return true;
}
function SetAmtDC (pcat, a1, p1) { // set cart amt dis breakpoints
var i,ad;
var aprc = new Array ();
var adis = new Array ();
if (pcat >= cats) { // check him out
alert ("SetAmtDC cat arg too big!");
return;
}
ad = 0; // count of breakpoints
for (i=1; i<arguments.length; i=i+2) {
aprc[ad] = arguments[i]; // price breakpoint
adis[ad] = arguments[i+1]; // discount percent
ad = ad + 1; // number of bkpts
}
root["ad" + pcat] = ad; // stash that bad boy off
root["aprc" + pcat] = aprc;
root["adis" + pcat] = adis;
root.store(); // remember forever...
}
function SetAmtSH (pcat, a1, c1) { // set cart amt shp brkpts
var i,sv;
var sval = new Array ();
var schg = new Array ();
if (pcat >= cats) { // check him out
alert ("SetAmtSH cat arg too big!");
return;
}
sv = 0; // count of breakpoints
for (i=1; i<arguments.length; i=i+2) {
sval[sv] = arguments[i]; // price breakpoint
schg[sv] = arguments[i+1]; // discount amount
sv = sv + 1; // number of bkpts
}
root["sv" + pcat] = sv; // stash that bad boy off
root["sval" + pcat] = sval;
root["schg" + pcat] = schg;
root.store(); // remember forever...
}
function SetCartDC (pcat, q1, c1) { // set cart qty dis breakpoints
var i,qd;
var qqty = new Array ();
var qamt = new Array ();
if (pcat >= cats) { // check him out
alert ("SetCartDC cat arg too big!");
return;
}
qd = 0; // count of breakpoints
for (i=1; i<arguments.length; i=i+2) {
qqty[qd] = arguments[i]; // price breakpoint
qamt[qd] = arguments[i+1]; // discount amount
qd = qd + 1; // number of bkpts
}
root["qd" + pcat] = qd; // stash that bad boy off
root["qqty" + pcat] = qqty;
root["qamt" + pcat] = qamt;
root.store(); // remember forever...
}
function SetCartHN (pcat, q1, c1) { // set cart hand breakpoints
var i,hn;
var hamt = new Array ();
var hqty = new Array ();
if (pcat >= cats) { // check him out
alert ("SetCartHN cat arg too big!");
return;
}
hn = 0; // count of breakpoints
for (i=1; i<arguments.length; i=i+2) {
hqty[hn] = arguments[i]; // price breakpoint
hamt[hn] = arguments[i+1]; // discount amount
hn = hn + 1; // number of bkpts
}
root["hn" + pcat] = hn; // stash that bad boy off
root["hqty" + pcat] = hqty;
root["hamt" + pcat] = hamt;
root.store(); // remember forever...
}
function SetCartSH (pcat, q1, c1) { // set cart shp qty breakpoints
var i,sn;
var sqty = new Array ();
var samt = new Array ();
if (pcat >= cats) { // check him out
alert ("SetCartSH cat arg too big!");
return;
}
sn = 0; // count of breakpoints
for (i=1; i<arguments.length; i=i+2) {
sqty[sn] = arguments[i]; // price breakpoint
samt[sn] = arguments[i+1]; // handling charge
sn = sn + 1; // number of bkpts
}
root["sn" + pcat] = sn; // stash that bad boy off
root["sqty" + pcat] = sqty;
root["samt" + pcat] = samt;
root.store(); // remember forever...
}
function SetCartTX (obj1) { // set cart tax value
var i,pos;
pos = obj1.selectedIndex; // which item selected
stax = obj1.options[pos].value;
ttxt = obj1.options[pos].text;
root.stax = stax;
root.ttxt = ttxt;
root.store(); // remember forever...
document.location.reload (); // show the latest info...
}
function SetCode (cd) { // set product code
bcode = cd;
}
function SetDesc (strn) { // set the desc field
blk3n = strn;
}
function SetFixed (amt, txt) { // set flat charge to item
ader = amt*1.0;
if (txt.length > 0) adtx = ", " + txt;
else adtx = "";
}
function SetHN (amt) { // set item-specific handling charges
blkhn = amt; // set local variable
AddPrice (amt); // add in the price
}
function SetID (strn) { // set the PayPal ID of this user
blk2b = strn;
}
function SetImg (strn) { // set the image for the cart
imgx = strn;
}
function SetOpt1 (nam, val) { // set the value of 1st option
op1n = nam;
op1v = val;
}
function SetOpt2 (nam, val) { // set the value of 2nd option
op2n = nam;
op2v = val;
}
function SetPcat (val) {
if (val >= cats) {
alert ("Only " + cats + " product categories allowed!\n\n" +
"Correct your HTML!");
return;
}
pcat = val;
}
function SetPerSH (pcat, a1, p1) { // % of amt-based shipping brkpts
var i,pv;
var pval = new Array ();
var pper = new Array ();
if (pcat >= cats) { // check him out
alert ("SetPerSH cat arg too big!");
return;
}
pv = 0; // count of breakpoints
for (i=1; i<arguments.length; i=i+2) {
pval[pv] = arguments[i]; // price breakpoint
pper[pv] = arguments[i+1]; // discount amount
pv = pv + 1; // number of bkpts
}
root["pv" + pcat] = pv; // stash that bad boy off
root["pval" + pcat] = pval;
root["pper" + pcat] = pper;
root.store(); // remember forever...
}
function SetPrice (strn) { // set the current price
blk4a = 0;
AddPrice (strn);
}
function SetQA (q1, a1) { // set qty amount breakpoints
var i;
an = 0; // count of breakpoints
for (i=0; i<arguments.length; i=i+2) {
aqty[an] = arguments[i]; // quantity
aamt[an] = arguments[i+1]; // amount
an = an + 1; // number of discount bkpts
}
}
function SetQT (q) { // set minimum item quantity
iqty = q;
}
function SetQX (q) { // set maximum item quantity
xqty = q;
}
function SetQtyD (q1, d1) { // set item qty discount breakpoints
var i;
dn = 0; // count of breakpoints
for (i=0; i<arguments.length; i=i+2) {
dqty[dn] = arguments[i]; // quantity
damt[dn] = arguments[i+1]; // percent
dn = dn + 1; // number of discount bkpts
}
}
function SetSH (amt) { // set item specific shipping amount
blksh = amt; // set local variable
AddPrice (amt); // add in the price
}
function SetWgtSH (pcat, w1, c1) { // ship by weight bkpts
var i,wv;
var wval = new Array ();
var wchg = new Array ();
if (pcat >= cats) { // check him out
alert ("SetWgtSH cat arg too big!");
return;
}
wv = 0; // count of breakpoints
for (i=1; i<arguments.length; i=i+2) {
wval[wv] = arguments[i]; // price breakpoint
wchg[wv] = arguments[i+1]; // discount amount
wv = wv + 1; // number of bkpts
}
root["wv" + pcat] = wv; // stash that bad boy off
root["wval" + pcat] = wval;
root["wchg" + pcat] = wchg;
root.store(); // remember forever...
}
function SetWt (ozs) { // set the weight of an item
bozs = ozs;
}
function SetZone (zi1, zn1) { // record zip/zone info into table
var i;
zn = 0; // count of breakpoints
for (var i=0; i<arguments.length; i=i+2) {
zzip[zn] = arguments[i]; // zip code index
zone[zn] = arguments[i+1]; // zone
zn = zn + 1; // number of bkpts
}
}
function StoreCart () { // store data in local cart
var i;
for (i=1; i<cmax; i++) { //check for dup entry
cook = new Cookie (document, "paycart" + i); // run
cook.load(); // get values
if (cook.qty*1.0 > 0) { // check it out - combine dups
if (cook.cod == bcode && // check everything!!!
cook.des == blk3n &&
cook.prc*1.0 == blk4a*1.0 &&
cook.op1n == op1n &&
cook.op1v == op1v &&
cook.op2n == op2n &&
cook.op2v == op2v) {
cook.qty = cook.qty*1.0 + blk2q*1.0; // combine
cook.store();
ClearAll ();
return; // th-th-thats all, folks
}
}
}
for (i=1; i<cmax; i++) { // find empty entry
cook = new Cookie (document, "paycart" + i);
cook.load();
if (cook.qty*1.0 == 0 ||
isNaN (cook.qty)) {
cook.pcat = pcat
cook.qty = blk2q;
cook.cod = bcode;
cook.des = blk3n;
cook.ihnd = blkhn;
cook.ishp = blksh;
cook.op1n = op1n;
cook.op1v = op1v;
cook.op2n = op2n;
cook.op2v = op2v;
cook.prc = blk4a;
cook.imgx = imgx;
cook.ozs = bozs;
cook.ader = ader;
cook.adtx = adtx;
cook.store();
ClearAll ();
if (i == cmax - 1)
alert ("Warning - that was your last cookie!");
return;
}
}
alert ("Error 1 - out of cookies!");
}
function Where (val, loc) { // store val at opt[loc]
if (loc == 1) AddOpt1 (val);
else AddOpt2 (val);
}
function Xbild () { // build the PayPal FORM
var inp = '<input type="hidden" name=';
var ary1 = new Array ();
var ary2 = new Array ();
var i,j,pc,sx;
var tot = 0; // price total
var frst = 1; // 1st time thru marker
var str = ""; // temp string
var disc = new Array (); // price per item to subtract for discount
var tmps = root.stxt0+" "+ttxt+" "+ctxt; // the shipping text
if (bmisc.length > 0) { // apply misc codes
ary1 = bmisc.split ("&"); // individual commands
for (i=0; i<ary1.length; i++) { // process individual entries
if (ary1(i).length > 0) { // but only if something there
ary2 = ary1[i].split ("="); // get parts
document.writeln (inp, '"', ary2[0], // build line
'" value="', ary2[1], '" />');
}
}
}
if (ttax > 0) // do we have a calculated tax
document.writeln (inp, '"tax_cart" value="', Dollar(ttax), '" />');
for (i=0; i<cats; i++) { // set item discounts
disc[i] = ctot["d" + i] / ctot["a" + i]; // % discount per item
}
j = 0; // starting suffix
for (i=1; i<cmax; i++) { // run all the data cookies
cook = new Cookie (document, "paycart" + i);
cook.load(); // get contents
if (cook.qty > 0) { // something here
j = j + 1; // bump suffix
document.writeln (inp, '"quantity_',
j, '" value="', cook.qty, '" />');
document.writeln (inp, '"item_name_',
j, '" value="', cook.des, cook.adtx, '" />');
document.writeln (inp, '"amount_',
j, '" value="', Dollar (cook.prc * (1.0 - disc[cook.pcat]) + cook.ader/cook.qty), '" />');
if (gwtot > 0 && frst > 0) str = ', GIFT-WRAP';
if (cook.op1n.length > 0) { // 1st option present
document.writeln (inp, '"on0_',
j, '" value="', cook.op1n, '" />');
document.writeln (inp, '"os0_',
j, '" value="', cook.op1v + ', ' + tmps, '" />');
} else if (tmps.length > 0) {
document.writeln (inp, '"on0_',
j, '" value="Shipping" />');
document.writeln (inp, '"os0_',
j, '" value="', tmps, str, '" />');
}
tmps = ""; // zap it
str = "";
if (cook.op2n.length > 0) { // 2nd option present
document.writeln (inp, '"on1_',
j, '" value="', cook.op2n, '" />');
document.writeln (inp, '"os1_',
j, '" value="', cook.op2v, '" />');
}
if (cook.cod != "")
document.writeln (inp, '"item_number_',
j, '" value="',cook.cod, '" />');
if (frst > 0 && (hand > 0 || insx > 0 || gwtot > 0)) {
document.writeln (inp, '"handling_',
j,'" value="', Dollar (hand*1.0 + insx*1.0 + gwtot*tqty), '" />');
}
if (frst > 0 && ship > 0)
document.writeln (inp, '"shipping_',
j, '" value="', Dollar (ship), '" />');
else
document.writeln (inp, '"shipping_',
j, '" value="0" />');
frst = 0; // set to false - true only on 1st item
}
}
}
// these are the priority mail charge tables (zones 1-8) to 40lbs.
var pz1 = new Array (0, // USPS priority zone one
3.85, 3.95, 4.75, 5.30, 5.85, 6.30, 6.80, 7.35, 7.90, 8.40,
8.95, 9.50, 10.00, 10.55, 11.05, 11.60, 12.15, 12.65, 13.20, 13.75,
14.25, 14.80, 15.30, 15.85, 16.40, 16.90, 17.45, 18.00, 18.50, 19.05,
19.55, 20.10, 20.65, 21.15, 21.70, 22.25, 22.75, 23.30, 23.75, 24.25);
var pz2 = new Array (0,
3.85, 3.95, 4.75, 5.30, 5.85, 6.30, 6.80, 7.35, 7.90, 8.40,
8.95, 9.50, 10.00, 10.55, 11.05, 11.60, 12.15, 12.65, 13.20, 13.75,
14.25, 14.80, 15.30, 15.85, 16.40, 16.90, 17.45, 18.00, 18.50, 19.05,
19.55, 20.10, 20.65, 21.15, 21.70, 22.25, 22.75, 23.30, 23.75, 24.25);
var pz3 = new Array (0,
3.85, 3.95, 4.75, 5.30, 5.85, 6.30, 6.80, 7.35, 7.90, 8.40,
8.95, 9.50, 10.00, 10.55, 11.05, 11.60, 12.15, 12.65, 13.20, 13.75,
14.25, 14.80, 15.30, 15.85, 16.40, 16.90, 17.45, 18.00, 18.50, 19.05,
19.55, 20.10, 20.65, 21.15, 21.70, 22.25, 22.75, 23.30, 23.75, 24.25);
var pz4 = new Array (0,
3.85, 4.55, 6.05, 7.05, 8.00, 8.85, 9.80, 10.75, 11.70, 12.60,
13.35, 14.05, 14.75, 15.45, 16.20, 16.90, 17.60, 18.30, 19.00, 19.75,
20.45, 21.15, 21.85, 22.55, 23.30, 24.00, 24.70, 25.40, 26.15, 26.85,
27.55, 28.25, 28.95, 29.70, 30.40, 31.10, 31.95, 32.65, 33.50, 34.30);
var pz5 = new Array (0,
3.85, 4.90, 6.85, 8.05, 9.30, 9.90, 10.65, 11.45, 12.20, 13.00,
13.75, 14.50, 15.30, 16.05, 16.85, 17.60, 18.35, 19.30, 20.20, 21.15,
22.05, 22.95, 23.90, 24.85, 25.75, 26.60, 27.55, 28.50, 29.45, 30.35,
31.20, 32.15, 33.10, 34.00, 34.95, 35.85, 36.80, 37.70, 38.65, 39.60);
var pz6 = new Array (0,
3.85, 5.05, 7.15, 8.50, 9.85, 10.05, 11.00, 11.95, 12.90, 14.00,
15.15, 16.30, 17.50, 18.60, 19.75, 20.85, 22.05, 23.15, 24.30, 25.35,
26.55, 27.65, 28.80, 29.90, 31.10, 32.25, 33.35, 34.50, 35.60, 36.80,
37.85, 39.00, 40.10, 41.25, 42.40, 43.55, 44.65, 45.85, 47.00, 48.10);
var pz7 = new Array (0,
3.85, 5.40, 7.85, 9.45, 11.00, 11.80, 12.55, 13.80, 15.05, 16.30,
17.55, 18.80, 20.05, 21.25, 22.50, 23.75, 25.00, 26.25, 27.50, 28.75,
30.00, 31.20, 32.45, 33.70, 34.95, 36.20, 37.45, 38.70, 39.95, 41.20,
42.40, 43.65, 44.90, 46.15, 47.40, 48.65, 49.90, 51.15, 52.40, 53.60);
var pz8 = new Array (0,
3.85, 5.75, 8.55, 10.35, 12.15, 13.30, 14.55, 15.75, 17.50, 19.20,
20.90, 22.65, 24.35, 26.05, 27.80, 29.50, 31.20, 32.95, 34.65, 36.40,
38.10, 39.80, 41.55, 43.25, 44.95, 46.70, 48.40, 50.15, 51.85, 53.55,
55.30, 57.00, 58.70, 60.45, 62.15, 63.85, 65.60, 67.30, 69.05, 70.75);
var pzx = new Array (0,pz1,pz2,pz3,pz4,pz5,pz6,pz7,pz8);
// these are the parcel post mail zone charge tables (1-8) to 40lbs.
var pp1 = new Array (0,
3.69, 3.85, 4.65, 4.86, 5.03, 5.63, 5.80, 5.98, 6.11, 6.28,
6.41, 6.54, 6.67, 6.80, 6.92, 7.02, 7.15, 7.25, 7.37, 7.46,
7.57, 7.66, 7.76, 7.83, 7.93, 8.01, 8.11, 8.18, 8.27, 8.35,
8.44, 8.50, 8.58, 8.66, 8.74, 8.80, 8.87, 8.94, 9.02, 9.09);
var pp2 = new Array (0,
3.69, 3.85, 4.65, 4.86, 5.03, 5.63, 5.80, 5.98, 6.11, 6.28,
6.41, 6.54, 6.67, 6.80, 6.92, 7.02, 7.15, 7.25, 7.37, 7.46,
7.57, 7.66, 7.76, 7.83, 7.93, 8.01, 8.11, 8.18, 8.27, 8.35,
8.44, 8.50, 8.58, 8.66, 8.74, 8.80, 8.87, 8.94, 9.02, 9.09);
var pp3 = new Array (0,
3.75, 3.85, 4.65, 5.20, 5.71, 6.01, 6.28, 6.53, 6.75, 7.57,
7.80, 8.01, 8.19, 8.42, 8.61, 8.79, 8.94, 9.11, 9.28, 9.43,
9.58, 9.72, 9.89, 10.01, 10.14, 10.27, 10.40, 10.52, 10.65, 10.76,
10.86, 10.99, 11.10, 11.18, 11.30, 11.39, 11.48, 11.60, 11.67, 11.78);
var pp4 = new Array (0,
3.75, 4.14, 5.55, 6.29, 6.94, 7.44, 7.91, 8.30, 8.74, 9.10,
9.47, 9.80, 10.12, 10.43, 10.73, 11.00, 11.28, 11.52, 11.77, 11.98,
12.20, 12.42, 12.65, 12.83, 13.03, 13.21, 13.38, 13.58, 13.75, 13.90,
14.06, 14.22, 14.38, 14.51, 14.66, 14.82, 14.93, 15.07, 15.19, 15.32);
var pp5 = new Array (0,
3.75, 4.14, 5.65, 6.93, 7.75, 8.50, 9.20, 9.84, 10.45, 11.01,
11.54, 12.04, 12.51, 12.95, 13.38, 13.78, 14.16, 14.52, 14.87, 15.20,
15.52, 15.82, 16.11, 16.39, 16.66, 16.92, 17.17, 17.41, 17.64, 17.87,
18.08, 18.29, 18.49, 18.69, 18.88, 21.06, 19.23, 19.41, 19.57, 19.73);
var pp6 = new Array (0,
3.75, 4.49, 5.71, 7.14, 8.58, 9.52, 10.35, 11.11, 11.83, 12.50,
13.13, 13.72, 14.28, 14.81, 15.31, 15.79, 16.24, 16.68, 17.09, 17.48,
17.86, 18.22, 18.57, 18.90, 19.22, 19.53, 19.83, 20.11, 20.39, 20.65,
20.91, 21.16, 21.40, 21.63, 21.85, 22.07, 22.28, 22.48, 22.68, 22.87);
var pp7 = new Array (0,
3.75, 4.49, 5.77, 7.20, 8.64, 9.90, 11.38, 12.54, 13.38, 14.17,
14.92, 15.62, 16.27, 16.90, 17.49, 18.05, 18.59, 19.09, 19.58, 20.05,
20.49, 20.92, 21.65, 21.72, 22.09, 22.46, 22.81, 23.14, 23.47, 23.78,
24.08, 24.37, 24.65, 24.93, 25.19, 25.25, 25.69, 25.93, 26.17, 26.39);
var pp8 = new Array (0,
3.75, 4.49, 6.32, 7.87, 9.43, 11.49, 12.83, 15.04, 17.04, 18.14,
19.15, 20.10, 20.99, 21.84, 22.64, 23.41, 24.13, 24.82, 25.48, 26.12,
26.72, 27.30, 27.85, 28.39, 28.90, 29.39, 29.87, 30.32, 30.76, 31.19,
31.60, 32.00, 32.38, 32.75, 33.11, 33.45, 33.79, 34.12, 34.43, 40.24);
var ppx = new Array (0,pp1,pp2,pp3,pp4,pp5,pp6,pp7,pp8);
// UPS residential ground, lower 48 charges to 160 lbs. 5 Jan 2005
var uz1 = new Array (0,
6.55, 6.65, 6.70, 6.95, 7.20, 7.30, 7.65, 7.85, 8.05, 8.30, 8.50, 8.70, 8.95, 9.10, 9.30, 9.40, 9.55, 9.70, 9.85, 10.05, 10.25, 10.45, 10.65, 10.90, 11.10, 11.35, 11.55, 11.80, 12.00, 12.25, 12.45, 12.55, 12.75, 12.95, 13.20, 13.35, 13.60, 13.80, 13.95, 14.15, 14.30, 14.50, 14.70, 14.90, 15.00, 15.15, 15.30, 15.40, 15.55, 15.65, 15.80, 15.95, 16.05, 16.20, 16.35, 16.45, 16.60, 16.75, 16.85, 17.00, 17.15, 17.30, 17.40, 17.55, 17.70, 17.80, 17.95, 18.05, 18.20, 18.30, 25.80, 32.20, 37.60, 41.35, 43.35, 45.40, 47.15, 48.60, 49.80, 50.80, 51.70, 52.50, 53.30, 53.95, 54.65, 55.30, 56.00, 56.65, 57.35, 58.05, 58.70, 59.40, 60.10, 60.70, 61.40, 62.05, 62.70, 63.40, 64.05, 64.70, 65.30, 65.90, 66.45, 67.10, 67.65, 68.25, 68.85, 69.40, 69.95, 70.55, 71.15, 71.70, 72.30, 72.85, 73.45, 74.00, 74.60, 75.15, 75.75, 76.30, 76.90, 77.45, 78.05, 78.60, 79.15, 79.75, 80.35, 80.90, 81.45, 82.05, 82.65, 83.20, 83.80, 84.35, 84.95, 85.50, 86.05, 86.65, 87.25, 87.80, 88.35, 88.95, 89.50, 90.10, 90.65, 91.25, 91.80, 92.40, 93.00);
var uz2 = new Array (0,
6.55, 6.65, 6.70, 6.95, 7.20, 7.30, 7.65, 7.85, 8.05, 8.30, 8.50, 8.70, 8.95, 9.10, 9.30, 9.40, 9.55, 9.70, 9.85, 10.05, 10.25, 10.45, 10.65, 10.90, 11.10, 11.35, 11.55, 11.80, 12.00, 12.25, 12.45, 12.55, 12.75, 12.95, 13.20, 13.35, 13.60, 13.80, 13.95, 14.15, 14.30, 14.50, 14.70, 14.90, 15.00, 15.15, 15.30, 15.40, 15.55, 15.65, 15.80, 15.95, 16.05, 16.20, 16.35, 16.45, 16.60, 16.75, 16.85, 17.00, 17.15, 17.30, 17.40, 17.55, 17.70, 17.80, 17.95, 18.05, 18.20, 18.30, 25.80, 32.20, 37.60, 41.35, 43.35, 45.40, 47.15, 48.60, 49.80, 50.80, 51.70, 52.50, 53.30, 53.95, 54.65, 55.30, 56.00, 56.65, 57.35, 58.05, 58.70, 59.40, 60.10, 60.70, 61.40, 62.05, 62.70, 63.40, 64.05, 64.70, 65.30, 65.90, 66.45, 67.10, 67.65, 68.25, 68.85, 69.40, 69.95, 70.55, 71.15, 71.70, 72.30, 72.85, 73.45, 74.00, 74.60, 75.15, 75.75, 76.30, 76.90, 77.45, 78.05, 78.60, 79.15, 79.75, 80.35, 80.90, 81.45, 82.05, 82.65, 83.20, 83.80, 84.35, 84.95, 85.50, 86.05, 86.65, 87.25, 87.80, 88.35, 88.95, 89.50, 90.10, 90.65, 91.25, 91.80, 92.40, 93.00);
var uz3 = new Array (0,
6.70, 6.95, 7.20, 7.40, 7.50, 7.80, 7.95, 8.20, 8.40, 8.45, 8.75, 9.00, 9.25, 9.50, 9.75, 9.95, 10.25, 10.50, 10.80, 11.15, 11.45, 11.70, 12.05, 12.30, 12.60, 12.85, 13.10, 13.35, 13.60, 13.90, 14.15, 14.45, 14.75, 15.00, 15.35, 15.60, 15.90, 16.15, 16.45, 16.75, 17.05, 17.30, 17.60, 17.85, 18.15, 18.45, 18.65, 18.90, 19.15, 19.30, 19.50, 19.65, 19.85, 20.00, 20.15, 20.35, 20.50, 20.70, 20.85, 21.00, 21.15, 21.30, 21.45, 21.60, 21.75, 21.85, 22.00, 22.20, 22.35, 22.45, 28.85, 35.10, 40.35, 44.20, 46.25, 47.90, 49.40, 50.85, 52.30, 53.70, 54.45, 55.20, 55.95, 56.65, 57.35, 58.05, 58.70, 59.40, 60.10, 60.75, 61.40, 62.10, 62.80, 63.45, 64.10, 64.70, 65.30, 65.90, 66.45, 67.10, 67.65, 68.25, 68.85, 69.45, 70.00, 70.60, 71.20, 71.80, 72.35, 72.95, 73.55, 74.15, 74.70, 75.30, 75.90, 76.50, 77.05, 77.65, 78.25, 78.85, 79.45, 80.05, 80.65, 81.20, 81.80, 82.40, 83.00, 83.55, 84.15, 84.75, 85.35, 85.95, 86.50, 87.10, 87.70, 88.30, 88.85, 89.45, 90.05, 90.65, 91.25, 91.80, 92.40, 93.00, 93.60, 94.15, 94.75, 95.35, 95.95);
var uz4 = new Array (0,
6.85, 7.50, 7.80, 8.15, 8.45, 8.60, 8.80, 8.95, 9.15, 9.30, 9.45, 9.65, 9.80, 9.95, 10.10, 10.30, 10.55, 10.85, 11.20, 11.55, 11.85, 12.25, 12.60, 12.95, 13.30, 13.65, 14.00, 14.40, 14.75, 15.15, 15.50, 15.85, 16.25, 16.60, 16.95, 17.30, 17.65, 18.00, 18.35, 18.75, 19.05, 19.40, 19.75, 20.10, 20.45, 20.70, 21.00, 21.30, 21.60, 21.85, 22.15, 22.40, 22.65, 22.90, 23.15, 23.40, 23.60, 23.80, 24.00, 24.20, 24.40, 24.60, 24.75, 24.90, 25.10, 25.25, 25.45, 25.60, 25.75, 25.90, 31.95, 37.85, 42.90, 46.70, 49.25, 50.45, 51.60, 52.60, 53.55, 54.35, 55.10, 55.85, 56.60, 57.30, 58.00, 58.70, 59.40, 60.10, 60.75, 61.40, 62.10, 62.75, 63.40, 64.00, 64.65, 65.25, 65.85, 66.50, 67.10, 67.70, 68.30, 68.95, 69.55, 70.15, 70.75, 71.35, 71.95, 72.55, 73.15, 73.75, 74.35, 75.00, 75.60, 76.20, 76.80, 77.40, 78.00, 78.60, 79.20, 79.80, 80.40, 81.00, 81.60, 82.20, 82.85, 83.45, 84.05, 84.65, 85.25, 85.35, 85.40, 86.00, 86.60, 87.20, 87.80, 88.35, 88.95, 89.55, 90.15, 90.75, 91.35, 91.95, 92.55, 93.15, 93.75, 94.35, 94.95, 95.55, 96.15);
var uz5 = new Array (0,
7.05, 7.60, 8.00, 8.40, 8.75, 9.00, 9.25, 9.45, 9.65, 9.85, 10.10, 10.30, 10.50, 10.75, 10.95, 11.20, 11.60, 12.10, 12.60, 13.10, 13.60, 14.05, 14.50, 14.95, 15.35, 15.80, 16.20, 16.65, 17.10, 17.55, 18.00, 18.45, 18.90, 19.35, 19.80, 20.25, 20.70, 21.15, 21.60, 22.05, 22.50, 22.95, 23.40, 23.85, 24.35, 24.75, 25.15, 25.60, 26.00, 26.35, 26.75, 27.05, 27.40, 27.70, 28.05, 28.35, 28.65, 28.95, 29.25, 29.45, 29.65, 29.80, 30.00, 30.20, 30.40, 30.60, 30.75, 30.95, 31.15, 31.35, 34.90, 39.10, 43.25, 47.45, 49.95, 51.50, 52.85, 53.95, 54.90, 55.60, 56.30, 56.95, 57.65, 58.30, 58.95, 59.65, 60.30, 60.95, 61.60, 62.25, 62.95, 63.60, 64.30, 64.95, 65.60, 66.30, 66.95, 67.60, 68.25, 68.90, 69.50, 70.05, 70.65, 71.25, 71.85, 72.40, 72.95, 73.55, 74.10, 74.70, 75.25, 75.80, 76.35, 76.95, 77.50, 78.10, 78.65, 79.25, 79.80, 80.40, 80.95, 81.50, 82.05, 82.65, 83.20, 83.80, 84.35, 84.95, 85.50, 86.05, 86.65, 87.20, 87.75, 88.35, 88.90, 89.50, 90.05, 90.60, 91.20, 91.75, 92.30, 92.90, 93.45, 94.05, 94.60, 95.15, 95.75, 96.30, 96.85);
var uz6 = new Array (0,
7.35, 8.05, 8.45, 8.90, 9.25, 9.50, 9.80, 10.10, 10.30, 10.65, 11.05, 11.50, 12.00, 12.55, 13.15, 13.70, 14.30, 14.90, 15.55, 16.15, 16.75, 17.35, 17.95, 18.60, 19.20, 19.80, 20.45, 21.05, 21.65, 22.25, 22.85, 23.45, 24.05, 24.65, 25.25, 25.85, 26.40, 26.95, 27.50, 28.05, 28.60, 29.15, 29.65, 30.15, 30.65, 31.10, 31.55, 31.95, 32.35, 32.80, 33.15, 33.55, 33.90, 34.30, 34.65, 35.05, 35.40, 35.80, 36.10, 36.40, 36.70, 37.00, 37.20, 37.45, 37.70, 37.90, 38.15, 38.35, 38.60, 38.80, 41.90, 44.80, 47.65, 50.45, 53.05, 55.20, 56.90, 58.15, 59.00, 59.65, 60.35, 61.00, 61.70, 62.35, 63.05, 63.70, 64.35, 65.05, 65.70, 66.40, 67.05, 67.70, 68.35, 69.00, 69.65, 70.35, 71.00, 71.65, 72.30, 72.95, 73.60, 74.25, 74.90, 75.55, 76.15, 76.75, 77.40, 78.00, 78.60, 79.20, 79.85, 80.45, 81.05, 81.65, 82.30, 82.90, 83.50, 84.15, 84.75, 85.35, 85.95, 86.60, 87.20, 87.80, 88.40, 89.05, 89.65, 90.30, 90.90, 91.55, 92.20, 92.80, 93.45, 94.05, 94.70, 95.30, 95.95, 96.55, 97.20, 97.80, 98.45, 99.10, 99.70, 100.35, 100.95, 101.60, 102.20, 102.85, 103.50);
var uz7 = new Array (0,
7.45, 8.20, 8.70, 9.15, 9.55, 9.90, 10.20, 10.65, 11.15, 11.80, 12.55, 13.30, 14.05, 14.80, 15.55, 16.25, 16.95, 17.65, 18.40, 19.10, 19.80, 20.50, 21.20, 21.95, 22.65, 23.35, 24.00, 24.65, 25.40, 26.15, 26.90, 27.65, 28.40, 29.15, 29.90, 30.65, 31.40, 32.15, 32.85, 33.65, 34.35, 35.10, 35.85, 36.55, 37.30, 37.95, 38.60, 39.25, 39.90, 40.50, 41.10, 41.55, 42.00, 42.35, 42.65, 42.90, 43.10, 43.35, 43.60, 43.80, 44.05, 44.35, 44.55, 44.80, 45.05, 45.30, 45.55, 45.80, 46.05, 46.30, 48.70, 51.20, 53.70, 55.80, 57.45, 58.70, 59.55, 60.30, 61.10, 61.75, 62.40, 63.10, 63.75, 64.45, 65.10, 65.75, 66.45, 67.10, 67.80, 68.45, 69.15, 69.80, 70.50, 71.15, 71.80, 72.45, 73.10, 73.75, 74.40, 75.05, 75.75, 76.35, 77.05, 77.70, 78.35, 79.00, 79.70, 80.35, 81.00, 81.65, 82.30, 82.90, 83.55, 84.20, 84.85, 85.50, 86.15, 86.75, 87.45, 88.10, 88.75, 89.40, 90.05, 90.70, 91.35, 92.00, 92.70, 93.35, 94.00, 94.65, 95.30, 95.95, 96.65, 97.30, 97.95, 98.60, 99.25, 99.90, 100.55, 101.20, 101.90, 102.55, 103.20, 103.85, 104.50, 105.15, 105.85, 106.50, 107.15);
var uz8 = new Array (0,
7.60, 8.60, 9.35, 9.85, 10.40, 10.75, 11.15, 11.80, 12.50, 13.25, 14.05, 15.00, 15.90, 16.80, 17.70, 18.55, 19.45, 20.35, 21.30, 22.20, 23.10, 24.00, 24.90, 25.80, 26.75, 27.60, 28.45, 29.35, 30.25, 31.15, 32.05, 32.95, 33.85, 34.75, 35.65, 36.55, 37.40, 38.30, 39.15, 40.00, 40.85, 41.70, 42.50, 43.35, 44.25, 45.00, 45.80, 46.50, 47.20, 47.80, 48.40, 48.95, 49.45, 49.90, 50.30, 50.65, 50.95, 51.30, 51.65, 51.95, 52.30, 52.65, 53.00, 53.30, 53.65, 53.95, 54.30, 54.65, 55.00, 55.30, 57.35, 59.00, 60.25, 61.35, 62.35, 63.15, 63.85, 64.50, 65.20, 65.85, 66.50, 67.15, 67.85, 68.50, 69.15, 69.80, 70.45, 71.15, 71.80, 72.45, 73.15, 73.80, 74.50, 75.15, 75.85, 76.50, 77.20, 77.85, 78.50, 79.20, 79.85, 80.50, 81.15, 81.80, 82.45, 83.10, 83.80, 84.45, 85.10, 85.75, 86.40, 87.05, 87.65, 88.30, 88.95, 89.60, 90.25, 90.90, 91.55, 92.20, 92.85, 93.50, 94.15, 94.80, 95.45, 96.10, 96.75, 97.45, 98.10, 98.75, 99.40, 100.05, 100.70, 101.35, 102.00, 102.70, 103.35, 104.00, 104.65, 105.30, 105.95, 106.65, 107.30, 107.95, 108.60, 109.25, 109.90, 110.55, 111.20);
var uzx = new Array (0,uz1,uz2,uz3,uz4,uz5,uz6,uz7,uz8);
// ups 2nd day air tables up to 70 lbs. 5 January 2004
var uy1 = new Array (0,
8.80, 9.10, 9.90, 10.60, 11.40, 11.70, 12.50, 13.40, 14.00, 14.50, 15.40, 16.30, 17.10, 17.90, 18.80, 19.60, 20.20, 20.80, 21.50, 22.10, 22.70, 23.30, 24.00, 24.60, 25.30, 26.00, 26.70, 27.50, 28.30, 29.00, 29.80, 30.50, 31.10, 31.80, 32.50, 33.10, 33.80, 34.50, 35.50, 36.50, 37.40, 38.20, 38.80, 39.50, 40.20, 40.90, 41.70, 42.50, 43.20, 44.00, 44.80, 45.50, 46.30, 47.10, 47.70, 48.40, 49.10, 49.70, 50.40, 51.20, 52.00, 52.90, 53.80, 54.70, 55.60, 56.20, 56.90, 57.50, 58.20, 58.90);
var uy2 = new Array (0,
8.80, 9.10, 9.90, 10.60, 11.40, 11.70, 12.50, 13.40, 14.00, 14.50, 15.40, 16.30, 17.10, 17.90, 18.80, 19.60, 20.20, 20.80, 21.50, 22.10, 22.70, 23.30, 24.00, 24.60, 25.30, 26.00, 26.70, 27.50, 28.30, 29.00, 29.80, 30.50, 31.10, 31.80, 32.50, 33.10, 33.80, 34.50, 35.50, 36.50, 37.40, 38.20, 38.80, 39.50, 40.20, 40.90, 41.70, 42.50, 43.20, 44.00, 44.80, 45.50, 46.30, 47.10, 47.70, 48.40, 49.10, 49.70, 50.40, 51.20, 52.00, 52.90, 53.80, 54.70, 55.60, 56.20, 56.90, 57.50, 58.20, 58.90);
var uy3 = new Array (0,
9.50, 10.10, 10.80, 11.60, 12.80, 13.50, 14.50, 15.60, 16.70, 17.70, 18.70, 19.80, 20.60, 21.50, 22.30, 23.10, 23.80, 24.30, 25.10, 25.90, 26.80, 27.80, 28.70, 29.60, 30.50, 31.40, 32.20, 33.10, 34.00, 34.90, 35.60, 36.50, 37.40, 38.20, 39.10, 40.00, 41.00, 41.90, 42.80, 43.70, 44.80, 45.70, 46.50, 47.30, 48.10, 49.00, 49.80, 50.70, 51.70, 52.70, 53.70, 54.70, 55.70, 56.50, 57.40, 58.40, 59.20, 60.00, 60.70, 61.50, 62.40, 63.40, 64.50, 65.60, 66.70, 67.40, 68.20, 69.10, 70.00, 71.00);
var uy4 = new Array (0,
10.00, 11.30, 12.50, 13.90, 15.20, 16.10, 17.40, 18.70, 20.10, 21.50, 22.80, 24.00, 25.30, 26.40, 27.60, 28.70, 29.70, 30.70, 31.90, 33.00, 34.20, 35.30, 36.50, 37.60, 38.80, 40.00, 41.00, 42.10, 43.20, 44.40, 45.70, 46.90, 48.00, 49.10, 50.20, 51.20, 52.30, 53.50, 54.70, 55.90, 57.00, 58.10, 59.10, 60.10, 61.10, 62.00, 63.10, 64.20, 65.30, 66.40, 67.40, 68.40, 69.40, 70.40, 71.40, 72.60, 73.70, 74.90, 76.20, 77.60, 78.70, 79.80, 80.90, 82.00, 83.10, 84.30, 85.40, 86.60, 87.70, 88.90);
var uy5 = new Array (0,
11.10, 12.40, 14.00, 15.70, 17.60, 19.10, 21.00, 22.80, 24.50, 26.30, 28.10, 29.80, 31.20, 32.90, 34.40, 35.60, 36.90, 38.10, 39.40, 40.90, 42.50, 43.90, 45.30, 46.80, 48.30, 49.90, 51.50, 52.90, 54.30, 55.80, 57.20, 58.70, 60.30, 61.60, 62.90, 64.20, 65.70, 67.00, 68.30, 69.70, 71.20, 72.60, 74.00, 75.20, 76.50, 77.80, 79.10, 80.40, 81.70, 83.10, 84.50, 85.90, 87.30, 88.80, 90.20, 91.60, 93.10, 94.50, 95.90, 97.40, 98.90, 100.30, 101.80, 103.30, 104.90, 106.60, 108.20, 109.90, 111.70, 113.40);
var uy6 = new Array (0,
12.20, 14.00, 16.10, 18.00, 19.90, 22.60, 25.00, 27.40, 29.80, 32.50, 34.90, 37.20, 39.30, 41.10, 43.20, 45.50, 47.60, 49.80, 52.00, 54.20, 56.40, 58.40, 60.50, 62.60, 64.50, 66.10, 67.90, 69.70, 71.70, 73.80, 75.90, 78.10, 80.20, 82.20, 84.20, 86.20, 88.30, 90.40, 92.50, 94.60, 96.70, 98.60, 100.40, 102.40, 104.40, 106.40, 108.40, 110.30, 112.30, 114.30, 116.20, 118.00, 119.90, 121.80, 123.60, 125.60, 127.60, 129.60, 131.60, 133.50, 135.50, 137.60, 139.80, 141.80, 143.80, 146.00, 148.10, 150.20, 152.20, 154.30);
var uy7 = new Array (0,
13.00, 15.10, 17.10, 19.30, 21.50, 24.10, 26.40, 29.00, 31.80, 34.40, 36.90, 39.10, 41.00, 43.10, 45.20, 47.60, 49.80, 52.10, 54.60, 56.90, 59.10, 61.40, 63.70, 66.00, 68.30, 70.40, 72.60, 74.60, 76.80, 78.80, 81.00, 83.30, 85.50, 87.80, 90.00, 92.30, 94.60, 97.00, 99.20, 101.50, 103.70, 105.90, 108.10, 110.20, 112.40, 114.60, 116.80, 119.00, 121.10, 123.20, 125.30, 127.40, 129.60, 131.60, 133.50, 135.60, 137.70, 139.90, 142.30, 144.80, 147.00, 149.30, 151.60, 153.90, 156.10, 158.40, 160.70, 163.00, 165.30, 167.60);
var uy8 = new Array (0,
13.30, 15.50, 17.60, 19.70, 22.10, 25.10, 27.90, 30.60, 33.30, 35.80, 38.30, 40.60, 42.70, 44.90, 47.10, 49.20, 51.40, 53.70, 56.00, 58.50, 61.10, 63.60, 66.00, 68.20, 70.50, 72.70, 74.90, 77.20, 79.40, 81.50, 83.80, 86.10, 88.30, 90.50, 92.80, 95.30, 97.60, 99.90, 102.10, 104.40, 106.70, 108.90, 111.10, 113.30, 115.50, 117.70, 119.90, 122.10, 124.10, 126.10, 128.20, 130.20, 132.30, 134.40, 136.50, 138.70, 140.90, 143.10, 145.30, 147.60, 150.00, 152.50, 154.90, 157.30, 159.80, 162.40, 164.90, 167.40, 169.80, 172.30);
var uzy = new Array (0,uy1,uy2,uy3,uy4,uy5,uy6,uy7,uy8);
function CalcCost () { // given weight and ZIP, calc cost
wte = Math.floor ((tozs + 15.999) / 16.0);
if (usps > 0) { // user selected USPS Priority shipping
SetUspsZ (); // set up USPS mail zones
} else
if (uspp > 0) { // user selected USPS Parcel Post shipping
SetUspsZ (); // set up USPS mail zones
} else
if (ups > 0) { // user has selected UPS ground shipping
SetUpsZ (); // set up UPS shipping zones
} else
if (ups2 > 0) { // user has selected UPS 2nd day air shipping
SetUpsZ (); // set up UPS shipping zones
}
for (var i=zn-1; i>=0; i--) { // run table backwards
if (zip >= zzip[i]) { // zip value
zne = zone[i]; // corresponding zone
break; // get out, now
}
}
root.stxt0 = root.stxt0 + ", zone " + zne;
root.zne = zne;
root.usps = usps;
root.uspp = uspp;
root.ups = ups;
root.ups2 = ups2;
root.insu = insu;
root.store ();
}
function SetUspsZ () { // set USPS zone chart in memory
// built from USPS 54703 zone chart
SetZone (000, 8,
5, 5, 6, 8, 10, 5, 25, 6, 30, 5,
38, 6, 50, 5, 160, 4, 163, 5, 164, 4,
166, 5, 214, 5, 260, 4, 262, 5, 270, 5,
294, 6, 295, 5, 315, 6, 317, 5, 320, 6,
330, 7, 333, 6, 340, 7, 341, 6, 344, 6,
346, 6, 349, 6, 350, 5, 354, 5, 382, 4,
383, 5, 400, 4, 407, 5, 410, 4, 411, 5,
413, 4, 415, 5, 420, 4, 430, 4, 463, 3,
465, 4, 493, 3, 497, 4, 498, 2, 500, 3,
515, 4, 520, 2, 522, 3, 530, 3, 534, 3,
535, 2, 537, 2, 540, 2, 547, 1, 548, 2,
553, 2, 559, 1, 560, 2, 562, 3, 563, 2,
564, 3, 565, 3, 566, 3, 567, 4, 570, 3,
574, 4, 580, 3, 582, 4, 588, 5, 590, 5,
596, 6, 600, 3, 617, 4, 622, 4, 633, 4,
644, 4, 660, 4, 664, 4, 677, 5, 680, 4,
683, 4, 700, 6, 703, 6, 704, 5, 710, 5,
716, 5, 726, 4, 728, 5, 733, 6, 734, 5,
743, 5, 769, 6, 776, 5, 779, 6, 790, 5,
797, 6, 800, 5, 820, 5, 832, 6, 840, 6,
850, 6, 852, 6, 855, 6, 859, 6, 863, 6,
870, 6, 877, 5, 878, 6, 881, 5, 882, 6,
884, 5, 885, 6, 889, 6, 893, 6, 894, 7,
897, 7, 898, 6, 900, 7, 910, 7, 930, 7,
967, 8, 970, 7, 978, 6, 980, 7, 988, 6,
989, 7, 990, 6, 995, 8
);
}
function SetUpsZ () { // set UPS lower 48 ground Zones
// built from UPS 54703 zone chart, lower 48
SetZone (000, 8,
4, 5, 10, 5, 19, 6, 20, 5, 25, 6,
30, 5, 38, 6, 50, 5, 100, 5, 143, 4,
144, 5, 161, 4, 162, 5, 164, 4, 166, 5,
200, 5, 260, 4, 262, 5, 294, 6, 295, 5,
300, 5, 315, 6, 317, 5, 320, 6, 330, 7,
333, 6, 341, 6, 350, 5, 382, 4, 383, 5,
400, 4, 407, 5, 410, 4, 411, 5, 413, 4,
415, 5, 420, 4, 463, 3, 465, 4, 493, 3,
497, 4, 498, 2, 500, 3, 504, 2, 505, 3,
515, 4, 520, 2, 522, 3, 535, 2, 561, 3,
563, 2, 564, 3, 567, 4, 570, 3, 573, 4,
580, 3, 582, 4, 588, 5, 596, 6, 600, 3,
617, 4, 635, 3, 636, 4, 677, 5, 680, 4,
700, 6, 704, 5, 726, 4, 728, 5, 733, 6,
734, 5, 743, 4, 744, 5, 769, 6, 776, 5,
779, 6, 790, 5, 797, 6, 800, 5, 832, 6,
854, 7, 855, 6, 875, 5, 878, 6, 881, 5,
882, 6, 884, 5, 885, 6, 894, 7, 898, 6,
900, 7, 970, 7, 978, 6, 980, 7, 988, 6,
989, 7, 990, 6);
}
function Shipper (obj1) { // use either amt or qty based shipping
/* Note - when using something other than SetAmtSH you must include
SetAmtSH (0,0,0); within every position to kill shipping question.
AND, every call used here must have a zero call under the worst area.*/
var pos;
ShipZap (obj1); // zap everything
pos = obj1.selectedIndex; // which option selected
root.stxt0 = obj1.options[pos].text;
if (pos == 1) { // 1st option
usps = 1;
insu = 1;
if (!ShipChk (obj1)) return; // see if ZIP ok
SetAmtSH (0,0,0);
CalcCost ();
} else
if (pos == 2) { // 2nd option
usps = 1;
if (!ShipChk (obj1)) return; // see if ZIP ok
SetAmtSH (0,0,0);
CalcCost ();
} else
if (pos == 3) { // 3rd option
uspp = 1;
if (!ShipChk (obj1)) return; // see if ZIP ok
SetAmtSH (0,0,0);
CalcCost ();
} else
if (pos == 4) { // 4th option
ups = 1;
if (!ShipChk (obj1)) return; // see if ZIP ok
SetAmtSH (0,0,0);
CalcCost ();
} else
if (pos == 5) { // 5th option
ups2 = 1;
if (!ShipChk (obj1)) return; // see if ZIP ok
SetAmtSH (0,0,0);
CalcCost ();
} else
if (pos == 6) { // 6th option
SetCartSH (0,0,0);
SetAmtSH (0,0,0);
}
document.location.reload (); // show the latest info...
}
function ShipChk (obj1) { // check for proper ZIP code
zip = prompt("Enter destination ZIP...", "").substring (0, 3);
if (isNaN (zip) || zip.length < 3) { // keep them honest
alert ("You must enter a valid ZIP code!");
ShipZap (obj1);
document.location.reload (); // show the latest info...
return false;
}
return true;
}
function ShipZap (obj1) { // error - zap all selections
SetAmtSH (0);
SetCartSH (0);
SetPerSH (0);
SetWgtSH (0);
usps = -1;
uspp = -1;
ups = -1;
ups2 = -1;
insu = -1;
stxt0 = "Error - Select Shipping";
root.usps = -1;
root.uspp = -1;
root.ups = -1;
root.ups2 = -1;
root.insu = -1;
root.stxt0 = stxt0;
root.store ()
}
function LoadIt () {
// executed at load time
Cookie.prototype.store = _Cookie_store; // load proto methods
Cookie.prototype.load = _Cookie_load;
Cookie.prototype.remove = _Cookie_remove;
cook = new Cookie (document, "paycart1");
cook.load();
if (!cook.qty) { //create the structure
root = new Cookie (document, "paycart0"); // root cookie
root.load();
InitRoot ();
for (var i=1; i<cmax; i++) { // load or init data cookies
cook = new Cookie (document, "paycart" + i);
InitData (); // create it
}
}
root = new Cookie (document, "paycart0"); // root cookie
root.load();
stax = root.stax; // load defaults
ttxt = root.ttxt;
coup = root.coup;
cdis = root.cdis;
camt = root.camt;
cval = root.cval;
ctxt = root.ctxt;
gwtot = root.gwtot;
zne = root.zne;
usps = root.usps;
uspp = root.uspp;
ups = root.ups;
ups2 = root.ups2;
insu = root.insu;
}