// NebuCart - The JavaScript Shopping Cart
// E-Commerce YOUR way
// by Nebulus Designs
//
// Copyright 1999-2001 all rights reserved.

// None of this script may be redistributed or sold
// without the authors express consent.
// Violations of copyright will be prosecuted.

// If you would like to use NebuCart,
// email us at nebucart@nebulus.org
// or visit http://nebucart.nebulus.org

// ********************************************
// NebuCart User Defined Settings             *
// ********************************************
// Cart variables - you edit these to taste   *
// ********************************************

// Debug Mode. Setting DEBUG to true will allow
// you to see descriptions of errors in a window.
// You should probably set this to false
// when you run the cart live
var DEBUG       = true;

// set your company information here. This will all
// generated on the printable form
// Default settings are for Nebulus Designs
var myName      = 'Bathtime Goodies';
var mySite      = 'http://www.bathtimegoodies.com';
var myEmail     = 'info@bathtimegoodies.com';
var myPhone     = '317.780.2284';
var myAddress   = 'PO Box 17012';
var myCityState = 'Indianapolis, IN';
var myZip       = '46217-0012';
var myCountry   = 'United States';
var myLogo      = '';

// this is your prefix for all cookies written by your
// implementation of the cart. Do not use spaces!
var myStoreName    = 'BG';

// set the domain values for your cookies.
// this should allow you to put catalog
// pages in different directories.
// domain values require two "."!
var unsecureDomain = '';
var secureDomain   = '';

// set the path for the cookies
// currently, we set the path as root.
var cookiePath     = '';

// set customer Info persistence and
// cart persistence via cookies.
// usage: "setExp(S,M,H,D,W,Mo,Y)"
// S = seconds, M = minutes, H = hours
// D = days, W = weeks, Mo = months, Y = years

// note, customer info should persist for a while, say
// 2 to 3 months or longer, but cart data should only
// last a few minutes for the shopping experience.
// default times:
// customer = 2 months,
// cart: 5 mintues
var customerTime = 'setExp(0,0,0,0,0,6,0)';
var cartTime     = 'setExp(0,0,1,0,0,0,0)';

// set this variable to true if you don't want the
// cart page to display each time an item's added.
// if set to true, you will get a pop up instead.
var supressCart  = true;

// set the font face to whatever font you're using on your site
// Default setting is "arial,helvetica"
var fontFace = 'Verdana,Arial,Helvetica';

// cart look and feel
var cartHeader    = '#C9C9C9';
var cartRow1      = '#FFFFFF';
var cartRow2      = '#C9C9C9';
var cartTaxRow    = '#FFFFFF';
var cartShipRow   = '#FFFFFF';
var cartSubRow    = '#E4E4E4';
var cartTotalRow  = '#C9C9C9';
var cartBorder    = 0;
var cartCellSpace = 1;
var cartCellPad   = 2;

// cart button text
// these variables set the text for each button in the cart
// some are used in more places than one, so use general
// descriptions!
var backText           = 'Back';
var clearFormText      = 'Clear';
var itemUpdateText     = 'Update';
var itemDeleteText     = 'Delete';
var checkoutText       = 'Checkout';
var keepShopText       = 'Keep Shopping';
var deleteCartText     = 'Delete Cart';
var printFormText      = 'Printable Form';
var unsecureFormText   = 'Unsecure Form Order';
var unsecureCreditText = 'Secure Credit';
var secureFormText     = 'Secure Form Order';
var secureCreditText   = 'Secure Credit';
var printMyOrderText   = 'Print My Order';
var orderFinalizeText  = 'Finalize My Order';
var editCartText       = 'Edit Cart';

// set the currency character
var currency = '$';

// set wether you want to gather seperate shipping info
var getAltShipping = true;

// enter the percentag tax to charge customers if
// you will charge tax. example - .06 is 6%
// Default setting is 6.5% for Kansas (where I live).
var taxPercent = '.06';

// set whether you want to charge tax all the time. If so,
// you do not need to edit the taxOnCountry or taxOnState variables
var alwaysTax = false;

// set whether you want to charge tax by country or by state/province
// if you want to use either of these two variables, then make sure that
// alwaysTax = false
// NOTE: typically, you would tax based on state/provice, so the cart
// will check that variable first.
var taxOnState   = true;
var taxOnCountry = false;

// set the state(s) you want to flag for taxing. Make sure that
// you use the common abreviation as well as the full name, all lower case!
var taxStateArray = new Array(
'in',
'indiana'
);

// set the country(s) you want to flag for taxing. Make sure that
// you use the common abreviation as well as the full name, all lower case!
var taxCountryArray = new Array(
'us',
'usa',
'ca',
'canada'
);

