//=====================================================================-|| 
// 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                 ||
//                  03/28/03  V.1.2.0 Bug fixes                         ||
//                            Corrected Taxable+Non-taxable Prod code   ||
//                            checkout with an empty cart               ||          
//===================================================================== || 

//----------------------------------------------------------------------|| 
// 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)                                                     || 
// * Protx (px)                                                         || 
//                                                                      || 
// 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        = '£'; //CHANGED TEXT TO REFLECT POUND VALUE. SJC 19-05-03
DisplayNotice         = true; 
DisplayShippingColumn = true; 
DisplayShippingRow    = true; 
TaxRate               = 0.1750; //SET UK VAT TO 17.5%. SJC 15-02.2010
DisplayTaxRow         = false; 
TaxByRegion           = false; //leave this at false, UPS Shipping Mod will activate taxable Zone 
TaxPrompt             = ''; //Deactivated. CHANGED TO REFLECT PRITESH VALUE.  SJC 07-09-03 
TaxablePrompt         = ''; //Deactivated. CHANGED TO REFLECT PRITESH VALUE.  SJC 07-09-03 
NonTaxablePrompt      = ''; //Deactivated. CHANGED TO REFLECT PRITESH VALUE.  SJC 07-09-03 
MinimumOrder          = 0.01; //
MinimumOrderPrompt    = 'We can not proceed to checkout since\nthere is no item(s) in the shopping cart.'; //CHANGED TEXT. SJC 19-05-03
//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      = 'px'; 

//Options for Programmers: 
OutputItemId           = 'ID_'; 
OutputItemQuantity     = 'QUANTITY_'; 
OutputItemPrice        = 'PRICE_'; 
OutputItemName         = 'NAME_'; 
OutputItemWeight       = 'WEIGHT_'; //Added for UPS mod ||
OutputItemAddtlInfo    = 'ADDTLINFO_'; 
OutputOrderSubtotal    = 'SUBTOTAL'; 
OutputOrderShipping    = 'POSTAGE & PACKAGING'; //CHANGED TO REFLECT CORRECT TEXT.  SJC 05-09-03
OutputOrderTax         = 'UK VAT ON GOODS (17.5%)'; //CHANGED TEXT TO REFLECT UK VAT. SJC 15/02/2010
OutputOrderTotal       = 'TOTAL'; 
AppendItemNumToOutput  = true; 
HiddenFieldsToCheckout = true; //CHANGED TO REFLECT TRUE FOR HIDDEN FIELDS TO CHECKOUT FOR PROTX.  SJC 05-09-03

//Options for Shipping by Weight: 
LocationLabel = 'ZONE'; // TEXT CHANGED FROM ZONE TO LOCATION. SJC 19-05-03
LocationPrompt = 'For shipping purpose, please select the location that you are in'; 
MaxWeightPrompt = 'Sorry, maximum weight allowable is 500Kg.'; 



//=====================================================================|| 
//---------------------------------------------------------------------|| 
// 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 shopping cart is full, please proceed to checkout."; //CHANGED TEXT. SJC 19-05-03
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 = "POSTAGE & PACKAGING"; //CHANGED TO REFLECT CORRECT TEXT.  SJC 05-09-03
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 + " - " + strADDTLINFO ;
// CHANGED ABOVE NOTICE FORMAT TO ALIGN CORRECTLY PLUS ADD EXTRA INFO INTO CART POPUP. SJC 19-05-03
break; 
} 
} 


if ( !bAlreadyInCart ) { 
iNumberOrdered++; 

if ( iNumberOrdered > 15 ) 
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 + " - " + strADDTLINFO ;
// CHANGED ABOVE NOTICE FORMAT TO ALIGN CORRECTLY PLUS ADD EXTRA INFO INTO CART POPUP. SJC 19-05-03
} 
} 

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 = 1; // Code to use location 0 as default checked if customer goes to Checkout with an empty Cart ||


if ( bDisplay ) 
strOutput = "<TABLE 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++ ) { 
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]) ); // ADDED FOR WEIGHT ROUNDING ERROR. SJC 19-05-03
fWeight = Math.round(fWeight * 1000)/1000; // ADDED FOR WEIGHT ROUNDING ERROR. SJC 19-05-03
var strProductId = fields[0]; 
strProductId=strProductId.charAt(0); 
if( strProductId!= 'n' ) { 
fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate;  

// Start Mod. SJC 19-05-03. Taken out and added four lines above
// var strProductId = fields[0]; 
// if( strProductId[0] != 'n' ) { 
// fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate; 
// End Mod

} 

strTotal = moneyFormat(fTotal); 
strTax = moneyFormat(fTax); 

if ( bDisplay ) { 
strOutput += "<TR><TD CLASS=\"nopentry\">" + 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>"; 
// aDDED 13-06-03 FOR MAXLENGHT=2.  Chg tip from Xeokeri on Nop Forum.
strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER><INPUT TYPE=TEXT NAME=Q SIZE=2 MAXLENGTH=2 VALUE=\"" + fields[1] + "\" onChange=\"ChangeQuantity("+i+", this.value);\"></TD>"; 
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(fields[2]) + "/ea</TD>"; 

if ( DisplayShippingColumn ) { 
if ( parseFloat(fields[4]) > 0 ) 
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ fields[4] + " kg" + "/ea</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 + "</B></TD>"; 
strOutput += "</TR>"; 

//this displays the shipping matrix and sets the value for each zone ||

if (( DisplayShippingRow ) && ( iNumberOrdered != 0)) { 

strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=CENTER><B>"+"SHIPPING<BR>TO..."+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=5>"; // CHANGED ABOVE LINE TO REFLECT PARCELFORCE FOR PACKAGES. SJC 19-05-03

strOutput += "<input type=radio name=\"ZONE\" value=\"0" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">"; 
strOutput += "No Shipping (Collection Only)"; 

strOutput += "<BR><input type=radio name=\"ZONE\" value=\"1" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">"; 
strOutput += "United Kingdom"; 

strOutput += "<BR><input type=radio name=\"ZONE\" value=\"2" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">"; 
strOutput += "EU - Zone 1: Belgium, Ireland, Luxembourg, Netherlands"; 

strOutput += "<BR><input type=radio name=\"ZONE\" value=\"3" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">"; 
strOutput += "EU - Zone 2: Denmark, France, Germany, Switzerland"; 

strOutput += "<BR><input type=radio name=\"ZONE\" value=\"4" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">"; 
strOutput += "EU - Zone 3: Austria, Finland, Italy, Norway, Portugal, Spain, Sweden"; 

strOutput += "<BR><input type=radio name=\"ZONE\" value=\"5" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">"; 
strOutput += "USA & Canada"; 

strOutput += "<BR><input type=radio name=\"ZONE\" value=\"6" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">"; 
strOutput += "Australia & New Zealand"; 

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

LocationSelected = GetCookie("ZoneSelected"); 
if (LocationSelected == null) LocationSelected = 1; // CHANGED CODE TO REFLECT UK DEFAULT SHIPPING. SJC 19-05-03
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 = "Collection Only";            //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 1) LocationLabel = "United Kingdom";             //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 2) LocationLabel = "Europe - Zone 1";            //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 3) LocationLabel = "Europe - Zone 2";            //CHANGED TEXT TO REFLECT UK. SJC 20-06-03
if (LocationSelected == 4) LocationLabel = "Europe - Zone 3";            //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 5) LocationLabel = "USA & Canada";               //CHANGED TEXT TO REFLECT UK. SJC 20-06-03
if (LocationSelected == 6) LocationLabel = "Australia & New Zealand";    //CHANGED TEXT TO REFLECT UK. SJC 19-07-06

if (fWeight == 0) fShipping = 0; 
else fShipping = ComputeShipping(LocationSelected, fWeight); 

strShipping = moneyFormat(fShipping); 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strWTOT+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + fWeight + " Kg" + "</B></TD>"; 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>" + strSHIP + " for " + LocationLabel + "</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strShipping + "</B></TD>"; 
strOutput += "</TR>"; 
} 

if ( DisplayTaxRow || TaxByRegion ) { 
if ( TaxByRegion ) { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2><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 + "</B></TD>"; 
strOutput += "</TR>"; 
} 
} 

// if (LocationSelected != 0) //sets tax to 0.00 for all areas except 0 || // Must be taken out else VAT is already
// fTax = 0.00;                                                            // counted on product price. SJC 24-05-03

// ADDED MULTIPLE LINES TO SUPPORT VAT FOR LOCATIONS 0 THROUGH 4. SJC 19-05-03

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 + "</B></TD>"; // SJC 19-05-03
strOutput += "</TR>"; 
} 

if (LocationSelected == 1)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; // SJC 19-05-03
strOutput += "</TR>"; 
} 

