//==================================================================	||
//	UPDATE: 08/27/09									||
//	Added new payment processor "AN"							||
//==================================================================	||

//==================================================================	||
//	 UPDATE: 06/24/08									||
// 													||
// Added some stuff specific to this site (powerstandards.com) to force the quantity to have a max ||
// no matter how many times the customer adds that item to the cart. ||
// Unfortunately, this means that the information for each product needs to be entered in at this time.||
// See additions that were made on 06/24/08 						||
// 													||
//================================================================== 	||

//=====================================================================||
// 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.1 ||
//=====================================================================||

//=====================================================================||
// UPS Shipping 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 and Non-taxable Product 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) ||
// * Google Checkout (gc) ||
// ||
// Options For Programmers: ||
// ======================== ||
// * OutputItem<..>: string, the name of the pair value passed at ||
// checkouttime. Change these only if you are connecting to a CGI ||
// script and need other field names, or are using a secure service ||
// that requires specific field names. ||
// * AppendItemNumToOutput: true/false, if set to true, the number of ||
// each ordered item will be appended to the output string. For ||
// example if OutputItemId is 'ID_' and this is set to true, the ||
// output field name will be 'ID_1', 'ID_2' ... for each item. ||
// * HiddenFieldsToCheckout: true/false, if set to true, hidden fields ||
// for the cart items will be passed TO the checkout page, from the ||
// ManageCart page. This is set to true for CGI/PHP/Script based ||
// checkout pages, but should be left false if you are using an ||
// HTML/Javascript Checkout Page. Hidden fields will ALWAYS be ||
// passed FROM the checkout page to the Checkout CGI/PHP/ASP/Script ||
//---------------------------------------------------------------------||

//Options for Everyone:
MonetarySymbol = '$';
DisplayNotice = true;
DisplayShippingColumn = false;
DisplayShippingRow = true;
TaxRate = 0.0975; //set taxable region rate ||
DisplayTaxRow = false;
TaxByRegion = false; //leave this at false, UPS Shipping Mod will activate taxable Zone ||
TaxPrompt = 'For tax purposes, please select if you are a CA resident before continuing'; //Deactivated ||
TaxablePrompt = 'California resident'; //Deactivated ||
NonTaxablePrompt = 'Other Locations'; //Deactivated ||
MinimumOrder = 0.01;
MinimumOrderPrompt = 'Oops!\n\nWe can not proceed to check out since\nthere is no item in the shopping cart.';
//original syntax - MinimumOrderPrompt = 'Your order is below our minimum order, please order more before checking out.';

NoQtyPrompt = 'Please select a Shipping Zone'; //If attempted to go to checkout before selecting shipping zone ||

//Payment Processor Options:
PaymentProcessor = 'gc';

//Options for Programmers:
OutputItemId = 'ID_';
OutputItemQuantity = 'QUANTITY_';
OutputItemPrice = 'PRICE_';
OutputItemName = 'NAME_';
OutputItemWeight = 'WEIGHT_'; //Added for UPS mod ||
OutputItemAddtlInfo = 'ADDTLINFO_';
OutputOrderSubtotal = 'SUBTOTAL';
OutputOrderShipping = 'SHIPPING';
OutputOrderTax = 'TAX';
OutputOrderTotal = 'TOTAL';
AppendItemNumToOutput = true;
HiddenFieldsToCheckout = true;

//Options for Shipping by Weight:
LocationLabel = 'ZONE';
LocationPrompt = 'For shipping purpose, please select the zone that your location is in.';
MaxWeightPrompt = 'Sorry, maximum weight allowable is 500lbs.';

//Product Description Section
/*----- PS1 Product information -----*/
PS1_PN = 'PS1-100~240-00';
PS1_Desc = 'Power Supply Module';
PS1_Cost = 169.00;
PS1_W = 2;

/*----- ETH1 Product information -----*/
ETH1_PN = 'ETH1-10T-00';
ETH1_Desc = 'Ethernet Module';
ETH1_Cost = 299.00;
ETH1_W = 2;

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


//---------------------------------------------------------------------||
// Language Strings ||
// ------------------ ||
// These strings will not be used unless you have not included a ||
// language pack already. You should NOT modify these, but instead ||
// modify the strings in language-**.js where ** is the language pack ||
// you are using. ||
//---------------------------------------------------------------------||
if ( !bLanguageDefined ) {
strSorry = "I'm Sorry, your cart is full, please proceed to checkout.";
strAdded = " Added to your shopping cart.";
strRemove = "Click 'Ok' to remove this product from your shopping cart.";
strILabel = "Product Id";
strDLabel = "Product Name/Description";
strQLabel = "Qty";
strPLabel = "Price";
strSLabel = "Weight"; //Added for UPS mod ||
strRLabel = "Remove From Cart";
strRButton= "Remove";
strSUB = "SUBTOTAL";
strWTOT = "TOTAL WEIGHT"; //Added for UPS mod ||
strSHIP = "SHIPPING";
strTAX = "TAX";
strTOT = "TOTAL";
strErrQty = "Invalid Quantity.";
strNewQty = 'Please enter new quantity:';
bLanguageDefined = true;
}


//---------------------------------------------------------------------||
// FUNCTION: CKquantity ||
// PARAMETERS: Quantity to ||
// RETURNS: Quantity as a number, and possible alert ||
// PURPOSE: Make sure quantity is represented as a number ||
//---------------------------------------------------------------------||
function CKquantity(checkString) {
var strNewQuantity = "";

for ( i = 0; i < checkString.length; i++ ) {
ch = checkString.substring(i, i+1);
if ( (ch >= "0" && ch <= "9") || (ch == '.') )
strNewQuantity += ch;
}

if ( strNewQuantity.length < 1 )
strNewQuantity = "1";

return(strNewQuantity);
}

