/*-------------------------------------------------------------------------------------------------
refreshCartWidget(qty):
qty = used to force a cart value

Only uses the qty variable on first press of add to card before a guest account has been used. 
Because can't grab the cookie right away, we manually push this qty to the cart 
-------------------------------------------------------------------------------------------------*/
function refreshCartWidget(qty) {
	
	document.getElementById("results_refreshCartWidget").style.display = "block";
	
	// If a qty wasn't passed it means this was called on page load. 
	if(qty == null) {
		qty = 'dontuse';
	}
	// Not called on page load, so do loader
	else {
		if(document.getElementById("widgetCartBackground").style.backgroundImage.indexOf("Empty") == -1) {
			document.getElementById("widgetCartLoader").style.display = "block";
		}
		else {
			document.getElementById("widgetCartLoaderEmpty").style.display = "block";
		}
	}
	
	var gwoTest = (document.getElementById("GWO")) ? document.getElementById("GWO").value : "";
	
	params     = new Array(); i = 0;
	params[i]  = "action=refreshCartWidget"; i++;	
	params[i]  = "qty=" + qty; i++;
	params[i]  = "gwoTest=" + gwoTest; i++;
	
	//  The results is put in the div that holds a text input created for each product by printCart
	putResults = "results_refreshCartWidget";	 
	 
	ajaxMagic('/store/cart/cart_ajax.php',params,putResults,'','doNotFade','doNotLoad'); 
	
	
	
}