if (LocationSelected == 2)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; // SJC 19-05-03
strOutput += "</TR>"; 
} 

if (LocationSelected == 3)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; // SJC 19-05-03
strOutput += "</TR>"; 
} 

if (LocationSelected == 4)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; // SJC 19-05-03
strOutput += "</TR>"; 
} 

if (LocationSelected == 5)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; // SJC 19-05-03
strOutput += "</TR>"; 
} 

if (LocationSelected == 6)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5><B>"+strTAX+"</B></TD>"; 
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; // SJC 19-07-06
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)) + "</B></TD>"; 
strOutput += "</TR>"; 
} 
strOutput += "</TABLE>"; 

if ( HiddenFieldsToCheckout ) { 
strOutput += "<input type=hidden name=\""+OutputOrderSubtotal+"\" value=\""+ MonetarySymbol + strTotal + "\">"; 
strOutput += "<input type=hidden name=\"shipping\" value=\""+ moneyFormat((fShipping)) + "\">"; //ADDED SJC 18/09/03
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=\"chargetotal\" value=\""+ moneyFormat((fTotal + fShipping + fTax)) + "\">"; //Add for PROTX.  SJC 07-09-03 
} 
} 
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 <= 999999999) && (TotWeight > 1)) return (0.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
} 
if (LocationValue == 1 ) { 
if (TotWeight < 0.060) return 1.56; //SET ALL VALUE FOR UK SHIPPING. SJC 23-01-04
if ((TotWeight < 0.100) && (TotWeight >= 0.060)) return (1.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.150) && (TotWeight >= 0.100)) return (2.11 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.200) && (TotWeight >= 0.150)) return (2.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.250) && (TotWeight >= 0.200)) return (2.58 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.300) && (TotWeight >= 0.250)) return (2.81 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.350) && (TotWeight >= 0.300)) return (3.04 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.400) && (TotWeight >= 0.350)) return (3.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.450) && (TotWeight >= 0.400)) return (3.74 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.500) && (TotWeight >= 0.450)) return (4.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.600) && (TotWeight >= 0.500)) return (4.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.700) && (TotWeight >= 0.600)) return (5.58 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.750) && (TotWeight >= 0.700)) return (5.90 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.800) && (TotWeight >= 0.750)) return (6.29 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.900) && (TotWeight >= 0.800)) return (6.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.000) && (TotWeight >= 0.900)) return (6.90 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 1.500) && (TotWeight >= 1.000)) return (7.08 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.000) && (TotWeight >= 1.500)) return (7.55 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.000) && (TotWeight >= 2.000)) return (9.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 6.000) && (TotWeight >= 4.000)) return (10.39 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 8.000) && (TotWeight >= 6.000)) return (11.30 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.000) && (TotWeight >= 8.000)) return (12.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 20.000) && (TotWeight >= 10.000)) return (14.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 20.500) && (TotWeight >= 20.000)) return (33.61 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 21.000) && (TotWeight >= 20.500)) return (34.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 21.500) && (TotWeight >= 21.000)) return (34.90 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.000) && (TotWeight >= 21.500)) return (35.54 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.500) && (TotWeight >= 22.000)) return (36.19 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 23.000) && (TotWeight >= 22.500)) return (36.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 23.500) && (TotWeight >= 23.000)) return (37.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.000) && (TotWeight >= 23.500)) return (38.13 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.500) && (TotWeight >= 24.000)) return (38.78 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 25.000) && (TotWeight >= 24.500)) return (39.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 25.500) && (TotWeight >= 25.000)) return (40.07 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 26.000) && (TotWeight >= 25.500)) return (41.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 26.500) && (TotWeight >= 26.000)) return (42.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 27.000) && (TotWeight >= 26.500)) return (42.65 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 27.500) && (TotWeight >= 27.000)) return (43.30 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.000) && (TotWeight >= 27.500)) return (43.95 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 28.500) && (TotWeight >= 28.000)) return (44.59 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 29.000) && (TotWeight >= 28.500)) return (45.24 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 29.500) && (TotWeight >= 29.000)) return (45.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 30.000) && (TotWeight >= 29.500)) return (46.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 30.500) && (TotWeight >= 30.000)) return (47.18 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 31.000) && (TotWeight >= 30.500)) return (47.82 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 31.500) && (TotWeight >= 31.000)) return (48.47 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 32.000) && (TotWeight >= 31.500)) return (49.12 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 32.500) && (TotWeight >= 32.000)) return (49.76 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 33.000) && (TotWeight >= 32.500)) return (50.41 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 33.500) && (TotWeight >= 33.000)) return (51.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 34.000) && (TotWeight >= 33.500)) return (51.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 34.500) && (TotWeight >= 34.000)) return (52.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 35.000) && (TotWeight >= 34.500)) return (52.99 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 35.500) && (TotWeight >= 35.000)) return (53.64 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 36.000) && (TotWeight >= 35.500)) return (54.29 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 36.500) && (TotWeight >= 36.000)) return (54.93 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 37.000) && (TotWeight >= 36.500)) return (55.58 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 37.500) && (TotWeight >= 37.000)) return (56.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 38.000) && (TotWeight >= 37.500)) return (56.87 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 38.500) && (TotWeight >= 38.000)) return (57.52 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 39.000) && (TotWeight >= 38.500)) return (58.16 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 39.500) && (TotWeight >= 39.000)) return (58.81 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 40.000) && (TotWeight >= 39.500)) return (59.46 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 40.500) && (TotWeight >= 40.000)) return (60.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 41.000) && (TotWeight >= 40.500)) return (60.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 41.500) && (TotWeight >= 41.000)) return (61.39 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 42.000) && (TotWeight >= 41.500)) return (62.04 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 42.500) && (TotWeight >= 42.000)) return (62.69 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 43.000) && (TotWeight >= 42.500)) return (63.33 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 43.500) && (TotWeight >= 43.000)) return (63.98 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 44.000) && (TotWeight >= 43.500)) return (64.63 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 44.500) && (TotWeight >= 44.000)) return (65.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 45.000) && (TotWeight >= 44.500)) return (65.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 45.500) && (TotWeight >= 45.000)) return (66.56 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 46.000) && (TotWeight >= 45.500)) return (67.21 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 46.500) && (TotWeight >= 46.000)) return (67.86 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 47.000) && (TotWeight >= 46.500)) return (68.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 47.500) && (TotWeight >= 47.000)) return (69.15 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 48.000) && (TotWeight >= 47.500)) return (69.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 48.500) && (TotWeight >= 48.000)) return (70.44 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 49.000) && (TotWeight >= 48.500)) return (71.09 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 49.500) && (TotWeight >= 49.000)) return (71.73 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 50.000) && (TotWeight >= 49.500)) return (72.38 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 50.500) && (TotWeight >= 50.000)) return (73.03 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 51.000) && (TotWeight >= 50.500)) return (73.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 51.500) && (TotWeight >= 51.000)) return (74.32 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 52.000) && (TotWeight >= 51.500)) return (74.97 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 52.500) && (TotWeight >= 52.000)) return (75.61 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 53.000) && (TotWeight >= 52.500)) return (76.26 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 53.500) && (TotWeight >= 53.000)) return (76.90 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 54.000) && (TotWeight >= 53.500)) return (77.55 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 54.500) && (TotWeight >= 54.000)) return (78.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 55.000) && (TotWeight >= 54.500)) return (78.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 55.500) && (TotWeight >= 55.000)) return (79.49 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 56.000) && (TotWeight >= 55.500)) return (80.14 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 56.500) && (TotWeight >= 56.000)) return (80.78 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 57.000) && (TotWeight >= 56.500)) return (81.43 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 57.500) && (TotWeight >= 57.000)) return (82.07 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 58.000) && (TotWeight >= 57.500)) return (82.72 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 58.500) && (TotWeight >= 58.000)) return (83.37 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 59.000) && (TotWeight >= 58.500)) return (84.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 59.500) && (TotWeight >= 59.000)) return (84.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 60.000) && (TotWeight >= 59.500)) return (85.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 60.500) && (TotWeight >= 60.000)) return (85.95 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 61.000) && (TotWeight >= 60.500)) return (86.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 61.500) && (TotWeight >= 61.000)) return (87.24 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 62.000) && (TotWeight >= 61.500)) return (87.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 62.500) && (TotWeight >= 62.000)) return (88.54 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 63.000) && (TotWeight >= 62.500)) return (89.18 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 63.500) && (TotWeight >= 63.000)) return (89.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 64.000) && (TotWeight >= 63.500)) return (90.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 64.500) && (TotWeight >= 64.000)) return (91.12 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 65.000) && (TotWeight >= 64.500)) return (91.77 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 65.500) && (TotWeight >= 65.000)) return (92.41 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 66.000) && (TotWeight >= 65.500)) return (93.06 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 66.500) && (TotWeight >= 66.000)) return (93.71 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 67.000) && (TotWeight >= 66.500)) return (94.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 67.500) && (TotWeight >= 67.000)) return (95.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 68.000) && (TotWeight >= 67.500)) return (95.65 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 68.500) && (TotWeight >= 68.000)) return (96.29 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 69.000) && (TotWeight >= 68.500)) return (96.94 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 69.500) && (TotWeight >= 69.000)) return (97.58 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 70.000) && (TotWeight >= 69.500)) return (98.23 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 70.500) && (TotWeight >= 70.000)) return (98.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 71.000) && (TotWeight >= 70.500)) return (99.52 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 71.500) && (TotWeight >= 71.000)) return (100.17 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 72.000) && (TotWeight >= 71.500)) return (100.82 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 72.500) && (TotWeight >= 72.000)) return (101.46 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 73.000) && (TotWeight >= 72.500)) return (102.11 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 73.500) && (TotWeight >= 73.000)) return (102.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 74.000) && (TotWeight >= 73.500)) return (103.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 74.500) && (TotWeight >= 74.000)) return (104.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 75.000) && (TotWeight >= 74.500)) return (104.69 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 75.500) && (TotWeight >= 75.000)) return (105.34 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 76.000) && (TotWeight >= 75.500)) return (105.99 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 76.500) && (TotWeight >= 76.000)) return (106.63 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 77.000) && (TotWeight >= 76.500)) return (107.28 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 77.500) && (TotWeight >= 77.000)) return (107.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 78.000) && (TotWeight >= 77.500)) return (108.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 78.500) && (TotWeight >= 78.000)) return (109.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 79.000) && (TotWeight >= 78.500)) return (109.86 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 79.500) && (TotWeight >= 79.000)) return (110.51 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 80.000) && (TotWeight >= 79.500)) return (111.16 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 80.500) && (TotWeight >= 80.000)) return (111.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 81.000) && (TotWeight >= 80.500)) return (112.45 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 81.500) && (TotWeight >= 81.000)) return (113.09 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 82.000) && (TotWeight >= 81.500)) return (113.74 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 82.500) && (TotWeight >= 82.000)) return (114.39 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 83.000) && (TotWeight >= 82.500)) return (115.03 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 83.500) && (TotWeight >= 83.000)) return (115.68 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 84.000) && (TotWeight >= 83.500)) return (116.33 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 84.500) && (TotWeight >= 84.000)) return (116.97 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 85.000) && (TotWeight >= 84.500)) return (117.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 85.500) && (TotWeight >= 85.000)) return (118.26 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 86.000) && (TotWeight >= 85.500)) return (118.91 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 86.500) && (TotWeight >= 86.000)) return (119.56 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 87.000) && (TotWeight >= 86.500)) return (120.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 87.500) && (TotWeight >= 87.000)) return (120.85 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 88.000) && (TotWeight >= 87.500)) return (121.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 88.500) && (TotWeight >= 88.000)) return (122.14 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 89.000) && (TotWeight >= 88.500)) return (122.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 89.500) && (TotWeight >= 89.000)) return (123.43 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 90.000) && (TotWeight >= 89.500)) return (124.08 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 90.500) && (TotWeight >= 90.000)) return (124.73 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 91.000) && (TotWeight >= 90.500)) return (125.37 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 91.500) && (TotWeight >= 91.000)) return (126.02 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 92.000) && (TotWeight >= 91.500)) return (126.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 92.500) && (TotWeight >= 92.000)) return (127.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 93.000) && (TotWeight >= 92.500)) return (127.96 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 93.500) && (TotWeight >= 93.000)) return (128.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 94.000) && (TotWeight >= 93.500)) return (129.25 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 94.500) && (TotWeight >= 94.000)) return (129.90 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 95.000) && (TotWeight >= 94.500)) return (130.54 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 95.500) && (TotWeight >= 95.000)) return (131.19 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 96.000) && (TotWeight >= 95.500)) return (131.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 96.500) && (TotWeight >= 96.000)) return (132.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 97.000) && (TotWeight >= 96.500)) return (133.13 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 97.500) && (TotWeight >= 97.000)) return (133.77 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 98.000) && (TotWeight >= 97.500)) return (134.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 98.500) && (TotWeight >= 98.000)) return (135.07 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 99.000) && (TotWeight >= 98.500)) return (135.71 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 99.500) && (TotWeight >= 99.000)) return (136.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 100.000) && (TotWeight >= 99.500)) return (137.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 100.500) && (TotWeight >= 100.000)) return (137.51 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 

} 

