var FoxyDomain = "thor.foxycart.com";


var w_array=new Array(); 
	 w_array[1]=2  ;w_array[2]=3;  w_array[3]=5;  w_array[4]=6 ; w_array[5]=7;  w_array[6]=9; w_array[7]=11; w_array[8]=12; w_array[9]=14;w_array[10]=15;w_array[11]=16;w_array[12]=17;
	w_array[13]=19;w_array[14]=20;w_array[15]=22;w_array[16]=23;w_array[17]=24;w_array[18]=26;w_array[19]=28;w_array[20]=29;w_array[21]=31;w_array[22]=32;w_array[23]=33;w_array[24]=34;
	w_array[25]=36;w_array[26]=37;w_array[27]=39;w_array[28]=40;w_array[29]=41;w_array[30]=43;w_array[31]=45;w_array[32]=46;w_array[33]=48;w_array[34]=49;w_array[35]=50;w_array[36]=51;
	w_array[37]=53;w_array[38]=54;w_array[39]=56;w_array[40]=57;w_array[41]=58;w_array[42]=60;w_array[43]=62;w_array[44]=63;w_array[45]=65;w_array[46]=66;w_array[47]=67;w_array[48]=68;
	
	
	

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);
		document.getElementById("thor_cart").style.visibility = "visible";
	} else {
		jQuery("#jsonCart").html("");
		
		//hide div
		document.getElementById("thor_cart").style.visibility = "hidden";
		
		}
	
}
 
// 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) {


	tempSTR="";
	fc_temp =  fc_options.Sizes  + " " +  tempSTR;
	fc_FoxyCart += "<tr>";
	fc_FoxyCart += "<td align='left' valign='top'>" + fc_name +  "</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;
}
