shopItems = new Array();
shopItems['id'] = new Array();
shopItems['id'][0] = "clarytone_plastic";
shopItems['id'][1] = "clarytone_unglazed";
shopItems['id'][2] = "clarytone_glazed";
shopItems['id'][3] = "full_fire";
shopItems['id'][4] = "half_fire";
shopItems['id'][5] = "shirts";
shopItems['id'][6] = "twigs";
shopItems['id'][7] = "sheets";
shopItems['id'][8] = "transfers";
shopItems['id'][9] = "transfers_medium";
shopItems['id'][10] = "transfers_small";
shopItems['id'][11] = "didgeridoos";
shopItems['id'][12] = "shakuhachis";
shopItems['id'][13] = "karimbas";
shopItems['id'][14] = "lekolilos_7";
shopItems['id'][15] = "lekolilos_13";
shopItems['id'][16] = "shakers";
shipping = new Array();
shipping['zone'] = new Array();
shipping['rate'] = new Array();
shipping['rate_100'] = new Array();

shipping['zone'][0] = "A";
shipping['rate'][0] = "84.50";
shipping['rate_100'][0] = "2.60";
shipping['zone'][1] = "B";
shipping['rate'][1] = "124.70";
shipping['rate_100'][1] = "3.25";
shipping['zone'][2] = "C";
shipping['rate'][2] = "124.65";
shipping['rate_100'][2] = "11.65";
shipping['zone'][3] = "D";
shipping['rate'][3] = "128.95";
shipping['rate_100'][3] = "10.65";
shipping['zone'][4] = "E";
shipping['rate'][4] = "96.00";
shipping['rate_100'][4] = "16.60";
shipping['zone'][5] = "F";
shipping['rate'][5] = "91.65";
shipping['rate_100'][5] = "14.90";
shipping['zone'][6] = "DOMESTIC";
shipping['rate'][6] = "28.35";
shipping['rate_100'][6] = "3.80";
shipping['zone'][7] = "other";
shipping['rate'][7] = "128.95";
shipping['rate_100'][7] = "16.60";

function showCategory(category_name) {
  groups = document.getElementsByClassName("catalog_group");
  nr_groups = groups.length;
  for (var g=0; g<nr_groups; g++)
    groups[g].style.display = "none";
  setDisplay(category_name, "block");
}

// ShoppingCart prototype
function ShoppingCart() {

// properties
  this.currency_code = "ZAR";
  this.currency_rate = 1.00;
  this.total = 0.0;
  this.shippingCountry = "South Africa";
  this.shippingZone = 'DOMESTIC';
  this.shippingWeight = 0.0;
  this.shippingTotal = 0.0;
  this.checkout_actions = {
    paypal             : "https://www.paypal.com/cgi-bin/webscr",
    paypal_sandbox     : "https://www.sandbox.paypal.com/cgi-bin/webscr",
    monsterpay         : "https://www.monsterpay.com/secure/",
    monsterpay_sandbox : "https://www.monsterpay.com/secure/",
    escrow_notify      : "http://www.aahalearning.com/shopping/escrow.php",
  };
  this.email = "bruce@aahalearning.com";
  this.cartItems = new Array();
  this.cartItems['id'] = new Array();
  this.cartItems['qty'] = new Array();
  this.cartItems['title'] = new Array();
  this.cartItems['weight'] = new Array();
  this.cartItems['total'] = new Array();

// methods
  this.init = init;
  this.setCookies = setCookies;
  this.getCookies = getCookies;
  this.deleteCookies = deleteCookies;
  this.add = add;
  this.remove = remove;
  this.computeTotal = computeTotal;
  this.calcShippingWeight = calcShippingWeight;
  this.calcShipping = calcShipping;
  this.setShipping = setShipping;
  this.selectShipping = selectShipping;
  this.viewShipping = viewShipping;
  this.monsterpayInputs = monsterpayInputs;
  this.paypalInputs = paypalInputs;
  this.viewRemove = viewRemove;
  this.view = view;
  this.setCurrency = setCurrency;
  this.selectCurrency= selectCurrency;
  this.checkTerms = checkTerms;
  this.checkEscrowForm = checkEscrowForm;
  this.checkOut = checkOut;
}

// check for session data in cookies
function init() {
  this.getCookies();
  this.selectCurrency();
  this.selectShipping("shipping");
  this.view(); 
}