if (LocationValue == 2 ) { 
if (TotWeight < 0.100) return 1.38; //SET ALL VALUE FOR EUROPE - ZONE 1 SHIPPING. SJC 23-01-04
if ((TotWeight < 0.200) && (TotWeight >= 0.100)) return (2.12 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.300) && (TotWeight >= 0.200)) return (2.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.400) && (TotWeight >= 0.300)) return (3.47 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.500) && (TotWeight >= 0.400)) return (4.17 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.600) && (TotWeight >= 0.500)) return (4.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.700) && (TotWeight >= 0.600)) return (5.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.800) && (TotWeight >= 0.700)) return (6.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.900) && (TotWeight >= 0.800)) return (7.16 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.000) && (TotWeight >= 0.900)) return (7.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.000) && (TotWeight >= 1.000)) return (17.03 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 3.000) && (TotWeight >= 2.000)) return (18.24 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.000) && (TotWeight >= 3.000)) return (19.46 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 5.000) && (TotWeight >= 4.000)) return (20.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 6.000) && (TotWeight >= 5.000)) return (20.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 7.000) && (TotWeight >= 6.000)) return (21.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 8.000) && (TotWeight >= 7.000)) return (21.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 9.000) && (TotWeight >= 8.000)) return (23.11 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.000) && (TotWeight >= 9.000)) return (24.32 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 12.000) && (TotWeight >= 10.000)) return (24.32 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 14.000) && (TotWeight >= 12.000)) return (25.54 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 16.000) && (TotWeight >= 14.000)) return (25.54 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 18.000) && (TotWeight >= 16.000)) return (26.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 20.000) && (TotWeight >= 18.000)) return (26.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.000) && (TotWeight >= 20.000)) return (27.97 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.000) && (TotWeight >= 22.000)) return (27.97 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 26.000) && (TotWeight >= 24.000)) return (29.19 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.000) && (TotWeight >= 26.000)) return (29.19 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 30.000) && (TotWeight >= 28.000)) return (30.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 31.500) && (TotWeight >= 30.000)) return (31.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 40.000) && (TotWeight >= 31.500)) return (52.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 50.000) && (TotWeight >= 40.000)) return (58.16 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
 
} 
if (LocationValue == 3 ) { 
if (TotWeight < 0.100) return 1.38; //SET ALL VALUE FOR EUROPE - ZONE 2 SHIPPING. SJC 23-01-04
if ((TotWeight < 0.200) && (TotWeight >= 0.100)) return (2.12 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.300) && (TotWeight >= 0.200)) return (2.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.400) && (TotWeight >= 0.300)) return (3.47 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.500) && (TotWeight >= 0.400)) return (4.17 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.600) && (TotWeight >= 0.500)) return (4.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.700) && (TotWeight >= 0.600)) return (5.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.800) && (TotWeight >= 0.700)) return (6.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.900) && (TotWeight >= 0.800)) return (7.16 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.000) && (TotWeight >= 0.900)) return (7.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.000) && (TotWeight >= 1.000)) return (19.46 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 3.000) && (TotWeight >= 2.000)) return (20.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.000) && (TotWeight >= 3.000)) return (21.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 5.000) && (TotWeight >= 4.000)) return (24.32 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 6.000) && (TotWeight >= 5.000)) return (25.54 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 7.000) && (TotWeight >= 6.000)) return (26.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 8.000) && (TotWeight >= 7.000)) return (29.19 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 9.000) && (TotWeight >= 8.000)) return (30.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.000) && (TotWeight >= 9.000)) return (31.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 12.000) && (TotWeight >= 10.000)) return (32.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 14.000) && (TotWeight >= 12.000)) return (32.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 16.000) && (TotWeight >= 14.000)) return (34.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 18.000) && (TotWeight >= 16.000)) return (34.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 20.000) && (TotWeight >= 18.000)) return (35.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.000) && (TotWeight >= 20.000)) return (35.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.000) && (TotWeight >= 22.000)) return (36.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 26.000) && (TotWeight >= 24.000)) return (36.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.000) && (TotWeight >= 26.000)) return (37.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 30.000) && (TotWeight >= 28.000)) return (37.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 31.500) && (TotWeight >= 30.000)) return (38.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 40.000) && (TotWeight >= 31.500)) return (57.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 50.000) && (TotWeight >= 40.000)) return (62.82 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
} 

