//processing// <SCRIPT LANGUAGE=JScript RUNAT=SERVER> // commented out client side but not server side!! 

// library scripts, redundant calculation on server and client to prevent fraud 


// formatting function, prettyprints dollars and cents 
function formatDollars (num) // formats a number with exactly 2 decimal places 
{
var v = String (Math.ceil (num * 100 - .001) / 100); // round up to the nearest cent 
v += (v.indexOf (".") == -1) ? ".00" : "00"; // add trailing zeros 
return v.substr (0, v.indexOf (".") + 3); // but not too many 
}

// Data for each sku (poor man's database) 
function sku (id, price, shipping, skuDescription, description) 
{
this.id = id; this.price = price; this.shipping = shipping; this.skuDescription = skuDescription; 
this.description = description + " $" + formatDollars (price) + " plus " + formatDollars (shipping) + " shipping and handling";
}
// planning to make sim_Request.asp x_Description  = "MyoRx Online Purchase-- " + skuDescription 
var skus = new Array () 
skus [0] = new sku ("sku0", 14.95, 3.95, "Introductory package 1 jar", "<strong>Introductory</strong> Offer-- MyoRx single jar, only") 
skus [1] = new sku ("sku1", 39.95,  6.95, "Standard package 3 jars", "<strong>MyoRx Standard Package</strong>, 3 jar package for") 
skus [2] = new sku ('sku2', 79.90,  13.90, 'OneJarFree package 7 jars', "<strong>One Jar FREE</strong>-- MyoRx 7 jar package for") 
skus [3] = new sku ("sku3", 119.85,  20.85, "SuperSaver pacakage 11 jars", "Best Value-- MyoRx <strong>Super-Saver</strong>, 11 jars for") 


// Tax rates 
var waTax = .086
var isWa = false

function skuDescription (skuI) {return skus [skuI].skuDescription} 
function setWa (yes) {isWa = yes} 
function price (skuI) {return skus [skuI].price} 
function shipping (skuI) {return skus [skuI].shipping} 
function tax (skuI) {return (!isWa) ? 0 : (Math.ceil (skus [skuI].price * waTax * 100 - .001) / 100)} 
function total (skuI) {return skus [skuI].price + skus [skuI].shipping + tax (skuI)} 

//</script> 

