UPS Shipping by Weight and Zone

Completed modifications to the NOP Shopping Cart. Additions, modifications, and more.

Moderators: Koibito, Stefko, Randy, Rosey

Postby angie5201 » Sun Jul 04, 2004 8:09 am

Is it possible to set up more than 8 Zones with this mod? I need 14 to be exact ....

any ideas on how to fix it?
angie5201
 
Posts: 14
Joined: Tue Sep 30, 2003 5:50 am

Postby Stefko » Sun Jul 04, 2004 8:13 am

yep!

just create more and contiue with 9, 10, 11......

follow the same format as it is now.
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Postby angie5201 » Sun Jul 04, 2004 8:26 am

I did and it's not showing up in the managecart at all, but it is in the checkout cart...

Not sure what I have done thats why I though I will ask to make sure it can be done...
angie5201
 
Posts: 14
Joined: Tue Sep 30, 2003 5:50 am

Cart Not being displayed after MOD

Postby michael88 » Sat Jul 17, 2004 11:18 am

Firstly I would like to say that this MOD is exactly what I am looking for to calculate the shipping based on weight. [ In Australia ] and after reading through the posts I downloaded STEFKO's MOD to replace the current working NOPCART.JS and subsequently the managecart.html does not seem to display the cart at all. I have also downloaded the original sample files included with NOP cart and that was working fine until I updated the nopcart.js file with the new MOD.

My question is has this happened to anyone else and how do I fix it?

Thanks in advance for any help offered.

Michael
michael88
 
Posts: 2
Joined: Sat Jul 17, 2004 11:07 am

Postby Stefko » Sat Jul 17, 2004 2:00 pm

You scared me, I placed the UPS Mod into a testing directory and the cart did not show also!!

I did receive a javascript browser error message, something about strSpace is not defined!!

Try this to solve your problem:

Upload both the language-en.js and the UPS Modified nopcart.js.
They are two peas in a pod!!
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Cart Not Being Displayed after UPS MOD

Postby michael88 » Sun Jul 18, 2004 10:44 am

Thanks Stefko, that did it - it just never occurred as all this discussions were referring to the UPS MOD and the nopcart.js file .

Thanks for your prompt response. I am about to embark on integrating the cart into the site and undoubtedly will require you wisdom once again.

Thanks,

Michael
michael88
 
Posts: 2
Joined: Sat Jul 17, 2004 11:07 am

dropdownmenu

Postby tox0tes » Sun Sep 26, 2004 1:55 am

I have changed the mod a little bit....instead of radio buttons, it uses a drop down menu for country selection. Each country corresponds to one of twelve zones (for USPS Global Express).

It works great except when the country is selected, and the page refreshes, the name of the country does not remain as the selected option on the menu. I think I need to use cookies to do this, but not sure.

The link is here: http://supra.websitewelcome.com/~eram/u ... ress.shtml

the code is here:

//=====================================================================||
// NOP Design JavaScript Shopping Cart ||
// ||
// For more information on SmartSystems, or how NOPDesign can help you ||
// Please visit us on the WWW at http://www.nopdesign.com ||
// ||
// Javascript portions of this shopping cart software are available as ||
// freeware from NOP Design. You must keep this comment unchanged in ||
// your code. For more information contact FreeCart@NopDesign.com. ||
// ||
// JavaScript Shop Module, V.4.4.0 ||
//=====================================================================||

//=====================================================================||
// UPS Shiping Mod by Stefko V.1.0.0 ||
// ||
// Version History: 02/23/03 V.1.0.0 Released ||
// includes USERENTRY ||
// 03/02/03 V.1.1.0 Now works with Netscape & Opera ||
// added Taxable and Non-taxable product code||
// added MathRound to Weight ||
//=====================================================================||