if (LocationValue == 4 ) { 
if (TotWeight < 0.100) return 1.38; //SET ALL VALUE FOR EUROPE - ZONE 3 SHIPPING. SJC 23-01-04
if ((TotWeight < 0.200) && (TotWeight >= 0.100)) return (2.12 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.300) && (TotWeight >= 0.200)) return (2.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.400) && (TotWeight >= 0.300)) return (3.47 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.500) && (TotWeight >= 0.400)) return (4.17 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.600) && (TotWeight >= 0.500)) return (4.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.700) && (TotWeight >= 0.600)) return (5.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.800) && (TotWeight >= 0.700)) return (6.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.900) && (TotWeight >= 0.800)) return (7.16 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.000) && (TotWeight >= 0.900)) return (7.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.000) && (TotWeight >= 1.000)) return (22.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 3.000) && (TotWeight >= 2.000)) return (24.43 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.000) && (TotWeight >= 3.000)) return (26.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 5.000) && (TotWeight >= 4.000)) return (29.08 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 6.000) && (TotWeight >= 5.000)) return (30.24 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 7.000) && (TotWeight >= 6.000)) return (31.41 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 8.000) && (TotWeight >= 7.000)) return (32.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 9.000) && (TotWeight >= 8.000)) return (34.90 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.000) && (TotWeight >= 9.000)) return (36.06 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 12.000) && (TotWeight >= 10.000)) return (37.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 14.000) && (TotWeight >= 12.000)) return (38.39 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 16.000) && (TotWeight >= 14.000)) return (38.39 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 18.000) && (TotWeight >= 16.000)) return (39.55 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 20.000) && (TotWeight >= 18.000)) return (40.71 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.000) && (TotWeight >= 20.000)) return (41.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.000) && (TotWeight >= 22.000)) return (43.04 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 26.000) && (TotWeight >= 24.000)) return (44.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.000) && (TotWeight >= 26.000)) return (45.37 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 30.000) && (TotWeight >= 28.000)) return (46.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 31.500) && (TotWeight >= 30.000)) return (47.69 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 40.000) && (TotWeight >= 31.500)) return (71.29 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 50.000) && (TotWeight >= 40.000)) return (79.59 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
} 
if (LocationValue == 5 ) { 
if (TotWeight <= 0.010) return 0.61; //SET ALL VALUE FOR USA & CANADA SHIPPING. SJC 05-08-05
if ((TotWeight < 0.020) && (TotWeight >= 0.010)) return (0.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.040) && (TotWeight >= 0.020)) return (1.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.060) && (TotWeight >= 0.040)) return (1.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.080) && (TotWeight >= 0.060)) return (2.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.100) && (TotWeight >= 0.080)) return (2.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.120) && (TotWeight >= 0.100)) return (3.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.140) && (TotWeight >= 0.120)) return (3.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.160) && (TotWeight >= 0.140)) return (4.23 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.180) && (TotWeight >= 0.160)) return (4.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.200) && (TotWeight >= 0.180)) return (5.18 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.220) && (TotWeight >= 0.200)) return (5.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.240) && (TotWeight >= 0.220)) return (6.14 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.260) && (TotWeight >= 0.240)) return (6.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.280) && (TotWeight >= 0.260)) return (7.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.300) && (TotWeight >= 0.280)) return (7.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.320) && (TotWeight >= 0.300)) return (8.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.340) && (TotWeight >= 0.320)) return (8.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.360) && (TotWeight >= 0.340)) return (9.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.380) && (TotWeight >= 0.360)) return (9.49 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.400) && (TotWeight >= 0.380)) return (9.97 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.420) && (TotWeight >= 0.400)) return (10.44 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.440) && (TotWeight >= 0.420)) return (10.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.460) && (TotWeight >= 0.440)) return (11.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.480) && (TotWeight >= 0.460)) return (11.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.500) && (TotWeight >= 0.480)) return (12.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.520) && (TotWeight >= 0.500)) return (12.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.540) && (TotWeight >= 0.520)) return (13.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.560) && (TotWeight >= 0.540)) return (13.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.580) && (TotWeight >= 0.560)) return (14.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.600) && (TotWeight >= 0.580)) return (14.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.620) && (TotWeight >= 0.600)) return (15.23 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.640) && (TotWeight >= 0.620)) return (15.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.660) && (TotWeight >= 0.640)) return (16.18 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.680) && (TotWeight >= 0.660)) return (16.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.700) && (TotWeight >= 0.680)) return (17.14 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.720) && (TotWeight >= 0.700)) return (17.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.740) && (TotWeight >= 0.720)) return (18.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.760) && (TotWeight >= 0.740)) return (18.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.780) && (TotWeight >= 0.760)) return (19.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.800) && (TotWeight >= 0.780)) return (19.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.820) && (TotWeight >= 0.800)) return (20.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.840) && (TotWeight >= 0.820)) return (20.49 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.860) && (TotWeight >= 0.840)) return (20.96 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.880) && (TotWeight >= 0.860)) return (21.44 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.900) && (TotWeight >= 0.880)) return (21.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.920) && (TotWeight >= 0.900)) return (22.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.940) && (TotWeight >= 0.920)) return (22.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.960) && (TotWeight >= 0.940)) return (23.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.980) && (TotWeight >= 0.960)) return (23.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.000) && (TotWeight >= 0.980)) return (24.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.020) && (TotWeight >= 1.000)) return (24.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.040) && (TotWeight >= 1.020)) return (25.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.060) && (TotWeight >= 1.040)) return (25.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.080) && (TotWeight >= 1.060)) return (26.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.100) && (TotWeight >= 1.080)) return (26.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.120) && (TotWeight >= 1.100)) return (27.18 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.140) && (TotWeight >= 1.120)) return (27.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.160) && (TotWeight >= 1.140)) return (28.14 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.180) && (TotWeight >= 1.160)) return (28.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.200) && (TotWeight >= 1.180)) return (29.09 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.220) && (TotWeight >= 1.200)) return (29.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.240) && (TotWeight >= 1.220)) return (30.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.260) && (TotWeight >= 1.240)) return (30.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.280) && (TotWeight >= 1.260)) return (31.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.300) && (TotWeight >= 1.280)) return (31.49 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.320) && (TotWeight >= 1.300)) return (31.96 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.340) && (TotWeight >= 1.320)) return (32.44 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.360) && (TotWeight >= 1.340)) return (32.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.380) && (TotWeight >= 1.360)) return (33.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.400) && (TotWeight >= 1.380)) return (33.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.420) && (TotWeight >= 1.400)) return (34.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.440) && (TotWeight >= 1.420)) return (34.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 1.460) && (TotWeight >= 1.440)) return (35.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.480) && (TotWeight >= 1.460)) return (35.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.500) && (TotWeight >= 1.480)) return (36.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.520) && (TotWeight >= 1.500)) return (36.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.540) && (TotWeight >= 1.520)) return (37.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.560) && (TotWeight >= 1.540)) return (37.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.580) && (TotWeight >= 1.560)) return (38.18 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.600) && (TotWeight >= 1.580)) return (38.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.620) && (TotWeight >= 1.600)) return (39.14 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.640) && (TotWeight >= 1.620)) return (39.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.660) && (TotWeight >= 1.640)) return (40.09 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.680) && (TotWeight >= 1.660)) return (40.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.700) && (TotWeight >= 1.680)) return (41.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.720) && (TotWeight >= 1.700)) return (41.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.740) && (TotWeight >= 1.720)) return (42.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.760) && (TotWeight >= 1.740)) return (42.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.780) && (TotWeight >= 1.760)) return (42.96 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.800) && (TotWeight >= 1.780)) return (43.44 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.820) && (TotWeight >= 1.800)) return (43.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.840) && (TotWeight >= 1.820)) return (44.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.860) && (TotWeight >= 1.840)) return (44.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.880) && (TotWeight >= 1.860)) return (45.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.900) && (TotWeight >= 1.880)) return (45.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.920) && (TotWeight >= 1.900)) return (46.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.940) && (TotWeight >= 1.920)) return (46.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.960) && (TotWeight >= 1.940)) return (47.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.980) && (TotWeight >= 1.960)) return (47.74 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.000) && (TotWeight >= 1.980)) return (48.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.500) && (TotWeight >= 2.000)) return (51.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 3.000) && (TotWeight >= 2.500)) return (55.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 3.500) && (TotWeight >= 3.000)) return (58.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.000) && (TotWeight >= 3.500)) return (61.85 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.500) && (TotWeight >= 4.000)) return (65.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 5.000) && (TotWeight >= 4.500)) return (68.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 5.500) && (TotWeight >= 5.000)) return (71.73 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 6.000) && (TotWeight >= 5.500)) return (74.77 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 6.500) && (TotWeight >= 6.000)) return (77.81 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 7.000) && (TotWeight >= 6.500)) return (80.85 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 7.500) && (TotWeight >= 7.000)) return (83.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 8.000) && (TotWeight >= 7.500)) return (86.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 8.500) && (TotWeight >= 8.000)) return (89.96 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 9.000) && (TotWeight >= 8.500)) return (93.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 9.500) && (TotWeight >= 9.000)) return (96.03 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.000) && (TotWeight >= 9.500)) return (99.07 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.500) && (TotWeight >= 10.000)) return (101.72 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 11.000) && (TotWeight >= 10.500)) return (104.37 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 11.500) && (TotWeight >= 11.000)) return (107.02 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 12.000) && (TotWeight >= 11.500)) return (108.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 12.500) && (TotWeight >= 12.000)) return (111.30 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 13.000) && (TotWeight >= 12.500)) return (113.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 13.500) && (TotWeight >= 13.000)) return (116.55 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 14.000) && (TotWeight >= 13.500)) return (118.08 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 14.500) && (TotWeight >= 14.000)) return (120.68 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 15.000) && (TotWeight >= 14.500)) return (123.28 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 15.500) && (TotWeight >= 15.000)) return (125.44 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 16.000) && (TotWeight >= 15.500)) return (126.60 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 16.500) && (TotWeight >= 16.000)) return (129.76 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 17.000) && (TotWeight >= 16.500)) return (131.91 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 17.500) && (TotWeight >= 17.000)) return (132.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 18.000) && (TotWeight >= 17.500)) return (134.97 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 18.500) && (TotWeight >= 18.000)) return (137.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 19.000) && (TotWeight >= 18.500)) return (139.24 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 19.500) && (TotWeight >= 19.000)) return (141.38 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 20.000) && (TotWeight >= 19.500)) return (143.52 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 20.500) && (TotWeight >= 20.000)) return (145.65 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 21.000) && (TotWeight >= 20.500)) return (147.79 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 21.500) && (TotWeight >= 21.000)) return (149.93 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.000) && (TotWeight >= 21.500)) return (152.06 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.500) && (TotWeight >= 22.000)) return (152.76 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 23.000) && (TotWeight >= 22.500)) return (154.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 23.500) && (TotWeight >= 23.000)) return (157.00 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.000) && (TotWeight >= 23.500)) return (159.11 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.500) && (TotWeight >= 24.000)) return (161.23 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 25.000) && (TotWeight >= 24.500)) return (163.35 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 25.500) && (TotWeight >= 25.000)) return (165.46 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 26.000) && (TotWeight >= 25.500)) return (167.58 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 26.500) && (TotWeight >= 26.000)) return (169.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 27.000) && (TotWeight >= 26.500)) return (171.82 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 27.500) && (TotWeight >= 27.000)) return (173.93 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.000) && (TotWeight >= 27.500)) return (174.39 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.500) && (TotWeight >= 28.000)) return (176.49 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 29.000) && (TotWeight >= 28.500)) return (178.59 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 29.500) && (TotWeight >= 29.000)) return (180.68 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 30.000) && (TotWeight >= 29.500)) return (182.78 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 

} 
if (LocationValue == 6 ) { 
if (TotWeight <= 0.010) return 1.89; //SET ALL VALUE FOR AUSTRALIA & NEW ZEALAND SHIPPING. SJC 19-07-06
if ((TotWeight < 0.020) && (TotWeight >= 0.010)) return (1.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.040) && (TotWeight >= 0.020)) return (1.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.060) && (TotWeight >= 0.040)) return (1.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.080) && (TotWeight >= 0.060)) return (1.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.100) && (TotWeight >= 0.080)) return (1.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.120) && (TotWeight >= 0.100)) return (2.15 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.140) && (TotWeight >= 0.120)) return (2.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.160) && (TotWeight >= 0.140)) return (2.68 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.180) && (TotWeight >= 0.160)) return (2.93 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.200) && (TotWeight >= 0.180)) return (3.21 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.220) && (TotWeight >= 0.200)) return (3.45 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.240) && (TotWeight >= 0.220)) return (3.70 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.260) && (TotWeight >= 0.240)) return (3.94 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.280) && (TotWeight >= 0.260)) return (4.19 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.300) && (TotWeight >= 0.280)) return (4.43 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.320) && (TotWeight >= 0.300)) return (4.68 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.340) && (TotWeight >= 0.320)) return (4.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.360) && (TotWeight >= 0.340)) return (5.17 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.380) && (TotWeight >= 0.360)) return (5.42 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.400) && (TotWeight >= 0.380)) return (5.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.420) && (TotWeight >= 0.400)) return (5.91 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.440) && (TotWeight >= 0.420)) return (6.15 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.460) && (TotWeight >= 0.440)) return (6.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.480) && (TotWeight >= 0.460)) return (6.64 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.500) && (TotWeight >= 0.480)) return (6.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.520) && (TotWeight >= 0.500)) return (7.13 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.540) && (TotWeight >= 0.520)) return (7.38 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.560) && (TotWeight >= 0.540)) return (7.63 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.580) && (TotWeight >= 0.560)) return (7.87 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.600) && (TotWeight >= 0.580)) return (8.12 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.620) && (TotWeight >= 0.600)) return (8.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.640) && (TotWeight >= 0.620)) return (8.61 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.660) && (TotWeight >= 0.640)) return (8.85 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.680) && (TotWeight >= 0.660)) return (9.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.700) && (TotWeight >= 0.680)) return (9.34 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.720) && (TotWeight >= 0.700)) return (9.59 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.740) && (TotWeight >= 0.720)) return (9.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.760) && (TotWeight >= 0.740)) return (10.08 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.780) && (TotWeight >= 0.760)) return (10.33 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.800) && (TotWeight >= 0.780)) return (10.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.820) && (TotWeight >= 0.800)) return (10.82 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.840) && (TotWeight >= 0.820)) return (11.06 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.860) && (TotWeight >= 0.840)) return (11.31 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.880) && (TotWeight >= 0.860)) return (11.55 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.900) && (TotWeight >= 0.880)) return (11.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.920) && (TotWeight >= 0.900)) return (12.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.940) && (TotWeight >= 0.920)) return (12.29 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.960) && (TotWeight >= 0.940)) return (12.54 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 0.980) && (TotWeight >= 0.960)) return (12.78 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.000) && (TotWeight >= 0.980)) return (13.03 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.020) && (TotWeight >= 1.000)) return (13.27 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.040) && (TotWeight >= 1.020)) return (13.52 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.060) && (TotWeight >= 1.040)) return (13.77 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.080) && (TotWeight >= 1.060)) return (14.01 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.100) && (TotWeight >= 1.080)) return (14.26 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.120) && (TotWeight >= 1.100)) return (14.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.140) && (TotWeight >= 1.120)) return (14.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.160) && (TotWeight >= 1.140)) return (14.99 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.180) && (TotWeight >= 1.160)) return (15.24 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.200) && (TotWeight >= 1.180)) return (15.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.220) && (TotWeight >= 1.200)) return (15.73 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 1.240) && (TotWeight >= 1.220)) return (15.98 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.260) && (TotWeight >= 1.240)) return (16.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.280) && (TotWeight >= 1.260)) return (16.47 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.300) && (TotWeight >= 1.280)) return (16.71 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.320) && (TotWeight >= 1.300)) return (16.96 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.340) && (TotWeight >= 1.320)) return (17.20 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.360) && (TotWeight >= 1.340)) return (17.45 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.380) && (TotWeight >= 1.360)) return (17.69 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.400) && (TotWeight >= 1.380)) return (17.94 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.420) && (TotWeight >= 1.400)) return (18.19 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.440) && (TotWeight >= 1.420)) return (18.43 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.460) && (TotWeight >= 1.440)) return (18.68 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.480) && (TotWeight >= 1.460)) return (18.92 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.500) && (TotWeight >= 1.480)) return (19.17 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.520) && (TotWeight >= 1.500)) return (19.41 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.540) && (TotWeight >= 1.520)) return (19.66 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.560) && (TotWeight >= 1.540)) return (19.90 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.580) && (TotWeight >= 1.560)) return (20.15 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.600) && (TotWeight >= 1.580)) return (20.40 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.620) && (TotWeight >= 1.600)) return (20.64 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.640) && (TotWeight >= 1.620)) return (20.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.660) && (TotWeight >= 1.640)) return (21.13 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.680) && (TotWeight >= 1.660)) return (21.38 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.700) && (TotWeight >= 1.680)) return (21.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.720) && (TotWeight >= 1.700)) return (21.87 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.740) && (TotWeight >= 1.720)) return (22.11 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.760) && (TotWeight >= 1.740)) return (22.36 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.780) && (TotWeight >= 1.760)) return (22.61 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.800) && (TotWeight >= 1.780)) return (22.85 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.820) && (TotWeight >= 1.800)) return (23.10 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.840) && (TotWeight >= 1.820)) return (23.34 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.860) && (TotWeight >= 1.840)) return (23.59 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.880) && (TotWeight >= 1.860)) return (23.83 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.900) && (TotWeight >= 1.880)) return (24.08 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.920) && (TotWeight >= 1.900)) return (24.32 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.940) && (TotWeight >= 1.920)) return (24.57 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.960) && (TotWeight >= 1.940)) return (24.82 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 1.980) && (TotWeight >= 1.960)) return (25.06 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.000) && (TotWeight >= 1.980)) return (25.32 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 2.500) && (TotWeight >= 2.000)) return (48.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 3.000) && (TotWeight >= 2.500)) return (52.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 3.500) && (TotWeight >= 3.000)) return (57.06 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.000) && (TotWeight >= 3.500)) return (61.33 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 4.500) && (TotWeight >= 4.000)) return (65.59 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 5.000) && (TotWeight >= 4.500)) return (69.86 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 5.500) && (TotWeight >= 5.000)) return (73.16 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 6.000) && (TotWeight >= 5.500)) return (76.45 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 6.500) && (TotWeight >= 6.000)) return (79.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 7.000) && (TotWeight >= 6.500)) return (83.04 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 7.500) && (TotWeight >= 7.000)) return (86.34 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 8.000) && (TotWeight >= 7.500)) return (89.63 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 8.500) && (TotWeight >= 8.000)) return (92.93 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 9.000) && (TotWeight >= 8.500)) return (96.23 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 9.500) && (TotWeight >= 9.000)) return (99.52 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.000) && (TotWeight >= 9.500)) return (102.82 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 10.500) && (TotWeight >= 10.000)) return (106.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 11.000) && (TotWeight >= 10.500)) return (109.28 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 11.500) && (TotWeight >= 11.000)) return (112.51 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 12.000) && (TotWeight >= 11.500)) return (114.69 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 12.500) && (TotWeight >= 12.000)) return (117.89 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 13.000) && (TotWeight >= 12.500)) return (121.09 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 13.500) && (TotWeight >= 13.000)) return (124.30 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 14.000) && (TotWeight >= 13.500)) return (126.33 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 14.500) && (TotWeight >= 14.000)) return (129.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 15.000) && (TotWeight >= 14.500)) return (132.67 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 15.500) && (TotWeight >= 15.000)) return (135.28 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 16.000) && (TotWeight >= 15.500)) return (137.88 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 16.500) && (TotWeight >= 16.000)) return (140.48 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 17.000) && (TotWeight >= 16.500)) return (143.08 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 17.500) && (TotWeight >= 17.000)) return (144.33 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 18.000) && (TotWeight >= 17.500)) return (146.91 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 18.500) && (TotWeight >= 18.000)) return (149.49 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 19.000) && (TotWeight >= 18.500)) return (152.06 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 19.500) && (TotWeight >= 19.000)) return (154.64 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 20.000) && (TotWeight >= 19.500)) return (157.22 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 20.500) && (TotWeight >= 20.000)) return (159.80 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 21.000) && (TotWeight >= 20.500)) return (162.37 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 21.500) && (TotWeight >= 21.000)) return (164.95 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.000) && (TotWeight >= 21.500)) return (167.53 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 22.500) && (TotWeight >= 22.000)) return (168.52 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 23.000) && (TotWeight >= 22.500)) return (171.07 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 23.500) && (TotWeight >= 23.000)) return (173.62 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.000) && (TotWeight >= 23.500)) return (176.18 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 24.500) && (TotWeight >= 24.000)) return (178.73 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 25.000) && (TotWeight >= 24.500)) return (181.28 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 25.500) && (TotWeight >= 25.000)) return (183.84 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 26.000) && (TotWeight >= 25.500)) return (186.39 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1))));
if ((TotWeight < 26.500) && (TotWeight >= 26.000)) return (188.94 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 27.000) && (TotWeight >= 26.500)) return (191.50 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 27.500) && (TotWeight >= 27.000)) return (194.05 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.000) && (TotWeight >= 27.500)) return (194.75 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 28.500) && (TotWeight >= 28.000)) return (197.28 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 29.000) && (TotWeight >= 28.500)) return (199.81 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 29.500) && (TotWeight >= 29.000)) return (202.34 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
if ((TotWeight < 30.000) && (TotWeight >= 29.500)) return (204.86 + (0.00 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
} 
}
// if (LocationValue == 7 ) { 
// if (TotWeight <= 1) return 9.18; 
// if ((TotWeight <= 999999999) && (TotWeight > 1)) return (9.18 + (0.40 * Math.ceil(parseFloat((TotWeight - 1) / 1)))); 
// } 
 

//---------------------------------------------------------------------||
// 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: Print_total                                               || 
// PARAMETERS: none                                                    || 
// RETURNS: Total cost currently racked up by shopper                  || 
// PURPOSE: Aesthetics.Coded by Webrecka. Added SJC 230503             || 
//---------------------------------------------------------------------|| 
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); 

}  

