// JavaScript Document
// count_cart.js
// ***
// * This javascript function updates the count of the cart in header
// * WebSphere Commerce AJAX controller command
// ***
function updateCount() {
	var itemCount = 0;
	dojo.xhrGet({
		url: "CusaUniversalCartOICountView?storeId=10051&catalogId=10051&langId=-1",
		mimetype: "text/html",
		load: function(response,ioArgs) {
		   	  document.getElementById("OICount").innerHTML = response;
    	   	  itemCount = response ;
     		  itemCount = itemCount.substring(0,itemCount.indexOf(" Items"));
     		  if(itemCount>0) document.getElementById("checkoutlink").style.visibility="visible";
     		  else document.getElementById("checkoutlink").style.visibility="hidden";
         } , 
		
		//This code gets invoked on an error in AJAX communication
		error: function(error, args) {
			document.getElementById("OICount").innerHTML = response;
		} //End of error
		
		
		
	}); //End dojoxhrGet call
	
}

