
function NumericValidation()
{
	var k = window.event.keyCode;
	return (((k >= 48) && (k <= 57)) || (k == 8) || (k == 9) || (k == 16));
}

// opens new window to disply help content
function my_win()
{
    window.open('drl/includes/help.htm','mywindow','width=450,height=400,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes');
}

// function to validate "Person LicenseNo" field
function validatePLicenseNo()
{

 var selIdx =document.PinLookupForm.personRegType.selectedIndex;
 //var selProf = document.PinLookupForm.personRegType.options[selIdx].value;   
 var checkStr=document.PinLookupForm.personLicenseNo.value;

if(checkStr.length==0)
{
    alert("Please enter value for the  \"Credential Number\" field.");
    document.PinLookupForm.personLicenseNo.focus();
    return (false);
}
if (!isNumber(checkStr))
{
    alert("Please enter only Numbers in the \"Credential Number\" field.");
    document.PinLookupForm.personLicenseNo.value="";
    document.PinLookupForm.personLicenseNo.focus();
    return (false);
}
//if(selProf==99999)
//{
//alert("Please Select a Profession.");
//document.PinLookupForm.personRegType.focus();
//return (false);
//}

var ssn=document.PinLookupForm.ssn4Char.value;
if(ssn.length==0)
{
    alert("Please enter value for the  \"Social Security Number\" field.");
    document.PinLookupForm.ssn4Char.focus();
    return (false);
}
if (!isNumber(ssn))
{
    alert("Please enter only Numbers in the \"Social Security Number\" field.");
    document.PinLookupForm.ssn4Char.value="";
    document.PinLookupForm.ssn4Char.focus();
    return (false);
}
    document.PinLookupForm.userAction.value="1";
    document.PinLookupForm.fein4Char.value="";
    document.PinLookupForm.firmLicenseNo.value="";
    //document.PinLookupForm.orgName.value="";
}
// Validate Firm License Number
function validateFLicenseNo()
{

    var checkStr=document.PinLookupForm.firmLicenseNo.value;
    var selIdx =document.PinLookupForm.firmRegType.selectedIndex;
 //var selProf = document.PinLookupForm.firmRegType.options[selIdx].value;   

if(checkStr.length==0)
{
    alert("Please enter value for the  \"Credential Number\" field.");
    document.PinLookupForm.firmLicenseNo.focus();
    return (false);
}
if (!isNumber(checkStr))
{
    alert("Please enter only Numbers in the \"Credential Number\" field.");
    document.PinLookupForm.firmLicenseNo.value="";
    document.PinLookupForm.firmLicenseNo.focus();
    return (false);
}
//if(selProf==99999)
//{
//alert("Please Select a Profession.");
//document.PinLookupForm.firmRegType.focus();
//return (false);
//}
var fein=document.PinLookupForm.fein4Char.value;

if(fein.length==0)
{
    alert("Please enter value for the  \"FEIN Number\" field.");
    document.PinLookupForm.fein4Char.focus();
    return (false);
}
if (!isNumber(fein))
{
    alert("Please enter only Numbers in the \"FEIN Number\" field.");
    document.PinLookupForm.fein4Char.value="";
    document.PinLookupForm.fein4Char.focus();
    return (false);
}
    document.PinLookupForm.userAction.value="2";
    document.PinLookupForm.ssn4Char.value="";
    document.PinLookupForm.personLicenseNo.value="";
}

function IsNumeric(sText)
 { 
    alert("inside IsNumeric");
    IsNumber=false;
   var ValidChars = "0123456789."; 
   var Char;
   for (i = 0; i < sText.length; i++) {
       Char = sText.charAt(i);
       alert("char:" + Char);
       if (ValidChars.indexOf(Char) == 1)
        {
         alert("inside ==1" );
          IsNumber= true;
         break;
       }
    }
    alert("IsNumber =" + IsNumber);
   return IsNumber;
}

function isNumber(aText)
{
    var checkStr=aText;
    var checkOK = "0123456789";
    var allValid = true;
    var allNum = "";

for (i = 0;  i < checkStr.length;  i++)
{
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
    if (ch == checkOK.charAt(j))
    break;
    if (j == checkOK.length)
    {
    allValid = false;
    break;
}
    if (ch != ",")
    allNum += ch;
}
    return allValid;
}


function checkFirm(e)
{ 
    //e is event object passed from function invocation
    var characterCode; //literal character code will be stored in this variable

    if(e && e.which)
    { 
        //if which property of event object is supported (NN4)
        e = e;
        characterCode = e.which ;//character code is contained in NN4's which property
    }
    else
    {
        e = event;
        characterCode = e.keyCode ;//character code is contained in IE's keyCode property
     }
     
    //alert("characterCode"+ characterCode);
    if(characterCode == 13)
    { 
    //document.forms[0].submit() //submit the form
    document.PinLookupForm.submit2.focus();
    //validateFLicenseNo();
    //return true 
    }
    else
    {
        return false ;
    }
}


