/*function ValidateRequired(control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0  
    }
      
    if (ctl.value=="")
    {
        if(msg!="")
        {
            alert(msg);
            if (keepfocus=1 )
                {
                    ctl.focus();   
                }
            return 0
        }
    }  
    else
    {
    return 1;
    
    }

}

function IsNumber(control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }


    if ( isNaN(ctl.value))
    {
        if(msg!="")
        {
            alert(msg);
            if (keepfocus=1 )
                {
                    ctl.focus();   
                }
            return 0
        }
    }  
    else
    {
    return 1;
    
    }
   

}

function IsEmailId(control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }



var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

     if (ctl.value!="")
    {
        if (!filter.test(ctl.value))
        {
            if(msg!="")
            {
                alert(msg);
                if (keepfocus=1 )
                    {
                        ctl.focus();   
                    }
                return 0
            }
        }  
        else
        {
        return 1;
        
        }
   }

}

function isValidRange(MinValue,MaxValue,control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }

    if (ctl.value!="")
    {
        if (ctl.value>MaxValue ||ctl.value<MinValue )
        {
            if(msg!="")
            {
                alert(msg);
                if (keepfocus=1 )
                    {
                        ctl.focus();   
                    }
                return 0
            }
        }  
        else
        {
        return 1;
        
        }
   }

}

function areEqual(FirstValue,SecondValue,control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }

    if (ctl.value!="")
    {
        if (FirstValue !=SecondValue  )
        {
            if(msg!="")
            {
                alert(msg);
                if (keepfocus=1 )
                    {
                        ctl.focus();   
                    }
                return 0
            }
        }  
        else
        {
        return 1;
        
        }
   }

}


function isValidLength(Length,control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }
 
    if (ctl.value!="")
    {
        if (ctl.value.length!=Length)
        {
            if(msg!="")
            {
                alert(msg);
                if (keepfocus=1 )
                    {
                        ctl.focus();   
                    }
                return 0
            }
        }  
        else
        {
        return 1;
        
        }
   }

}


function OnlyCharectersAndSymbols(control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }
 
 var filter = /^([a-zA-Z\~\!\@\#\$\%\^\&\*\(\)\_\+\|\}\{\"\:\?\>\<\`\-\=\\\]\[\'\;\/\.\,]*)$/;

   if (ctl.value!="") 
    {
        if (!filter.test(ctl.value))
        {
            if(msg!="")
            {
                alert(msg);
                if (keepfocus=1 )
                    {
                        ctl.focus();   
                    }
                return 0
            }
        }  
        else
        {
        return 1;
        
        }
   }

}

function InvalidCharecter(vaildcharecters, control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }
    
    var strChars=new String(vaildcharecters)
    
    var filter= new RegExp()
   var strfilter= "/^(["
    for(var i=0;i<=strChars.length;i++)
    {
    strfilter=strfilter+ "\\" + strChars.substring(i,i+1) 
    
    }
    strfilter =strfilter + "]*)$/" 
    
    var match= filter.exec(strfilter);   
    
 

   if (ctl.value!="") 
    {
        if (!filter.test(ctl.value))
        {
            if(msg!="")
            {
                alert(msg);
                if (keepfocus=1 )
                    {
                        ctl.focus();   
                    }
                return 0
            }
        }  
        else
        {
        return 1;
        
        }
   }

}

*/

function CharectersOnly(control,msg,keepfocus)
{
    var ctl
    ctl =document.getElementById(control);
    if (ctl==null)
    {
    alert("Control "+ control +" not found.");
    return 0 
    }
 
 var filter = /^([a-zA-Z]*)$/;

   if (ctl.value!="") 
    {
        if (!filter.test(ctl.value))
        {
            if(msg!="")
            {
                alert(msg);
                if (keepfocus=1 )
                    {
                        ctl.focus();   
                    }
                return 0
            }
        }  
        else
        {
        return 1;
        
        }
   }

}