//---------------------------------------------------------------------|| 
// 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 jVat = 0; // just VAT
var itemTotal = 0; // Item total including VAT
var grandTotal = 0; // Grand total including VAT
var megaTotal = 0;
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 strJustVat = ""; // VAT formatted as money 
var strItemTotal = ""; // Item Total formatted as money
var strGrandTotal = ""; // Grand total formatted as money
var strMegaTotal = "";
var strPP = ""; //Payment Processor Description Field
var strPX = ""; //Protx payment processor description field
var bDisplay = true; //Whether to write string to the page (here for programmers).  ADDED SJC 20/08/03

iNumberOrdered = GetCookie("NumberOrdered"); 
if ( iNumberOrdered == null ) 
iNumberOrdered = 0; 

if ( TaxByRegion ) { 
QueryString_Parse(); 
fTax = parseFloat( QueryString( OutputOrderTax ) ); 
strTax = moneyFormat(fTax); 
} 

if ( bDisplay ) 
strOutput = "<TABLE 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++ ) { 
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); 
Token5 = database.indexOf("|", Token4+1); //Possible fix to not in final E-Mail to Customer.  // SJCINFO


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]) ); // ADDED FOR WEIGHT ROUNDING ERROR. SJC 19-05-03
fWeight = Math.round(fWeight * 1000)/1000; // ADDED FOR WEIGHT ROUNDING ERROR. SJC 19-05-03 