//---------------------------------------------------------------------||
// Global Options ||
// ---------------- ||
// Shopping Cart Options, you can modify these options to change the ||
// the way the cart functions. ||
// ||
// Language Packs ||
// ============== ||
// You may include any language pack before nopcart.js in your HTML ||
// pages to change the language. Simply include a language pack with ||
// a script src BEFORE the <SCRIPT SRC="../os1/nopcart.js">... line. ||
// For example: <SCRIPT SRC="language-en.js"></SCRIPT> ||
// ||
// Options For Everyone: ||
// ===================== ||
// * MonetarySymbol: string, the symbol which represents dollars/euro, ||
// in your locale. ||
// * DisplayNotice: true/false, controls whether the user is provided ||
// with a popup letting them know their product is added to the cart ||
// * DisplayShippingColumn: true/false, controls whether the managecart||
// and checkout pages display shipping cost column. ||
// * DisplayShippingRow: true/false, controls whether the managecart ||
// and checkout pages display shipping cost total row. ||
// * DisplayTaxRow: true/false, controls whether the managecart ||
// and checkout pages display tax cost total row. ||
// * TaxRate: number, your area's current tax rate, ie: if your tax ||
// rate was 7.5%, you would set TaxRate = 0.075 ||
// * TaxByRegion: true/false, when set to true, the user is prompted ||
// with TaxablePrompt to determine if they should be charged tax. ||
// In the USA, this is useful to charge tax to those people who live ||
// in a particular state, but no one else. ||
// * TaxPrompt: string, popup message if user has not selected either ||
// taxable or nontaxable when TaxByRegion is set to true. ||
// * TaxablePrompt: string, the message the user is prompted with to ||
// select if they are taxable. If TaxByRegion is set to false, this ||
// has no effect. Example: 'Arizona Residents' ||
// * NonTaxablePrompt: string, same as above, but the choice for non- ||
// taxable people. Example: 'Other States' ||
// * MinimumOrder: number, the minium dollar amount that must be ||
// purchased before a user is allowed to checkout. Set to 0.00 ||
// to disable. ||
// * MinimumOrderPrompt: string, Message to prompt users with when ||
// they have not met the minimum order amount. ||
// ||
// Payment Processor Options: ||
// ========================== ||
// * PaymentProcessor: string, the two digit payment processor code ||
// for support payment processor gateways. Setting this field to ||
// anything other than an empty string will override your OutputItem ||
// settings -- so please be careful when receiving any form data. ||
// Support payment processor gateways are: ||
// * Authorize.net (an) ||
// * Worldpay (wp) ||
// * LinkPoint (lp) ||
// ||
// Options For Programmers: ||
// ======================== ||
// * OutputItem<..>: string, the name of the pair value passed at ||
// checkouttime. Change these only if you are connecting to a CGI ||
// script and need other field names, or are using a secure service ||
// that requires specific field names. ||
// * AppendItemNumToOutput: true/false, if set to true, the number of ||
// each ordered item will be appended to the output string. For ||
// example if OutputItemId is 'ID_' and this is set to true, the ||
// output field name will be 'ID_1', 'ID_2' ... for each item. ||
// * HiddenFieldsToCheckout: true/false, if set to true, hidden fields ||
// for the cart items will be passed TO the checkout page, from the ||
// ManageCart page. This is set to true for CGI/PHP/Script based ||
// checkout pages, but should be left false if you are using an ||
// HTML/Javascript Checkout Page. Hidden fields will ALWAYS be ||
// passed FROM the checkout page to the Checkout CGI/PHP/ASP/Script ||
//---------------------------------------------------------------------||

//Options for Everyone:
MonetarySymbol = '$';
DisplayNotice = true;
DisplayChangeQty = false;
DisplayShippingColumn = true;
DisplayShippingRow = true;
TaxRate = 0.063; //set taxable region rate ||
DisplayTaxRow = false;
TaxByRegion = false; //leave this at false, UPS Shipping Mod will activate taxable Zone ||
TaxPrompt = 'For tax purposes, please select if you are an Kansas branch of Oasis before continuing'; //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 Zone 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';
LocationPrompt = 'For shipping purpose, please select the zone that your location is in.';
MaxWeightPrompt = 'Sorry, maximum weight allowable is 500lbs.';



//=====================================================================||
//---------------------------------------------------------------------||
// YOU DO NOT NEED TO MAKE ANY MODIFICATIONS BELOW THIS LINE ||
//---------------------------------------------------------------------||
//=====================================================================||


//---------------------------------------------------------------------||
// 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 bChecked;
}



