  
// check that the quantity ordered is not greater than the quantity available 
function checkqty(formobj,formobj1)
{    
	qty1= formobj.value;  
	maxqty= formobj1.value;  
	if  ((isNumber(formobj)) == false)
	{
		formobj.focus();
		document.form1.submit.value="Buy";
		alert("Please enter a numeric value for the quantity");
		return false;
	}
	 
	
	if(parseInt(maxqty) > 0 && parseInt(qty1) > parseInt(maxqty)){
		formobj.focus();
		document.form1.submit.value="Buy";
		alert("Quantity entered is greater than the quantity available.");
		return false;
	}
		
	return true;
} 


// form level validation for all the fields. 
function checkform()
{ 
		
	if (!checkqty(document.form1.qty,document.form1.inventory_qty)
		)
	{
		return false;
	}
	return true;
} // end of function checkform

var popUpWin=0;
function openWin(linkURL)
{
  if(popUpWin)
  {
  if (popUpWin && popUpWin.open && !popUpWin.closed) popUpWin.close();
  }
  popUpWin = window.open(linkURL, 'productDetail', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=620,height=500,left=100,top=100,screenX=100,screenY=100');
  bringToTop = popUpWin.focus();
}