// if ( !TaxByRegion ) var strProductId = fields[0]; 
// Above line taken out for new code below. SJC 02/01/04
var strProductId = fields[0]; 
strProductId=strProductId.charAt(0); 
if( strProductId!= 'n' ) { 
fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate;
jVat = (parseFloat(fields[2]) * TaxRate); //ADDED TO REFLECT PRITESH VALUE.  SJC 07-09-03
}


  
strTotal = moneyFormat(fTotal); 
if ( !TaxByRegion ) strTax = moneyFormat(fTax); 
if ( !TaxByRegion ) strJustVat = moneyFormat(jVat);  //ADDED TO REFLECT PRITESH VALUE.  SJC 07-09-03
itemTotal = (jVat + parseFloat(fields[2]));          //ADDED TO REFLECT PRITESH VALUE.  SJC 07-09-03
strItemTotal = moneyFormat(itemTotal);               //ADDED TO REFLECT PRITESH VALUE.  SJC 07-09-03
grandTotal = (itemTotal * parseInt(fields[1]));      //ADDED TO REFLECT PRITESH VALUE.  SJC 07-09-03
strGrandTotal = moneyFormat(grandTotal);             //ADDED TO REFLECT PRITESH VALUE.  SJC 07-09-03

if ( bDisplay ) { 
strOutput += "<TR><TD CLASS=\"nopentry\" ALIGN=LEFT>" + 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=RIGHT>" + fields[1] + "</TD>"; 
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(fields[2]) + "/ea</TD>"; 

if ( DisplayShippingColumn ) { 
if ( parseFloat(fields[4]) > 0 ) 
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ fields[4] + " Kg" + "/ea</TD>"; 
else 
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>N/A</TD>"; 
} 

strOutput += "</TR>"; 
} 