//---------------------------------------------------------------------||
// FUNCTION: SubmitZone, SubmitZip, and CheckZipBeforeSubmit ||
// PARAMETERS: ZONE, and x_zip ||
// RETURNS: ZONE as a number (0, 1, 2, 3) ||
// PURPOSE: Adjust tax ans shipping based on zip code ||
//---------------------------------------------------------------------||
function SubmitAddress()
{
	var ADD1 = document.getElementById('address_1').value;
	var ADD2 = document.getElementById('address_2').value;
	if (ADD1 && ADD2 != "")
	{
		document.getElementById('x_address').value = "" + ADD1 + " - " + ADD2 + "";
	}
	else
	{
		document.getElementById('x_address').value = "" + ADD1 + "";
	}
}
function SubmitShipAddress()
{
	var SADD1 = document.getElementById('s_address_1').value;
	var SADD2 = document.getElementById('s_address_2').value;
	if (SADD1 && SADD2 != "")
	{
		document.getElementById('x_ship_to_address').value = "" + SADD1 + " - " + SADD2 + "";
	}
	else
	{
		document.getElementById('x_ship_to_address').value = "" + SADD1 + "";
	}
}
/*function SubmitZone()
{
	if (document.getElementById('ZONE0').checked == true)
	{
		document.getElementById('Radio2').style.visibility = 'hidden';
		document.getElementById('Radio3').style.visibility = 'hidden';
		document.getElementById('Radio4').style.visibility = 'hidden';
		document.getElementById('ZipTextBox').style.visibility = 'visible';
	}
}
function SubmitZip()
{
	var EnteredZip = document.getElementById('x_zip').value;
	var TaxRate = 0.0975;
	if ((document.getElementById('ZONE0').checked == true) && ((EnteredZip == '94501') || (EnteredZip == '94502') || (EnteredZip == '94706') || (EnteredZip == '94701') || (EnteredZip == '94702') || (EnteredZip == '94703') || (EnteredZip == '94704') || (EnteredZip == '94705') || (EnteredZip == '94707') || (EnteredZip == '94708') || (EnteredZip == '94709') || (EnteredZip == '94710') || (EnteredZip == '94712') || (EnteredZip == '94720') || (EnteredZip == '94546') || (EnteredZip == '94552') || (EnteredZip == '94568') || (EnteredZip == '94608') || (EnteredZip == '94662') || (EnteredZip == '94536') || (EnteredZip == '94537') || (EnteredZip == '94538') || (EnteredZip == '94539') || (EnteredZip == '94555') || (EnteredZip == '94540') || (EnteredZip == '94541') || (EnteredZip == '94542') || (EnteredZip == '94543') || (EnteredZip == '94544') || (EnteredZip == '94545') || (EnteredZip == '94557') || (EnteredZip == '94550') || (EnteredZip == '94551') || (EnteredZip == '94560') || (EnteredZip == '94601') || (EnteredZip == '94602') || (EnteredZip == '94603') || (EnteredZip == '94604') || (EnteredZip == '94605') || (EnteredZip == '94606') || (EnteredZip == '94607') || (EnteredZip == '94609') || (EnteredZip == '94610') || (EnteredZip == '94611') || (EnteredZip == '94612') || (EnteredZip == '94613') || (EnteredZip == '94614') || (EnteredZip == '94615') || (EnteredZip == '94617') || (EnteredZip == '94618') || (EnteredZip == '94619') || (EnteredZip == '94621') || (EnteredZip == '94622') || (EnteredZip == '94623') || (EnteredZip == '94624') || (EnteredZip == '94649') || (EnteredZip == '94659') || (EnteredZip == '94660') || (EnteredZip == '94661') || (EnteredZip == '94666') || (EnteredZip == '94620') || (EnteredZip == '94566') || (EnteredZip == '94588') || (EnteredZip == '94577') || (EnteredZip == '94578') || (EnteredZip == '94579') || (EnteredZip == '94580') || (EnteredZip == '94586') || (EnteredZip == '94587')))
	{
		TaxRate = 0.0975;
		//alert("" + TaxRate + "");
	}
	else if ((document.getElementById('ZONE0').checked == true) && ((EnteredZip != '94501') || (EnteredZip != '94502') || (EnteredZip != '94706') || (EnteredZip != '94701') || (EnteredZip != '94702') || (EnteredZip != '94703') || (EnteredZip != '94704') || (EnteredZip != '94705') || (EnteredZip != '94707') || (EnteredZip != '94708') || (EnteredZip != '94709') || (EnteredZip != '94710') || (EnteredZip != '94712') || (EnteredZip != '94720') || (EnteredZip != '94546') || (EnteredZip != '94552') || (EnteredZip != '94568') || (EnteredZip != '94608') || (EnteredZip != '94662') || (EnteredZip != '94536') || (EnteredZip != '94537') || (EnteredZip != '94538') || (EnteredZip != '94539') || (EnteredZip != '94555') || (EnteredZip != '94540') || (EnteredZip != '94541') || (EnteredZip != '94542') || (EnteredZip != '94543') || (EnteredZip != '94544') || (EnteredZip != '94545') || (EnteredZip != '94557') || (EnteredZip != '94550') || (EnteredZip != '94551') || (EnteredZip != '94560') || (EnteredZip != '94601') || (EnteredZip != '94602') || (EnteredZip != '94603') || (EnteredZip != '94604') || (EnteredZip != '94605') || (EnteredZip != '94606') || (EnteredZip != '94607') || (EnteredZip != '94609') || (EnteredZip != '94610') || (EnteredZip != '94611') || (EnteredZip != '94612') || (EnteredZip != '94613') || (EnteredZip != '94614') || (EnteredZip != '94615') || (EnteredZip != '94617') || (EnteredZip != '94618') || (EnteredZip != '94619') || (EnteredZip != '94621') || (EnteredZip != '94622') || (EnteredZip != '94623') || (EnteredZip != '94624') || (EnteredZip != '94649') || (EnteredZip != '94659') || (EnteredZip != '94660') || (EnteredZip != '94661') || (EnteredZip != '94666') || (EnteredZip != '94620') || (EnteredZip != '94566') || (EnteredZip != '94588') || (EnteredZip != '94577') || (EnteredZip != '94578') || (EnteredZip != '94579') || (EnteredZip != '94580') || (EnteredZip != '94586') || (EnteredZip != '94587')))
	{
		TaxRate = 0.0825;
		//alert("" + TaxRate + "");
	}
}
function CheckZipBeforeSubmit()
{
	if ((document.getElementById('ZONE0').checked == true) && (document.getElementById('x_zip').value == 'Enter Zip'))
	{
		alert('Enter a Zip!!!');
		//return false;
	}
	else if ((document.getElementById('ZONE0').checked == false) && (document.getElementById('ZONE1').checked == false) && (document.getElementById('ZONE2').checked == false) && (document.getElementById('ZONE3').checked == false))
	{
		alert('Select a Zone');
		//return false;
	}
	else
	{
		//alert('WOOT!!!');
		//return true;
	}
}*/



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

