function checkMail(obj,error)
{
    if (obj == null)
return "NULL";
    if (obj.value == "")
return "EMPTY";
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (filter.test(obj.value)) 
return true;
    else 
alert(error);
return false;
}
function checkDigitalChar(cntrl,errmsg3,flag,errmsg1,errmsg2)
  {
    var str;
    str = cntrl.value;
   if (str.indexOf(" ") >=0)
   {

window.alert(errmsg3);
cntrl.focus();
cntrl.select();
return false;
}

if (flag == 1){
    if(str.length==0)
    {
       //alert("Input is blank, please re-input.");
       alert(errmsg1);
       return false;
    }
}
    for(var loop_index=0; loop_index<str.length; loop_index++)
    {
      if(str.charAt(loop_index) == '0' 
         ||str.charAt(loop_index) == '1'
         ||str.charAt(loop_index) == '2'
         ||str.charAt(loop_index) == '3'
         ||str.charAt(loop_index) == '4'
         ||str.charAt(loop_index) == '5'
         ||str.charAt(loop_index) == '6'
         ||str.charAt(loop_index) == '7'
         ||str.charAt(loop_index) == '8'
         ||str.charAt(loop_index) == '9')
          continue;
      else
         {
           //alert("Valid characters are 0-9. Please re-input.");
           alert(errmsg2);
           return false;
    }
    }
    return true;
  }
  
 str.lengthif(str.length==0)
    {
       //alert("Input is blank, please re-input.");
       alert(errmsg1);
       return false;
    }