/* 
function NameChk(field,label,boolEmpty,boolNum,splChar)
Author VP Singh
Dated 07-06-2k1.
Parameters : field-> The name of the field whose value is to be checked
             label-> The label with that field to give the appropiate error message
             boolEmpty-> It can have only two values - 1 or 0.
             if it is 1 then the value passed can not be blank else it can be blank.
             boolNum->It can have only two values - 1 or 0.
             if it is 1 then the value passed can not have numeric values else it can have numeric values.
             splChar-> Will contain the string of special characters allowed in the field.
Purpose : To check the format of each type of name.For Eg: FirstName,LastName etc etc.
Return Value : False if value is empty else True
*/
function NameChk(field,label,boolEmpty,boolNum,splChar)
{
	if(boolEmpty == 1)
    {
        if (isEmpty(field,label)==false)
            return false;            
    
    }
    else
    {
    if( !field.value)
        return true;
    }
                    
       var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
    if(boolNum == 0)
    {
        valid = valid + "0123456789"
    }       
        
    valid = valid + splChar
    var input = field.value;
    var length = input.length;
    for(i=0; i<length; i++)
    {
        var sub = input.substring(i,i+1);
        if(valid.indexOf(sub)==-1)
           {
                label = "Please enter the valid  " + label + "  before submitting the form "
             alert(label);
             field.focus();
             return false;        
         }    
       
     }
}
/* 
function NumChk(field,label,boolEmpty)
Author VP Singh
Dated 07-06-2k1.
Parameters : field-> The name of the field whose value is to be checked
             label-> The label with that field to give the appropiate error message
             boolEmpty-> It can have only two values - 1 or 0.
             if it is 1 then the value passed can not be blank else it can b blank.
Purpose : To check the value of fields where numeric data is allowed.
Return Value : False if value is non numeric else True
*/             
function NumChk(field,label,boolEmpty)
{
    if(boolEmpty == 1)
    {
        if (isEmpty(field,label)==false)
            return false;            
    
    }
    else
    {
    if( !field.value)
        return true;
    }
                    
       var valid = "0123456789"; 
    var input = field.value;
    var length = input.length;
    for(i=0; i<length; i++)
    {
        var sub = input.substring(i,i+1);
        if(valid.indexOf(sub)==-1)
           {
                label = label + "  can conatin only numeric data"
             alert(label);
             field.focus();
             return false;        
         }    
       
     }
}