//---------------------------------------------------------------------||
// 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 = 8; // Code to use Wichita 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>"+strRLabel+"</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>";
strOutput += "<TD CLASS=\"nopship\" COLSPAN=5>";
strOutput += "<SELECT name=\"ZONE\" onChange=\"ComputeShipping(this.options[this.selectedIndex].value)\">";
strOutput += "<OPTION VALUE=\"0\">Your Country</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Afghanistan</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Albania</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Algeria</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Andorra</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Angola</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Anguilla</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Antigua & Barbuda</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Argentina</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Armenia</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Aruba</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Ascension</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Australia</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Austria</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Azerbaijan</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Bahamas</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Bahrain</OPTION>";
strOutput += "<OPTION VALUE=\"9\">Bangladesh</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Barbados</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Belarus</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Belgium</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Belize</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Benin</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Bermuda</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Bhutan</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Bolivia</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Bosnia-Herzegovina</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Botswana</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Brazil</OPTION>";
strOutput += "<OPTION VALUE=\"0\">British Virgin Islands</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Brunei Darussalam</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Bulgaria</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Burkina Faso</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Burma (Myanmar)</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Burundi</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Cambodia</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Cameroon</OPTION>";
strOutput += "<OPTION VALUE=\"1\">Canada</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Cape Verde</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Cayman Islands</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Central African Republic</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Chad</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Chile</OPTION>";
strOutput += "<OPTION VALUE=\"5\">China</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Colombia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Comoros</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Congo, Democratic Republic of the</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Congo, Republic of the</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Costa Rica</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Cote d'Ivoire (Ivory Coast)</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Croatia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Cuba</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Cyprus</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Czech Republic</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Denmark</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Djibouti</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Dominica</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Dominican Republic</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Ecuador</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Egypt</OPTION>";
strOutput += "<OPTION VALUE=\"12\">El Salvador</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Equatorial Guinea</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Eritrea</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Estonia</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Ethiopia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Falkland Islands</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Faroe Islands</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Fiji</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Finland</OPTION>";
strOutput += "<OPTION VALUE=\"6\">France</OPTION>";
strOutput += "<OPTION VALUE=\"12\">French Guiana</OPTION>";
strOutput += "<OPTION VALUE=\"9\">French Polynesia</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Gabon</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Gambia</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Georgia, Republic of</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Germany</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Ghana</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Gibraltar</OPTION>";
strOutput += "<OPTION VALUE=\"3\">Great Britain & Northern Ireland</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Greece</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Greenland</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Grenada</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Guadeloupe</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Guatemala</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Guinea</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Guinea-Bissau</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Guyana</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Haiti</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Honduras</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Hong Kong</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Hungary</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Iceland</OPTION>";
strOutput += "<OPTION VALUE=\"8\">India</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Indonesia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Iran</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Iraq</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Ireland (Eire)</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Israel</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Italy</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Jamaica</OPTION>";
strOutput += "<OPTION VALUE=\"4\">Japan</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Jordan</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Kazakhstan</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Kenya</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Kiribati</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Korea, Democratic People's Republic of (North)</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Korea, Republic of (South)</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Kuwait</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Kyrgyzstan</OPTION>";
strOutput += "<OPTION VALUE=\"9\">Laos</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Latvia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Lebanon</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Lesotho</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Liberia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Libya</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Liechtenstein</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Lithuania</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Luxembourg</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Macao</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Macedonia, Republic of</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Madagascar</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Malawi</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Malaysia</OPTION>";
strOutput += "<OPTION VALUE=\"9\">Maldives</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Mali</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Malta</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Martinique</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Mauritania</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Mauritius</OPTION>";
strOutput += "<OPTION VALUE=\"2\">Mexico</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Moldova</OPTION>";
strOutput += "<OPTION VALUE=\"9\">Mongolia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Montserrat</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Morocco</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Mozambique</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Namibia</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Nauru</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Nepal</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Netherlands</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Netherlands Antilles</OPTION>";
strOutput += "<OPTION VALUE=\"9\">New Caledonia</OPTION>";
strOutput += "<OPTION VALUE=\"8\">New Zealand</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Nicaragua</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Niger</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Nigeria</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Norway</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Oman</OPTION>"
strOutput += "<OPTION VALUE=\"8\">Pakistan</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Panama</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Papua New Guinea</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Paraguay</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Peru</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Philippines</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Pitcairn Island</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Poland</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Portugal</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Qatar</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Reunion</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Romania</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Russia</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Rwanda</OPTION>";
strOutput += "<OPTION VALUE=\"12\">St. Christopher (St. Kitts) & Nevis</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Saint Helena</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Saint Lucia</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Saint Pierre & Miquelon</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Saint Vincent & Grenadines</OPTION>";
strOutput += "<OPTION VALUE=\"7\">San Marino</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Sao Tome & Principe</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Saudi Arabia</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Senegal</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Serbia-Montenegro (Yugoslavia)</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Seychelles</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Sierra Leone</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Singapore</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Slovak Republic (Slovakia)</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Slovenia</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Solomon Islands</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Somalia</OPTION>";
strOutput += "<OPTION VALUE=\"11\">South Africa</OPTION>";
strOutput += "<OPTION VALUE=\"6\">Spain</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Sri Lanka</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Sudan</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Suriname</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Swaziland</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Sweden</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Switzerland</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Syrian Arab Republic (Syria)</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Taiwan</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Tajikistan</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Tanzania</OPTION>";
strOutput += "<OPTION VALUE=\"9\">Thailand</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Togo</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Tonga</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Trinidad & Tobago</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Tristan da Cunha</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Tunisia</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Turkey</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Turkmenistan</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Turks & Caicos Islands</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Tuvalu</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Uganda</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Ukraine</OPTION>";
strOutput += "<OPTION VALUE=\"10\">United Arab Emirates</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Uruguay</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Uzbekistan</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Vanuatu</OPTION>";
strOutput += "<OPTION VALUE=\"7\">Vatican City</OPTION>";
strOutput += "<OPTION VALUE=\"12\">Venezuala</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Vietnam</OPTION>";
strOutput += "<OPTION VALUE=\"0\">Wallis & Futuna Islands</OPTION>";
strOutput += "<OPTION VALUE=\"8\">Western Samoa</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Yemen</OPTION>";
strOutput += "<OPTION VALUE=\"10\">Zambia</OPTION>";
strOutput += "<OPTION VALUE=\"11\">Zimbabwe</OPTION>";
strOutput += "</SELECT>";
strOutput += "</TD>";
strOutput += "</TR>";
document.write(strOutput);
strOutput = "";

LocationSelected = GetCookie("ZoneSelected");
if (LocationSelected == null) LocationSelected = 8; // 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 = "Zone 0";
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 = "Zone 9";
if (LocationSelected == 10) LocationLabel = "Zone 10";
if (LocationSelected == 11) LocationLabel = "Zone 11";
if (LocationSelected == 12) LocationLabel = "Zone 12";

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=\"nopship\" 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 +"&&" + 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 != 0) //sets tax to 0.00 for all areas except 0 ||
fTax = 0.00;

