function cart_mini_offset() {
	// $j('#cart_mini_offset').animate({
	// 	height: $j('#cart_mini').height()
	// }, 1250);
	$j('#cart_mini_offset').slideDown(1250);
}

function cart_mini_alert() {
	$j('#cart_mini_alert').fadeIn('slow');
	setTimeout('$j("#cart_mini_alert").fadeOut("slow")', 7500);
}

function cart_mini_thickbox_close() {
	$j('#fc_tb_overlay, #fc_tb_window, #fc_tb_load').remove();
	fc_BuildFoxyCart();
	alert('delayed?');
}

// Set a counter so we can avoid sliding the cart down on page load
counter = 0;

function fc_BuildFoxyCart() {
	// Define the JSON cart output
	fc_FoxyCart = '';
	// Set a loop to go through the products in the cart
	for (i=0; i<fc_json.cart.length; i++) {
		fc_BuildFoxyCartRow(fc_json.cart[i].product.name,fc_json.cart[i].product.code,fc_json.cart[i].product.options,fc_json.cart[i].product.quantity,fc_json.cart[i].product.price_each,fc_json.cart[i].product.price);
	}
	
	// If the JSON has anything in it, stick it into your #cart_mini_content element
	// Otherwise, empty that element.
	if (fc_json.cart.length > 0) {
		$j("#cart_mini_content").html(fc_FoxyCart);
		if (!$j('#cart_mini').hasClass('sticky_true')) $j('#cart_mini').viewSticky();
		// cart_mini_offset();
	} else {
		$j("#cart_mini_content").html("");
	}
	
	// Do anything else you want to do, like insert the subtotal into an element
	$j('#cart_mini_subtotal').html('$' + fc_json.total_price);
	
	// If you don't want the JSON cart to display on page load, you can use a counter.
	// fc_BuildFoxyCart() gets called on pageload, so adding this counter will prevent it from loading
	// that first time.
	// Uncomment and customize the bottom two lines to enable this.
	// if (fc_json.cart.length > 0 && counter != 0) {
	// 	$j('#cart_mini').viewSticky();
	// 	cart_mini_offset();
	// } else if (fc_json.cart.length > 0 && counter == 0) {
	// 	$j('#cart_mini').viewSticky();
	// 	$j('#cart_mini_offset').show();
	// }
	// if (counter != 0) cart_mini_alert();
	counter += 1;
}

// 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.
// For example, you might want to be <li> instead of <span> based,
// or you might want more options displayed (like the item code, the price, etc.).
function fc_BuildFoxyCartRow(fc_name,fc_code,fc_options,fc_quantity,fc_price_each,fc_price) {
	fc_FoxyCart += ' \
		<span class="cart_mini_product"> \
			<span class="name">'+fc_name+'</span> \
			<span class="quantity">('+fc_quantity+')</span> \
		</span> \
	';
}
