var winpops;

function submitForm(id)
{

	if ( document.forms[id].quantity.value == "" )
	{
		alert("Please enter a quantity");
	}
	else
	{
		document.forms[id].submit();
	}
}

function addToBasket(productId)
{
	var quantity, string;
	//quantity = document.getElementById(productId + "quantity").value;
	quantity = 1;
	string = "addToBasket.asp?productId=" + productId + "&quantity=" + quantity + "&action=ADD"
	openpopup(string, 310, 110, 0);
}

function removeFromBasket(productId)
{
	var quantity, string;
	//quantity = document.getElementById(productId + "quantity").value;
	quantity = 1;
	string = "addToBasket.asp?productId=" + productId + "&quantity=" + quantity + "&action=REMOVE"
	openpopup(string, 310, 110, 0);
}

function openpopup(codein, width, height, scroller)
{
	
	var w = width;
	var h = height;
	var	code = codein;
	
	// get the screen size and center the popupbox
	if (screen)
	{
		x = (screen.availHeight - height) /2;
		y = (screen.availWidth - width) /2;
	}
	
	if (winpops && !winpops.closed )
	{
		winpops.close();			
	}
	
	// open the popup box
	winpops=window.open(code,"","status=0,scrollbars=" + scroller + ",width=" + w + ",height=" + h + ",top=" + x + ",left=" + y+ ",screenX=" + x + ",screenY=" + y + ",")
	//winpops.document.write(x + " " + y);
	
}