if (LocationSelected == 0) {
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: ComputeShipping ||
// PARAMETERS: ||
// RETURNS: ||
// PURPOSE: Compute shipping cost due to total weight ||
//---------------------------------------------------------------------||
function ComputeShipping(Zone, TotWeight) {
LocationValue = GetCookie("ZoneSelected");

if (LocationValue != Zone) {
SetCookie("ZoneSelected", Zone, null, "/");
location.href=location.href;
}

if (TotWeight == 0) return 0.00;

if (LocationValue == 0 ) {
if (TotWeight <= 1) return 0.00;
if ((TotWeight <= 500) && (TotWeight > 1)) return (0.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 1 ) {
if (TotWeight <= 1) return 16.75;
if ((TotWeight <= 2) && (TotWeight > 1)) return (17.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 3) && (TotWeight > 2)) return (18.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 4) && (TotWeight > 3)) return (19.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 5) && (TotWeight > 4)) return (20.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 6) && (TotWeight > 5)) return (22.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 7) && (TotWeight > 6)) return (25.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 8) && (TotWeight > 7)) return (27.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 9) && (TotWeight > 8)) return (29.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 10) && (TotWeight > 9)) return (31.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 11) && (TotWeight > 10)) return (34.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 12) && (TotWeight > 11)) return (36.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 13) && (TotWeight > 12)) return (38.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 14) && (TotWeight > 13)) return (40.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 15) && (TotWeight > 14)) return (43.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 16) && (TotWeight > 15)) return (45.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 17) && (TotWeight > 16)) return (47.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 18) && (TotWeight > 17)) return (49.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 19) && (TotWeight > 18)) return (52.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 20) && (TotWeight > 19)) return (54.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 21) && (TotWeight > 20)) return (56.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 22) && (TotWeight > 21)) return (58.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 23) && (TotWeight > 22)) return (61.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 24) && (TotWeight > 23)) return (63.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 25) && (TotWeight > 24)) return (65.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if (TotWeight > 25) return 70.00;
}
if (LocationValue == 2 ) {
if (TotWeight <= 1) return 20.00;
if ((TotWeight <= 2) && (TotWeight > 1)) return (23.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 3) && (TotWeight > 2)) return (27.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 4) && (TotWeight > 3)) return (31.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 5) && (TotWeight > 4)) return (34.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 6) && (TotWeight > 5)) return (36.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 7) && (TotWeight > 6)) return (38.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 8) && (TotWeight > 7)) return (40.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 9) && (TotWeight > 8)) return (43.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 10) && (TotWeight > 9)) return (45.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 11) && (TotWeight > 10)) return (47.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 12) && (TotWeight > 11)) return (49.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 13) && (TotWeight > 12)) return (51.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 14) && (TotWeight > 13)) return (54.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 15) && (TotWeight > 14)) return (56.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 16) && (TotWeight > 15)) return (58.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 17) && (TotWeight > 16)) return (60.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 18) && (TotWeight > 17)) return (62.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 19) && (TotWeight > 18)) return (65.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 20) && (TotWeight > 19)) return (67.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 21) && (TotWeight > 20)) return (69.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 22) && (TotWeight > 21)) return (71.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 23) && (TotWeight > 22)) return (73.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 24) && (TotWeight > 23)) return (76.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 25) && (TotWeight > 24)) return (78.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if (TotWeight > 25) return 80.00;
}
if (LocationValue == 3 ) {
if (TotWeight <= 1) return 24.75;
if ((TotWeight <= 2) && (TotWeight > 1)) return (28.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 3) && (TotWeight > 2)) return (32.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 4) && (TotWeight > 3)) return (35.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 5) && (TotWeight > 4)) return (38.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 6) && (TotWeight > 5)) return (41.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 7) && (TotWeight > 6)) return (44.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 8) && (TotWeight > 7)) return (47.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 9) && (TotWeight > 8)) return (50.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 10) && (TotWeight > 9)) return (53.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 11) && (TotWeight > 10)) return (56.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 12) && (TotWeight > 11)) return (59.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 13) && (TotWeight > 12)) return (62.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 14) && (TotWeight > 13)) return (65.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 15) && (TotWeight > 14)) return (68.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 16) && (TotWeight > 15)) return (71.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 17) && (TotWeight > 16)) return (74.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 18) && (TotWeight > 17)) return (77.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 19) && (TotWeight > 18)) return (80.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 20) && (TotWeight > 19)) return (83.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 21) && (TotWeight > 20)) return (86.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 22) && (TotWeight > 21)) return (89.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 23) && (TotWeight > 22)) return (92.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 24) && (TotWeight > 23)) return (95.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 25) && (TotWeight > 24)) return (98.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if (TotWeight > 25) return 100.00;
}
if (LocationValue == 4 ) {
if (TotWeight <= 1) return 21.00;
if ((TotWeight <= 2) && (TotWeight > 1)) return (25.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 3) && (TotWeight > 2)) return (29.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 4) && (TotWeight > 3)) return (33.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 5) && (TotWeight > 4)) return (36.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 6) && (TotWeight > 5)) return (40.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 7) && (TotWeight > 6)) return (43.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 8) && (TotWeight > 7)) return (46.65 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 9) && (TotWeight > 8)) return (49.95 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 10) && (TotWeight > 9)) return (53.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 11) && (TotWeight > 10)) return (56.55 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 12) && (TotWeight > 11)) return (59.85 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 13) && (TotWeight > 12)) return (63.15 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 14) && (TotWeight > 13)) return (66.45 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 15) && (TotWeight > 14)) return (69.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 16) && (TotWeight > 15)) return (73.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 17) && (TotWeight > 16)) return (76.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 18) && (TotWeight > 17)) return (79.65 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 19) && (TotWeight > 18)) return (82.95 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 20) && (TotWeight > 19)) return (86.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 21) && (TotWeight > 20)) return (89.55 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 22) && (TotWeight > 21)) return (92.85 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 23) && (TotWeight > 22)) return (96.15 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 24) && (TotWeight > 23)) return (99.45 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 25) && (TotWeight > 24)) return (102.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if (TotWeight > 25) return 105.00;
}
if (LocationValue == 5 ) {
if (TotWeight <= 1) return 9.02;
if ((TotWeight <= 77) && (TotWeight > 1)) return (9.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 80) && (TotWeight > 77)) return (12.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 85) && (TotWeight > 80)) return (14.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 500) && (TotWeight > 85)) return (15.00 + (0.40 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 6 ) {
if (TotWeight <= 1) return 9.07;
if ((TotWeight <= 500) && (TotWeight > 1)) return (9.07 + (0.50 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 7 ) {
if (TotWeight <= 1) return 9.18;
if ((TotWeight <= 500) && (TotWeight > 1)) return (9.18 + (0.65 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 8 ) {
if (TotWeight <= 1) return 9.02;
if ((TotWeight <= 77) && (TotWeight > 1)) return (9.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 80) && (TotWeight > 77)) return (12.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 85) && (TotWeight > 80)) return (14.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 500) && (TotWeight > 85)) return (15.00 + (0.40 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 9 ) {
if (TotWeight <= 1) return 9.02;
if ((TotWeight <= 77) && (TotWeight > 1)) return (9.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 80) && (TotWeight > 77)) return (12.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 85) && (TotWeight > 80)) return (14.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 500) && (TotWeight > 85)) return (15.00 + (0.40 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 10 ) {
if (TotWeight <= 1) return 9.02;
if ((TotWeight <= 77) && (TotWeight > 1)) return (9.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 80) && (TotWeight > 77)) return (12.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 85) && (TotWeight > 80)) return (14.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 500) && (TotWeight > 85)) return (15.00 + (0.40 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 11 ) {
if (TotWeight <= 1) return 9.02;
if ((TotWeight <= 77) && (TotWeight > 1)) return (9.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 80) && (TotWeight > 77)) return (12.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 85) && (TotWeight > 80)) return (14.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 500) && (TotWeight > 85)) return (15.00 + (0.40 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 12 ) return 0.00;
}

