﻿// JScript File
function IsNumeric(value)
{  
    var anum=/(^\d+$)|(^\d+\.\d+$)/
    if (anum.test(value))
    return true;
    return false;
}

function CheckNum(evt,dot)
{
	
// numbers only

var code = (evt.which) ? evt.which : event.keyCode


	if ((code >= 48 && code <=57) || code == 8)
	{
	
		return true;
	} // if 1
	else
	{
	// checks dot  1 : check 0 : do not check
		if (dot == 1)
		{
		
			if (code == 46)
			{
				return true;
			}
		} // if 2	alert('Please Enter Only Numbers.');
		alert('Please Enter Numbers Only.');
	return false;
} // else 1
} // chknum

function ChkQty(qty)
{
alert(qty);
var strValue =qty;
			if (IsNumeric(strValue) == false) 
      		{
				alert("Please Enter a Valid Qty.");
				document.getElementById('txtQty').value="1";
				form1.txtQty.focus();				
				return false;			
			}
			if (strValue ==0) 
      		{
				alert("Please Enter a Valid Qty.");
				document.getElementById('txtQty').value="1";
				form1.txtQty.focus();				
				return false;			
			}
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "1234567890";
   var strChar;
   var blnResult = true;

  
   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   
   function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
      
      
      function IsInt(txt)
{
    ////debugger;
    var sText=txt;
    var ValidChars = "0123456789";
    var IsNumber=true;
    var Char;
    var dot=0;

    for (i = 0; i < sText.length && IsNumber == true; i++) 
    { 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1) 
        {
            IsNumber = false;
//            alert('Please enter numbers only!');
//            txt.value = '';
//            txt.focus();
            return false;
        }
    }
    return true;
}