// store shopping cart in cookies
function setCookies() {
  setCookie("currency_code", this.currency_code, 1);
  setCookie("currency_rate", this.currency_rate, 1);
  setCookie("shipping_country", this.shippingCountry, 1);
  setCookie("shipping_zone", this.shippingZone, 1);
  var cart_items = "";
  var l = this.cartItems["id"].length;
  for (var i = 0; i < l; i++) {
    cart_items += this.cartItems["id"][i] + "#" + this.cartItems["qty"][i] + "#" + this.cartItems["title"][i] + "#" + this.cartItems["weight"][i] + "#" + this.cartItems["total"][i];
    if (i < l-1) cart_items += "*";
  }
  setCookie("cart_items", cart_items, 1);
}

// fetch shopping cart contents from cookies
function getCookies() {
  var code = getCookie("currency_code");
  var rate = getCookie("currency_rate");
  if (code != "" && code != null && rate != "" && rate != null) this.setCurrency(code + "_" + rate);
  var ship = getCookie("shipping_country");
  if (ship != "" && ship != null) this.shippingCountry = ship; 
  var zone = getCookie("shipping_zone");
  if (zone != "" && ship != null) this.shippingZone = zone; 
  var items = getCookie("cart_items");
  if (items != null && items != "") {
    var items_arr = items.split("*");
    for (var i=0; i<items_arr.length; i++) {
      var item_arr = items_arr[i].split("#");
      this.cartItems["id"][i] = item_arr[0];
      this.cartItems["qty"][i] = parseFloat(item_arr[1]);
      this.cartItems["title"][i] = item_arr[2];
      this.cartItems["weight"][i] = parseFloat(item_arr[3]);
      this.cartItems["total"][i] = parseFloat(item_arr[4]);
    }
    this.computeTotal();  
    this.calcShipping();
  }
}

function deleteCookies() {
//  setCookie("currency_code", "", 0);
//  setCookie("currency_rate", "", 0);
//  setCookie("shipping_country", "", 0);
//  setCookie("shipping_zone", "", 0);
  setCookie("cart_items", "", 0);
}

// select correct currency in catalog dropdown list
function selectCurrency() {
  var curr_select = document.forms.currency_form.currency_select;
  var curr_options = curr_select.options;
  var nr_currs = curr_options.length;
  var c_index = nr_currs - 1;  // corresponds to local currency "ZAR"
  for (var i = 0; i < nr_currs - 1; i++) {
    if (curr_options[i].value.substr(0, 3) == this.currency_code) { 
      c_index = i; break; 
    }
  }
  curr_select[c_index].selected = "1";
}

// Update all currency codes and values
function setCurrency(code_and_rate) {
  code = code_and_rate.substr(0, 3);
  rate = parseFloat(code_and_rate.substr(4));
  this.currency_code = code;
  this.currency_rate = rate;
  this.view();

  codes = document.getElementsByClassName("currency_code");
  for (var c = 0; c < codes.length; c++)
    codes[c].innerHTML = code;

  nr_items = shopItems["id"].length;
  for (var p = 0; p < nr_items; p++) {
    var item_id = shopItems["id"][p]
    var price_id = "price_" + item_id;
    var price_span = document.getElementById(price_id);
    var price = parseFloat(eval("document.forms." + item_id + "_form.price.value"));
    price_span.innerHTML = ((price*rate).toFixed(2)).toString();
  }
}

// set the shipping location in a country dropdown list equal to cart.shippingCountry
function selectShipping(form_name) {
  var country_select = eval("document.forms." + form_name + "_form." + form_name + "_select");
  var coptions = country_select.options;
  var nr_countries = coptions.length;
  var cindex = nr_countries - 1;
  for (var i=0; i<nr_countries - 1; i++) {
    if (coptions[i].text == this.shippingCountry) { 
      cindex = i; break;
    }
  }
  country_select[cindex].selected = "1";
}

function setShipping(shipping_zone, shipping_country) {
  this.shippingZone = shipping_zone;
  this.shippingCountry = shipping_country;
  this.calcShipping(); this.view();
  this.selectShipping("shipping");
  var escrow_total_span = document.getElementById("escrow_total");
  if (escrow_total_span) {
    escrow_total_span.innerHTML = (this.currency_rate*(this.total + this.shippingTotal)).toFixed(2);
  }
}