//---------------------------------------------------------------------||
// 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 (LocationValue == 0 ) {

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 = "Zone 0";
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 = "Zone 9";
if (LocationSelected == 10) LocationLabel = "Zone 10";
if (LocationSelected == 11) LocationLabel = "Zone 11";
if (LocationSelected == 12) LocationLabel = "Zone 12";

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 != 0) //sets tax to 0.00 for all other areas ||
fTax = 0.00;

if (LocationSelected == 0) {
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 != 0){
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 ||
//=====================================================================||
~ tox0tes ~
tox0tes
 
Posts: 25
Joined: Fri May 21, 2004 12:35 am
Location: California

Shipping by the weight

Postby cyberdata.dk » Tue Oct 26, 2004 4:05 pm

I need a mod to calgulate shipping by the total weight. there are 25 weight steps all with different charge.
example:

<=50 gram = 5,50 kr.
>50 and <=100 gram = 6,60 kr.
>100 and <=250 gram = 12,00 kr.
....
....
....
....
ect.

But if they in the checkuot page want a special dilevery the shipping is different. so it will be something like this:

<=100 gram = 28,75 kr.
>100 and <=250 gram = 36,25 kr.
....
....
....
....

ect.

I hope there some one out there can figure out that :-)
cyberdata.dk
 
Posts: 6
Joined: Sun Oct 24, 2004 2:44 am

shipping not sent to email

Postby plugnz » Sat Dec 11, 2004 11:31 am

Hi Stefko, I have used the UPS shipping mod which is just great - very nice script.

One thing I can't seem to fix is the shipping amount is not being sent in the emails, and tax is shown on the email even if the country selected does not have tax added! The totals on the checkout page are all correct however.

Thanks
plugnz
 
Posts: 10
Joined: Mon Oct 04, 2004 11:08 am
Location: New Zealand

Postby Stefko » Sat Dec 11, 2004 6:09 pm

Post a URL to your shop, I'll look at the scripts, set-up a test URL with your scripts and see if we can correct these minor problems!
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Thanks Stefko

Postby plugnz » Sun Dec 12, 2004 7:54 am

Thanks Stefko, the best page to go to is http://www.plugged.co.nz/sample_libraries_elab.html
and click on any one of the thumbnails. Please note they are all live so once you get to the DPS payment checkout page a real credit card no. will purchase the product! The respective emails will be sent once you have reached that page anyway so you dont need to proceed any further.
I have the scripts nested in frames so you'll probably need the scripts separately - and they don't seem to be able to upload here. If you can't locate them email me at michael@plugged.co.nz and I'll send them direct to you.

