
var FoxyDomain = "oldsalem.foxycart.com/"; // replace this with your store subdomain
var timer = 0;
// this function hides the cart in a very nice way
function json_cart_fade_out(){
     if (timer != 0){
          clearTimeout(timer);
          timer = 0;
     }
     $("#fc_cart").animate({
      top: 0 - $("#fc_cart").height(),
      opacity: 0
      }, 1000);
}
$(document).ready(function(){

  $('#fc_cart').show();
 
});
 
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 = "";
        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_FoxyCart is a javascript variable that now holds your shopping cart data
 		fc_FoxyCart += "<tr id=\"cartTotal\"><td><strong>Total</strong>: <span style=\"margin-left: 30px;\" >$" + fc_json.total_price.toFixed(2) + "</span></td></tr>"; 
        // if you have some products in your cart, why not display it?
        if (fc_json.products.length > 0) {
				fc_FoxyCart1 = "<img src=\"assets/templates/oldsalem/images/yourCart.png\" alt=\"Your cart\"/><div class=\"showCart\"><div id=\"fc_cart\"><div class=\"fc_clear\"></div><table><thead><th>item (qty) </th></thead><tbody id=\"cart_content\">";
				
				fc_FoxyCart2 ="</tbody></table><a href=\"https://oldsalem.foxycart.com/cart?cart=view\" id=\"fc_edit_link\" class=\"foxycart\" style=\"text-align: middle;\">Edit Cart</a><a href=\"https://oldsalem.foxycart.com/cart?cart=checkout\" id=\"fc_checkout_link\" style=\"width: 70px;float: right; padding: 0px; margin:0px; height: 20px;\"></a><div class=\"fc_clear\"></div></div><ul><li class=\"horizontal_line_2\"></li></ul></div>";
				
				fc_FoxyCart =  fc_FoxyCart1 + fc_FoxyCart + fc_FoxyCart2;
				
				//alert(fc_FoxyCart);
				
                $("#cart_contentAll").html(fc_FoxyCart);
        } else {
                $("#cart_contentAll").html("");
        }
}
// 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) {
        fc_FoxyCart += "<tr colspan='2'>";
        fc_FoxyCart += "<td>" + fc_name + "(" + fc_quantity +")" +"</td> </tr>";
//      fc_FoxyCart += "<td>" + fc_options + "</td>";
//      fc_FoxyCart += "<td>" + fc_code + "</td>";
        fc_FoxyCart += "<tr colspan='2'><td>&nbsp; price: " + fc_price.toFixed(2) + "</td></tr>";
		fc_FoxyCart += "<tr><td>&nbsp;</td></tr>";
//      fc_FoxyCart += "<td>" + fc_price_each + "</td>";
//        fc_FoxyCart += "<td class=\"right-align\">" + fc_price + "</td>";
//        fc_FoxyCart += "</tr>";
}

