 function hideCart(){ 
 		$("#cartSpace").hide();
		}
 function showButton(){ 
 		$("#showHide").html("<a href='javascript:showCart()'><img src='/image/navigation/CartMax.gif' border='0' width='21' height='16' style='padding-top: 1px; margin-top: 1px;' alt='Show cart'></a>");
		$("#cartSpace").animate({top: 76}, 500);
 }
 function showCart(CartID, selector, cartLinks, mainCategory, country, currency ){
	  	changeCart(selector, CartID, cartLinks, mainCategory);
	
	 	$("#cartSpace").show();
		$.ajax({
			type: "POST",
			url: "/ajaxCart.php",
			data: "cartID="+CartID+"&country="+country+"&currency="+currency+"&maincat="+mainCategory+"&cartlinks="+cartLinks+"",
			success: updateTotals,
			error: showError
			});
		setTimeout("hideCart()", 10000);
		
 }
 function updateTotals(data, status){
	  cartItems = data.split(":");	 
	 if(cartItems[0]==''){cartItems[0]=0;}
	 if(cartItems[1]==''){cartItems[1]=0;} 
	 
//	 $("#cartAmount").html("<a href='/my_cart_big.php3?Selector=cart'>Shopping Bag</a> (<b>" + cartItems[0] + "</b>)");	
//	 $("#wishAmount").html("<a href='/my_cart_big.php3?Selector=wish'>Saved Items</a> (<b>" + cartItems[1] + "</b>)");		
	 $("#cartAmount").html("(<b>" + cartItems[0] + "</b>)");	
	 $("#wishAmount").html("(<b>" + cartItems[1] + "</b>)");	
 
 }
 function showDetails(element){
	xpos = document.getElementById("I-"+element+"").offsetLeft;
	ypos = document.getElementById("I-"+element+"").offsetTop;
	 $("#P-"+element+"").css({ left: (xpos+10), top: (ypos+57) });
	 $("#P-"+element+"").show(); 
 }
 function hideDetails(element){ $("#P-"+element+"").hide();}
 
 function getCartDetails(cartID, selector, cartLinks, mainCategory, country, currency){
	 $.ajax({
			type: "POST",
			url: "/cartDisplay.php",
			data: "cart="+cartID+"&selector="+selector+"&mainC="+mainCategory+"&catLinks="+cartLinks+"&country="+country+"&currency="+currency+"",
			success: showCartDetails,
			error: showError
			});
 }
 function showCartDetails(data, status){
	 		allHTML = data.split("|");
			cart = allHTML[2];
			
			if (cart=='cart')
			{
				$('#cartView').html(allHTML[0]);
				$("#shoppingCartInfo").html(allHTML[1]);
			}
			else
			{
				$('#wishView').html(allHTML[0]);
				$("#shoppingWishInfo").html(allHTML[1]);
			}
			//$("#shoppingCartitems").html(allHTML[0]);
			
			
			
 }
 function showError(xhr, reason, ex){
		 	$("#content").text(xhr+" -- "+reason+" -- "+ex);
 }
 function checkCartStatus()
 {
	var cookieStatus = ReadCookie("DDScart");
	if (cookieStatus !="")
		{
			if (cookieStatus == "open") 
				{ 
				$("#cartSpace").css({ top: 0 });
				$("#showHide").html("<a href='javascript:hideCart()'><img src='/image/navigation/CartMin.gif' border='0' width='21' height='16' style='padding-top: 1px; margin-top: 1px;' alt='Hide cart'></a>");
				}
				else 
				{ 
				$("#showHide").html("<a href='javascript:showCart()'><img src='/image/navigation/CartMax.gif' border='0' width='21' height='16' style='padding-top: 1px; margin-top: 1px;' alt='Show cart'></a>");
				$("#cartSpace").css({ top: 76 });
				}
		}
		else
		{
				document.getElementById("cartSpace").style.top = 0; // default is open.
		}
}
function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
function changeCart(selector, cartID, cartLinks, mainCategory){
	
	if (selector=="cart" || selector=="Cart" ) 
		{
			
			//$('#cartTab').html("<li><a id='cartLink' style='background-color:#FFF;font-size:10px;' href=\"/my_cart_big.php3?Selector=cart&"+cartLinks+"&mainCategory="+mainCategory+"\">My Bag</a></li>");
			//$('#wishTab').html("<li><a id=\"wishLink\" style=\"background-color:#F4F4F4;font-size:10px;\" href=\"/my_cart_big.php3?Selector=wish&"+cartLinks+"&mainCategory="+mainCategory+"\" onmouseover=\"javascript:changeCart('wish', "+cartID+",'"+cartLinks+"','"+mainCategory+"')\" >Saved Items</a></li>");
			//$("#cartLink").attr("href", "/my_cart_big.php3?Selector=cart&"+cartLinks+"&mainCategory="+mainCategory+"");
			$('#cartView').show(); $('#wishView').hide();
		}
		else
		{
			//$('#cartTab').html("<li><a id='cartLink' style='background-color:#F4F4F4;font-size:10px;' onmouseover=\"javascript:changeCart('cart', "+cartID+",'"+cartLinks+"','"+mainCategory+"')\" href='http://www.allaboutdance.com/my_cart_big.php3?Selector=cart'>My Bag</a></li>");
			//$('#wishTab').html("<li><a id=\"wishLink\" style=\"background-color:#FFF;font-size:10px;\" href=\"http://www.allaboutdance.com/my_cart_big.php3?Selector=wish\" >Saved Items</a></li>");
			//$("#wishLink").attr("href", "/my_cart_big.php3?Selector=wish&"+cartLinks+"&mainCategory="+mainCategory+"");
			$('#cartView').hide(); $('#wishView').show();
		}
		
		return;
}
function displayExtras(cartID, selector){
	 		 $.ajax({
			type: "POST",
			url: "/extraTools.php",
			data: "cart="+cartID+"&selector="+selector+"",
			success: function(data, status){
							$("#content").html(""+data+"");
			},
			error: showError
			});
}