Kind regards
Michael Bennington-Barr
plugnz
 
Posts: 10
Joined: Mon Oct 04, 2004 11:08 am
Location: New Zealand

Ups mod does it work with Paypal, help pls.

Postby Tom4us » Fri Feb 04, 2005 7:23 am

hi

This mod work well, have ever somebody try to intergrate it with Paypal. I have try to use the mod found here but does not seems to work. When send to Paypal the cart is always empty. Please can anybody help here.

Tom
Tom4us
Guru
 
Posts: 55
Joined: Fri Feb 07, 2003 11:02 am
Location: Kenya

Got The Stefko UPS mod work with Paypal now.

Postby Tom4us » Sat Feb 19, 2005 12:49 pm

Hey!.

I final got it out of hook. The Stefko Ups mod now work great with Paypal. Anybody who had difficult intergrating it with paypal, here is a copy of it.

Please pay more attention on the "FUNCTION: CheckoutCart" section.

Viva Stefko, viva nopcart.

Many thanks to everybody who had made all the contribution here and the whole crew of Nopdesign.



IN managecart.htm , you can add this little css sript to make you cart more beautiful.

.nobottom {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; border-bottom:orange 1px solid; border-top:orange 1px solid; border-right:orange 1px solid; border-left:orange 1px solid; text-align:center}

Its great. I have tested it and it work, you test it to and it will work.

Code: Select all
//=====================================================================||
// NOP Design JavaScript Shopping Cart ||
// ||
// For more information on SmartSystems, or how NOPDesign can help you ||
// Please visit us on the WWW at http://www.nopdesign.com ||
// ||
// Javascript portions of this shopping cart software are available as ||
// freeware from NOP Design. You must keep this comment unchanged in ||
// your code. For more information contact FreeCart@NopDesign.com. ||
// ||
// JavaScript Shop Module, V.4.4.0 ||
//=====================================================================||

//=====================================================================||
// UPS Shiping Mod by Stefko V.1.0.0 ||
// ||
// Version History: 02/23/03  V.1.0.0 Released ||
//                            includes USERENTRY ||                           
//                  03/02/03  V.1.1.0 Now works with Netscape & Opera ||
//                            added Taxable and Non-taxable product code||
//                            added MathRound to Weight ||
//=====================================================================||

//---------------------------------------------------------------------||
// Global Options ||
// ---------------- ||
// Shopping Cart Options, you can modify these options to change the ||
// the way the cart functions. ||
// ||
// Language Packs ||
// ============== ||
// You may include any language pack before nopcart.js in your HTML ||
// pages to change the language. Simply include a language pack with ||
// a script src BEFORE the <SCRIPT SRC="../os1/nopcart.js">... line. ||
// For example: <SCRIPT SRC="language-en.js"></SCRIPT> ||
// ||
// Options For Everyone: ||
// ===================== ||
// * MonetarySymbol: string, the symbol which represents dollars/euro, ||
// in your locale. ||
// * DisplayNotice: true/false, controls whether the user is provided ||
// with a popup letting them know their product is added to the cart ||
// * DisplayShippingColumn: true/false, controls whether the managecart||
// and checkout pages display shipping cost column. ||
// * DisplayShippingRow: true/false, controls whether the managecart ||
// and checkout pages display shipping cost total row. ||
// * DisplayTaxRow: true/false, controls whether the managecart ||
// and checkout pages display tax cost total row. ||
// * TaxRate: number, your area's current tax rate, ie: if your tax ||
// rate was 7.5%, you would set TaxRate = 0.075 ||
// * TaxByRegion: true/false, when set to true, the user is prompted ||
// with TaxablePrompt to determine if they should be charged tax. ||
// In the USA, this is useful to charge tax to those people who live ||
// in a particular state, but no one else. ||
// * TaxPrompt: string, popup message if user has not selected either ||
// taxable or nontaxable when TaxByRegion is set to true. ||
// * TaxablePrompt: string, the message the user is prompted with to ||
// select if they are taxable. If TaxByRegion is set to false, this ||
// has no effect. Example: 'Arizona Residents' ||
// * NonTaxablePrompt: string, same as above, but the choice for non- ||
// taxable people. Example: 'Other States' ||
// * MinimumOrder: number, the minium dollar amount that must be ||
// purchased before a user is allowed to checkout. Set to 0.00 ||
// to disable. ||
// * MinimumOrderPrompt: string, Message to prompt users with when ||
// they have not met the minimum order amount. ||
// ||
// Payment Processor Options: ||
// ========================== ||
// * PaymentProcessor: string, the two digit payment processor code ||
// for support payment processor gateways. Setting this field to ||
// anything other than an empty string will override your OutputItem ||
// settings -- so please be careful when receiving any form data. ||
// Support payment processor gateways are: ||
// * Authorize.net (an) ||
// * Worldpay (wp) ||
// * LinkPoint (lp) ||
// ||
// Options For Programmers: ||
// ======================== ||
// * OutputItem<..>: string, the name of the pair value passed at ||
// checkouttime. Change these only if you are connecting to a CGI ||
// script and need other field names, or are using a secure service ||
// that requires specific field names. ||
// * AppendItemNumToOutput: true/false, if set to true, the number of ||
// each ordered item will be appended to the output string. For ||
// example if OutputItemId is 'ID_' and this is set to true, the ||
// output field name will be 'ID_1', 'ID_2' ... for each item. ||
// * HiddenFieldsToCheckout: true/false, if set to true, hidden fields ||
// for the cart items will be passed TO the checkout page, from the ||
// ManageCart page. This is set to true for CGI/PHP/Script based ||
// checkout pages, but should be left false if you are using an ||
// HTML/Javascript Checkout Page. Hidden fields will ALWAYS be ||
// passed FROM the checkout page to the Checkout CGI/PHP/ASP/Script ||
//---------------------------------------------------------------------||