// add an item to the shopping cart
function add(itemId) {
  this.selectShipping("shipping");
  var shopIndx = shopItems['id'].indexOf(itemId);
  var cart_len = this.cartItems['id'].length;
  var cartIndx = -1;
  for (var i=0; i<cart_len; i++) {
    if (this.cartItems['id'][i] == itemId) {  // check if item already in cart
      cartIndx = i;
    }
  }

  if (cartIndx == -1) {
    cartIndx = cart_len; this.cartItems['qty'][cartIndx] = 0;
    this.cartItems['id'][cartIndx] = shopItems['id'][shopIndx];
    this.cartItems['title'][cartIndx] = eval("document.forms." + itemId + "_form.title.value");
    this.cartItems['weight'][cartIndx] = eval("document.forms." + itemId + "_form.weight.value");
  }

  var qty = parseInt(eval("document.forms." + itemId + "_form.qty.value"));
  if (!isNaN(qty)) {
    var price = parseFloat(eval("document.forms." + itemId + "_form.price.value"));
    this.cartItems['qty'][cartIndx] += qty;  
    this.cartItems['total'][cartIndx] = this.cartItems['qty'][cartIndx]*price;
    this.computeTotal();  this.calcShipping();
    this.view();
  }
}

// remove item(s) from shopping cart
function remove(itemIndx) {
  this.cartItems['id'].splice(itemIndx,1);  this.cartItems['title'].splice(itemIndx,1);
  this.cartItems['qty'].splice(itemIndx,1); this.cartItems['weight'].splice(itemIndx,1);
  this.cartItems['total'].splice(itemIndx,1);
  this.computeTotal(); this.calcShipping();
  if (this.cartItems["id"].length < 1) {this.deleteCookies();}
  this.view();
}

// compute the total due to all items in the cart (shipping excluded)
function computeTotal() {
  var tot = 0.0;
  var cart_len = this.cartItems['id'].length;
  for (var i=0;i<cart_len;i++) {
    tot += this.cartItems['total'][i];
  }
  this.total = tot;
}

function calcShippingWeight() {
  var weight = 0.0;
  var container_weight = 0.0;
  var cart_len = this.cartItems['id'].length; 
  for (var i=0; i<cart_len; i++) {
    weight += (this.cartItems['weight'][i])*(this.cartItems['qty'][i]);
  }
  container_weight = weight*0.1;
  this.shippingWeight = weight + container_weight; 
}

function calcShipping() {
  this.calcShippingWeight();                                                       
  var overWeightLimit = 2.0;			// kilogram
  if (this.shippingZone == 'DOMESTIC') overWeightLimit = 1.0;
  var overWeightRate = 0.0;
  var overWeightTotal = 0.0;

  if (this.shippingWeight > 0.0) {
    var shipIndx = shipping['zone'].indexOf(this.shippingZone); 

    // calculate the shipping rate per parcel (excluding overweight rate)
    this.shippingTotal = parseFloat(shipping['rate'][shipIndx]);    

    // determine how much over weight
    var weightDiff = this.shippingWeight - overWeightLimit;

    // if over weight, calculate the over weight total and add to shipping total
    if (weightDiff > 0.0) { 
      overWeightRate = parseFloat(shipping['rate_100'][shipIndx]);  

      if (this.shippingZone == 'DOMESTIC')
        overWeightTotal = Math.ceil(weightDiff/1.0)*overWeightRate;
      else
        overWeightTotal = Math.ceil(weightDiff/0.1)*overWeightRate;       

      this.shippingTotal += overWeightTotal; 
    }
  }
  else this.shippingTotal = 0.0;
}

function viewShipping() {
  if (this.shippingWeight > 0.0) { 
    setDisplay('view_shipping', 'block');
    showHTML('shipping_total', (this.shippingTotal*this.currency_rate).toFixed(2));
    showHTML('big_total', (this.currency_rate*(this.shippingTotal + this.total)).toFixed(2));
//    selectShipping();
  }
  else setDisplay('view_shipping', 'none');
}

function viewRemove(itemIndx) {
  return "<input type=button title=remove value=' X ' class=button onclick=javascript:Cart.remove(" + itemIndx.toString() + ")>";
}