// enter shipping amount in percentage or straight charge.
// if you use a percentage, then set shipPercent = true,
// otherwise set it to false.
// Default setting is 10%
var shipAmt = '0.00';
var shipPercent = false;

// set shipping cost per item.
// If set to true and shipPercent is false, then the cusomter will
// be charged shipping on a per item basis.
// If set to true, shipPercent is false, and useShipOptions is false,
// then the cusomter will be charged the set shipping amount per item ordered.
var shipPerItem = false;

// set this to true if you want to use shipping
// options as opposed to a set amount or percentage.
// set to false to use a set amount or percentage
// This will override the variables shipAmt, shipPercent, and shipPerItem
var useShipOptions = false;

// set this to true if you want to use shipping
// rules as opposed to a set amount, percentage, or straight shipping options
// shipPercent, shipPerItem, and shipOptions must be false!
var useShipRules = true;

// this will define a set of radio buttons for your shipping options.
// the true/false at the end is for setting that shipping option to
// be charged per each item ordered.
// Formatting:
// One option per line - "Options Description + | + option cost + | true/false",
var shipOptions = new Array(
'UPS Ground|14.95|false',
'UPS Second Day Air|32.50|false',
'FedEx Overnight|40.95|false'
);

// this will define a set of rules for what amount ot charge for shipping
// should you decide not to use options, set amount, percentage, etc.
// Formatting:
// Define a new shipRule per line and pass the proper arguments:
// new shipRule(amtLbound,amtUbound,qtyLbound,qtyUbound,shipCost,percent,countries,applyDomestic)
// amtLbound & amtUbound - the monetary range of the order to apply this rule.
//						   set both  to 0 to disqualify the amount range.
//						   if you don't use amount, then you must use the quantity
//						   bounds for the rule.
// qtyLbound & qtyUbound - the item quantity range of the order to apply this rule
//						   set both  to 0 to disqualify the quantity range.
//						   if you don't use quantity, then you must use the amount
//						   bounds for the rule.
// shipCost              - any numerical value
// percent               - true/false. True charges the shipCost as a percentage of
//						   the order subtotal. False charges as a straight amount
// countries             - the listing of the countries that you consider in your
//                         national shipping area. List must be delimited with a |
// applyDomestic         - true/false. True applies the rule if the customer's
//                         country of residence matches your list and other
//                         qualifiers apply. False applies the rule if the
//                         customer's country does NOT match the list (international)
//                         and other qualifiers apply.
var myShipRules = new Array(
new shipRule(0.01,  15.00,0,0,3.50,false,'USA|United States',true),
//new shipRule(15.01, 24.99,0,0,5.00,false,'USA|United States',true),
//new shipRule(25.00, 5000.00,0,0,0.00,false,'USA|United States',true)
new shipRule(15.01, 30.00,0,0,5.00,false,'USA|United States',true),
new shipRule(30.01, 50.00,0,0,7.00,false,'USA|United States',true),
new shipRule(50.01, 60.00,0,0,9.00,false,'USA|United States',true),
new shipRule(60.01, 70.00,0,0,11.00,false,'USA|United States',true),
new shipRule(70.01, 100.00,0,0,13.00,false,'USA|United States',true),
new shipRule(100.01, 5000.00,0,0,0.00,false,'USA|United States',true)
);

// set whether you will use discounts on your site or not.
var useDiscount = true;

// if you're using discounts, set whether you want to allow
// discounts by quantity or by a code. If set to false,
// then the discount will be by code. Default is to 
// discount by quantity!
var discountByQty = false;

// fill this array with the quantity range and the percentage discount.
// Formatting (discount by quantity):
// one discount option per line: 'Min qty | Max qty | Percent'
// Formatting (discount by code):
// one discount option per line: 'Code | Percent'
// to make things easy, discount codes will be converted to lowercase
// before matching so customers won't need to worry about it.
var discountArray = new Array(
// January Email Code
//'x126|.25',
// New Customers Coupon on next order

//  Survey Discount Coupon
// 0503M Ends 6/15/03
//'0503M|.25',
//'0503m|.25',
// wedding promotion email
'2628|.15',
'5736|.25'
//'new|.20',
//'gift|.25'
);

// set this option for which credit cards you accept
// use the same formatting as the shipOptions
var cardOption = new Array(
//'Visa',
//'MasterCard',
//'Discover',
//'American Express'
);

// set whether you'd like to allow a printable form for orders
// If you don't use a printable form, then make sure you
// have your form or gateway based ording variables set!
// default is true
var usePrint = true;

// set whether you want to allow CGI or ASP form based order submission.
// default is true
var useForm = false;

// set whether you want to allow order submission through a payment
// gateway or alternate method
var useGateway = true;