//Options for Everyone:
MonetarySymbol = '$';
DisplayNotice = true;
DisplayChangeQty = true;
DisplayShippingColumn = true;
DisplayShippingRow = true;
TaxRate = 0.00; //set taxable region rate ||
DisplayTaxRow = false;
TaxByRegion = false; //leave this at false, UPS Shipping Mod will activate taxable Zone ||
TaxPrompt = 'For tax purposes, please select if you are an Kansas branch of Oasis before continuing'; //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 Zone 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';
LocationPrompt = 'For shipping purpose, please select the zone that your location is in.';
MaxWeightPrompt = 'Sorry, maximum weight allowable is 500Kgs.';



//=====================================================================||
//---------------------------------------------------------------------||
// YOU DO NOT NEED TO MAKE ANY MODIFICATIONS BELOW THIS LINE ||
//---------------------------------------------------------------------||
//=====================================================================||


//---------------------------------------------------------------------||
// 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 bChecked;
}



//---------------------------------------------------------------------||
// 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 = 8; // Code to use Wichita 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 class=\" nobottom \"   VALUE=\"" + fields[1] + "\" onChange=\"ChangeQuantity("+i+", this.value);\" ALIGN=CENTER></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 class=\" nobottom \"   VALUE=\"" + fields[1] + "\" onChange=\"ChangeQuantity("+i+", this.value);\" ALIGN=CENTER></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>"+"UPS<BR>SHIPPING<BR>ZONE"+"</B></TD>";
strOutput += "<TD CLASS=\"nopship\" COLSPAN=5>";
strOutput += "<input type=radio name=\"ZONE\" value=\"0" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
strOutput += "Zone 1 - Wichita KS";
//strOutput += "<BR><input type=radio name=\"ZONE\" value=\"1" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
//strOutput += "Zone 2 - Tulsa OK";
strOutput += "<BR><input type=radio name=\"ZONE\" value=\"2" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
strOutput += "Zone 3 - Ft.Smith AR, Lincoln/Omaha NE, Okla.City/Norman/Marietta OK";
//strOutput += "<BR><input type=radio name=\"ZONE\" value=\"3" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
//strOutput += "Zone 4 -";
//strOutput += "<BR><input type=radio name=\"ZONE\" value=\"4" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
//strOutput += "Zone 5 -";
strOutput += "<BR><input type=radio name=\"ZONE\" value=\"5" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
strOutput += "Zone 6 - All Florida Locations";
//strOutput += "<BR><input type=radio name=\"ZONE\" value=\"6" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
//strOutput += "Zone 7 -";
strOutput += "</TD>";
strOutput += "</TR>";

document.write(strOutput);
strOutput = "";

LocationSelected = GetCookie("ZoneSelected");
if (LocationSelected == null) LocationSelected = 8; // 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 = "Zone 1";
if (LocationSelected == 1) LocationLabel = "Zone 2";
if (LocationSelected == 2) LocationLabel = "Zone 3";
if (LocationSelected == 3) LocationLabel = "Zone 4";
if (LocationSelected == 4) LocationLabel = "Zone 5";
if (LocationSelected == 5) LocationLabel = "Zone 6";
if (LocationSelected == 6) LocationLabel = "Zone 7";
if (LocationSelected == 7) LocationLabel = "Zone G";
if (LocationSelected == 8) LocationLabel = '<font color="#FF0000">Select Shipping Zone</font>';

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=\"nopship\" COLSPAN=1 ALIGN=RIGHT><B>" + fWeight + "Kgs" + "</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 != 0) //sets tax to 0.00 for all areas except 0 ||
fTax = 0.00; 