function view() {
  var cart_len = this.cartItems['id'].length;
  if (cart_len > 0) {
    var cartLines = "";
    var cartHeader = "<table width=100% cellspcaing=2 border=0 cellpadding=0><tr><th class=hitext>Qty</th><th class=hitext>Description</th><th align='right' class='hitext currency_code'>" + this.currency_code + "</th><th class=hitext>Remove</th></tr>";
    var cartFooter = "</table>";
    var cartTotal = "<tr><td colspan=2 align=right><b>SUB TOTAL:</b>&nbsp;</td><td align=right class='hitext'>" +
                     (this.total*this.currency_rate).toFixed(2) + "&nbsp;<span class='currency_code hitext smalltext'>" + this.currency_code + "</span></td><td></td></tr>";
    for (var i=0; i<cart_len; i++) {
      if (this.cartItems['total'][i]!=0.0) {
        cartLines += "<tr><td align=center>" + this.cartItems['qty'][i] + "</td><td>" + this.cartItems['title'][i] + "</td><td align=right>" 
                  + (this.cartItems['total'][i]*this.currency_rate).toFixed(2) + "</td><td align=center>" + viewRemove(i) + "</td></tr>";
        cartLines += "<tr><td colspan=4 ><hr class=ruler2></td></tr>"; 
      }
    }
    setDisplay('cart_default', 'none');  setDisplay('cart_items', 'block');   
    showHTML('cart_items', cartHeader + cartLines + cartTotal + cartFooter);
    setDisplay('view_checkout', 'block');
    setDisplay('checkout_monsterpay', 'block');
    setDisplay('checkout_paypal', 'block');
    this.setCookies();
  }
  else {
    setDisplay('cart_default', 'block'); setDisplay('cart_items', 'none'); setDisplay('view_checkout', 'none');
  }
  this.viewShipping();
}

function monsterpayInputs(mode) {
  var merchant_id = "2PR7X148KT";
  var shopping_url = "http://www.aahalearning.com/shopping/";
  var return_url = "http://www.aahalearning.com/shopping/index.php?alert=success";
  var notify_url = "http://www.aahalearning.com/shopping/monsterpay.php";
  var biz_email = {
    real : "bruce@aahalearning.com",
    sandbox : "testseller1@monsterpay.com",
  }
  var biz = biz_email["real"];
  if (mode == 'sandbox') {
    biz = biz_email['sandbox'];
    merchant_id = "testseller1";
  }
  var sandbox_buyer = "testbuyer1@monsterpay.com";
  var str_inputs = "<input type='hidden' name='MerchantIdentifier' value='" + merchant_id + " '>\n" + 
                   "<input type='hidden' name='CurrencyAlphaCode' value='" + this.currency_code + "' >\n" +
                   "<input type='hidden' name='total' value='" + (this.total*this.currency_rate).toFixed(2) + "'>\n";
  var l = this.cartItems['id'].length;
  for (var j = 0; j < l; j++) {
    var itemId = this.cartItems["id"][j];
    var base_price = parseFloat(eval("document.forms." + itemId + "_form.price.value"));
    var price = (this.currency_rate*base_price).toFixed(2);
    if (j==0) {
      str_inputs += "<input type='hidden' name='LIDSKU' value='" + this.cartItems['id'][0] + "'>\n" +
                    "<input type='hidden' name='LIDDesc' value='" + this.cartItems['title'][0] + "'>\n" +
                    "<input type='hidden' name='LIDWeight' value='" + this.cartItems['weight'][0] + "'>\n" +
                    "<input type='hidden' name='LIDQty' value='" + this.cartItems['qty'][0].toString() + "'>\n" +
                    "<input type='hidden' name='LIDPrice' value='" + price + "'>\n" +
                    "<input type='hidden' name='ShippingRequired' value='0'>\n";
    }
    else {
      str_inputs += "<input type='hidden' name='LIDSKU" + j.toString() + "' value='" + this.cartItems['id'][j] + "'>\n" +
                    "<input type='hidden' name='LIDDesc" + j.toString() + "' value='" + this.cartItems['title'][j] + "'>\n" +
                    "<input type='hidden' name='LIDWeight" + j.toString() + "' value='" + this.cartItems['weight'][j] + "'>\n" +
                    "<input type='hidden' name='LIDQty" + j.toString() + "' value='" + this.cartItems['qty'][j].toString() + "'>\n" +
                    "<input type='hidden' name='LIDPrice" + j.toString() + "' value='" + price + "'>\n" +
                    "<input type='hidden' name='ShippingRequired" + (j).toString() + "' value='0'>\n";
    }
  }
  str_inputs += "<input type='hidden' name='LIDSKU" + l.toString() + "' value='shipping'>\n" +
                    "<input type='hidden' name='LIDDesc" + l.toString() + "' value='<b>Shipping and Handling</b>'>\n" +
                    "<input type='hidden' name='LIDWeight" + l.toString() + "' value='1'>\n" +
                    "<input type='hidden' name='LIDQty" + l.toString() + "' value='1'>\n" +
                    "<input type='hidden' name='LIDPrice" + l.toString() + "' value='" + (this.shippingTotal*this.currency_rate).toFixed(2) + "'>\n" +
                    "<input type='hidden' name='ShippingRequired" + l.toString() + "' value='0'>\n";
  return str_inputs;
}

