var FoxyDomain = "hungrylizard.foxycart.com/";
 
function fc_PreProcess() {
	// do something here before opening the cart... maybe some form error checking?
        // if you don't want the cart to open, say for example if there were some data validation problems you
        // want your customer to fix, then return false from this function instead of true.
	return true;
}
 
function fc_BuildFoxyCart() {
	
	fc_FoxyCart = "";
	fc_FoxyCart += "<div><table style='width:189px;color:#000' border=0 id=\"fc_table\">";
	fc_FoxyCart += "<tr>";
	fc_FoxyCart += "<th align='left' style='width:80px;'>Product</th>";
//	fc_FoxyCart += "<th>Options</th>";
//	fc_FoxyCart += "<th>Code</th>";
	fc_FoxyCart += "<th style='width:20px;'>Qty</th>";
//	fc_FoxyCart += "<th>Price Each</th>";
	fc_FoxyCart += "<th align='right' style='width:45px;'>Price</th>";
	fc_FoxyCart += "</tr>";
	fc_temp_price = 0;
	for (i=0;i<fc_json.products.length;i++) {
		// BEGIN DO NOT EDIT
		
		fc_BuildFoxyCartRow(fc_json.products[i].name,fc_json.products[i].code,fc_json.products[i].options,fc_json.products[i].quantity,fc_json.products[i].price_each,fc_json.products[i].price);
		// END DO NOT EDIT
		fc_temp_price = fc_temp_price + fc_json.products[i].price;
	}
	
	fc_FoxyCart += "</table>";
	
		//fc_FoxyCart += fc_total_price
	fc_FoxyCart += "<br /><table style='width:189px;color:#000'' border=0><tr>";
	fc_FoxyCart += "<td align='right' valign='top'>Total:</td>";
	fc_FoxyCart += "<td align='right' valign='top' style='width:45px;'>$" + fc_CurrencyFormatted(fc_temp_price) + "</td>";
	fc_FoxyCart += "</tr>";
	fc_FoxyCart += "</table></div>";
	//document.getElementById("jsonCart").innerHTML = fc_FoxyCart;
	// fc_FoxyCart is a javascript variable that now holds your shopping cart data
 	//alert(jQuery("#jsonCart").html);
	// if you have some products in your cart, why not display it?
	if (fc_json.products.length > 0) {
		jQuery("#jsonCart").html(fc_FoxyCart);
	} else {
		jQuery("#jsonCart").html("");
		}
	adjCols('leftNav','content');
}
 
// This function is called by fc_BuildFoxyCart() for each product in your cart.
// Feel free to edit this function as needed to display each row of your cart.
function fc_BuildFoxyCartRow(fc_name,fc_code,fc_options,fc_quantity,fc_price_each,fc_price) {

	if (fc_options.Heatpack==undefined)
	{
		tempSTR = "Without Heatpack";
	}else{
		tempSTR = fc_options.Heatpack;	
	}
	fc_temp =  fc_options.Sizes  + " " +  tempSTR;
	fc_FoxyCart += "<tr>";
	fc_FoxyCart += "<td align='left' valign='top'>" + fc_name +" (" + fc_temp +  ")</td>";
//	fc_FoxyCart += "<td>" + fc_options + "</td>";
//	fc_FoxyCart += "<td>" + fc_code + "</td>";
	fc_FoxyCart += "<td align='right' valign='top'>" + fc_quantity + "</td>";
//	fc_FoxyCart += "<td align='right'>$" + fc_CurrencyFormatted(fc_price_each) + "</td>";
	fc_FoxyCart += "<td align='right' valign='top'>$" + fc_CurrencyFormatted(fc_price) + "</td>";
	fc_FoxyCart += "</tr>";
}




function fc_CurrencyFormatted(amount) {
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = "";
	if(i < 0) { minus = "-"; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf(".") < 0) { s += ".00"; }
	if(s.indexOf(".") == (s.length - 2)) { s += "0"; }
	s = minus + s;
	return s;
}