// set wether you want to allow customers the option to use
// unsecure order submission (not including printable forms)
// if useSecure is false and/or you're missing your secure
// page settings, the cart defaults to unsecure ordering
var useUnsecure = true;

// set whether you want to allow secure order submission.
// default is true
var useSecure = false;

// the page that displays the cart contents
// if the cart script is on this page, it will display
// update/delete buttons for your items
// otherwise, it displays as a receipt format.
var cartPage = 'cart.html';

// set the names of the cart pages
// the page where we get the shipping information
var COstep1 = 'customer_data.html';

// the last step for printing an order form (verify address, etc.)
var COprintVerify = 'printorder.html';

// the printable order form
var COprint = 'printorder.html';

// the page that will build the form data
// for posting to your form handling CGI/ASP
// this will post to the unsecure form handler
// defined by 'unsecurePostAction'
var COform = 'gateway.html';

// the page that will build the form data
// for credit card validation
// through your merchant account
// this will post to the unsecure form handler
// defined by 'unsecureGatewayAction'
var COgateway = 'gateway.html';

// the page that will build the form data
// for the secure CGI/ASP order form submission
// This posts the order to your form handling CGI script
// defined by 'securePostAction'
var COsecureForm = 'secure_formorder.html';

// the page tha will build the form data
// for secure credit card validation
// through your merchant account
// this posts the order to the merchant account gateway
// or account handling script defined by 'secureGatewayAction'
var COsecureGateway = 'secure_gateway.html';

// set CGI/ASP Post Action path (non-secure)
// if you aren't using CGI/ASP submission, then set to ""
var unsecurePostAction = 'http://www.bathtimegoodies.com/cgi-bin/bnbform.pl';

// set the Post Action for your particular
// credit card gateway processor
// see your processor documentation for this address
var unsecureGatewayAction = 'http://www.bathtimegoodies.com/cgi-bin/bnbform.pl';

// set up the Post action for your secure form.
// If you aren't using secure ordering, then set securePostAction = ""
var securePostAction = '';

// set up the Post action for your secure form.
// If you aren't using secure ordering, then set securePostAction = ""
var secureGatewayAction = '';

// set the path to your SSL here. If you aren't using
// secure server, then this variable isn't necessary
var securePath = '';

// set up an array of tags for your specific form handling CGI script
// see the form script help file for required/optional tags
// be sure to use escape charcaters (see example)!
// by default, these tags are specifically coded for use with
// Matt's Script Archive formmail.cgi
var extraFormTags = new Array(
'<input type="hidden" name="submit_to"  value="info@bathtimegoodies.com">',
'<input type="hidden" name="form_id"    value="BTG - OnLine Order">',
'<input type="hidden" name="title"      value="Order Conformation">',
'<input type="hidden" name="submit_by"  value="info@bathtimegoodies.com">',
'<INPUT TYPE="HIDDEN" NAME="outputfile" VALUE="Sales">',
// '<input type="hidden" name="data_order" value="Customer_Name,Customer_Email,Customer_Address_1,Customer_Address_2,Customer_City,Customer_State,Customer_Zip,Customer_Country,Customer_Phone,Ship_To,Ship_To_Email,Ship_To_Address_1,Ship_To_Address_2,Ship_To_City,Ship_To_State,Ship_To_Zip,Subtotal,Discount,Tax,Shipping,Total,Item1,Item2,Item3,Item4,Item5,Item6,Item7,Item8,Item9,Item10,Item11,Item12,Item13,Item14,Item15,Item16,Item17,Item18,Item19,Item20,Order_ID,">'
'<input type="hidden" name="data_order" value="card_holder_name,email,street_address,street_address_2,city,state,zip,country,phone,ship_name,Ship_To_Email,ship_street_address,ship_street_address_2,ship_city,ship_state,ship_zip,Subtotal,Discount,Tax,Shipping,Total,Item1,Item2,Item3,Item4,Item5,Item6,Item7,Item8,Item9,Item10,Item11,Item12,Item13,Item14,Item15,Item16,Item17,Item18,Item19,Item20,Order_ID,">'
);

// set the name of the field that designates the mail recipient for
// your form handling CGI or ASP. This gets used to add the customer's email
// to this field so that they get a copy of the order as well.
// leave blank if you have another method of mailing a receipt to the
// customer
var cgiMailField = '';

// Shipping Rule Object - Do not edit
function shipRule(amtLbound,amtUbound,qtyLbound,qtyUbound,shipCost,percent,countries,applyDomestic){
	this.amtLbound     = amtLbound;
	this.amtUbound     = amtUbound;
	this.qtyLbound     = qtyLbound;
	this.qtyUbound     = qtyUbound;
	this.shipCost      = shipCost;
	this.percent       = percent;
	this.countries     = countries;
	this.applyDomestic = applyDomestic
}