if ( AppendItemNumToOutput ) { 
strFooter = i; 
} else { 
strFooter = ""; 
} 
if ( PaymentProcessor != '' && PaymentProcessor != 'px' ) { 
//Process description field for payment processors (except Protx) 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 if ( PaymentProcessor == 'px' ) {
// Process description field for payment processor Protx
strPP += ":" + fields[0] +" "+ fields[3] +" "+ fields[5] +":"+ fields[1] +":"+ fields[2] +":"+ strJustVat +":"+ strItemTotal +":"+ strGrandTotal;
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] + "\">";
} else { 
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=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 = 1; // CHANGED CODE TO REFLECT UK DEFAULT SHIPPING. SJC 19-05-03
// if (LocationSelected == null) LocationSelected = 0; // Code to use Local Area as default checked, but not needed because want null selected at this time ||
// if (LocationSelected != null) document.all.ZONE[LocationSelected].checked = true; 


if (LocationSelected == 0) LocationLabel = "Collection Only";            //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 1) LocationLabel = "United Kingdom";             //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 2) LocationLabel = "EU - Zone 1";                //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 3) LocationLabel = "EU - Zone 2";                //CHANGED TEXT TO REFLECT UK. SJC 20-06-03
if (LocationSelected == 4) LocationLabel = "EU - Zone 3";                //CHANGED TEXT TO REFLECT UK. SJC 19-05-03
if (LocationSelected == 5) LocationLabel = "USA & Canada";               //CHANGED TEXT TO REFLECT UK. SJC 20-06-03
if (LocationSelected == 6) LocationLabel = "Australia & New Zealand";    //CHANGED TEXT TO REFLECT UK. SJC 19-07-06


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 + " Kg" + "</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 (LocationSelected != 0) //sets tax to 0.00 for all other areas || // Must be taken out else VAT is already
// fTax = 0.00;                                                     // counted on product price. SJC 24-05-03


if (LocationSelected == 0)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; // ADDED VAT ON CHECKOUT. SJC 19-05-03
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=3 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; 
strOutput += "</TR>"; 
} 