if (LocationSelected == 0)  {
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: ComputeShipping ||
// PARAMETERS: ||
// RETURNS: ||
// PURPOSE: Compute shipping cost due to total weight ||
//---------------------------------------------------------------------||
function ComputeShipping(Zone, TotWeight) {
LocationValue = GetCookie("ZoneSelected");

if (LocationValue != Zone) {
SetCookie("ZoneSelected", Zone, null, "/");
location.href=location.href;
}

if (TotWeight == 0) return 0.00;

if (LocationValue == 0 ) {
if (TotWeight <= 1) return 0.00;
if ((TotWeight <= 500) && (TotWeight > 1)) return (0.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 1 ) {
if (TotWeight <= 1) return 8.39;
if ((TotWeight <= 500) && (TotWeight > 1)) return (8.39 + (0.20 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 2 ) {
if (TotWeight <= 1) return 8.50;
if ((TotWeight <= 70) && (TotWeight > 1)) return (8.50 + (0.15 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 74) && (TotWeight > 70)) return (12.02 + (0.20 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 79) && (TotWeight > 74)) return (14.02 + (0.20 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 500) && (TotWeight > 79)) return (20.00 + (0.30 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 3 ) {
if (TotWeight <= 1) return 8.74;
if ((TotWeight <= 500) && (TotWeight > 1)) return (8.74 + (0.25 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 4 ) {
if (TotWeight <= 1) return 8.82;
if ((TotWeight <= 500) && (TotWeight > 1)) return (8.82 + (0.30 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 5 ) {
if (TotWeight <= 0.5) return 18.00;
if (TotWeight <= 1) return 37.00;
if ((TotWeight <= 10) && (TotWeight > 0.5)) return (37.00 + (11.0 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 20) && (TotWeight > 10)) return (12.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 85) && (TotWeight > 80)) return (14.02 + (0.35 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight <= 500) && (TotWeight > 85)) return (15.00 + (0.40 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 6 ) {
if (TotWeight <= 1) return 9.07;
if ((TotWeight <= 500) && (TotWeight > 1)) return (9.07 + (0.50 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 7 ) {
if (TotWeight <= 1) return 9.18;
if ((TotWeight <= 500) && (TotWeight > 1)) return (9.18 + (0.65 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
}
if (LocationValue == 8 ) return 0.00;
}

//---------------------------------------------------------------------||
// 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
var PaymentProcessor = "pp";

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 == 'pp' ) {
//Process description field for payment processors instead of hidden values.
//Format Description of product as:
// ID, Name, Qty X
strPP += fields[3];
if ( fields[5] != "" )
strPP += " - " + fields[5] + "\n";
strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
strOutput += "<input type=hidden name=\"add_" + strFooter + "\" value=\"" + fields[1] + "\">";
strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" + fields[2] + "\">";
strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
if (i == iNumberOrdered) {

}
} else 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 = "Zone 1";
if (LocationSelected == 1) LocationLabel = "Zone 2";
if (LocationSelected == 2) LocationLabel = "Zone 3";
if (LocationSelected == 3) LocationLabel = "Zone 4";
if (LocationSelected == 4) LocationLabel = "Zone 5";
if (LocationSelected == 5) LocationLabel = "Zone 6";
if (LocationSelected == 6) LocationLabel = "Zone 7";
if (LocationSelected == 7) LocationLabel = "Zone G";
if (LocationSelected == 8) LocationLabel = "Zone";

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 != 0) //sets tax to 0.00 for all other areas ||
fTax = 0.00;

if (LocationSelected == 0)  {
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 == 'pp') {
//Process hidden values for PayPal.
strOutput += "<input type=hidden name=\"handling_cart\" value=\"" +moneyFormat(fShipping)+"\">";
//strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
//strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" +moneyFormat(fShipping + fTotal)+"\">";
//strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
//strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
//strOutput += "<input type=hidden name=\"handling_cart\" value=\" + fields[4] + "\">";
//if (i == iNumberOrdered) {
//strOutput += "<input type=hidden name=\"handling_cart\" value=\"" + fields[4] + "\">";
//}


//} else if (LocationSelected != 0){
//strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
//strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
//strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" +moneyFormat(fShipping + fTotal)+"\">";
//strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
//strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
//} else {
//strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
//strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
//strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" +moneyFormat(fShipping + fTotal)+"\">";
//strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
//strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
}
}


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 ||
//=====================================================================||
Tom4us
Guru
 
Posts: 55
Joined: Fri Feb 07, 2003 11:02 am
Location: Kenya

Quantity variable?

Postby Mx4Px » Mon Mar 07, 2005 3:59 pm

Hi!

This mod is great - does just about everything I need it to. One thing, though...maybe I'm not implementing it right, but it doesn't seem to account for the big difference in UPS shipping costs based on quantity. For example, if you ship 1 package that weighs 40 lbs to a particular zone, it costs around $12...and the mod calculates that just fine. However, if you shipped, say, 5 packages that were 8 lbs each (so the total weight would still be 40 lbs), the actual UPS cost is something like $27....but the mod still calculates it as $12. Is there a way to get this mod to reflect that difference?

Thanks!
Andy Frazier
Mx4Px
 
Posts: 1
Joined: Mon Mar 07, 2005 3:52 pm
Location: Massachusetts, USA

Postby Stefko » Mon Mar 07, 2005 7:05 pm

Wish I knew of a way, but one never knows how many cartons or the actual end senerio!
I have developed a "REAL-TIME" UPS SHIPPING MOD, which pulls the shipping costs from the UPS database, and is VERY close to the billed amount from UPS themselves.
I am not currently releaseing this MOD to the public, more development is required, but have used it on several contrated projects
If you have any coding knowledge perhaps you may think in that direction.
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

PreviousNext

Return to Modifications

Who is online

Users browsing this forum: No registered users and 0 guests

cron