
function openWin(url,name,width,height,features)
{
	var left = (screen.width) ? (screen.width-width) / 2 : 0;
	var top = (screen.height) ? (screen.height-height) / 2 : 0;

	// adjust for window borders
	width += 20;
	height += 120;

	var win = window.open(url,name,'width='+width+',top='+(top-20)+',left='+(left+50)+',height='+height+','+features);
	if (!win)
	{
		alert('A window popup has been blocked. Try allowing popups for this domain');
	}
}

function showImage(url,width,height)
{
	var left = (screen.width) ? (screen.width-width) / 2 : 0;
	var top = (screen.height) ? (screen.height-height) / 2 : 0;
	
	// adjust for  window borders
	width += 20;
	height += 120;

	var win = window.open(url,'largeImg','width='+width+',top='+top+',left='+left+',height='+height+',toolbar=no,scrollbars=no,resizable=yes,menubar=yes,location=no');
	if (!win)
	{
		alert('A window popup has been blocked. Try allowing popups for this domain');
	}
}

/* only allows numbers to be entered */
function numbersonly(myfield, e) {
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);

	// control keys
	if ((key==null) || (key==0) || (key==8) || 
		(key==9) || (key==13) || (key==27) )
	   return true;

	// numbers
	else if ((("0123456789").indexOf(keychar) > -1))
	   return true;
	
	else if (key == 13 && (myfield.value == ""))
	{
		alert('Please enter a quantity');
		return false;
	}

	else
	   return false;
}

function confirmURL(txt,url)
{
	if (confirm(txt))
	{
		document.location = url;
	}
}