//Added on 06/24/08 by Edward Winterberger to stop customers from adding more than the price break (95 for PQ1 and 18 for T1 and TH1) for items
if (( thisForm.QUANTITY.value > 95 ) && ( thisForm.NAME.value == "PQ1-01-0001 - Power Quality Relay" ))
	{
		thisForm.QUANTITY.value = 95;
		alert('95 "PQ1s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
	
//NEW PQube-02 Limits
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-0000 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-1000 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-2000 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-0100 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-0010 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-000G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-1100 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-2100 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-0110 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-001G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-1010 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-2010 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-010G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-100G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-200G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-1110 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-2110 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-011G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-101G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-201G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-110G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-210G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-111G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-02-211G - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
//NEW PQube-02 Limits

if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-01-0000 - Power Quality Monitor" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube - Power Quality Monitors" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQube-01" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQube-01' + "-" + thisForm.ADDITIONALINFO.value + thisForm.ADDITIONALINFO2.value + thisForm.ADDITIONALINFO3.value + thisForm.ADDITIONALINFO4.value + 's" can be ordered through the website at a time'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CTE1-10T-0.333V-00 - Current/Ethernet Module" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CTE1-10T-0.333V-00 - Current/Ethernet Module" can be ordered through the website' + '\n' + 'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CTE1-10T-1V-00 - Current/Ethernet Module" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CTE1-10T-1V-00 - Current/Ethernet Module" can be ordered through the website' + '\n' + 'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CTE1-10T-5V-00 - Current/Ethernet Module" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CTE1-10T-5V-00 - Current/Ethernet Module" can be ordered through the website' + '\n' + 'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CTE1-10T-10V-00 - Current/Ethernet Module" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CTE1-10T-10V-00 - Current/Ethernet Module" can be ordered through the website' + '\n' + 'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-ETH1-00 - PQube Package – Power Quality Kit" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-ETH1 - PQube Package – Power Quality Kit" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-CT4-00 - PQube Package – Embedded Energy & PQ Kit" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-CT4 - PQube Package – Embedded Energy & PQ Kit" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-CT4-20A-00" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-CT4-20A-00 - PQube Package – Embedded Energy & PQ Kit" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-CT4-50A-00" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-CT4-50A-00 - PQube Package – Embedded Energy & PQ Kit" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-XCT5" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-XCT5' + "-" + thisForm.ADDITIONALINFO.value + "-" + thisForm.ADDITIONALINFO2.value + ' - PQube Energy & PQ Kit" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-CTE1" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-CTE1' + "-" + thisForm.ADDITIONALINFO.value + "-" + thisForm.ADDITIONALINFO2.value + ' - PQube Energy & PQ Kit" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-CTE1-0050A-00" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-CTE1-0050A-00 - PQube Energy & PQ Kits" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-CTE1-0600A-00" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-CTE1-0600A-00 - PQube Energy & PQ Kits" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQP-CTE1-0000A-00" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQP-CTE1-0000A-00 - PQube Energy & PQ Kits" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PS1-100~240-00 - Power Supply Module" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PS1s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PS2-100~240-00 - Power Supply Module" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PS2s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "ETH1-10T-00 - Ethernet Module" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "ETH1s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CT4-20A-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CT4s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CT4-100A-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CT4s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "XCT4-1A-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "XCT4s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "XCT4-5A-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "XCT4s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "XCT5-1V-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "XCT5s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "XCT5-0.333V-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "XCT5s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "XCT5-5V-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "XCT5s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "XCT5-10V-00 - Current Monitoring" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "XCT5s" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 18 ) && ( thisForm.NAME.value == "TH1-80C-00 - Temperature/Humidity Probe" ))
	{
		thisForm.QUANTITY.value = 18;
		alert('18 "Temperature/Humidity Probes" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 18 ) && ( thisForm.NAME.value == "THC-2M-00 - 2M Extension cable" ))
	{
		thisForm.QUANTITY.value = 18;
		alert('18 "2M Extension cables" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "DRK-270-00 - DIN Rail Kit" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "Aluminum DIN Rail Kits" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "SD" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "SD-' + thisForm.ADDITIONALINFO.value + ' - Cards" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-075-0005A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-750-0005A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-075-0020A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-750-0020A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-075-0050A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-750-0050A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-075-0100A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-750-0100A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-125-0200A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-125-0200A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-125-0300A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-125-0300A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-200-0005A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-200-0005A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-200-0400A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-200-0400A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-200-0600A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-200-0600A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-300-0005A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-300-0005A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-300-1000A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-300-1000A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-300-2000A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-300-2000A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 36 ) && ( thisForm.NAME.value == "SCS-300-3000A:0.333V" ))
	{
		thisForm.QUANTITY.value = 36;
		alert('36 "SCS-300-3000A:0.3V" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQBEZ-IP54-00 - Panel Mount Bezel" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQBEZ-IP54-00" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQBEZ-OPEN-00 - Panel Mount Bezel" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQBEZ-OPEN-00" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "PQBPNL-3MOD-00 - Hinged Panel Mount Bracket" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "PQBPNL-3MOD-00" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "ENCL-EXT1074-01 - Enclosure for PQube assembly" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "ENCL-EXT1074-01" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CB-1P-277/480V-1A - Single-phase circuit breaker" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CB-1P-277/480V-1A" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "CB-3P-277/480V-1A - Three-phase circuit breaker" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "CB-3P-277/480V-1A" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "ATT1-0600V-00 - AC/DC Voltage Attenuator" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "ATT1-0600V-00 - AC/DC Voltage Attenuators" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
if (( thisForm.QUANTITY.value > 9 ) && ( thisForm.NAME.value == "ATT1-1200V-00 - AC/DC Voltage Attenuator" ))
	{
		thisForm.QUANTITY.value = 9;
		alert('9 "ATT1-1200V-00 - AC/DC Voltage Attenuators" can be ordered through the website'+ '\n' +'If you need more, please contact us.');
	}
//if ( thisForm.ADDITIONALINFO.value == "0000")
	//{
		//alert('Please select the Quantity and Type of CT');
	//}
//End of Ed's stuff

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;
/*changed "thisForm.ADDITIONALINFO[thisForm.ADDITIONALINFO.selectedIndex].value;" to "thisForm.ADDITIONALINFO[thisForm.ADDITIONALINFO.selectedIndex].name;"*/
if ( thisForm.ADDITIONALINFO == null ) {
strADDTLINFO = "";
} else {
strADDTLINFO = thisForm.ADDITIONALINFO[thisForm.ADDITIONALINFO.selectedIndex].value;
}
/*changed "; " to "" for PQube part numbering*/
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;
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;
}
}

//if ( DisplayNotice && notice!=''){
//alert(notice);
//confirm(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) {
expires = new Date();
//expires.setTime(expires.getTime() + Math.round(86400000*30));
expires.setTime(expires.getTime() + Math.round(86400000*1));
//multiply the number to make it represent days, and then times by number of days
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-2005 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 fill-in 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)

var strDisplayCart_Visibility;
var strDisplayEmptyCart_Visibility;

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

LocationSelected = GetCookie("ZoneSelected");
if (LocationSelected == null) LocationSelected = 0; // Code to use Other as default checked if customer goes to Checkout with an empty Cart ||
/*judstuff*/
if ( iNumberOrdered == 0 ){
	strDisplayCart_Visibility = "hidden;float:right;position:absolute";
	strDisplayEmptyCart_Visibility = "visible";
}
else{
	strDisplayCart_Visibility = "visible";
	strDisplayEmptyCart_Visibility = "hidden;float:right;position:absolute";
}
/* end judstuf */
if ( bDisplay )
strOutput = "<TABLE WIDTH=\"700\" CLASS=\"nopcart\" style=visibility:" + strDisplayEmptyCart_Visibility + ";><TR><TD CLASS=\"nopheader\" ALIGN=LEFT><font style=\"font-variant:small-caps;\"><B>&nbsp;Cart Contents:</B></font></TD></TR><TR><TD COLSPAN=5 CLASS=\"nopentry\"><CENTER><B>Your cart is empty</B></CENTER></TD></TR></TABLE>";
document.write(strOutput);
strOutput = "<TABLE WIDTH=\"700\" CLASS=\"nopcart\" style=visibility:" + strDisplayCart_Visibility + ";><TR><TD COLSPAN=5 CLASS=\"nopheader\" ALIGN=RIGHT><img src=\"images/print02.png\" style=\"cursor: pointer;\" border=0 onClick=\"print();\"></TD></TR><TR><TD COLSPAN=5 CLASS=\"nopheader\" ALIGN=LEFT><font style=\"font-variant:small-caps;\"><B>&nbsp;Cart Contents:</B></font></TD><!--TD COLSPAN=3 CLASS=\"nopheader\" ALIGN=CENTER><input type=button onclick=print('ManageCart') value='Fax Form Checkout'></TD--></TR><TR>" +
//strOutput = "<TABLE WIDTH=\"700\" CLASS=\"nopcart\" style=visibility:" + strDisplayCart_Visibility + ";><TR><TD COLSPAN=5 CLASS=\"nopheader\" ALIGN=RIGHT><img src=\"images/print02.png\" style=\"cursor: pointer;\" border=0 onClick=\"window.location.href='PSLQuotePrint.htm';\"></TD></TR><TR><TD COLSPAN=5 CLASS=\"nopheader\" ALIGN=LEFT><font style=\"font-variant:small-caps;\"><B>&nbsp;Cart Contents:</B></font></TD><!--TD COLSPAN=3 CLASS=\"nopheader\" ALIGN=CENTER><input type=button onclick=print('ManageCart') value='Fax Form Checkout'></TD--></TR><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=5 CLASS=\"nopentry\"><CENTER><BR><B>Your cart is empty</B><BR><BR></CENTER></TD></TR>";
//document.getElementById("DisplayedCart").style.visibility="hidden";
}

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

//Added on 06/24/08 by Edward to keep customers from ordering more than the max (95 for PQ1, 9 for PQube, ETH1 and PS1, and 18 for T1 and TH1)
if (( fields[1] > 95 ) && ( fields[3] == "PQ1-01-0001 - Power Quality Relay" ))
fields[1] = 95;
//NEW PQube-02 Limits
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-000G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-001G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-010G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-100G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-200G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-011G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-101G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-201G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-110G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-210G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-111G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-211G - Power Quality Monitor" ))
fields[1] = 9;
//NEW PQube-02 Limits
if (( fields[1] > 9 ) && ( fields[3] == "PQube-01" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-01-0000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-0.333V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-1V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-5V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-10V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-ETH1-00 - PQube Package – Power Quality Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CT4-00 - PQube Package – Embedded Energy & PQ Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CT4-20A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CT4-50A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-XCT5" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1-0050A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1-0600A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1-0000A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PS1-100~240-00 - Power Supply Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PS2-100~240-00 - Power Supply Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ETH1-10T-00 - Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CT4-20A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CT4-100A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT4-1A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT4-5A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-1V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-0.333V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-5V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-10V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 18 ) && ( fields[3] == "TH1-80C-00 - Temperature/Humidity Probe" ))
fields[1] = 18;
if (( fields[1] > 18 ) && ( fields[3] == "THC-2M-00 - 2M Extension cable" ))
fields[1] = 18;
if (( fields[1] > 9 ) && ( fields[3] == "DRK-270-00 - DIN Rail Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "SD" ))
fields[1] = 9;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0005A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0020A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0050A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0100A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-125-0200A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-125-0300A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0005A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0400A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0600A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-0005A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-1000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-2000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-3000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 9 ) && ( fields[3] == "ENCL-EXT1074-01 - Enclosure for PQube assembly" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQBEZ-IP54-00 - Panel Mount Bezel" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQBEZ-OPEN-00 - Panel Mount Bezel" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQBPNL-3MOD-00 - Hinged Panel Mount Bracket" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CB-1P-277/480V-1A - Single-phase circuit breaker" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CB-3P-277/480V-1A - Three-phase circuit breaker" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ATT1-0600V-00 - AC/DC Voltage Attenuator" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ATT1-1200V-00 - AC/DC Voltage Attenuator" ))
fields[1] = 9;
//End of Ed's stuff

fTotal += (parseInt(fields[1]) * parseFloat(fields[2]) );
fWeight += (parseInt(fields[1]) * parseFloat(fields[4]) );
fWeight = Math.round(fWeight * 100)/100; 
var strProductId = fields[0];
if( strProductId[0] != 'n' ) {
fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate;
}

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

if ( bDisplay ) {
strOutput += "<TR><TD CLASS=\"nopentry\">" + fields[0] + "</TD>";

if ( fields[5] == "" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "</TD>";
else if ( fields[3] == "PQube-01" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Power Quality Monitor</TD>";
else if ( fields[3] == "CT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Current Monitoring</TD>";
else if ( fields[3] == "XCT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Current Monitoring</TD>";
else if ( fields[3] == "SD" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Secure Digital Card</TD>";
else if ( fields[3] == "PQP-XCT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Energy & PQ Kit</TD>";
else if ( fields[3] == "PQP-XCT5" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Energy & PQ Kit</TD>";
else if ( fields[3] == "PQP-CT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Embedded Energy & PQ Kit</TD>";
else if ( fields[3] == "PQP-ETH1" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Power Quality Kit</TD>";
else
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + "</TD>";

strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER><INPUT TYPE=TEXT  style='text-align:center;border:1px solid #464444;' NAME=Q SIZE=2 VALUE=\"" + fields[1] + "\" onChange=\"ChangeQuantity("+i+", this.value);\"><br><input type=button value='  Update  '><BR><input type=button value=\" "+strRButton+" \" onClick=\"RemoveFromCart("+i+")\"></TD>";
strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER>"+ MonetarySymbol + moneyFormat(fields[2]) + "</TD>";

if ( DisplayShippingColumn ) {
if ( parseFloat(fields[4]) > 0 )
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ fields[4] + " lbs" + "</TD>";
else
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>N/A</TD>";
}
/*removed "class=\"nopbutton\"" from the remove button*/
/*Removed the "remove" button and turned this column into the "Extended Price" column*/
strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER>"+ MonetarySymbol + moneyFormat(fields[1]*fields[2]) + "</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=4 align=right><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 ||
//Updated 08/27/09 to make it chose tax and shipping by zip code

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

strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=1 rowspan=4 ALIGN=CENTER><B>Choose<BR>Shipping</B></TD>";
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 rowspan=4 id=\"ChooseShipping\" style=\"background:#ffffff;\">";

// strOutput += "<script>";
// strOutput += "function DropDownMaker(ZoneValue)";
// strOutput += "{";
// strOutput += "if (ZoneValue = '1')";
// strOutput += "{";
// strOutput += "document.getElementById('ShipAcctMethod').innerHTML = \"<option selected=\"selected\" value=\"\">--Shipping Method--</option><option value=\"UPS RED\">UPS RED (Over-Night)</option><option value=\"UPS BLUE\">UPS BLUE (2 Day)</option><option value=\"UPS ORANGE\">UPS ORANGE (3 Day)</option><option value=\"UPS GROUND\">UPS GROUND (3-5 Day)</option><option value=\"FedEx OVERNIGHT\">FedEx Over-Night</option><option value=\"FedEx 2 DAY\">FedEx 2 Day</option><option value=\"FedEx GROUND\">FedEx Ground (3-5 Day)</option>\";";
// strOutput += "}";
// strOutput += "else";
// strOutput += "{";
// strOutput += "document.getElementById('ShipAcctMethod').innerHTML = \"<option selected=\"selected\" value=\"\">--Shipping Method--</option><option value=\"UPS WORLDWIDE\">UPS Worldwide Express</option><option value=\"FedEx INTERNATIONAL\">FedEx International</option>\";";
// strOutput += "}";
// strOutput += "}";
// strOutput += "</script>";

strOutput += "<input type=radio name=\"ZONE\" value=\"0" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
strOutput += "Zone 1 - California (adds CA sales tax)";
strOutput += "<BR><input type=radio name=\"ZONE\" value=\"1" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
strOutput += "Zone 2 - USA";
strOutput += "<BR><input type=radio name=\"ZONE\" value=\"2" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
strOutput += "Zone 3 - Canada, Mexico";
strOutput += "<BR><input type=radio name=\"ZONE\" value=\"3" + "\" onClick=\"ComputeShipping(this.value, "+fWeight+")\">";
strOutput += "Zone 4 - All other countries";
strOutput += "<BR>";
 // Removes shipping charges if the customer is using there own shipping Acct.
strOutput += "<script>";
strOutput += "function ShipAcctVisibility()";
strOutput += "{";
strOutput += "ShipAcctCheckBox = document.getElementById('UseShipAcct');";
strOutput += "if (ShipAcctCheckBox.checked)";
strOutput += "{";
strOutput += "document.getElementById('ShipAcctNum').style.visibility = 'visible';";
strOutput += "document.getElementById('ShipAcctMethod').style.visibility = 'visible';";
strOutput += "SetCookie('ShipAcctCheckBoxValue', 0);";
strOutput += "location.href=location.href;";
strOutput += "}";
strOutput += "else";
strOutput += "{";
strOutput += "document.getElementById('ShipAcctNum').style.visibility = 'hidden';";
strOutput += "document.getElementById('ShipAcctMethod').style.visibility = 'hidden';";
strOutput += "SetCookie('ShipAcctCheckBoxValue', 1);";
strOutput += "location.href=location.href;";
strOutput += "}";
strOutput += "}";
strOutput += "function ShipAcctCookieMaker()";
strOutput += "{";
strOutput += "ShipAcctNumValue = document.form.ShipAcctNum.value;";
strOutput += "ShipMethodValue = document.form.ShipAcctMethod.value;";
strOutput += "SetCookie('ShipAcctNum', ShipAcctNumValue);";
strOutput += "SetCookie('ShipMethod', ShipMethodValue);";
strOutput += "}";
strOutput += "</script>";
strOutput += "<input type=\"checkbox\" name=\"UseShipAcct\" id=\"UseShipAcct\" onClick=\"ShipAcctVisibility();\"> Check this Box to use your own shipping account<br>";
strOutput += "<input type=\"text\" size=\"20\" name=\"ShipAcctNum\" id=\"ShipAcctNum\" value=\" Account #\" style=\"border:1px solid #660066;background-image:url(images/input_shadow.png);visibility:hidden;\" onFocus=\"document.getElementById('ShipAcctNum').value='';\" onChange=\"ShipAcctCookieMaker();\">";
strOutput += "&nbsp;";
strOutput += "<select name=\"ShipAcctMethod\" id=\"ShipAcctMethod\" class=\"Menubackground\" style=\"border:1px solid #660066;visibility:hidden;\" onChange=\"ShipAcctCookieMaker();\">";
strOutput += "<option selected=\"selected\" value=\"\">--Shipping Method--</option>";
strOutput += "<option value=\"UPS RED\">UPS RED (Over-Night)</option>";
strOutput += "<option value=\"UPS BLUE\">UPS BLUE (2 Day)</option>";
strOutput += "<option value=\"UPS ORANGE\">UPS ORANGE (3 Day)</option>";
strOutput += "<option value=\"UPS GROUND\">UPS GROUND (3-5 Day)</option>";
strOutput += "<option value=\"UPS WORLDWIDE\">UPS Worldwide Express</option>";
strOutput += "<option value=\"FedEx OVERNIGHT\">FedEx Over-Night</option>";
strOutput += "<option value=\"FedEx 2 DAY\">FedEx 2 Day</option>";
strOutput += "<option value=\"FedEx GROUND\">FedEx Ground (3-5 Day)</option>";
strOutput += "<option value=\"FedEx INTERNATIONAL\">FedEx International</option>";
strOutput += "<option value=\"TNT ECONOMY\">TNT ECONOMY</option>";
strOutput += "<option value=\"TNT EXPRESS\">TNT EXPRESS</option>";
strOutput += "</select>";
 // Removes shipping charges if the customer is using there own shipping Acct.

strOutput += "</TD>";

/*strOutput += "</TR>";*/

document.write(strOutput);
strOutput = "";
 // Removes shipping charges if the customer is using there own shipping Acct.
ShipAcctCheckBoxCookie = GetCookie("ShipAcctCheckBoxValue");

LocationSelected = GetCookie("ZoneSelected");
//if (LocationSelected == null) LocationSelected = 1;
// Code to use Local Area as default checked, but not needed because want null selected at this time ||
//if (LocationSelected != null) document.all.ZONE[LocationSelected].checked = true;

if (LocationSelected != null) {
	var cLocations = document.getElementsByName('ZONE');
	for (var iCtr = 0; iCtr < cLocations.length; iCtr++) {
		 if (cLocations[iCtr].value == LocationSelected) cLocations[iCtr].checked = true;
	}
}


if (LocationSelected == 0) LocationLabel = "Zone 1";
if (LocationSelected == 1) LocationLabel = "Zone 2";
if (LocationSelected == 2) LocationLabel = "Zone 3";
if (LocationSelected == 3) LocationLabel = "Zone 4";
if (LocationSelected == 4) LocationLabel = "Zone 5";
if (LocationSelected == 5) LocationLabel = "Zone 6";
if (LocationSelected == 6) LocationLabel = "Zone 7";
if (LocationSelected == 7) LocationLabel = "Zone 8";
if (LocationSelected == 8) LocationLabel = "Zone 9";

//if (fWeight == 0) fShipping = 0;
if (fTotal >= 6000000) fShipping = 0; // FREE Shipping for orders >= $6,000,000.00
if (ShipAcctCheckBoxCookie == 0)  // Removes shipping charges if the customer is using there own shipping Acct.
{
	fShipping = 0;
	document.getElementById('ShipAcctNum').style.visibility = 'visible';
	document.getElementById('ShipAcctMethod').style.visibility = 'visible';
	document.getElementById('UseShipAcct').checked = "yes";
}
else fShipping = ComputeShipping(LocationSelected, fWeight)

//Added by ED to try to get rid of NaN.aN issue
if (LocationSelected != null)
	{
		strShipping = moneyFormat(fShipping);
		fWeight = Math.round(fWeight * 100)/100; 
		//strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=4><B>"+strWTOT+"</B></TD>";
		//strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + fWeight + " lbs" + "</B></TD>";
		strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 align=right><B>" + strSHIP + /*" for " + LocationLabel + */":</B></TD>";
		strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strShipping + "</B></TD>";
		strOutput += "</TR>";
	}
if (LocationSelected == null)
	{
		strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 align=right><B>" + strSHIP + /*" for " + LocationLabel + */":</B></TD>";
		//strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + moneyFormat(0.00) + "</B></TD>";
		strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT style=\"background-color:#a0a0a0;cursor:help;\" onMouseover=\"ddrivetip('<b>Please<br>Choose<br>Shipping</b>', 75), event;document.getElementById('ChooseShipping').style.background='#a0a0a0';document.getElementById('ChooseShipping').style.color='#ffffff';\" onMouseout=\"hideddrivetip();document.getElementById('ChooseShipping').style.background='#ffffff';document.getElementById('ChooseShipping').style.color='#000000';\"><B>Not Selected</B></TD>";
		strOutput += "</TR>";
	}
//END - Added by ED to try to get rid of NaN.aN issue
}

if ( DisplayTaxRow || TaxByRegion ) {
if ( TaxByRegion ) {
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=2><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=2 align=right><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 ||
fTax = 0.00;

if (LocationSelected == 0)  {
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=2 align=right><B>"+strTAX+"</B></TD>";
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>";
strOutput += "</TR>";
}

//Added by ED to try to get rid of NaN.aN issue
if (LocationSelected != null)
	{
		if ( !TaxByRegion ) {
		strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=2 align=right><B>"+strTOT+"</B></TD>";
		strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT><B>" + MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + "</B></TD>";
		strOutput += "</TR>";
		strOutput += "<td class=\"noptotal\" colspan=3 align=right><input type=image src=images/PSLCheckout.gif height=30 width=129 border=0></td></tr>";
		strOutput += "<tr><td class=\"noptotal\" colspan=5></td></tr>";
		strOutput += "<tr><td class=\"noptotal\" colspan=1 align=left><font size=-2>For alternate<br>shipping methods,<br>please <a href=contact.htm>contact</a><br>the factory</td><td class=\"noptotal\" colspan=4 align=right><font size=-2>Customer is responsible for all customs, duties, taxes and fees.</font></td></tr>";
		}
	}
if (LocationSelected == null)
	{
		if ( !TaxByRegion ) {
		strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=2 align=right><B>"+strTOT+"</B></TD>";
		strOutput += "<TD CLASS=\"noptotal\" COLSPAN=1 ALIGN=RIGHT style=\"background-color:#a0a0a0;\"><B>$----.--</B></TD>";
		strOutput += "</TR>";
		strOutput += "<td class=\"noptotal\" colspan=3 align=right><input type=image src=images/PSLCheckout.gif height=30 width=129 border=0></td></tr>";
		strOutput += "<tr><td class=\"noptotal\" colspan=5></td></tr>";
		strOutput += "<tr><td class=\"noptotal\" colspan=1 align=left><font size=-2>For alternate<br>shipping methods,<br>please <a href=contact.htm>contact</a><br>the factory</td><td class=\"noptotal\" colspan=4 align=right><font size=-2>Customer is responsible for all customs, duties, taxes and fees.</font></td></tr>";
		}
	}
//END - Added by ED to try to get rid of NaN.aN issue
strOutput += "</TABLE>";

if ( HiddenFieldsToCheckout ) {
strOutput += "<input type=hidden name=\""+OutputOrderSubtotal+"\" value=\""+ MonetarySymbol + strTotal + "\">";
strOutput += "<input type=hidden name=\""+OutputOrderShipping+"\" value=\""+ MonetarySymbol + strShipping + "\">";
strOutput += "<input type=hidden name=\""+OutputOrderTax+"\" value=\""+ MonetarySymbol + strTax + "\">";
strOutput += "<input type=hidden name=\""+OutputOrderTotal+"\" value=\""+ MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + "\">";
}
}
g_TotalCost = (fTotal + fShipping + fTax);

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

//---------------------------------------------------------------------||
// FUNCTION: ComputeShipping ||
// PARAMETERS: ||
// RETURNS: ||
// PURPOSE: Compute shipping cost due to total weight ||
//---------------------------------------------------------------------||
function ComputeShipping(Zone, TotWeight) {
LocationValue = GetCookie("ZoneSelected");

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

if (TotWeight == 0) return 0.00;

//California 
if (LocationValue == 0 ) {
if ((TotWeight <= 3) && (TotWeight >= 1)) return 21.00;//Less than 1 PQube
if ((TotWeight <= 9) && (TotWeight >= 4)) return 21.00;//1-2 PQubes
if ((TotWeight <= 16) && (TotWeight >= 10)) return 21.00;//3-4 PQubes
if ((TotWeight <= 24) && (TotWeight >= 17)) return 22.00;//5-6 PQubes
if ((TotWeight <= 32) && (TotWeight >= 25)) return 22.00;//7-8 PQubes
if ((TotWeight <= 40) && (TotWeight >= 33)) return 24.00;//9-10 PQubes
if ((TotWeight <= 64) && (TotWeight >= 41)) return 29.00;//11-16 PQubes
if ((TotWeight <= 80) && (TotWeight >= 65)) return 31.00;//17-20 PQubes
if (TotWeight >= 81) return 35.00;//21 or more PQubes
}
//USA
if (LocationValue == 1 ) {
if ((TotWeight <= 3) && (TotWeight >= 1)) return 22.00;//Less than 1 PQube
if ((TotWeight <= 9) && (TotWeight >= 4)) return 22.00;//1-2 PQubes
if ((TotWeight <= 16) && (TotWeight >= 10)) return 25.00;//3-4 PQubes
if ((TotWeight <= 24) && (TotWeight >= 17)) return 28.00;//5-6 PQubes
if ((TotWeight <= 32) && (TotWeight >= 25)) return 30.00;//7-8 PQubes
if ((TotWeight <= 40) && (TotWeight >= 33)) return 33.00;//9-10 PQubes
if ((TotWeight <= 64) && (TotWeight >= 41)) return 40.00;//11-16 PQubes
if ((TotWeight <= 80) && (TotWeight >= 65)) return 46.00;//17-20 PQubes
if (TotWeight >= 81) return 50.00;//21 or more PQubes
}
//Canada, Mexico
if (LocationValue == 2 ) {
if ((TotWeight <= 3) && (TotWeight >= 1)) return 50.00;//Less than 1 PQube
if ((TotWeight <= 9) && (TotWeight >= 4)) return 50.00;//1-2 PQubes
if ((TotWeight <= 16) && (TotWeight >= 10)) return 54.00;//3-4 PQubes
if ((TotWeight <= 24) && (TotWeight >= 17)) return 62.00;//5-6 PQubes
if ((TotWeight <= 32) && (TotWeight >= 25)) return 70.00;//7-8 PQubes
if ((TotWeight <= 40) && (TotWeight >= 33)) return 78.00;//9-10 PQubes
if ((TotWeight <= 64) && (TotWeight >= 41)) return 91.00;//11-16 PQubes
if ((TotWeight <= 80) && (TotWeight >= 65)) return 100.00;//17-20 PQubes
if (TotWeight >= 81) return 120.00;//21 or more PQubes
}
//International
if (LocationValue == 3 ) {
if ((TotWeight <= 3) && (TotWeight >= 1)) return 77.00;//Less than 1 PQube
if ((TotWeight <= 9) && (TotWeight >= 4)) return 77.00;//1-2 PQubes
if ((TotWeight <= 16) && (TotWeight >= 10)) return 83.00;//3-4 PQubes
if ((TotWeight <= 24) && (TotWeight >= 17)) return 95.00;//5-6 PQubes
if ((TotWeight <= 32) && (TotWeight >= 25)) return 106.00;//7-8 PQubes
if ((TotWeight <= 40) && (TotWeight >= 33)) return 117.00;//9-10 PQubes
if ((TotWeight <= 64) && (TotWeight >= 41)) return 143.00;//11-16 PQubes
if ((TotWeight <= 80) && (TotWeight >= 65)) return 160.00;//17-20 PQubes
if ((TotWeight <= 100) && (TotWeight >= 81)) return 180.00;
if ((TotWeight <= 120) && (TotWeight >= 101)) return 200.00;
if ((TotWeight <= 140) && (TotWeight >= 121)) return 220.00;
if ((TotWeight <= 160) && (TotWeight >= 141)) return 260.00;
if ((TotWeight <= 180) && (TotWeight >= 161)) return 280.00;
if ((TotWeight <= 200) && (TotWeight >= 181)) return 320.00;
if ((TotWeight <= 220) && (TotWeight >= 201)) return 340.00;
if ((TotWeight <= 240) && (TotWeight >= 221)) return 380.00;
if ((TotWeight <= 260) && (TotWeight >= 241)) return 420.00;
if ((TotWeight <= 280) && (TotWeight >= 261)) return 440.00;
if ((TotWeight <= 300) && (TotWeight >= 281)) return 470.00;
if ((TotWeight <= 320) && (TotWeight >= 301)) return 520.00;
if ((TotWeight <= 340) && (TotWeight >= 321)) return 540.00;
if ((TotWeight <= 360) && (TotWeight >= 341)) return 580.00;
if ((TotWeight <= 380) && (TotWeight >= 361)) return 620.00;
if ((TotWeight <= 400) && (TotWeight >= 381)) return 640.00;
if (TotWeight >= 401) return 680.00;//21 or more PQubes
}
}

//---------------------------------------------------------------------||
// 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 );
	  document.getElementById('ChooseShipping').style.background='#a0a0a0';
	  document.getElementById('ChooseShipping').style.color='#ffffff';
	  return false;
   }

   if ( MinimumOrder >= 0.01 ) {
	  if ( g_TotalCost < MinimumOrder ) {
		 alert( MinimumOrderPrompt );
		 return false;
	  }
   }

   if ( !RadioChecked(theForm.ZONE) ) {
	  alert( LocationPrompt );
	  document.getElementById('ChooseShipping').style.background='#a0a0a0';
	  document.getElementById('ChooseShipping').style.color='#ffffff';
	  return false;
   }
   
	ShipAcctCheckBoxCookieValue = GetCookie("ShipAcctCheckBoxValue");
	if ((ShipAcctCheckBoxCookieValue == 0) && ((document.form.ShipAcctNum.value == " Account #")||(document.form.ShipAcctNum.value == "")))
	{
		alert('You must enter your Shipping Account Number before placing this order!\nThank you');
		document.getElementById('ChooseShipping').style.background='#a0a0a0';
		document.getElementById('ChooseShipping').style.color='#ffffff';
		return false;
	}
	
	if ((ShipAcctCheckBoxCookieValue == 0) && (document.form.ShipAcctMethod.value == ""))
	{
		alert('You must select your Shipping Method before placing this order!\nThank you');
		document.getElementById('ChooseShipping').style.background='#a0a0a0';
		document.getElementById('ChooseShipping').style.color='#ffffff';
		return false;
	}
   
   return true;
}

//---------------------------------------------------------------------||
// FUNCTION: CheckoutCart ||
// PARAMETERS: Null ||
// RETURNS: Product Table Written to Document ||
// PURPOSE: Draws current cart product table on HTML page for ||
// checkout. ||
//---------------------------------------------------------------------||
function CheckoutCart( ) {
var iNumberOrdered = 0; //Number of products ordered
var fTotal = 0; //Total cost of order
var fTax = 0; //Tax amount
var fWeight = 0; //Weight
var fShipping = 0; //Shipping amount
var strTotal = ""; //Total cost formatted as money
var strTax = ""; //Total tax formatted as money
var strShipping = ""; //Total shipping formatted as money
var strOutput = ""; //String to be written to page
var bDisplay = true; //Whether to write string to the page (here for programmers)
var strPP = ""; //Payment Processor Description Field

<!---- Random Invoice Number Generator  ------------>
var randomnumber=Math.floor(Math.random()*999999)
var invoicenum=randomnumber
<!---- End Random Invoice Number Generator  ----->

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\" width=\"700\"><TR>" +
/*"<TR><TD COLSPAN=5 CLASS=\"nopheader\" ALIGN=RIGHT><img src=\"images/print02.png\" style=\"cursor: pointer;\" border=0 onClick=\"print('PriceChart')\"></TD></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>" +
"<td class=\"nopheader\" align=center><b>"+strRLabel+"</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);

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

//Added on 06/24/08 by Edward to keep customers from ordering more than the max (95 for PQ1, 9 for PQube, ETH1 and PS1, and 18 for T1 and TH1)
if (( fields[1] > 95 ) && ( fields[3] == "PQ1-01-0001 - Power Quality Relay" ))
fields[1] = 95;
//NEW PQube-02 Limits
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-000G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-001G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-010G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-100G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-200G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-011G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-101G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-201G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-110G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-210G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-111G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-211G - Power Quality Monitor" ))
fields[1] = 9;
//NEW PQube-02 Limits
if (( fields[1] > 9 ) && ( fields[3] == "PQube-01" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-01-0000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-0.333V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-1V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-5V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CTE1-10T-10V-00 - Current/Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-ETH1-00 - PQube Package – Power Quality Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CT4-00 - PQube Package – Embedded Energy & PQ Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CT4-20A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CT4-50A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-XCT5-00 - PQube Package – Energy & PQ Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-XCT5" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1-0050A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1-0600A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CTE1-0000A-00" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PS1-100~240-00 - Power Supply Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PS2-100~240-00 - Power Supply Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ETH1-10T-00 - Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CT4-20A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CT4-100A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT4-1A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT4-5A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-1V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-0.333V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-5V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-10V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 18 ) && ( fields[3] == "TH1-80C-00 - Temperature/Humidity Probe" ))
fields[1] = 18;
if (( fields[1] > 18 ) && ( fields[3] == "THC-2M-00 - 2M Extension cable" ))
fields[1] = 18;
if (( fields[1] > 9 ) && ( fields[3] == "DRK-270-00 - DIN Rail Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "SD" ))
fields[1] = 9;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0005A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0020A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0050A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0100A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-125-0200A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-125-0300A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0005A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0400A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0600A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-0005A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-1000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-2000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-3000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 9 ) && ( fields[3] == "ENCL-EXT1074-01 - Enclosure for PQube assembly" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQBEZ-IP54-00 - Panel Mount Bezel" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQBEZ-OPEN-00 - Panel Mount Bezel" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQBPNL-3MOD-00 - Hinged Panel Mount Bracket" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CB-1P-277/480V-1A - Single-phase circuit breaker" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CB-3P-277/480V-1A - Three-phase circuit breaker" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ATT1-0600V-00 - AC/DC Voltage Attenuator" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ATT1-1200V-00 - AC/DC Voltage Attenuator" ))
fields[1] = 9;
//End of Ed's stuff

fTotal += (parseInt(fields[1]) * parseFloat(fields[2]) );
fWeight += (parseInt(fields[1]) * parseFloat(fields[4]) * 100)/100;
if ( !TaxByRegion ) var strProductId = fields[0];
if( strProductId[0] != 'n' ) {
fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate;
} 
strTotal = moneyFormat(fTotal);
if ( !TaxByRegion ) strTax = moneyFormat(fTax);

if ( bDisplay ) {
strOutput += "<TR><TD CLASS=\"nopentry\" ALIGN=LEFT>" + fields[0] + "</TD>";

if ( fields[5] == "" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "</TD>";
else if ( fields[3] == "PQube-01" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Power Quality Monitor</TD>";
else if ( fields[3] == "CT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Current Monitoring</TD>";
else if ( fields[3] == "XCT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Current Monitoring</TD>";
else if ( fields[3] == "SD" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Secure Digital Card</TD>";
else
/*Changed "" - <I>"+ fields[5] + "<I></TD>"" to ""-"+ fields[5] + "</TD>"" for PQube model numbering*/
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + "</TD>";

strOutput += "<TD CLASS=\"nopentry\" ALIGN=center>" + fields[1] + "</TD>";
strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ MonetarySymbol + moneyFormat(fields[2]) + "</TD>";

strOutput += "<td class=\"nopentry\" align=right>"+ MonetarySymbol + moneyFormat(fields[1]*fields[2]) + "</td>";

<!---- Display Invoice Number --------->
//strOutput += "<TD CLASS=\"nopentry\" ALIGN=RIGHT>"+ invoicenum + "</TD>";
<!----- End Invoice Number Display ------------>


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

strOutput += "</TR>";
}

 // Removes shipping charges if the customer is using there own shipping Acct.
ShipAcctCheckBoxCookie = GetCookie("ShipAcctCheckBoxValue");

LocationSelected = GetCookie("ZoneSelected");
if (LocationSelected == null) LocationSelected = 0; // Code to use Local Area as default checked, but not needed because want null selected at this time ||
//if (LocationSelected != null) document.all.ZONE[LocationSelected].checked = true;

if (LocationSelected != null) {
	var cLocations = document.getElementsByName('ZONE');
	for (var iCtr = 0; iCtr < cLocations.length; iCtr++) {
		 if (cLocations[iCtr].value == LocationSelected) cLocations[iCtr].checked = true;
	}
}


if (LocationSelected == 0) LocationLabel = "Zone 1";
if (LocationSelected == 1) LocationLabel = "Zone 2";
if (LocationSelected == 2) LocationLabel = "Zone 3";
if (LocationSelected == 3) LocationLabel = "Zone 4";
if (LocationSelected == 4) LocationLabel = "Zone 5";
if (LocationSelected == 5) LocationLabel = "Zone 6";
if (LocationSelected == 6) LocationLabel = "Zone 7";
if (LocationSelected == 7) LocationLabel = "Zone 8";
if (LocationSelected == 8) LocationLabel = "Zone 9";

//if (fWeight == 0) fShipping = 0;
if (fTotal >= 6000000) fShipping = 0; // FREE Shipping for orders >= $6,000,000.00
if (ShipAcctCheckBoxCookie == 0) fShipping = 0; // Removes shipping charges if the customer is using there own shipping Acct.
else fShipping = ComputeShipping(LocationSelected, fWeight)

if ( AppendItemNumToOutput ) {
strFooter = i;
} else {
strFooter = "";
}
if ( PaymentProcessor == 'pp' ) {
//Process hidden values for PayPal.
strOutput += "<input type=hidden name=\"item_number_" + strFooter + "\" value=\"" + fields[0] + "\">";
strOutput += "<input type=hidden name=\"quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
strOutput += "<input type=hidden name=\"amount_" + strFooter + "\" value=\"" + fields[2] + "\">";
strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"0.00\">";
strOutput += "<input type=hidden name=\"on0_" + strFooter + "\" value=\"" + fields[5] + "\">";
if (i == iNumberOrdered) {
strOutput += "<input type=hidden name=\"shipping_" + strFooter + "\" value=\"" + fShipping + "\">";
strOutput += "<input type=hidden name=\"custom\" value=\""+ LocationLabel + ","+ fWeight + "\">";
strOutput += "<input type=hidden name=\"invoice\" value=\""+ invoicenum + "\">";
}
}
else if ( PaymentProcessor == 'gc' ) {
//Process hidden values for Google Checkout
strOutput += "<input type=hidden name=\"item_name_" + strFooter + "\" value=\"" + fields[3] + "\">";
strOutput += "<input type=hidden name=\"item_quantity_" + strFooter + "\" value=\"" + fields[1] + "\">";
strOutput += "<input type=hidden name=\"item_price_" + strFooter + "\" value=\"" + fields[2] + "\">";
strOutput += "<input type=hidden name=\"item_description_" + strFooter + "\" value=\"" /*+ fields[0] +"-"*/+ fields[5] +"\">";
strOutput += "<input type=hidden name=\"ship_method_name_1\" value=\"Expedited\">";
/*OLD SHIP NAME*//*strOutput += "<input type=hidden name=\"ship_method_name_1\" value=\"RED/Expedited\">";*/
//strOutput += "<input type=hidden name=\"ship_method_area_1\" value=\"ALL\">";
//added the following line to enable international shipping
strOutput += "<input type=hidden name=\"checkout-flow-support.merchant-checkout-flow-support.shipping-methods.flat-rate-shipping-1.shipping-restrictions.allowed-areas.world-area-1\" value=\"true\">";
//Added 04/27/08 by Edward Winterberger to allow for the tax rate to be transfered to Google Checkout.
if (LocationSelected == 0){
strOutput += "<input type=hidden name=\"tax_rate\" value=\"" + TaxRate + "\">";
strOutput += "<input type=hidden name=\"tax_us_state\" value=\"CA\">";
}
if (i == iNumberOrdered) {
strOutput += "<input type=hidden name=\"ship_method_price_1\" value=\"" + fShipping + "\">";
}
strOutput += "<input type=hidden name=\"order_total\" value=\"" + MonetarySymbol + moneyFormat(((fields[1]*fields[2])+fShipping)+fTax) + "\">";
}
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
//Added 08/27/09 by Edward Winterberger w/ Power Standards Lab
else if ( PaymentProcessor == 'AN' ) {
//Process hidden values for Authorize.Net
strOutput += "<input type=\"hidden\" name=\"x_version\" value=\"3.1\">";
strOutput += "<input type=\"hidden\" name=\"x_type\" value=\"AUTH_ONLY\">";
strOutput += "<input type=\"hidden\" name=\"x_method\" value=\"CC\">";
strOutput += "<input type=\"hidden\" name=\"x_recurring_billing\" value=\"FALSE\">";
if (LocationSelected == 0) {
	strOutput += "<input type=\"hidden\" name=\"x_amount\" value=\"" + moneyFormat(fTotal + fShipping + fTax) + "\">";
	strOutput += "<input type=\"hidden\" name=\"x_tax\" id=\"x_tax\" value=\"Tax1<|>CA Tax<|>" + moneyFormat(fTax) + "\">";
}
else {
	strOutput += "<input type=\"hidden\" name=\"x_amount\" value=\"" + moneyFormat(fTotal + fShipping) + "\">";
}
strOutput += "<input type=\"hidden\" name=\"x_freight\" id=\"x_freight\" value=\"Freight<|>Expedited<|>" + moneyFormat(fShipping) + "\">";
strOutput += "<input type=\"hidden\" name=\"x_description\" id=\"x_description\" value=\"PSL Web Order\">";
strOutput += "<input type=\"hidden\" name=\"x_delim_data\" id=\"x_delim_data\" value=\"true\">";
//strOutput += "<input type=\"hidden\" name=\"x_delim_char\" id=\"x_delim_char\" value=\"|\">";
strOutput += "<input type=\"hidden\" name=\"x_relay_response\" id=\"x_relay_response\" value=\"false\">";
if (fields[5] != ""){
	strOutput += "<input type=\"hidden\" name=\"x_line_item\" id=\"x_line_item\" value=\"" + strFooter + "<|>PSL Web Order<|>" + fields[3] + "-" + fields[5] + "<|>" + fields[1] + "<|>" + fields[2] + "<|>TRUE\">";
}
else {
	strOutput += "<input type=\"hidden\" name=\"x_line_item\" id=\"x_line_item\" value=\"" + strFooter + "<|>PSL Web Order<|>" + fields[3] + "<|>" + fields[1] + "<|>" + fields[2] + "<|>TRUE\">";
}
}
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
else if ( PaymentProcessor != '' ) {
//Process description field for payment processors instead of hidden values.
//Format Description of product as:
// ID, Name, Qty X
strPP += fields[0] + ", " + fields[3];
if ( fields[5] != "" )
strPP += " - " + fields[5];
strPP += ", Q= " + fields[1] + "\n";
} 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=\"" + OutputItemShipping + strFooter + "\" value=\"" + fields[4] + "\">";
strOutput += "<input type=hidden name=\"" + OutputItemAddtlInfo + strFooter + "\" value=\"" + fields[5] + "\">";
}
}

if ( bDisplay ) {
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3 align=right><B>"+strSUB+"</B></TD>";
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + strTotal + "</B></TD>";
strOutput += "</TR>";

 // Removes shipping charges if the customer is using there own shipping Acct.
ShipAcctCheckBoxCookie = GetCookie("ShipAcctCheckBoxValue");

if ( DisplayShippingRow ) {
LocationSelected = GetCookie("ZoneSelected");
if (LocationSelected == null) LocationSelected = 0; //Needed if checkout cart is empty

if (LocationSelected == 0) LocationLabel = "Zone 1";
if (LocationSelected == 1) LocationLabel = "Zone 2";
if (LocationSelected == 2) LocationLabel = "Zone 3";
if (LocationSelected == 3) LocationLabel = "Zone 4";
if (LocationSelected == 4) LocationLabel = "Zone 5";
if (LocationSelected == 5) LocationLabel = "Zone 6";
if (LocationSelected == 6) LocationLabel = "Zone 7";
if (LocationSelected == 7) LocationLabel = "Zone 8";
if (LocationSelected == 8) LocationLabel = "Zone 9";

//if (fWeight == 0) fShipping = 0;
if (fTotal >= 6000000) fShipping = 0; // FREE Shipping for orders >= $6,000,000.00
if (ShipAcctCheckBoxCookie == 0) fShipping = 0; // Removes shipping charges if the customer is using there own shipping Acct.
else fShipping = ComputeShipping(LocationSelected, fWeight)
strShipping = moneyFormat(fShipping);
/*strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3><B>"+strWTOT+"</B></TD>";*/
/*strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + fWeight + " lbs" + "</B></TD>";*/
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3 align=right><B>" + strSHIP + /*" for " + LocationLabel + */":</B></TD>";
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + strShipping + "</B></TD>";
strOutput += "</TR>";
}

if ( DisplayTaxRow || TaxByRegion ) {
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3 align=right><B>"+strTAX+"</B></TD>";
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + strTax + "</B></TD>";
strOutput += "</TR>";
}

if (LocationSelected != 0) //sets tax to 0.00 for all other areas ||
fTax = 0.00;

if (LocationSelected == 0)  {
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=3 align=right><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 align=right><B>"+strTOT+"</B></TD>";
strOutput += "<TD CLASS=\"noptotal\" COLSPAN=2 ALIGN=RIGHT><B>" + MonetarySymbol + moneyFormat((fTotal + fShipping + fTax)) + "</B></TD>";
strOutput += "</TR>";
strOutput += "<TR><TD CLASS=\"noptotal\" COLSPAN=5 align=right><font size=-2>Customer is responsible for all customs, duties, taxes and fees.</font></TD></TR>";
strOutput += "</TABLE>";

}

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

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


























//---------------------------------------------------------------------||
// FUNCTION: QuoteCart ||
// 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 QuoteCart( ) {
var iNumberOrdered = 0; //Number of products ordered
var fTotal = 0; //Total cost of order
var fTax = 0; //Tax amount
var fWeight = 0; //Weight
var fShipping = 0; //Shipping amount
var strTotal = ""; //Total cost formatted as money
var strTax = ""; //Total tax formatted as money
var strShipping = ""; //Total shipping formatted as money
var strOutput = ""; //String to be written to page
var bDisplay = true; //Whether to write string to the page (here for programmers)

var strDisplayCart_Visibility;
var strDisplayEmptyCart_Visibility;

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

LocationSelected = GetCookie("ZoneSelected");
if (LocationSelected == null) LocationSelected = 0; // Code to use Other as default checked if customer goes to Checkout with an empty Cart ||
/*judstuff*/
if ( iNumberOrdered == 0 ){
	strDisplayCart_Visibility = "hidden;float:right;position:absolute";
	strDisplayEmptyCart_Visibility = "visible";
}
else{
	strDisplayCart_Visibility = "visible";
	strDisplayEmptyCart_Visibility = "hidden;float:right;position:absolute";
}
/* end judstuf */
if ( bDisplay )
strOutput = "<TABLE WIDTH=\"700\" CLASS=\"nopcart\" style=visibility:" + strDisplayEmptyCart_Visibility + ";><TR><TD CLASS=\"nopheader\" ALIGN=LEFT><font style=\"font-variant:small-caps;\"><B>&nbsp;Cart Contents:</B></font></TD></TR><TR><TD COLSPAN=5 CLASS=\"nopentry\"><CENTER><B>Your cart is empty</B></CENTER></TD></TR></TABLE>";
document.write(strOutput);
strOutput = "<TABLE WIDTH=\"700\" CLASS=\"nopcart\" style=visibility:" + strDisplayCart_Visibility + ";><TR><TD COLSPAN=5 CLASS=\"nopheader\" ALIGN=RIGHT>Click here to print <img src=\"images/print02.png\" style=\"cursor: pointer;\" border=0 onClick=\"print();gar();\"></TD></TR><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=5 CLASS=\"nopentry\"><CENTER><BR><B>Your cart is empty</B><BR><BR></CENTER></TD></TR>";
//document.getElementById("DisplayedCart").style.visibility="hidden";
}

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

//Added on 06/24/08 by Edward to keep customers from ordering more than the max (95 for PQ1, 9 for PQube, ETH1 and PS1, and 18 for T1 and TH1)
if (( fields[1] > 95 ) && ( fields[3] == "PQ1-01-0001 - Power Quality Relay" ))
fields[1] = 95;
//NEW PQube-02 Limits
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-000G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2100 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-0110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-001G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2010 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-010G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-100G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-200G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-1110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-2110 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-011G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-101G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-201G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-110G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-210G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-111G - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-02-211G - Power Quality Monitor" ))
fields[1] = 9;
//NEW PQube-02 Limits
if (( fields[1] > 9 ) && ( fields[3] == "PQube-01" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQube-01-0000 - Power Quality Monitor" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-ETH1-00 - PQube Package – Power Quality Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-CT4-00 - PQube Package – Embedded Energy & PQ Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PQP-XCT5" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "PS1-100~240-00 - Power Supply Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ETH1-10T-00 - Ethernet Module" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CT4-20A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CT4-100A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT4-1A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT4-5A-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-1V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-0.333V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-5V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "XCT5-10V-00 - Current Monitoring" ))
fields[1] = 9;
if (( fields[1] > 18 ) && ( fields[3] == "TH1-80C-00 - Temperature/Humidity Probe" ))
fields[1] = 18;
if (( fields[1] > 18 ) && ( fields[3] == "THC-2M-00 - 2M Extension cable" ))
fields[1] = 18;
if (( fields[1] > 9 ) && ( fields[3] == "DRK-270-00 - DIN Rail Kit" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "SD" ))
fields[1] = 9;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0020A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0050A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-075-0100A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-125-0200A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-125-0300A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0400A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-200-0600A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-1000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-2000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 36 ) && ( fields[3] == "SCS-300-3000A:0.333V" ))
fields[1] = 36;
if (( fields[1] > 9 ) && ( fields[3] == "ENCL-EXT1074-01 - Enclosure for PQube assembly" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CB-1P-277/480V-1A - Single-phase circuit breaker" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "CB-3P-277/480V-1A - Three-phase circuit breaker" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ATT1-0600V-00 - AC/DC Voltage Attenuator" ))
fields[1] = 9;
if (( fields[1] > 9 ) && ( fields[3] == "ATT1-1200V-00 - AC/DC Voltage Attenuator" ))
fields[1] = 9;
//End of Ed's stuff

fTotal += (parseInt(fields[1]) * parseFloat(fields[2]) );
fWeight += (parseInt(fields[1]) * parseFloat(fields[4]) );
fWeight = Math.round(fWeight * 100)/100; 
var strProductId = fields[0];
if( strProductId[0] != 'n' ) {
fTax += (parseInt(fields[1]) * parseFloat(fields[2]) ) * TaxRate;
}

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

if ( bDisplay ) {
strOutput += "<TR><TD CLASS=\"nopentry\">" + fields[0] + "</TD>";

if ( fields[5] == "" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "</TD>";
else if ( fields[3] == "PQube-01" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Power Quality Monitor</TD>";
else if ( fields[3] == "CT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Current Monitoring</TD>";
else if ( fields[3] == "XCT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Current Monitoring</TD>";
else if ( fields[3] == "SD" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - Secure Digital Card</TD>";
else if ( fields[3] == "PQP-XCT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Energy & PQ Kit</TD>";
else if ( fields[3] == "PQP-XCT5" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Energy & PQ Kit</TD>";
else if ( fields[3] == "PQP-CT4" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Embedded Energy & PQ Kit</TD>";
else if ( fields[3] == "PQP-ETH1" )
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + " - PQube Power Quality Kit</TD>";
else
strOutput += "<TD CLASS=\"nopentry\">" + fields[3] + "-"+ fields[5] + "</TD>";

strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER><INPUT TYPE=TEXT  style='text-align:center;border:1px solid #464444;' NAME=Q SIZE=2 VALUE=\"" + fields[1] + "\" onChange=\"ChangeQuantity("+i+", this.value);\"><br><input type=button value='  Update  '><BR><input type=button value=\" "+strRButton+" \" onClick=\"RemoveFromCart("+i+")\"></TD>";
strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER></TD>";


strOutput += "<TD CLASS=\"nopentry\" ALIGN=CENTER></TD></TR>";
}

if ( AppendItemNumToOutput ) {
strFooter = i;
} else {
strFooter = "";
}

}

if ( bDisplay ) {

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

document.write(strOutput);
strOutput = "";
 // Removes shipping charges if the customer is using there own shipping Acct.
ShipAcctCheckBoxCookie = GetCookie("ShipAcctCheckBoxValue");

LocationSelected = GetCookie("ZoneSelected");
}
strOutput += "</TABLE>";
}

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