function showCart()
{
	$('#cart_blk').slideDown(500, function(){
		$('#cart_top')[0].innerHTML = '<div style="float:left"><a href="shopping_cart.php" class="lnkwht1">CART</a></div><div style="float:right;padding-right:10px;"><a href="javascript:void(0)" onclick="javascript:hideCart()"><img id="arrow_blk" src="img/sort_asc_white.gif" style="border:0px"></a></div><div class="spacer"></div>';
		$('#cart_btm')[0].innerHTML = '<br><a href="shopping_cart.php" class="btn5" style="margin-left:5px"><b>Cart</b></a><a href="checkout.php" class="btn_checkout">Check Out</a>';
		$('#cart_price').slideDown(500);
		});
}
function hideCart()
{
	$('#cart_blk').slideUp(500, function(){
		$('#cart_top')[0].innerHTML = '<div style="float:left"><a href="shopping_cart.php" class="lnkwht1">CART</a></div><div style="float:right;padding-right:10px;"><a href="javascript:void(0)" onclick="javascript:showCart()"><img id="arrow_blk" src="img/sort_desc_white.gif" style="border:0px" alt=""></a></div><div class="spacer"></div>';
		$('#cart_btm')[0].innerHTML = '<div style="padding-left:10px;padding-top:10px;"><span style="color:#FFFFFF">'+totalQuantity+' Item'+((totalQuantity > 1)? 's': '')+'... <b>$'+grandTotal+'</b></span></div>';
		});
}
function changeTopCart(quantity, price)
{
	$('#hdr_cart').fadeOut(500, function(){
			if(quantity == 0)
				$(this).html('<a href="shopping_cart.php" class="lnktop"><img src="img/shopping_bag.gif" alt="Shopping Cart" title="Shopping Cart" style="vertical-align:middle"> Shopping Cart: 0 Items</a>');
			else
				$(this).html('<a href="shopping_cart.php" class="lnktop"><img src="img/shopping_bag.gif" alt="Shopping Cart" title="Shopping Cart" style="vertical-align:middle"> Shopping Cart: '+quantity+' Items</a> &nbsp;<span class="hdr_price">$'+price+'</span>');
			$(this).fadeIn();
		});
}
function deleteItem(productID, productAttributes)
{
	if(confirm("Are you sure you want to delete this Product?"))
	{
		 $.ajax({
		   type: "GET",
		   data: "opt=delete&id="+productID+'&attributes='+productAttributes+'&hash='+parseInt(Math.random() * 10000000000),
		   url: "cart_process.php",
		   success: function(msg){
				showDeleteEffect(msg);
		   }
	   });
   }
}
function showDeleteEffect(msg)
{
	tempURL = location.href;
	tempURL = tempURL.replace(MainSiteURL+'/', "");
	tempURL = tempURL.substring(0, 17);
	if(tempURL == 'shopping_cart.php')
		self.location = 'shopping_cart.php';
   if(msg == 'NO_ITEMS')
   {
	   $('#cart_blk').slideUp(100, function(){
		$('#cart_btm').html('<p style="margin:0px;padding-top:10px;text-align:center;color:#FFFFFF;">(Cart is Empty)</p>');
		$('#hdr_cart').fadeOut(500, function(){
			$(this)[0].innerHTML = '<a href="shopping_cart.php" class="lnktop"><img src="img/shopping_bag.gif" alt="Shopping Cart" title="Shopping Cart" style="vertical-align:middle"> Shopping Cart: 0 Items</a>';
			$(this).fadeIn();
			$('#cart_top')[0].innerHTML = '<a href="shopping_cart.php" class="lnkwht1">CART</a>';
		});
		});
   }
   else
   {
		arrTemp1 = msg.split('<|||>');
		$('#cart_blk').css({paddingLeft:"5px", paddingTop:"5px"});
		$('#cart_blk')[0].innerHTML = arrTemp1[0];
		$('#cart_btm')[0].innerHTML = arrTemp1[1];
		$('#cart_blk').slideDown(1000, function(){
			$('#cart_btm').slideDown();
			$('#cart_top')[0].innerHTML = '<div style="float:left"><a href="shopping_cart.php" class="lnkwht1">CART</a></div><div style="float:right;padding-right:10px;"><a href="javascript:void(0)" onclick="javascript:hideCart()"><img id="arrow_blk" src="img/sort_asc_white.gif" style="border:0px"></a></div><div class="spacer"></div>';
				totalQuantity = arrTemp1[2];
				grandTotal = arrTemp1[3];

				//Change the top cart with effect
				changeTopCart(totalQuantity, grandTotal);
			});
	}
}
$(document).ready(function(){
		animateSeller(1);
		setTimeout('animateSpecial(1)', 1500);
	});
function animateSeller(index)
{
	newIndex = (index + 1) > numSellers? 1: (index + 1);
	$('#seller'+index).fadeIn(500, function(){

		$('#seller'+index).fadeOut(1500, function(){
				$('#seller'+newIndex).fadeIn(500);
				setTimeout('animateSeller(newIndex)', 4500);
			});
	});
}
function animateSpecial(index1)
{
	newIndex1 = (index1 + 1) > numSpecials? 1: (index1 + 1);
	$('#special'+index1).fadeIn(500, function(){

		$('#special'+index1).fadeOut(1500, function(){
				$('#special'+newIndex1).fadeIn(500);
				setTimeout('animateSpecial(newIndex1)', 4500);
			});
	});
}
function categorySlide(index)
{
	oldIndex = $('#old_category')[0].value;
	if(index == oldIndex)
	{
		if($('#sub_cat_'+oldIndex)[0].style.display == 'none')
			$('#sub_cat_'+index).slideDown(500);
		else
			$('#sub_cat_'+index).slideUp(500);
	}
	else
	{
		$('#sub_cat_'+oldIndex).slideUp(500);
		$('#sub_cat_'+index).slideDown(500);
	}
	$('#old_category')[0].value = index;
}
