
function check_product_max(name)
{
	old_value = document.getElementById(name).value;
	t = name.split("_");
	if (document.getElementById('productmaxqty_'+t[1]) && document.getElementById('productmaxqty_'+t[1]).value != -1)
	{
		max_value = document.getElementById('productmaxqty_'+t[1]).value;
		if (parseInt(old_value) > parseInt(max_value))
		{
			alert("Only "+max_value+" Products Are Available.");
			document.getElementById('productqty_'+t[1]).value = max_value;
			return false;		
		}
	}
	return true;
}


function check_quantity(evt,name,value)
{
	old_value = document.getElementById(name).value;
	if(old_value.length < 2)
	{	
		 var charCode = (evt.which) ? evt.which : event.keyCode
		 if (charCode > 31 && (charCode < 48 || charCode > 57))
		 {
			alert("only Digits are Allowed");
			return false;
		 }		
		 return true;
	}
}