if (LocationSelected == 1)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; // ADDED VAT ON CHECKOUT. SJC 19-05-03
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=3 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; 
strOutput += "</TR>"; 
} 

if (LocationSelected == 2)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; // ADDED VAT ON CHECKOUT. SJC 19-05-03
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=3 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; 
strOutput += "</TR>"; 
} 

if (LocationSelected == 3)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; // ADDED VAT ON CHECKOUT. SJC 19-05-03
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=3 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; 
strOutput += "</TR>"; 
} 

if (LocationSelected == 4)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; // ADDED VAT ON CHECKOUT. SJC 19-05-03
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=3 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>"; 
strOutput += "</TR>"; 
}


if (LocationSelected == 5)  { 
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTAX+"</B></TD>"; // ADDED VAT ON CHECKOUT. SJC 19-05-03
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=3 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</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>"; 
} 

strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strTOT+"</B></TD>"; // ADDED VAT ON CHECKOUT. SJC 19-05-03
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 ( PaymentProcessor == 'px') {
//Process this for Protx.  SJC 20/08/03
strPX = iNumberOrdered + strPP; //add a further quantity to denote postage paid line for Protx display
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=\"chargetotal\" value=\""+ moneyFormat((fTotal + fShipping + fTax)) + "\">"; 
strOutput += "<input type=hidden name=\"desc\" value=\""+ strPX + "\">";
strOutput += "<input type=hidden name=\"postagetype\" value=\""+ LocationLabel + "\">";
strOutput += "<input type=hidden name=\"shipping\" value=\""+ moneyFormat((fShipping)) + "\">"; //ADDED SJC 18/09/03
} 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)) + "\">"; 
} 
} 


document.write(strOutput); 
document.close(); 
} 

//=====================================================================|| 
// END NOP Design SmartPost Shopping Cart                              || 
//=====================================================================||