function paypalInputs(mode) {
  var merchant_id = "3UB4W6YM4VY2Y";
  var shopping_url = "http://www.aahalearning.com/shopping/";
  var return_url = "http://www.aahalearning.com/shopping/index.php?alert=success";
  var notify_url = "http://www.aahalearning.com/shopping/paypal.php";

  var biz_email = {
    real : "bruce@aahalearning.com",
    sandbox : "stefan_1279787033_biz@gmail.com",
  }
  var sandbox_buyer = "john_1279791827_per@gmail.com";

  var biz = biz_email['real'];
  if (mode == 'sandbox') biz = biz_email['sandbox'];

  var str_inputs = "<input type='hidden' name='cmd' value='_cart'>\n" +
		   "<input type='hidden' name='upload' value='1'>\n" +
		   "<input type='hidden' name='business' value='" + biz + "'>\n" + 
		   "<input type='hidden' name='currency_code' value='" + this.currency_code + "'>\n" + 
		   "<input type='hidden' name='notify' value='" + notify_url + "'>\n" + 
		   "<input type='hidden' name='shopping_url' value='" + shopping_url + "'>\n" + 
		   "<input type='hidden' name='return' value='" + return_url + "'>\n" + 
		   "<input type='hidden' name='country' value='" + this.shippingCountry + "'>\n" + 
		   "<input type='hidden' name='total' value='" + (this.currency_rate*(this.shippingTotal + this.total)).toFixed(2) + "'>\n" + 
                   "<input type='hidden' name='handling_cart' value='" + (this.shippingTotal*this.currency_rate).toFixed(2) + "'>\n";

  var nr_items = this.cartItems["id"].length;
  for (var j = 1; j <= nr_items; j++) {
    var itemId = this.cartItems["id"][j-1];
    var J = j.toString();
    var base_price = parseFloat(eval("document.forms." + itemId + "_form.price.value"));
    var price = (this.currency_rate*base_price).toFixed(2);
    str_inputs += "<input type='hidden' name='item_name_" + J + "' value='" + this.cartItems["title"][j-1] + "'>\n" +
		  "<input type='hidden' name='quantity_" + J + "' value='" + this.cartItems["qty"][j-1] + "'>\n" + 
		  "<input type='hidden' name='amount_" + J + "' value='" + price + "'>\n" + 
                  "<input type='hidden' name='shipping_" + J + "' value='0'>\n";

  }
  return str_inputs;
}

function checkTerms(terms_type) {
  if (terms_type == "payment") {
    var terms_agree = document.forms.checkout_form.terms_agree.checked;
    if (!terms_agree) {
      alert("You have to agree with our Payment Terms and Conditions if you want to proceed.");
      return 0;
    }
  }
  else if (terms_type == "escrow") {
    var terms_escrow_agree = document.forms.checkout_form.terms_escrow_agree.checked;
    if (!terms_escrow_agree) {
      alert("You have to agree with our Escrow Terms and Conditions if you want to use Escrow.");
      return 0;
    }
  }
  return 1;
}

