function displayCart(pageId) {

	var args = "command=displayCart&pageId=" + pageId;
	var myAjax = new Ajax.Updater('maincontent',"hamshop.php",{
						method:"post",
						parameters:args});

}

function updateCartItemQuantity(pageId,productId,thisObject) {

	var args = "command=updateCartItemQuantity&pageId=" + pageId + "&productId=" + productId + "&quantity=" + thisObject.value;
	var myAjax = new Ajax.Updater('maincontent',"hamshop.php",{
						method:"post",
						parameters:args});
	
}

function addToCart(pageId,productId) {
	
	var quantity = $("quantity_"+productId).value;

	var args = "command=addToCart&pageId=" + pageId + "&productId=" + productId + "&quantity=" + quantity;
	var myAjax = new Ajax.Request("hamshop.php",{
						method:"post",
						parameters:args,
						onSuccess: function(transport) {
							a = 1;
						},
						onFailure: function(transport) {
							a = 1;
						}
					});
}

var hstarget = null;
var previoushstarget = null;
var previouscontents = null;
var previousHsImage = new Array();
previousHsImage['object'] = null;
previousHsImage['width'] = 0;
previousHsImage['height'] = 0;

var thisHsImage = null;
var thsHsQuantity = null;

function hsProductDetails(pageId,productId,thisObject) {

	var hstarget = thisObject.parentNode;
	var resize = 0;

	if (resize) {
		thisHsImage = $('hsImage_'+productId);
		thisHsQuantity = $('quantity_'+productId);
		if (previoushstarget) {
			previoushstarget.innerHTML = previouscontents;
			previousHsImage['object'].width = previousHsImage['width'];
			previousHsImage['object'].height = previousHsImage['height'];
		}

		previoushstarget = hstarget;
		previouscontents = hstarget.innerHTML;

		previousHsImage['object'] = thisHsImage;
		previousHsImage['width'] = thisHsImage.width;
		previousHsImage['height'] = thisHsImage.height;
	}
	
	var args = "command=displayDetails&pageId=" + pageId + "&productId=" + productId;
	var myAjax = new Ajax.Request("index.php",{
						method:"post",
						parameters:args,
						onSuccess: function(transport) {
							a = 1;
							hstarget.innerHTML = transport.responseText;
							var t = hstarget.offsetTop + 100;
							var t1 = 0;
							scroll(0,t);
							if (thisHsImage) {
								thisHsImage.width = thisHsImage.naturalWidth;
								thisHsImage.height = thisHsImage.naturalHeight;
								// thisHsQuantity.focus();
							}
						},
						onFailure: function(transport) {
							a = 1;
						}
					});
}