
var reqSCItems_CartCountPopup;
/*******************************************************************************/
// This function will update shopping cart count, but will be called from all kinds of popups
// like zoom swatch, order samples, etc.
function sndReq_CartCountPopup() {
	var destURL = "util/CartCount.jsp";
	reqSCItems_CartCountPopup = createXMLRequestObject();
	reqSCItems_CartCountPopup.onreadystatechange = handleResponse_CartCountPopup;
	reqSCItems_CartCountPopup.open("post", destURL);
	reqSCItems_CartCountPopup.send(null);
}
function handleResponse_CartCountPopup() {
	var update;
	var resultVal_prod = "";
	var resultVal_swatch = "";
	var visitorExists;
	if (reqSCItems_CartCountPopup.readyState == 4) {
		var responseTXT = reqSCItems_CartCountPopup.responseText;
		if (responseTXT.indexOf("|" != -1)) {
			update = responseTXT.split("|");
			visitorExists = update[1];
			resultVal_prod = update[2];
			resultVal_swatch = update[3];
		}
		if (visitorExists != "true") {
			resultVal_prod = 0;
			resultVal_swatch = 0;
		}
		var document = null;
		try {
			document = window.opener.top.document;
		}
		catch (err) {
			document = window.top.document;
		}
		if (document != null) {
				// following 4 lines needs to be uncomment whenevr we will be having new header and footer
			document.getElementById("sc_items_header").innerHTML = "(" + resultVal_prod + ((resultVal_prod == 1) ? " Product, " : " Products") + ")";
			document.getElementById("sc_items_footer").innerHTML = "(" + resultVal_prod + ((resultVal_prod == 1) ? " Product, " : " Products") + ")";
			document.getElementById("sc_items1_header").innerHTML = "(" + resultVal_swatch + ((resultVal_swatch == 1) ? " Sample" : " Samples") + ")";
			document.getElementById("sc_items1_footer").innerHTML = "(" + resultVal_swatch + ((resultVal_swatch == 1) ? " Sample" : " Samples") + ")";
				
				//document.getElementById("sc_items").innerHTML = "<img src='/smith_noble/sp.gif' width='4' height='1'>(" + resultVal_prod + ((resultVal_prod==1) ? " item" : " items") + ")";
		}
	}
}

var reqSCItems_CartCountGeneral;
/*******************************************************************************/
// This function will update shopping cart count, but will be called from any parent jsp page
function sndReq_CartCountGeneral() {
	var destURL = "util/CartCount.jsp";
	reqSCItems_CartCountGeneral = createXMLRequestObject();
	reqSCItems_CartCountGeneral.onreadystatechange = handleResponse_CartCountGeneral;
	reqSCItems_CartCountGeneral.open("post", destURL);
	reqSCItems_CartCountGeneral.send(null);
}
function handleResponse_CartCountGeneral() {
	var update;
	var resultVal_prod = "";
	var resultVal_swatch = "";
	var visitorExists;
	if (reqSCItems_CartCountGeneral.readyState == 4) {
		var responseTXT = reqSCItems_CartCountGeneral.responseText;
		if (responseTXT.indexOf("|" != -1)) {
			update = responseTXT.split("|");
			visitorExists = update[1];
			resultVal_prod = update[2];
			resultVal_swatch = update[3];
		}
		if (visitorExists != "true") {
			resultVal_prod = 0;
			resultVal_swatch = 0;
		}
		if (document != null) {
				// following 4 lines needs to be uncomment whenevr we will be having new header and footer
			document.getElementById("sc_items_header").innerHTML = "(" + resultVal_prod + ((resultVal_prod == 1) ? " Product, " : " Products") + ")";
			document.getElementById("sc_items_footer").innerHTML = "(" + resultVal_prod + ((resultVal_prod == 1) ? " Product, " : " Products") + ")";
			document.getElementById("sc_items1_header").innerHTML = "(" + resultVal_swatch + ((resultVal_swatch == 1) ? " Sample" : " Samples") + ")";
			document.getElementById("sc_items1_footer").innerHTML = "(" + resultVal_swatch + ((resultVal_swatch == 1) ? " Sample" : " Samples") + ")";
				
				//document.getElementById("sc_items").innerHTML = "<img src='/smith_noble/sp.gif' width='4' height='1'>(" + resultVal_prod + ((resultVal_prod==1) ? " item" : " items") + ")";
		}
	}
}

