function fnAddProduct(nProductID, nCategoryID) {
	if (!isNaN(nProductID)) {
		document.all["ctlXml"].src = sAppDomain + "/_Shop/ShoppingCart.asp?SessionID=" + nID + "&ProductID=" + nProductID + "&CategoryID=" + nCategoryID + "&Type=add";
	}
}

function fnUpdateShopCart(oXml) {
	var oElement = oXml.XMLDocument.documentElement;
	for (var i=0; i<oElement.childNodes.length; i++) {
		if (oElement.childNodes[i].childNodes[5].text == "true") {
			var oAddProduct = new Object();
				oAddProduct.Title = oElement.childNodes[i].childNodes[1].text;
				oAddProduct.Buy = "";
			
			var sArgs = "dialogHeight: 250px; dialogWidth: 520px; edge: Raised; center: Yes; help: No; resizable: No; status: No";
			var sUrl = sAppDomain + "/_Shop/ProductMsg.asp?";
			//window.name = "ProductMsg";
			window.showModalDialog(sUrl, oAddProduct, sArgs);
			if (oAddProduct.Buy == "1") {
				window.location = sAppDomain + "/_Shop/CashBox.asp";
				return;
			}
			break;
		}
	}
		
	var oTblCart = document.all.tblCart;
	for (var i = oTblCart.rows.length-2; i >= 0; i--) {
		oTblCart.deleteRow(i);
	} 
	
	var nTotal = 0;
	for (var i=0; i<oElement.childNodes.length; i++) {
		oTblCart.insertRow(oTblCart.rows.length-1);
		oTblCart.rows[oTblCart.rows.length-2].setAttribute("className","chartItem");
		var tblCell = oTblCart.rows[oTblCart.rows.length-2].insertCell();
			tblCell.setAttribute("className","ShopCart");
		tblCell.innerHTML = (i+1) + ". <a href=\"" + sAppDomain + "/Index.asp?CategoryID=" + oElement.childNodes[i].childNodes[4].text + "&ArticleID=" + oElement.childNodes[i].childNodes[0].text  + "\">" + oElement.childNodes[i].childNodes[1].text + " [" + oElement.childNodes[i].childNodes[2].text + "]</a>"
		nTotal += parseFloat(oElement.childNodes[i].childNodes[3].text)*parseInt(oElement.childNodes[i].childNodes[2].text);
	}
	
	if (oElement.childNodes.length > 0) {
		document.all.tblCashbox.style.display = "block";
		document.all.ctlTotal.innerText = parseInt(nTotal*100)/100;
	}
}