// check that all required fields have been filled correctly in the Escrow details form
function checkEscrowForm() {
  var eform = document.forms.escrow_form;
  var result = "";
  results = {
    email : "Please Enter a Valid Email Address", 
    name : "Please Enter your Name",
    surname : "Please Enter your Surname",
    tel : "Please Enter your Telephone or Cellphone Number",
    street1 : "Please Enter your Street Name",
    city : "Please Enter the name of your City",
    region : "Please Enter your State/Region or Province",
    code : "Please Enter your Postal Code",
    airport : "Please Enter your Nearest Airport (for example 'Los Angeles')",
  }
  if (!isValidEmail(eform.email.value.trim())) {
    alert(results["email"]); 
    return false;
  }
  for (var field in results) {
    result = eval("eform." + field + ".value.trim()");
    if (!result) {
      alert(results[field]);
      return false;
    }
  }
  return true;
}

function checkOut(method) {
  var paypal_methods = ("paypal", "paypal_sandbox");
  var paypal_no_currencies = ["ZAR"];
  var monster_methods = new Array ("monsterpay", "monsterpay_sandbox");
  var monster_currencies = ["ZAR", "USD"];
  var escrow_currencies = ["USD"];

  // Check to see if the correct checkout method is being used

  var cform = document.forms.checkout_form;
  switch (method) {
    case "monsterpay"         : if (checkTerms("payment")) {
                                  if (!isIn(this.currency_code, monster_currencies)) {
                                    alert("Monsterpay accepts only the following currencies: " + monster_currencies.join(", ") + ".\nPlease change your currency to one of these codes, or use another checkout option.");
                                    return;
                                  }
                                  showHTML("checkout_inputs", this.monsterpayInputs('real'));
                                  cform.action = this.checkout_actions["monsterpay"];
                                  cform.submit();
 				}
                                break;
    case "monsterpay_sandbox" : if (checkTerms("payment")) {
                                  if (!isIn(this.currency_code, monster_currencies)) {
                                    alert("Monsterpay accepts only the following currencies: " + monster_currencies.join(", ") + ".\nPlease change your currency to one of these codes, or use another checkout option.");
                                    return;
                                  }
                                  showHTML("checkout_inputs", this.monsterpayInputs('sandbox'));
                                  cform.action = this.checkout_actions["monsterpay_sandbox"];
                                  cform.submit();
                                }
                                break;
    case "paypal" :             if (checkTerms("payment")) {
                                  var curr_check = isIn(this.currency_code, paypal_no_currencies);
  				  if (curr_check) {
				    alert("Unfortunately you cannot checkout with PayPal if you want to pay in the local currency (ZAR).\nPlease select another currency, or use another checkout option.");
   				    return;
				  }
				  showHTML("checkout_inputs", this.paypalInputs('real'));
                                  cform.action = this.checkout_actions["paypal"];
                                  cform.submit();
 				}
                                break;
    case "paypal_sandbox" :     if (checkTerms("payment")) {
                                  var curr_check = isIn(this.currency_code, paypal_no_currencies);
  				  if (curr_check) {
				    alert("Unfortunately you cannot checkout with PayPal if you want to pay in the local currency (ZAR).\nPlease select another currency, or use another checkout option.");
   				    return;
				  }
				  showHTML("checkout_inputs", this.paypalInputs('sandbox'));
                                  cform.action = this.checkout_actions["paypal_sandbox"];
                                  cform.submit();
				}
                                break;
    case "escrow" :             var agree = checkTerms("escrow");
				if (agree) {
				  if (!isIn(this.currency_code, escrow_currencies)) {
                                    alert("Escrow accepts only the following currency: " + escrow_currencies[0] + ".\nPlease change your currency, or use another checkout option.");
                                    return;
                                  }
                                  setDisplay("escrow_details", "block");
                                  setDisplay("fade", "block");
				  var escrow_total_span = document.getElementById("escrow_total");
                                  escrow_total_span.innerHTML = (this.currency_rate*(this.shippingTotal + this.total)).toFixed(2);
                                  document.getElementById("escrow_currency").innerHTML = this.currency_code;
 				  window.location.hash = "escrow_details";
                                  this.selectShipping("escrow");
				}
				break;
    case "escrow_notify":       if (this.checkEscrowForm()) {
				  showHTML("escrow_inputs", this.paypalInputs('real'));
				  this.deleteCookies();
				  var eform = document.forms.escrow_form;
                                  eform.action = this.checkout_actions["escrow_notify"];
                                  eform.submit();
				  setDisplay('escrow_details', 'none');
                                  setDisplay('fade', 'none');
  				}
                                break;
  }
}

var Cart = new ShoppingCart();
