//Options for Everyone: 
MonetarySymbol = '$'; 
DisplayNotice = false; 
DisplayChangeQty = true; 
DisplayShippingColumn = true; 
DisplayShippingRow = true; 
TaxRate = 0.07; //set taxable region rate ||
DisplayTaxRow = false; 
TaxByRegion = false; //leave this at false, UPS Shipping Mod will activate taxable Zone ||
TaxPrompt = 'For tax purposes,'; //Deactivated ||
TaxablePrompt = 'Kansas Branch'; //Deactivated ||
NonTaxablePrompt = 'Other Branches'; //Deactivated ||
MinimumOrder = 0.01; 
MinimumOrderPrompt = 'Oops!\n\nWe can not proceed to check out since\nthere is no item in the shopping cart.'; 
//original syntax - MinimumOrderPrompt = 'Your order is below our minimum order, please order more before checking out.'; 

NoQtyPrompt = 'You cannot proceed until a Shipping area has been selected'; //If attempted to go to checkout before selecting shipping zone ||

//Payment Processor Options: 
PaymentProcessor = ''; 

//Options for Programmers: 
OutputItemId = 'ID_'; 
OutputItemQuantity = 'QUANTITY_'; 
OutputItemPrice = 'PRICE_'; 
OutputItemName = 'NAME_'; 
OutputItemWeight = 'WEIGHT_'; //Added for UPS mod ||
OutputItemAddtlInfo = 'ADDTLINFO_'; 
OutputItemXtend = 'XTEND_'; 
OutputOrderZone = 'SHIPZONE'; 
OutputOrderSubtotal = 'SUBTOTAL'; 
OutputOrderShipping = 'SHIPPING'; 
OutputOrderTax = 'TAX'; 
OutputOrderTotal = 'TOTAL'; 
AppendItemNumToOutput = true; 
HiddenFieldsToCheckout = true; 

//Options for Shipping by Weight: 
LocationLabel = 'Zone Not Selected Yet'; 
LocationPrompt = 'For shipping purposes, please enter your zip code.'; 
MaxWeightPrompt = 'Sorry, maximum weight allowable is 70lbs.'; 

//=====================================================================|| 
//---------------------------------------------------------------------|| 
// YOU DO NOT NEED TO MAKE ANY MODIFICATIONS BELOW THIS LINE || 
//---------------------------------------------------------------------|| 
//=====================================================================|| 

// Global Variables - Lana's Modification
// var zne,wte,amt,mpp;
var zne, scf, mpp;
zn = 0;                // ZIP, zone entries index
zzip = new Array ();   // ZIP entry
zone = new Array ();   // corresponding zone for ZIP

