function setProduct(product_id, account_id) 
{
	document.forms['PurchaseProduct']['product_selected'].value = product_id;
//	document.forms['PurchaseProduct']['product_name'].value = product_name;
//	document.forms['PurchaseProduct']['price'].value = price;
	document.forms['PurchaseProduct']['account_id'].value = account_id;
}

function addToBasket()
{
	if (document.forms.PurchaseProduct)
	{
		document.forms.PurchaseProduct.submit();
	}
	else
	{
		alert("Form: PurchaseProduct not found");
	}
	
}

// toggle visibility
function toggle( targetId )
{
	if (document.getElementById)
	{
		target = document.getElementById( targetId );
        if (target.style.display == "none")
		{
			target.style.display = "";
		} 
		else 
		{
			target.style.display = "none";
		}
	}
}


function FocusField(strField)
{
	if (document.getElementById(strField))
	{
		document.getElementById(strField).focus();
	}
}

function submitForm(strFormName)
{
	if (document.forms[strFormName])
	{
		if (document.forms[strFormName].onsubmit())
		{
			document.forms[strFormName].submit();
		}
	}
	else
	{
		alert("Form: " + strFormName + " not found");
	}
}

var objPopWindow;

function showPopWindow(url, width, height)
{
	var topDist;
	var leftDist;
	var objPopWindow = null;

	width = (width == null) ? 500 : width;
	height = (height == null) ? 400 : height;

	if (objPopWindow  && objPopWindow.document)
	{
		objPopWindow.location.href = url;
	}
	else
	{
		if (screen)
		{
			leftDist	= (screen.width/2) - (width/2);
			topDist		= (screen.height/2) - (height/2);
		}
		else
		{
			leftDist	= 400 - (width/2);
			topDist		= 300 - (height/2);
		}

		objPopWindow = window.open(url,'name','height=' + height + ',width=' + width + ',left=' + leftDist + ',top=' + topDist + ',resizable=no,scrollbars=yes,toolbar=no,status=no,menubar=no');
	}
	if (window.focus && objPopWindow)
	{
		objPopWindow.focus();
	}
}
