var FoxyDomain = "cart.ldsmusicnow.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(){
   // shows the cart when the mouse is positioned on an specific link
   $(".fc_link").mouseover(function(){
   if (timer!= 0){
        clearTimeout(timer);
        timer = 0;
   }
 
   $("#fc_cart").animate({
             opacity: '.99',
             top: '0px'
       }, 1000);
   timer = setTimeout(function(){
      json_cart_fade_out();
   }, 2500);
   // if the user is looking/using the cart don't hide it
   $("#fc_cart").hover(function(){
      clearTimeout(timer);
      timer = 0;
   }, function(){
      timer = setTimeout(function(){
        json_cart_fade_out();
      }, 1000);
   });
 
   });
 
});
 
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_saFoxyCart = "";
		fc_saFoxyCartQ = "";
		fc_saFoxyCartP = 0;
        
		fc_FoxyCart += "<tr align='left'>";
		fc_FoxyCart += "<th>item</th>";
		fc_FoxyCart += "<th>qty</th>";
		fc_FoxyCart += "<th>price</th>";
		fc_FoxyCart += "</tr>";
		
		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_saFoxyCartQ = parseInt(fc_saFoxyCartQ + fc_json.products[i].quantity);
			fc_saFoxyCartP += (100 * parseFloat(fc_json.products[i].price));
			}
			fc_saFoxyCartP /= 100;
 
 		fc_saFoxyCart += "your cart: ";
		fc_saFoxyCart += fc_saFoxyCartQ;
		fc_saFoxyCart += " items $";
		fc_saFoxyCart += fc_saFoxyCartP.toFixed(2);
 
        // fc_FoxyCart is a javascript variable that now holds your shopping cart data
        // if you have some products in your cart, why not display it?
        if (fc_json.products.length > 0) {
                $("#fc_cart #cart_content").html(fc_FoxyCart);
				$("#fc_sacart #cart_sacontent").html(fc_saFoxyCart);
        } else {
		        $("#fc_cart #cart_content").html("Your cart: 0 items  $0.00");
				$("#fc_sacart #cart_sacontent").html("your cart: 0 items  $0.00");
        }
}
// 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 align='left'>";
        fc_FoxyCart += "<td>" + fc_name + "</td>";
//      fc_FoxyCart += "<td>" + fc_options + "</td>";
//      fc_FoxyCart += "<td>" + fc_code + "</td>";
        fc_FoxyCart += "<td>" + fc_quantity + "</td>";
//      fc_FoxyCart += "<td>" + fc_price_each + "</td>";
        fc_FoxyCart += "<td>" + "$" + fc_price.toFixed(2) + "</td>";
        fc_FoxyCart += "</tr>";
		
	/*	fc_saFoxyCart += "your cart:";
		fc_saFoxyCart += "1";
		fc_saFoxyCart += "items ";
		fc_saFoxyCart += "$";*/
}