//---------------------------------------------------------------------|| 
// Language Strings || 
// ------------------ || 
// These strings will not be used unless you have not included a || 
// language pack already. You should NOT modify these, but instead || 
// modify the strings in language-**.js where ** is the language pack || 
// you are using. || 
//---------------------------------------------------------------------|| 
if ( !bLanguageDefined ) { 
strSorry = "I'm Sorry, your cart is full, please proceed to checkout."; 
strAdded = " Added to your shopping cart."; 
strRemove = "Click 'Ok' to remove this product from your shopping cart."; 
strILabel = "Product Id"; 
strDLabel = "Product Name/Description"; 
strQLabel = "Qty"; 
strPLabel = "Price"; 
strSLabel = "Weight"; //Added for UPS mod ||
strRLabel = "Remove From Cart"; 
strRButton= "Remove"; 
strSUB = "SUBTOTAL"; 
strWTOT = "TOTAL WEIGHT"; //Added for UPS mod ||
strSHIP = "SHIPPING"; 
strTAX = "TAX"; 
strTOT = "TOTAL"; 
strErrQty = "Invalid Quantity."; 
strNewQty = 'Please enter new quantity:'; 
bLanguageDefined = true; 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: CKquantity                                                || 
// PARAMETERS: Quantity to                                             || 
// RETURNS: Quantity as a number, and possible alert                   || 
// PURPOSE: Make sure quantity is represented as a number              || 
//---------------------------------------------------------------------|| 
function CKquantity(checkString) { 
var strNewQuantity = ""; 

for ( i = 0; i < checkString.length; i++ ) { 
ch = checkString.substring(i, i+1); 
if ( (ch >= "0" && ch <= "9") || (ch == '.') ) 
strNewQuantity += ch; 
} 

if ( strNewQuantity.length < 1 ) 
strNewQuantity = "1"; 

return(strNewQuantity); 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: AddToCart                                                 || 
// PARAMETERS: Form Object                                             || 
// RETURNS: Cookie to user's browser, with prompt                      || 
// PURPOSE: Adds a product to the user's shopping cart                 || 
// EXTRAS ADDED IN: USERENTRY for customer text input                  ||
//---------------------------------------------------------------------|| 
function AddToCart(thisForm) { 
var iNumberOrdered = 0; 
var bAlreadyInCart = false; 
var notice = ""; 
iNumberOrdered = GetCookie("NumberOrdered"); 

if ( iNumberOrdered == null ) 
iNumberOrdered = 0; 

if ( thisForm.ID_NUM == null ) 
strID_NUM = ""; 
else 
strID_NUM = thisForm.ID_NUM.value; 

if ( thisForm.QUANTITY == null ) 
strQUANTITY = "1"; 
else 
strQUANTITY = thisForm.QUANTITY.value; 

if ( thisForm.PRICE == null ) 
strPRICE = "0.00"; 
else 
strPRICE = thisForm.PRICE.value; 

if ( thisForm.NAME == null ) 
strNAME = ""; 
else 
strNAME = thisForm.NAME.value; 

if ( thisForm.WEIGHT == null ) //Added for UPS mod ||
strSHIPPING = "0"; 
else 
strSHIPPING = thisForm.WEIGHT.value; 

if ( thisForm.ADDITIONALINFO == null ) { strADDTLINFO = ""; } else { strADDTLINFO = thisForm.ADDITIONALINFO[thisForm.ADDITIONALINFO.selectedIndex].value; } if ( thisForm.ADDITIONALINFO2 != null ) { strADDTLINFO += "; " + thisForm.ADDITIONALINFO2[thisForm.ADDITIONALINFO2.selectedIndex].value; } if ( thisForm.ADDITIONALINFO3 != null ) { strADDTLINFO += "; " + thisForm.ADDITIONALINFO3[thisForm.ADDITIONALINFO3.selectedIndex].value; } if ( thisForm.ADDITIONALINFO4 != null ) { strADDTLINFO += "; " + thisForm.ADDITIONALINFO4[thisForm.ADDITIONALINFO4.selectedIndex].value; } 
if ( thisForm.USERENTRY != null ) { 
strADDTLINFO += "; " + thisForm.USERENTRY.value; 
} 
if ( thisForm.USERENTRY2 != null ) { 
strADDTLINFO += "; " + thisForm.USERENTRY2.value; 
} 
if ( thisForm.USERENTRY3 != null ) { 
strADDTLINFO += "; " + thisForm.USERENTRY3.value; 
} 
//Is this product already in the cart? If so, increment quantity instead of adding another. 
for ( i = 1; i <= iNumberOrdered; i++ ) { 
NewOrder = "Order." + i; 
database = ""; 
database = GetCookie(NewOrder); 

Token0 = database.indexOf("|", 0); 
Token1 = database.indexOf("|", Token0+1); 
Token2 = database.indexOf("|", Token1+1); 
Token3 = database.indexOf("|", Token2+1); 
Token4 = database.indexOf("|", Token3+1); 

fields = new Array; 
fields[0] = database.substring( 0, Token0 ); 
fields[1] = database.substring( Token0+1, Token1 ); 
fields[2] = database.substring( Token1+1, Token2 ); 
fields[3] = database.substring( Token2+1, Token3 ); 
fields[4] = database.substring( Token3+1, Token4 ); 
fields[5] = database.substring( Token4+1, database.length ); 

if ( fields[0] == strID_NUM && 
fields[2] == strPRICE && 
fields[3] == strNAME && 
fields[5] == strADDTLINFO 
) { 
bAlreadyInCart = true; 
dbUpdatedOrder = strID_NUM + "|" + 
(parseInt(strQUANTITY)+parseInt(fields[1])) + "|" + 
strPRICE + "|" + 
strNAME + "|" + 
strSHIPPING + "|" + 
strADDTLINFO; 
strNewOrder = "Order." + i; 
DeleteCookie(strNewOrder, "/"); 
SetCookie(strNewOrder, dbUpdatedOrder, null, "/"); 
notice = strAdded + "\n-------------------------------------\n" + "Quantity : " + strQUANTITY + "\nProduct  : " + strNAME;
break; 
} 
} 


if ( !bAlreadyInCart ) { 
iNumberOrdered++; 

if ( iNumberOrdered > 12 ) 
alert( strSorry ); 
else { 
dbUpdatedOrder = strID_NUM + "|" + 
strQUANTITY + "|" + 
strPRICE + "|" + 
strNAME + "|" + 
strSHIPPING + "|" + 
strADDTLINFO; 

strNewOrder = "Order." + iNumberOrdered; 
SetCookie(strNewOrder, dbUpdatedOrder, null, "/"); 
SetCookie("NumberOrdered", iNumberOrdered, null, "/"); 
notice = strAdded + "\n-------------------------------------\n" + "Quantity : " + strQUANTITY + "\nProduct  : " + strNAME;
} 
} 

if ( DisplayNotice && notice!=''){ 
alert(notice); 
}else{ 
} 

} 


//---------------------------------------------------------------------|| 
// FUNCTION: getCookieVal || 
// PARAMETERS: offset || 
// RETURNS: URL unescaped Cookie Value || 
// PURPOSE: Get a specific value from a cookie || 
//---------------------------------------------------------------------|| 
function getCookieVal (offset) { 
var endstr = document.cookie.indexOf (";", offset); 

if ( endstr == -1 ) 
endstr = document.cookie.length; 
return(unescape(document.cookie.substring(offset, endstr))); 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: FixCookieDate || 
// PARAMETERS: date || 
// RETURNS: date || 
// PURPOSE: Fixes cookie date, stores back in date || 
//---------------------------------------------------------------------|| 
function FixCookieDate (date) { 
var base = new Date(0); 
var skew = base.getTime(); 

date.setTime (date.getTime() - skew); 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: GetCookie || 
// PARAMETERS: Name || 
// RETURNS: Value in Cookie || 
// PURPOSE: Retrieves cookie from users browser || 
//---------------------------------------------------------------------|| 
function GetCookie (name) { 
var arg = name + "="; 
var alen = arg.length; 
var clen = document.cookie.length; 
var i = 0; 

while ( i < clen ) { 
var j = i + alen; 
if ( document.cookie.substring(i, j) == arg ) return(getCookieVal (j)); 
i = document.cookie.indexOf(" ", i) + 1; 
if ( i == 0 ) break; 
} 

return(null); 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: SetCookie || 
// PARAMETERS: name, value, expiration date, path, domain, security || 
// RETURNS: Null || 
// PURPOSE: Stores a cookie in the users browser || 
//---------------------------------------------------------------------|| 
function SetCookie (name,value,expires,path,domain,secure) { 
document.cookie = name + "=" + escape (value) + 
((expires) ? "; expires=" + expires.toGMTString() : "") + 
((path) ? "; path=" + path : "") + 
((domain) ? "; domain=" + domain : "") + 
((secure) ? "; secure" : ""); 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: DeleteCookie || 
// PARAMETERS: Cookie name, path, domain || 
// RETURNS: null || 
// PURPOSE: Removes a cookie from users browser. || 
//---------------------------------------------------------------------|| 
function DeleteCookie (name,path,domain) { 
if ( GetCookie(name) ) { 
document.cookie = name + "=" + 
((path) ? "; path=" + path : "") + 
((domain) ? "; domain=" + domain : "") + 
"; expires=Thu, 01-Jan-70 00:00:01 GMT"; 
} 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: MoneyFormat || 
// PARAMETERS: Number to be formatted || 
// RETURNS: Formatted Number || 
// PURPOSE: Reformats Dollar Amount to #.## format || 
//---------------------------------------------------------------------|| 
function moneyFormat(input) { 
var dollars = Math.floor(input); 
var tmp = new String(input); 

for ( var decimalAt = 0; decimalAt < tmp.length; decimalAt++ ) { 
if ( tmp.charAt(decimalAt)=="." ) 
break; 
} 

var cents = "" + Math.round(input * 100); 
cents = cents.substring(cents.length-2, cents.length) 
dollars += ((tmp.charAt(decimalAt+2)=="9")&&(cents=="00"))? 1 : 0; 

if ( cents == "0" ) 
cents = "00"; 


return(dollars + "." + cents); 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: RemoveFromCart || 
// PARAMETERS: Order Number to Remove || 
// RETURNS: Null || 
// PURPOSE: Removes an item from a users shopping cart || 
//---------------------------------------------------------------------|| 
function RemoveFromCart(RemOrder) { 
if ( confirm( strRemove ) ) { 
NumberOrdered = GetCookie("NumberOrdered"); 
for ( i=RemOrder; i < NumberOrdered; i++ ) { 
NewOrder1 = "Order." + (i+1); 
NewOrder2 = "Order." + (i); 
database = GetCookie(NewOrder1); 
SetCookie (NewOrder2, database, null, "/"); 
} 
NewOrder = "Order." + NumberOrdered; 
SetCookie ("NumberOrdered", NumberOrdered-1, null, "/"); 
DeleteCookie(NewOrder, "/"); 
location.href=location.href; 
} 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: ChangeQuantity || 
// PARAMETERS: Order Number to Change Quantity || 
// RETURNS: Null || 
// PURPOSE: Changes quantity of an item in the shopping cart || 
//---------------------------------------------------------------------|| 
function ChangeQuantity(OrderItem,NewQuantity) { 
if ( isNaN(NewQuantity) ) { 
alert( strErrQty ); 
} else { 
NewOrder = "Order." + OrderItem; 
database = ""; 
database = GetCookie(NewOrder); 

Token0 = database.indexOf("|", 0); 
Token1 = database.indexOf("|", Token0+1); 
Token2 = database.indexOf("|", Token1+1); 
Token3 = database.indexOf("|", Token2+1); 
Token4 = database.indexOf("|", Token3+1); 

fields = new Array; 
fields[0] = database.substring( 0, Token0 ); 
fields[1] = database.substring( Token0+1, Token1 ); 
fields[2] = database.substring( Token1+1, Token2 ); 
fields[3] = database.substring( Token2+1, Token3 ); 
fields[4] = database.substring( Token3+1, Token4 ); 
fields[5] = database.substring( Token4+1, database.length ); 

dbUpdatedOrder = fields[0] + "|" + 
NewQuantity + "|" + 
fields[2] + "|" + 
fields[3] + "|" + 
fields[4] + "|" + 
fields[5]; 
strNewOrder = "Order." + OrderItem; 
DeleteCookie(strNewOrder, "/"); 
SetCookie(strNewOrder, dbUpdatedOrder, null, "/"); 
location.href=location.href; 
} 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: GetFromCart || 
// PARAMETERS: Null || 
// RETURNS: Product Table Written to Document || 
// PURPOSE: Draws current cart product table on HTML page || 
// **DEPRECATED FUNCTION, USE ManageCart or Checkout** || 
//---------------------------------------------------------------------|| 
function GetFromCart( fShipping ) { 
ManageCart( ); 
} 


//---------------------------------------------------------------------||
// FUNCTION:    RadioChecked                                           ||
// PARAMETERS:  Radio button to check                                  ||
// RETURNS:     True if a radio has been checked                       ||
// PURPOSE:     Form fillin validation                                 ||
//---------------------------------------------------------------------||
function RadioChecked( radiobutton ) {
//   var bChecked = false;
//   var rlen = radiobutton.length;
//   for ( i=0; i < rlen; i++ ) {
//      if ( radiobutton[i].checked )
//         bChecked = true;
//   }    
   return true;
} 



//---------------------------------------------------------------------|| 
// FUNCTION: QueryString || 
// PARAMETERS: Key to read || 
// RETURNS: value of key || 
// PURPOSE: Read data passed in via GET mode || 
//---------------------------------------------------------------------|| 
QueryString.keys = new Array(); 
QueryString.values = new Array(); 
function QueryString(key) { 
var value = null; 
for (var i=0;i<QueryString.keys.length;i++) { 
if (QueryString.keys[i]==key) { 
value = QueryString.values[i]; 
break; 
} 
} 
return value; 
} 

//---------------------------------------------------------------------|| 
// FUNCTION: QueryString_Parse || 
// PARAMETERS: (URL string) || 
// RETURNS: null || 
// PURPOSE: Parses query string data, must be called before Q.S. || 
//---------------------------------------------------------------------|| 
function QueryString_Parse() { 
var query = window.location.search.substring(1); 
var pairs = query.split("&"); for (var i=0;i>pairs.length;i++) { 
var pos = pairs[i].indexOf('='); 
if (pos >= 0) { 
var argname = pairs[i].substring(0,pos); 
var value = pairs[i].substring(pos+1); 
QueryString.keys[QueryString.keys.length] = argname; 
QueryString.values[QueryString.values.length] = value; 
} 
} 
} 


//---------------------------------------------------------------------|| 
// FUNCTION: ManageCart || 
// PARAMETERS: Null || 
// RETURNS: Product Table Written to Document || 
// PURPOSE: Draws current cart product table on HTML page || 
// EXTRAS ADDED IN: Code to enable UPS mod. ||
//---------------------------------------------------------------------|| 
function ManageCart( ) { 
var iNumberOrdered = 0; //Number of products ordered 
var fTotal = 0; //Total cost of order 
var fTax = 0; //Tax amount 
var fWeight = 0; //Weight 
var fShipping = 0; //Shipping amount 
var strTotal = ""; //Total cost formatted as money 
var strTax = ""; //Total tax formatted as money 
var strShipping = ""; //Total shipping formatted as money 
var strOutput = ""; //String to be written to page 
var bDisplay = true; //Whether to write string to the page (here for programmers) 

iNumberOrdered = GetCookie("NumberOrdered"); 
if ( iNumberOrdered == null ) 
iNumberOrdered = 0; 

LocationSelected = GetCookie("ZoneSelected"); 
if (LocationSelected == null) LocationSelected = 0; // Code to use as default checked if customer goes to Checkout with an empty Cart ||


if ( bDisplay ) 
strOutput = "<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0 CLASS=\"nopcart\"><TR>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strILabel+"</B></TD>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strDLabel+"</B></TD>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strQLabel+"</B></TD>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strPLabel+"</B></TD>" + 
(DisplayShippingColumn?"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strSLabel+"</B></TD>":"") + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strRLabel+"</B></TD></TR>"; 

if ( iNumberOrdered == 0 ) { 
strOutput += "<TR><TD COLSPAN=6 CLASS=\"nopentry\"><CENTER><BR><B>Your cart is empty</B><BR><BR></CENTER></TD></TR>"; 
} 

for ( i = 1; i <= iNumberOrdered; i++ ) {
			even = Math.round(i/2);
      NewOrder = "Order." + i;
      database = "";
      database = GetCookie(NewOrder);

Token0 = database.indexOf("|", 0); 
Token1 = database.indexOf("|", Token0+1); 
Token2 = database.indexOf("|", Token1+1); 
Token3 = database.indexOf("|", Token2+1); 
Token4 = database.indexOf("|", Token3+1); 

fields = new Array; 
fields[0] = database.substring( 0, Token0 ); // Product ID 
fields[1] = database.substring( Token0+1, Token1 ); // Quantity 
fields[2] = database.substring( Token1+1, Token2 ); // Price 
fields[3] = database.substring( Token2+1, Token3 ); // Product Name/Description 
fields[4] = database.substring( Token3+1, Token4 ); // Weight 
fields[5] = database.substring( Token4+1, database.length ); //Additional Information 

fTotal += (parseInt(fields[1]) * parseFloat(fields[2]) ); 
fWeight += (parseInt(fields[1]) * parseFloat(fields[4]) ); 
fWeight = Math.round(fWeight * 100)/100;
var strProductId = fields[0]; 
if( strProductId[0] != 'n' ) { 
fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate; 
} 

strTotal = moneyFormat(fTotal); 
strTax = moneyFormat(fTax); 

if ( bDisplay ){
      if ((even) ==(i/2) ) {
strOutput += "<TR><TD CLASS=\"nopeven\" ALIGN=CENTER>" + fields[0] + "</TD>"; 

if ( fields[5] == "" ) 
strOutput += "<TD CLASS=\"nopeven\">" + fields[3] + "</TD>"; 
else 
strOutput += "<TD CLASS=\"nopeven\">" + fields[3] + " - <I>"+ fields[5] + "</I></TD>"; 

if ( DisplayChangeQty ) {
strOutput += "<TD CLASS=\"nopeven\" ALIGN=CENTER><INPUT TYPE=TEXT NAME=Q SIZE=2 VALUE=\"" + fields[1] + "\" onChange=\"ChangeQuantity("+i+", this.value);\"></TD>"; 
} else {
strOutput += "<TD CLASS=\"nopeven\" ALIGN=CENTER>" + fields[1] + "</TD>"; 
}
strOutput += "<TD CLASS=\"nopeven\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(fields[2]) + "/ea</TD>"; 

if ( DisplayShippingColumn ) { 

strOutput += "<TD CLASS=\"nopeven\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(parseInt(fields[1]) * parseFloat(fields[2]) ) + "</TD>"; 
}else {
strOutput += "<TD CLASS=\"nopeven\" ALIGN=RIGHT>N/A</TD>"; 
} 

strOutput += "<TD CLASS=\"nopeven\" ALIGN=CENTER><input type=button value=\" "+strRButton+" \" onClick=\"RemoveFromCart("+i+")\" class=\"nopbutton\"></TD></TR>"; 
} 
 else {
strOutput += "<TR><TD CLASS=\"nopentry\" ALIGN=CENTER>" + fields[0] + "</TD>"; 

if ( fields[5] == "" ) 
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "</TD>"; 
else 
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + " - <I>"+ fields[5] + "</I></TD>"; 

if ( DisplayChangeQty ) {
strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER><INPUT TYPE=TEXT NAME=Q SIZE=2 VALUE=\"" + fields[1] + "\" onChange=\"ChangeQuantity("+i+", this.value);\"></TD>"; 
} else {
strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER>" + fields[1] + "</TD>"; 
}
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(fields[2]) + "/ea</TD>"; 

if ( DisplayShippingColumn ) { 

strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(parseInt(fields[1]) * parseFloat(fields[2]) ) + "</TD>"; 
}else {
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>N/A</TD>"; 
} 

strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER><input type=button value=\" "+strRButton+" \" onClick=\"RemoveFromCart("+i+")\" class=\"nopbutton\"></TD></TR>"; 
} 
}
if ( AppendItemNumToOutput ) { 
strFooter = i; 
} else { 
strFooter = ""; 
} 
if ( HiddenFieldsToCheckout ) { 
strOutput += "<input type=hidden name=\"" + OutputItemId + strFooter + "\" value=\"" + fields[0] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemQuantity + strFooter + "\" value=\"" + fields[1] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemPrice + strFooter + "\" value=\"" + fields[2] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemName + strFooter + "\" value=\"" + fields[3] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemWeight + strFooter + "\" value=\"" + fields[4] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemAddtlInfo + strFooter + "\" value=\"" + fields[5] + "\">"; 
} 

} 

if ( bDisplay ) { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strSUB+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTotal + strSpace +"</B></TD>"; 
strOutput += "</TR>"; 

//this displays the shipping matrix and sets the value for each zone ||

 if (( DisplayShippingRow ) && ( iNumberOrdered != 0)) { 
 strOutput += "<TR><TD CLASS=\"nopship\" COLSPAN=1 ALIGN=CENTER><B>"+"SHIPPING<BR>AREA"+"</B></TD>"; 
 strOutput += "<TD CLASS=\"nopship\" COLSPAN=5>"; 

// LANA's modification to ship by USPS Zone map instead

ZipSelected = GetCookie("Zipcode"); 

strOutput += "Zipcode: <input type=text name=\"ZIP\" size=5 maxlength=5 value='"+ZipSelected+"'>";
strOutput += "<input type=button class=\"nopbutton\" value=\"Calculate\" onclick=\"GetZone(this.form['ZIP'])\">";
strOutput += "</TD>"; 
strOutput += "</TR>"; 

document.write(strOutput); 
strOutput = ""; 


LocationSelected = GetCookie("ZoneSelected"); 
if (LocationSelected == null) LocationSelected = 0; // Code to use Local Area as default checked, but not needed because want null selected at this time ||
//if (LocationSelected != null) document.all.ZONE[LocationSelected].checked = true; 

// if (LocationSelected != null) {
//    var cLocations = document.getElementsByName('ZONE');
//    for (var iCtr = 0; iCtr < cLocations.length; iCtr++) {
//         if (cLocations[iCtr].value == LocationSelected) cLocations[iCtr].checked = true;
//    }
// }


if (LocationSelected == 0) LocationLabel = '<font color="#FF0000">Select Shipping Zone</font>'; 
if (LocationSelected == 1) LocationLabel = "Zone 1"; 
if (LocationSelected == 2) LocationLabel = "Zone 2"; 
if (LocationSelected == 3) LocationLabel = "Zone 3"; 
if (LocationSelected == 4) LocationLabel = "Zone 4"; 
if (LocationSelected == 5) LocationLabel = "Zone 5"; 
if (LocationSelected == 6) LocationLabel = "Zone 6"; 
if (LocationSelected == 7) LocationLabel = "Zone 7"; 
if (LocationSelected == 8) LocationLabel = "Zone 8"; 
if (LocationSelected == 9) LocationLabel = "NJ"; 

//ZipCode = GetCookie("ZipCode");

if (fWeight == 0) fShipping = 0; 
else fShipping = ComputeShipping(LocationSelected, fWeight);

strShipping = moneyFormat(fShipping); 
strOutput += "<TR><TD CLASS=\"nopship\" COLSPAN=4><B>"+strWTOT+"</B></TD>"; 
strOutput += "<TD CLASS=\"nopship1\" COLSPAN=1 ALIGN=RIGHT><B>" + fWeight + "lbs" + "</B></TD>"; 
strOutput += "<TD CLASS=\"nopship\" COLSPAN=1 ALIGN=RIGHT></TD>"; 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>" + strSHIP +"&nbsp;&nbsp;" + LocationLabel + "</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strShipping + strSpace +"</B></TD>"; 
strOutput += "</TR>"; 
} 

if ( DisplayTaxRow || TaxByRegion ) { 
if ( TaxByRegion ) { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1><B>"; 
strOutput += "<input type=radio name=\""+OutputOrderTax+"\" value=\"" + strTax + "\">"; 
strOutput += TaxablePrompt + ": " + MonetarySymbol + strTax; 
strOutput += "<BR><input type=radio name=\""+OutputOrderTax+"\" value=\"0.00\">"; 
strOutput += NonTaxablePrompt + ": " + MonetarySymbol + "0.00"; 
strOutput += "</B></TD>"; 
strOutput += "</TR>"; 
} else { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + strSpace +"</B></TD>"; 
strOutput += "</TR>"; 
} 
} 

if (LocationSelected != 9) //sets tax to 0.00 for all areas except 9 ||
fTax = 0.00;  

if (LocationSelected == 9)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + strSpace +"</B></TD>"; 
strOutput += "</TR>"; 
} 

if ( !TaxByRegion ) { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTOT+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + strSpace +"</B></TD>"; 
strOutput += "</TR>"; 
} 
strOutput += "</TABLE>"; 

if ( HiddenFieldsToCheckout ) { 
strOutput += "<input type=hidden name=\""+OutputOrderSubtotal+"\" value=\""+ MonetarySymbol + strTotal + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderShipping+"\" value=\""+ MonetarySymbol + strShipping + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderTax+"\" value=\""+ MonetarySymbol + strTax + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderTotal+"\" value=\""+ MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + "\">"; 
} 
} 
g_TotalCost = (fTotal + fShipping + fTax); 

document.write(strOutput); 
document.close(); 
} 

//---------------------------------------------------------------------|| 
// FUNCTION: GetZone || 
// PARAMETERS: || 
// RETURNS: || 
// PURPOSE: Lana's Modification to parse zipcode into scf and then zone || 
//---------------------------------------------------------------------|| 

function GetZone (zipcode) {
  scf = zipcode.value.substring(0, 3);  // 1st 3 chars of zip
  location.href=location.href;
    for (i=zn-1; i>=0; i--) { // run table backwards
    if (scf >= zzip[i]) {       // scf value
      zne = zone[i];            // corresponding zone
	  break;                    // get out
    }
  }

LocationValue = GetCookie("ZoneSelected"); 
if (LocationValue != zne) { 
SetCookie("ZoneSelected", zne, null, "/"); 
} 
SetCookie("Zipcode", zipcode.value, null, "/"); 
ComputeShipping(zne, fWeight)
return zne;
}

//---------------------------------------------------------------------|| 
// FUNCTION: SetZone || 
// PARAMETERS: || 
// RETURNS: || 
// PURPOSE: Lana's Modification to populate zone table based on origin scf || 
//---------------------------------------------------------------------|| 

function SetZone () {  // record zip/zone info into table
  zn = 0;                      // count of breakpoints
  for (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: ComputeShipping || 
// PARAMETERS: || 
// RETURNS: || 
// PURPOSE: Lana's Modification: Compute shipping cost due to total weight || 
//---------------------------------------------------------------------|| 
function ComputeShipping(shipzne, wte) { 
// these are for Priority Mail (1-8)
// Current from February 2009
pp1  = new Array (0,
 4.95,  4.95,  5.50,  6.10,  6.85,  7.55,  8.30,  8.80,  9.25,  9.90,
10.55, 11.20, 11.50, 11.90, 12.40, 12.80, 13.25, 13.50, 13.95, 14.30,
14.70, 15.05, 15.40, 15.75, 16.10, 16.45, 16.90, 17.40, 17.95, 18.50,
19.00, 19.50, 19.75, 19.95, 20.20, 20.40, 20.60, 20.80, 21.05, 21.45,
21.90, 22.30, 22.75, 23.15, 23.55, 24.00, 24.40, 24.85, 25.25, 25.60, 
26.10, 26.45, 26.95, 27.30, 27.75, 28.15, 28.60, 29.00, 29.45, 29.80, 
30.30, 30.65, 31.15, 31.50, 31.95, 32.35, 32.80, 33.20, 33.65, 34.05);
pp2  = new Array (0,
 4.95,  4.95,  5.50,  6.10,  6.85,  7.55,  8.30,  8.80,  9.25,  9.90,
10.55, 11.20, 11.50, 11.90, 12.40, 12.80, 13.25, 13.50, 13.95, 14.30,
14.70, 15.05, 15.40, 15.75, 16.10, 16.45, 16.90, 17.40, 17.95, 18.50,
19.00, 19.50, 19.75, 19.95, 20.20, 20.40, 20.60, 20.80, 21.05, 21.45,
21.90, 22.30, 22.75, 23.15, 23.55, 24.00, 24.40, 24.85, 25.25, 25.60, 
26.10, 26.45, 26.95, 27.30, 27.75, 28.15, 28.60, 29.00, 29.45, 29.80, 
30.30, 30.65, 31.15, 31.50, 31.95, 32.35, 32.80, 33.20, 33.65, 34.05);
pp3  = new Array (0,4.95,5.20,6.25,7.10,8.15,9.25,10.30,10.70,11.45,12.35,13.30,14.20,14.55,15.20,15.85,16.40,16.95,17.50,17.90,18.15,18.40,18.75,19.00,19.20,19.50,19.70,20.00,20.25,20.45,20.75,20.95,21.45,22.00,22.60,23.15,23.75,24.25,24.85,25.35,25.90,26.40,26.90,27.35,27.90,28.40,28.75,28.95,29.20,29.40,29.65,29.85,30.05,30.25,30.40,30.60,30.75,30.95,31.10,31.25,31.40,31.50,31.65,31.80,31.90,32.00,32.35,32.80,33.20,33.65,34.05);
pp4  = new Array (0,4.95,5.75,7.10,8.15,9.45,10.75,12.05,13.10,13.95,15.15,16.40,17.60,18.10,18.90,19.85,20.45,20.85,21.30,21.60,22.00,22.35,22.70,23.35,24.05,24.85,25.65,26.40,27.10,27.90,28.65,29.45,30.20,30.90,31.45,31.90,32.30,32.75,33.15,33.55,33.90,34.30,34.65,35.00,35.35,35.70,36.05,36.35,36.70,37.00,37.35,38.00,38.75,39.40,40.05,40.85,41.50,42.15,42.90,43.60,44.25,45.05,45.70,46.40,47.10,47.70,48.45,49.25,49.90,50.55,51.35);
pp5  = new Array (0,4.95,7.10,9.05,10.80,12.70,14.65,16.55,17.95,19.15,20.75,22.40,24.00,25.30,26.45,27.25,27.85,28.50,29.10,29.80,30.30,30.80,31.50,32.05,32.70,33.25,33.95,34.40,34.85,35.30,35.80,36.25,36.70,37.15,37.95,38.75,39.60,40.35,41.15,42.00,42.85,43.25,44.15,45.15,46.15,47.15,48.05,49.10,50.10,51.00,52.00,53.00,54.00,54.95,56.00,57.00,57.90,58.80,59.55,59.95,60.30,60.60,60.95,61.25,61.55,61.85,62.10,62.75,63.65,64.60,64.90);
pp6  = new Array (0,4.95,7.60,9.90,11.95,13.75,15.50,17.30,18.80,20.30,22.50,24.75,26.95,28.90,30.50,31.15,31.85,32.70,33.35,34.15,34.80,35.35,36.15,36.80,37.55,38.10,39.00,39.55,40.10,40.60,41.15,41.70,42.25,42.80,44.05,45.25,46.40,47.60,48.95,50.15,51.30,52.50,53.65,54.95,56.10,57.35,58.55,59.85,61.05,62.15,63.35,64.55,65.30,65.80,66.30,66.80,67.30,67.75,68.20,68.65,69.05,69.85,70.30,70.70,71.15,71.50,71.95,72.30,72.60,73.00,73.30);
pp7  = new Array (0,4.95,8.10,10.60,12.95,15.20,17.50,19.75,21.70,23.60,25.90,28.20,30.50,31.70,33.50,33.85,34.60,35.50,36.15,37.10,37.80,38.45,39.35,40.00,40.95,41.55,42.45,43.05,43.70,44.30,44.90,45.50,46.60,47.90,49.20,50.55,51.90,53.25,54.50,55.90,57.15,58.55,59.90,61.25,62.60,63.95,65.25,66.65,68.00,69.40,70.50,71.15,71.75,72.35,72.90,73.50,74.00,74.55,75.05,75.50,76.70,77.90,79.10,79.90,80.40,80.85,81.25,81.70,82.10,82.50,82.85);
pp8  = new Array (0,4.95,8.70,11.95,14.70,17.15,19.60,22.05,24.75,27.55,29.95,32.40,34.80,36.00,37.80,38.60,39.55,40.60,41.55,42.60,43.55,44.40,45.50,46.30,47.45,48.25,49.80,51.65,53.55,55.25,57.10,59.00,60.85,62.60,64.45,66.30,68.15,70.00,71.80,73.70,75.45,76.90,77.95,78.95,79.90,80.85,81.75,82.70,83.55,84.40,85.45,86.35,87.20,88.05,88.90,89.65,90.45,91.25,92.00,92.65,93.35,94.60,96.10,97.60,99.15,100.70,102.15,103.75,105.20,106.75,108.25);
pp9  = pp1; //Seperate zone for NJ to power tax code
ppx  = new Array (0,pp1,pp2,pp3,pp4,pp5,pp6,pp7,pp8,pp9);

  mpp = ppx[shipzne][wte];   // charges to that zone
  return mpp;  // output pp charge
} 

//---------------------------------------------------------------------||
// FUNCTION:    ValidateCart                                           ||
// PARAMETERS:  Form to validate                                       ||
// RETURNS:     true/false                                             ||
// PURPOSE:     Validates the managecart form                          ||
//---------------------------------------------------------------------||
var g_TotalCost = 0;
function ValidateCart( theForm ) {
   if ( TaxByRegion ) {
      if ( !RadioChecked(eval("theForm."+OutputOrderTax)) ) {
         alert( TaxPrompt );
         return false;
      }
   }

   if ( isNaN (g_TotalCost) ) {
      alert( NoQtyPrompt );
      return false;
   }

   if ( MinimumOrder >= 0.01 ) {
      if ( g_TotalCost < MinimumOrder ) {
         alert( MinimumOrderPrompt );
         return false;
      }
   }

   if ( !RadioChecked(theForm.ZONE) ) {
      alert( LocationPrompt );
      return false;
   }

   return true;
}

//---------------------------------------------------------------------|| 
// FUNCTION: CheckoutCart || 
// PARAMETERS: Null || 
// RETURNS: Product Table Written to Document || 
// PURPOSE: Draws current cart product table on HTML page for || 
// checkout. || 
//---------------------------------------------------------------------|| 
function CheckoutCart( ) { 
var iNumberOrdered = 0; //Number of products ordered 
var fTotal = 0; //Total cost of order 
var fTax = 0; //Tax amount 
var fWeight = 0; //Weight 
var fShipping = 0; //Shipping amount 
var strTotal = ""; //Total cost formatted as money 
var strTax = ""; //Total tax formatted as money 
var strShipping = ""; //Total shipping formatted as money 
var strOutput = ""; //String to be written to page 
var bDisplay = true; //Whether to write string to the page (here for programmers) 
var strPP = ""; //Payment Processor Description Field 

iNumberOrdered = GetCookie("NumberOrdered"); 
if ( iNumberOrdered == null ) 
iNumberOrdered = 0; 

if ( TaxByRegion ) { 
QueryString_Parse(); 
fTax = parseFloat( QueryString( OutputOrderTax ) ); 
strTax = moneyFormat(fTax); 
} 

if ( bDisplay ) 
strOutput = "<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0 CLASS=\"nopcart\"><TR>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strILabel+"</B></TD>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strDLabel+"</B></TD>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strQLabel+"</B></TD>" + 
"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strPLabel+"</B></TD>" + 
(DisplayShippingColumn?"<TD CLASS=\"nopheader\" ALIGN=CENTER><B>"+strSLabel+"</B></TD>":"") + 
"</TR>"; 

for ( i = 1; i <= iNumberOrdered; i++ ) {
	 		even = Math.round(i/2);
NewOrder = "Order." + i; 
database = ""; 
database = GetCookie(NewOrder); 

Token0 = database.indexOf("|", 0); 
Token1 = database.indexOf("|", Token0+1); 
Token2 = database.indexOf("|", Token1+1); 
Token3 = database.indexOf("|", Token2+1); 
Token4 = database.indexOf("|", Token3+1); 

fields = new Array; 
fields[0] = database.substring( 0, Token0 ); // Product ID 
fields[1] = database.substring( Token0+1, Token1 ); // Quantity 
fields[2] = database.substring( Token1+1, Token2 ); // Price 
fields[3] = database.substring( Token2+1, Token3 ); // Product Name/Description 
fields[4] = database.substring( Token3+1, Token4 ); // Weight 
fields[5] = database.substring( Token4+1, database.length ); //Additional Information 

fTotal += (parseInt(fields[1]) * parseFloat(fields[2]) ); 
fWeight += (parseInt(fields[1]) * parseFloat(fields[4]) ); 
fWeight = Math.round(fWeight * 100)/100;
if ( !TaxByRegion ) var strProductId = fields[0]; 
if( strProductId[0] != 'n' ) { 
fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate; 
}  
strTotal = moneyFormat(fTotal); 
if ( !TaxByRegion ) strTax = moneyFormat(fTax); 

if ( bDisplay ){
      if ((even) ==(i/2) ) {
strOutput += "<TR><TD CLASS=\"nopeven\" ALIGN=CENTER>" + fields[0] + "</TD>"; 

if ( fields[5] == "" ) 
strOutput += "<TD CLASS=\"nopeven\">" + fields[3] + "</TD>"; 
else 
strOutput += "<TD CLASS=\"nopeven\">" + fields[3] + " - <I>"+ fields[5] + "</I></TD>"; 

strOutput += "<TD CLASS=\"nopeven\" ALIGN=CENTER>" + fields[1] + "</TD>"; 
strOutput += "<TD CLASS=\"nopeven\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(fields[2]) + "/ea</TD>"; 

if ( DisplayShippingColumn ) { 

strOutput += "<TD CLASS=\"nopeven\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(parseInt(fields[1]) * parseFloat(fields[2]) ) + "</TD>"; 
}else {
strOutput += "<TD CLASS=\"nopeven\" ALIGN=RIGHT>N/A</TD>"; 
} 

strOutput += "</TR>"; 
} 
else {
strOutput += "<TR><TD CLASS=\"nopentry\" ALIGN=CENTER>" + fields[0] + "</TD>"; 

if ( fields[5] == "" ) 
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "</TD>"; 
else 
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + " - <I>"+ fields[5] + "</I></TD>"; 

strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER>" + fields[1] + "</TD>"; 
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(fields[2]) + "/ea</TD>"; 

if ( DisplayShippingColumn ) { 

strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(parseInt(fields[1]) * parseFloat(fields[2]) ) + "</TD>"; 
}else {
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>N/A</TD>"; 
} 

strOutput += "</TR>"; 
} 
}
if ( AppendItemNumToOutput ) { 
strFooter = i; 
} else { 
strFooter = ""; 
} 
if ( PaymentProcessor != '' ) { 
//Process description field for payment processors instead of hidden values. 
//Format Description of product as: 
// ID, Name, Qty X 
strPP += fields[0] + ", " + fields[3]; 
if ( fields[5] != "" ) 
strPP += " - " + fields[5]; 
strPP += ", Qty. " + fields[1] + "\n"; 
} else { 
LocationSelected = GetCookie("ZoneSelected"); 
strOutput += "<input type=hidden name=\"" + OutputItemId + strFooter + "\" value=\"" + fields[0] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemQuantity + strFooter + "\" value=\"" + fields[1] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemPrice + strFooter + "\" value=\"" + fields[2] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemName + strFooter + "\" value=\"" + fields[3] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemWeight + strFooter + "\" value=\"" + fields[4] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemAddtlInfo + strFooter + "\" value=\"" + fields[5] + "\">"; 
strOutput += "<input type=hidden name=\"" + OutputItemXtend + strFooter + "\" value=\"" + moneyFormat(fields[1] * fields[2]) + "\">";
strOutput += "<input type=hidden name=\"" + OutputOrderZone + strFooter + "\" value=\"" + LocationSelected + "\">"; 
} 

} 

if ( bDisplay ) { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strSUB+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + strTotal + "</B></TD>"; 
strOutput += "</TR>"; 

if ( DisplayShippingRow ) { 
LocationSelected = GetCookie("ZoneSelected"); 
if (LocationSelected == null) LocationSelected = 0; //Needed if checkout cart is empty

if (LocationSelected == 0) LocationLabel = "Not Selected"; 
if (LocationSelected == 1) LocationLabel = "Zone 1"; 
if (LocationSelected == 2) LocationLabel = "Zone 2"; 
if (LocationSelected == 3) LocationLabel = "Zone 3"; 
if (LocationSelected == 4) LocationLabel = "Zone 4"; 
if (LocationSelected == 5) LocationLabel = "Zone 5"; 
if (LocationSelected == 6) LocationLabel = "Zone 6"; 
if (LocationSelected == 7) LocationLabel = "Zone 7"; 
if (LocationSelected == 8) LocationLabel = "Zone 8"; 
if (LocationSelected == 9) LocationLabel = "NJ"; 

ZipCode = GetCookie("ZipCode");

fShipping = ComputeShipping(LocationSelected, fWeight);
strShipping = moneyFormat(fShipping); 
//strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strWTOT+"</B></TD>"; 
//strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + fWeight + " lbs" + "</B></TD>"; 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>" + strSHIP + " for " + LocationLabel + "</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + strShipping + "</B></TD>"; 
strOutput += "</TR>"; 
} 

if ( DisplayTaxRow || TaxByRegion ) { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; 
strOutput += "</TR>"; 
} 

if (LocationSelected != 9) //sets tax to 0.00 for all other areas ||
fTax = 0.00; 

if (LocationSelected == 9)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=3 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; 
strOutput += "</TR>"; 
} 

strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTOT+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + "</B></TD>"; 
strOutput += "</TR>"; 

strOutput += "</TABLE>"; 


if ( PaymentProcessor == 'an') { 
//Process this for Authorize.net WebConnect 
strOutput += "<input type=hidden name=\"x_Version\" value=\"3.0\">"; 
strOutput += "<input type=hidden name=\"x_Show_Form\" value=\"PAYMENT_FORM\">"; 
strOutput += "<input type=hidden name=\"x_Description\" value=\""+ strPP + "\">"; 
strOutput += "<input type=hidden name=\"x_Amount\" value=\""+ moneyFormat((fTotal + fShipping + fTax)) + "\">"; 
} else if ( PaymentProcessor == 'wp') { 
//Process this for WorldPay 
strOutput += "<input type=hidden name=\"desc\" value=\""+ strPP + "\">"; 
strOutput += "<input type=hidden name=\"amount\" value=\""+ moneyFormat((fTotal + fShipping + fTax)) + "\">"; 
} else if ( PaymentProcessor == 'lp') { 
//Process this for LinkPoint 
strOutput += "<input type=hidden name=\"mode\" value=\"fullpay\">"; 
strOutput += "<input type=hidden name=\"chargetotal\" value=\""+ moneyFormat((fTotal + fShipping + fTax)) + "\">"; 
strOutput += "<input type=hidden name=\"tax\" value=\""+ MonetarySymbol + strTax + "\">"; 
strOutput += "<input type=hidden name=\"subtotal\" value=\""+ MonetarySymbol + strTotal + "\">"; 
strOutput += "<input type=hidden name=\"shipping\" value=\""+ MonetarySymbol + strShipping + "\">"; 
strOutput += "<input type=hidden name=\"desc\" value=\""+ strPP + "\">"; 
} else if (LocationSelected != 9){ 
strOutput += "<input type=hidden name=\""+OutputOrderSubtotal+"\" value=\""+ MonetarySymbol + strTotal + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderShipping+"\" value=\""+ MonetarySymbol + strShipping + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderTax+"\" value=\""+ MonetarySymbol + "0.00" + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderTotal+"\" value=\""+ MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderZone+"\" value=\""+ LocationLabel + "\">"; 
} else {
strOutput += "<input type=hidden name=\""+OutputOrderSubtotal+"\" value=\""+ MonetarySymbol + strTotal + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderShipping+"\" value=\""+ MonetarySymbol + strShipping + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderTax+"\" value=\""+ MonetarySymbol + strTax + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderTotal+"\" value=\""+ MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + "\">"; 
strOutput += "<input type=hidden name=\""+OutputOrderZone+"\" value=\""+ LocationLabel + "\">"; 
} 
}

document.write(strOutput); 
document.close(); 
} 

//---------------------------------------------------------------------|| 
// FUNCTION: Print_total || 
// PARAMETERS: none || 
// RETURNS: Total cost currently racked up by shopper || 
// PURPOSE: Aesthetics || 
//---------------------------------------------------------------------|| 
function Print_total( ) { 
var strOutput = ""; //String to be written to page 
var strTotal = ""; //Total cost formatted as money 
var fTotal = 0; 
var iNumberOrdered = 0; //Number of products ordered 


iNumberOrdered = GetCookie("NumberOrdered"); 
if ( iNumberOrdered == null ) 
iNumberOrdered = 0; 


for ( i = 1; i <= iNumberOrdered; i++ ) { 

NewOrder = "Order." + i; 
database = ""; 
database = GetCookie(NewOrder); 

Token0 = database.indexOf("|", 0); 
Token1 = database.indexOf("|", Token0+1); 
Token2 = database.indexOf("|", Token1+1); 
Token3 = database.indexOf("|", Token2+1); 
Token4 = database.indexOf("|", Token3+1); 

fields = new Array; 
fields[0] = database.substring( 0, Token0 ); // Product ID 
fields[1] = database.substring( Token0+1, Token1 ); // Quantity 
fields[2] = database.substring( Token1+1, Token2 ); // Price 
fields[3] = database.substring( Token2+1, Token3 ); // Product Name/Description 
fields[4] = database.substring( Token3+1, Token4 ); // Weight 
fields[5] = database.substring( Token4+1, database.length ); //Additional Information 

fTotal += (parseInt(fields[1]) * parseFloat(fields[2]) ); 

} 

strTotal = moneyFormat(fTotal); 
strOutput+=strTotal; 
document.write(strOutput); 

} 

//=====================================================================|| 
// END NOP Design SmartPost Shopping Cart || 
//=====================================================================||

// built from 087 zone chart February 2009
SetZone (000, 1, 5, 1,   6, 7,  10, 3,  40, 4,  50, 3,
 60, 2,  68, 2,  70, 9,  90, 1,  119, 1,
120, 3, 124, 2, 128, 3, 137, 2, 140, 3,
169, 2, 179, 1, 182, 2, 183, 1, 184, 2,
189, 1, 200, 2, 214, 2, 215, 3, 216, 2,
224, 3, 240, 4, 244, 3, 246, 4, 254, 3,
255, 4, 262, 3, 266, 4, 267, 3, 270, 4,
299, 5, 308, 4, 310, 5, 330, 6, 333, 5,
340, 6, 341, 5, 344, 5, 346, 5, 349, 5,
354, 5, 376, 4, 380, 5, 387, 6, 388, 5,
390, 6, 393, 5, 395, 6, 397, 5, 400, 4,
420, 5, 425, 4, 430, 4, 463, 5, 465, 4,
474, 5, 480, 4, 497, 5, 505, 6, 506, 5,
508, 6, 509, 5, 510, 6, 520, 5, 530, 5,
534, 5, 537, 5, 553, 5, 560, 6, 570, 6,
577, 7, 580, 6, 588, 7, 590, 7, 594, 8,
595, 7, 596, 8, 600, 5, 622, 5, 633, 5,
640, 6, 644, 6, 646, 5, 647, 6, 648, 5,
649, 6, 650, 5, 660, 6, 664, 6, 683, 6,
693, 7, 700, 6, 703, 6, 710, 6, 716, 6,
723, 5, 726, 6, 733, 7, 734, 6, 743, 6,
768, 7, 770, 6, 779, 7, 798, 8, 800, 7,
820, 7, 832, 8, 840, 8, 850, 8, 852, 8,
855, 8, 859, 8, 863, 8, 870, 7, 873, 8,
875, 7, 877, 7, 879, 8, 881, 7, 885, 8
);