var expChk1=new Array(" SCRIPT "," CREATE "," INSERT "," SELECT "," DELETE "," DROP "," UPDATE "," HAVING ");

var errMsg=new String();

function  valkeywords(strChk,fieldName)
{

//Reserved Words
for(i=0;i<expChk1.length;i++)
   {

	var chk=new RegExp(expChk1[i]);
	if (strChk.toUpperCase().match(chk) )
	{
	   errMsg="Use synonym of word "+expChk1[i]+" .";
	   return true;
	}
   
   }
   return false;
}


 //client side js for firing clickbutton on textbox when enter key is pressed
   function clickButton(e, buttonid)
   { 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object')
      { 
            if(navigator.appName.indexOf("Netscape")>(-1))
            { 
                  if (e.keyCode == 13)
                  { 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
            { 
                  if (event.keyCode == 13)
                  { 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
   } 
   
         
function ValidateDropdownC(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"

      ///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
    if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return  false;
     }
 //Reserved Words    
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
     {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
     }
// //reserved characters   
//   var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
//    if (strChk.match(chkStr))
//     {
//       alert('Invalid characters in field');
//       document.getElementById(mast+str).focus();
//       return false;
//     }
  else
       return  true; 
 
}


function ValidatetxtOld(control)
{

  var mast="ctl00_ContentPlaceHolder1_"

      ///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
    if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(control.id).focus();
        return  false;
     }
 //Reserved Words    
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     }

  else
       return  true; 
 
}

function ValidateDropdownCpopup(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
/// selected index zero   
    if(document.getElementById(str).selectedIndex==0)
    {
        
        alert(message);
        document.getElementById(str).focus();
        return  false;
    }
      
      ///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(str).value;
    if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(str).focus();
        return  false;
     }
 //Reserved Words    
    if(valkeywords(document.getElementById(str).value,document.getElementById(str)))
     {
        alert(errMsg);
        document.getElementById(str).focus();
        return false;
    
     }
// //reserved characters   
//   var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
//    if (strChk.match(chkStr))
//     {
//       alert('Invalid characters in field');
//       document.getElementById(mast+str).focus();
//       return false;
//     }
  else
       return  true; 
 
}


function ValidateDropdownPSandTS(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
 
 /// if  Radiopolicestation is checked 
  
 if (document.getElementById(mast+"Radiopolicestation").checked)
    {
    /// selected index zero   
    if(document.getElementById(mast+"lipolicestation").selectedIndex==0)
    {
        
        alert(message);
        document.getElementById(mast+"lipolicestation").focus();
        return  false;
    }
      
    ///check for blank field
    var chkStr = /^[\s]*$/;
    var strChk = document.getElementById(mast+"lipolicestation").value;
          if (strChk.match(chkStr))
         {
            alert(message);
            document.getElementById(mast+"lipolicestation").focus();
            return  false;
         }
     //Reserved Words    
          if(valkeywords(document.getElementById(mast+"lipolicestation").value,document.getElementById(mast+"lipolicestation")))
        {
            alert(errMsg);
            document.getElementById(mast+"lipolicestation").focus();
            return false;
        
        }
   
        else
        return true;
     }
    


//// if  Radiotraffic is checked   
   
 if (document.getElementById(mast+"Radiotraffic").checked)
    {
    /// selected index zero   
    if(document.getElementById(mast+"litrafficstaff").selectedIndex==0)
    {
        
        alert(message);
        document.getElementById(mast+"litrafficstaff").focus();
        return  false;
    }   
    ///check for blank field
        var chkStr = /^[\s]*$/;
    var strChk = document.getElementById(mast+"litrafficstaff").value;
    if (strChk.match(chkStr))
         {
            alert(message);
            document.getElementById(mast+"litrafficstaff").focus();
            return  false;
         }
     //Reserved Words    
          if(valkeywords(document.getElementById(mast+"litrafficstaff").value,document.getElementById(mast+"litrafficstaff")))
        {
            alert(errMsg);
            document.getElementById(mast+"litrafficstaff").focus();
            return false;
        
        }
   
         else
        return true;
     }
     
     
     
     //// if  Radioothers is checked   
   
if (document.getElementById(mast+"Radioothers").checked)
    {///check for blank field
    
    var chkStr = /^[\s]*$/;
    var strChk = document.getElementById(mast+"txtothers").value;
    if (strChk.match(chkStr))
         {
            alert(message);
            document.getElementById(mast+"txtothers").focus();
            return  false;
         }
     //Reserved Words    
          if(valkeywords(document.getElementById(mast+"txtothers").value,document.getElementById(mast+"txtothers")))
        {
            alert(errMsg);
            document.getElementById(mast+"txtothers").focus();
            return false;
        
        }
   
         else
        return true;
     }

}  



//////////////validate for Blank text boxes
function ValidateAll(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
  else
       return  true; 
}
///user id validation
function Validateuserid(cont)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+cont).value;
if (strChk.match(chkStr))
     {
        alert('Invalid User ID ...');
        document.getElementById(mast+cont).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+cont).value,document.getElementById(mast+cont)))
    {
        alert(errMsg);
        document.getElementById(mast+cont).focus();
        return false;
    
    }
    var chkStr = /^([a-zA-Z0-9.-]{8,25})$/;
   if (!strChk.match(chkStr))
    {
       alert('Minimum 8 and maximum 25 characters and only use A-Z , a-z ,0-9 , dash(-)and dot(.) characters in this field');
       document.getElementById(mast+cont).focus();
       return false;
    }
    
  else
       return  true; 
}

///user id validation
function welcomeuserid(cont)
{
 
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(cont).value;
if (strChk.match(chkStr))
     {
        alert('Invalid User ID');
        document.getElementById(cont).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(cont).value,document.getElementById(cont)))
    {
        alert(errMsg);
        document.getElementById(cont).focus();
        return false;
    
    }
    var chkStr = /^([a-zA-Z0-9.-]{8,25})$/;
   if (!strChk.match(chkStr))
    {
       alert('only use A-Z , a-z ,0-9 , dash(-)and dot(.) characters in this field');
       document.getElementById(cont).focus();
       return false;
    }
    
  else
       return  true; 
}


//////////////validate file uploaded
function fileupload(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
    
     //reserved characters 
     // /^([a-zA-Z]:(\\w+)*\\[a-zA-Z0_9]+)?.[pP][dD][fF]$/; 
   var chkStr = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf|.PDF)$/;
   if (!strChk.match(chkStr))
    {
       alert('Invalid file selected');
       document.getElementById(mast+str).focus();
       return false;
    }
  else
       return  true; 
}

function fileuploadZip(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
    
//     //reserved characters 
//     // /^([a-zA-Z]:(\\w+)*\\[a-zA-Z0_9]+)?.[pP][dD][fF]$/; 
//   var chkStr = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.zip|.rar)$/;
//   if (!strChk.match(chkStr))
//    {
//       alert('Invalid file selected');
//       document.getElementById(mast+str).focus();
//       return false;
//    }
  else
       return  true; 
}
//////////////validate for directory text box
function ValidateAlldirectorytxt(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for special characters
if (document.getElementById(mast+str).disabled == false )
 {  
   var strChk = document.getElementById(mast+str).value;
   var chkStr = /^([a-zA-Z0-9]*[\040]*[-]*[,]*[/]*[.]*[(]*[)]*)*$/;
   if (!strChk.match(chkStr))
    {
       alert('only use A-Z , a-z , 0-9 , dash(-),comma(,),slash (/),space,period(.) and parenthesis() characters in this field');
       document.getElementById(mast+str).focus();
       return false;
    }
 
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
  else
       return  true; 
 }
 else
       return  true; 
}

function ValidateAllpopup(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(str).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(str).value,document.getElementById(str)))
    {
        alert(errMsg);
        document.getElementById(str).focus();
        return false;
    
    }
  else
       return  true; 
}

function ValidateDropdownACTSECTIONdirectory(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
if (document.getElementById(mast+str).disabled == false )
 {
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return  false;
     }
 //Reserved Words    
      if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
 //reserved characters   
var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
   if (strChk.match(chkStr))
    {
       alert('Invalid characters in the field');
       document.getElementById(mast+str).focus();
       return false;
    }
    else
       return  true; 
  }
  else
  return  true; 
       
}


function ValidateDropdownmaintanance(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  var strChk = document.getElementById(mast+str).value;
 //Reserved Words    
      if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
 //reserved characters   
var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
   if (strChk.match(chkStr))
    {
       alert('Invalid characters in the field');
       document.getElementById(mast+str).focus();
       return false;
    }
    else
       return  true; 
       
}

function ValidateDropdownFILETYPE(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
 ///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return  false;
     }
 //Reserved Words    
      if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
 //reserved characters   
var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
   if (strChk.match(chkStr))
    {
       alert('Invalid characters in the field');
       document.getElementById(mast+str).focus();
       return false;
    }
    else
       return  true; 
       
}

function ValidateDropdownACTSECTION(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
 /// selected index zero   
    if(document.getElementById(mast+str).selectedIndex==0)
    {
        alert(message);
        document.getElementById(mast+str).focus();
        return  false;
    }
 
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return  false;
     }
 //Reserved Words    
      if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
 //reserved characters   
var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
   if (strChk.match(chkStr))
    {
       alert('Invalid characters in the field');
       document.getElementById(mast+str).focus();
       return false;
    }
    else
       return  true; 
       
}




function ValidateDropdown(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
 /// selected index zero   
    if(document.getElementById(mast+str).selectedIndex==0)
    {
        
        alert(message);
        document.getElementById(mast+str).focus();
        return  false;
    }
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return  false;
     }
 //Reserved Words    
      if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
 //reserved characters   
var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
   if (strChk.match(chkStr))
    {
       alert('Invalid characters in the field');
       document.getElementById(mast+str).focus();
       return false;
    }
    else
       return  true; 
       
}


function ValidateDropdownpopup(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
 /// selected index zero   
    if(document.getElementById(str).selectedIndex==0)
    {
        
        alert(message);
        document.getElementById(str).focus();
        return  false;
    }
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(str).focus();
        return  false;
     }
 //Reserved Words    
      if(valkeywords(document.getElementById(str).value,document.getElementById(str)))
    {
        alert(errMsg);
        document.getElementById(str).focus();
        return false;
    
    }
 //reserved characters   
var chkStr = /^['\\@#$%\^*~!+=|:;,./()\-\"{}\[\]?><`]+$/;
   if (strChk.match(chkStr))
    {
       alert('Invalid characters in the field');
       document.getElementById(str).focus();
       return false;
    }
    else
       return  true; 
       
}


function telephonenumber(control) 
{
var mast="ctl00_ContentPlaceHolder1_"
var strng = document.getElementById(control.id).value;
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');

if (isNaN(parseInt(stripped))) 
   {
        alert('The phone number is Invalid.');
        document.getElementById(control.id).focus();
        return  false;
   
   }
if (!(stripped.length > 9) && (stripped.length < 12)) 
      {
        alert('The phone number is the wrong length.Make sure it is 10 or 11 digits.');
        document.getElementById(control.id).focus();
        return  false;
	   }
	   
	var emailFilter=/^0{0,1}[1-9]{1}[0-9]{2}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$/;

if (!(emailFilter.test(stripped))) 
     { 
        alert('Please enter a valid Telephone Number.');
        document.getElementById(control.id).focus();
        return  false;
     }

///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     }
  
       return  true; 
    
       
}


function referencenumber(control)
{
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     } 	
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
 ////reserved characters    
var chkStr = /^([a-zA-Z0-9])+([/]*[a-zA-Z0-9]*)*$/;
   if (!strChk.match(chkStr))
    {
       alert('only use A-Z , a-z , 0-9 and slash (/) characters in this field');
       document.getElementById(control.id).focus();
       return false;
    }
   else
       return  true; 
  
 
}

function paymentamount(control)
{
  ///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
  
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     } 	

 ////reserved characters    
var chkStr = /^[0-9]+$/;
   if (!strChk.match(chkStr))
    {
       alert('only use  0-9  characters in this field');
       document.getElementById(control.id).focus();
       return false;
    }
   else
       return  true; 
  
 
}


function ValidateAllpayment(str,message)
{
 var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(mast+str).focus();
        return false;
     }
  
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
     {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
     } 	

 ////reserved characters    
var chkStr = /^[0-9]+$/;
   if (!strChk.match(chkStr))
    {
       alert('only use  0-9  characters in this field');
       document.getElementById(mast+str).focus();
       return false;
    }
   else
       return  true; 
  
 
}

function alphanumericaddress(control)
{
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     } 	
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
 ////reserved characters    
var chkStr = /^([a-zA-Z0-9\s\n-,\\/.])+$/;
   if (!strChk.match(chkStr))
    {
       alert('only use A-Z , a-z , 0-9 , dash(-),comma(,),slash (/),space,period(.) and parenthesis() characters in this field');
       document.getElementById(control.id).focus();
       return false;
    }
   else
       return  true; 
  
 
}

///////// check for complaint text entered

function alphanumericcomplaint(control)
{
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     } 	
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
  var chkStr = /^([a-zA-Z0-9\s\n-,\\/.])+$/;
   if (!strChk.match(chkStr))
    {
       alert('only use A-Z , a-z , 0-9 , dash(-),comma(,),slash (/),space,period(.) and parenthesis() characters in this field');
       document.getElementById(control.id).focus();
       return false;
    }
   else
       return  true; 
 
}


function validatedirectoryradio(str,message)
{
var mast="ctl00_ContentPlaceHolder1_"

if (document.getElementById(mast+str+"_0").checked == true && document.getElementById(mast+str+"_0").disabled == false)
 { var index="_0" }
else if (document.getElementById(mast+str+"_1").checked == true && document.getElementById(mast+str+"_1").disabled == false)
 { var index="_1" }
else if (document.getElementById(mast+str+"_2").checked == true && document.getElementById(mast+str+"_2").disabled == false)
 { var index="_2" }
else
 return  true; 
 
var strng = document.getElementById(mast+str+index).value;

  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str+index).value,document.getElementById(mast+str+index)))
     {
        alert(errMsg);
        document.getElementById(mast+str+index).focus();
        return false;
    
     } 	
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str+index).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(mast+str+index).focus();
        return false;
     }
  var chkStr = /^1|2|3$/;
   if (!strChk.match(chkStr))
    {
       alert('Invalid characters in this field');
       document.getElementById(mast+str+index).focus();
       return false;
    }
   else
       return  true; 
 
}


function valdirectorytxt(control)
{
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     } 	
///check for special characters
  var strChk = document.getElementById(control.id).value;
  var chkStr = /^([a-zA-Z0-9]*[\040]*[-]*[,]*[/]*[.]*[(]*[)]*)*$/;
   if (!strChk.match(chkStr))
    {
       alert('only use A-Z , a-z , 0-9 , dash(-),comma(,),slash (/),space,period(.) and parenthesis() characters in this field');
       document.getElementById(control.id).focus();
       return false;
    }
   else
       return  true; 
 
}


function alphanumericcomplaintpopup(control)
{
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     } 	
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
//  var chkStr = /^([a-zA-Z0-9\s\n-,\\/.])+$/;
//   if (!strChk.match(chkStr))
//    {
//       alert('only use A-Z , a-z , 0-9 , dash(-),comma(,),slash (/),space,period(.) and parenthesis() characters in this field');
//       document.getElementById(control.id).focus();
//       return false;
//    }
   else
       return  true; 
 
}

function alphanumericname(control)
{
//Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     }
///check for blank field                                                             
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
  
// ///allow a-z,A-Z,. and space only 
// var chkStr =  /^([a-zA-Z])+([\040]*[.]*[a-zA-Z]*)*$/;
//   if (!strChk.match(chkStr))
//     {
//        alert("Only  A-Z , a-z ,period and 'space' characters are allowed in this field");
//        document.getElementById(control.id).focus();
//        return false;
//     }
// 
//    else
//       return  true; 
		   
 
}


/////////validate 10-11 phone number
function ValidatePN(str,message)
{
var mast="ctl00_ContentPlaceHolder1_"
var strng = document.getElementById(mast+str).value;
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');

if (isNaN(parseInt(stripped))) 
   {
        alert('The phone number is Invalid.');
        document.getElementById(mast+str).focus();
        return  false;
   
   }
if (!(stripped.length > 9) && (stripped.length < 12)) 
      {
        alert('The phone number is the wrong length.Make sure it is 10 or 11 digits.');
        document.getElementById(mast+str).focus();
        return  false;
	   }
	   
	var emailFilter=/^0{0,1}[1-9]{1}[0-9]{2}[\s]{0,1}[\-]{0,1}[\s]{0,1}[1-9]{1}[0-9]{6}$/;

if (!(emailFilter.test(stripped))) 
     { 
        alert('Please enter a valid Telephone Number.');
        document.getElementById(mast+str).focus();
        return  false;
     }

///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(mast+str).focus();
        return false;
     }
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
     {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
     }
  //reserved characters   
var chkStr = /^['\\@#$%\^*~!+=|:;,./()\"{}\[\]?><`]+$/;
   if (strChk.match(chkStr))
    {
       alert('only numbers and dash(-) characters in this field');
       document.getElementById(mast+str).focus();
       return false;
    }
    else
       return  true; 
		 
}

function alphanumericchallannumber(control)
{
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     }
  //reserved characters   
var chkStr =  /^[a-zA-Z0-9]+$/;
   if (!strChk.match(chkStr))
    {
       alert('Only  A-Z , a-z , 0-9 characters are allowed in this field');
       document.getElementById(control.id).focus();
       return false;
    }
    else
       return  true; 
 
}


function alphanumericregistrationnumber(control)
{
 
///check for blank field
var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert('This field can not be left blank.');
        document.getElementById(control.id).focus();
        return false;
     }
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
     {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
     }
   //reserved characters   
var chkStr =  /^([a-zA-Z0-9]+[-]?[\s]?[/]?)+$/;
   if (!strChk.match(chkStr))
    {
       alert('only use A-Z , a-z , 0-9, dash(-),slash (/) and space characters in this field');
       document.getElementById(control.id).focus();
       return false;
    }
    else
       return  true; 
}

//////////////validate for Blank text boxes
function Validatedate(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
    //reserved characters
       
var chkStr =  /^(\d{2})(\,)([A-Za-z]{3})(\,)(\d{4})$/;
   if (!strChk.match(chkStr))
    {
       alert('Invalid date');
       document.getElementById(mast+str).focus();
       return false;
    }
    
  else
       return  true; 
}

function Validatedatepopup(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(str).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(str).value,document.getElementById(str)))
    {
        alert(errMsg);
        document.getElementById(str).focus();
        return false;
    
    }
    //reserved characters
       
var chkStr =  /^(\d{2})(\/)(\d{2})(\/)(\d{4})$/;
   if (!strChk.match(chkStr))
    {
       alert('Invalid date');
       document.getElementById(str).focus();
       return false;
    }
    
  else
       return  true; 
}
//// validate notice expire date
function Validatenoticedate(str,message)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(mast+str).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(mast+str).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(mast+str).value,document.getElementById(mast+str)))
    {
        alert(errMsg);
        document.getElementById(mast+str).focus();
        return false;
    
    }
    //reserved characters
       
var chkStr =  /^(\d{2})(\/)(\d{2})(\/)(\d{4})$/;
   if (!strChk.match(chkStr))
    {
       alert('Invalid date');
       document.getElementById(mast+str).focus();
       return false;
    }
    
  else
       return  true; 
}


//// validate notice expire date
function Validatenoticedate1(control)
{
  var mast="ctl00_ContentPlaceHolder1_"
  ///check for blank field
  var chkStr = /^[\s]*$/;
var strChk = document.getElementById(control.id).value;
if (strChk.match(chkStr))
     {
        alert(message);
        document.getElementById(control.id).focus();
        return false;
    }
  //Reserved Words      
    if(valkeywords(document.getElementById(control.id).value,document.getElementById(control.id)))
    {
        alert(errMsg);
        document.getElementById(control.id).focus();
        return false;
    
    }
    //reserved characters
       
var chkStr =  /^(\d{2})(\/)(\d{2})(\/)(\d{4})$/;
   if (!strChk.match(chkStr))
    {
       alert('Invalid date');
       document.getElementById(control.id).focus();
       return false;
    }
    
  else
       return  true; 
}




function PrintGrievanceAckAuth() 
			{
			
			var mast="ctl00_ContentPlaceHolder1_"
								

				var tdTable7=document.getElementById("tblbtnHTMLprint");
				tdTable7.style.display = "none";
				
				var tdTable8=document.getElementById("tblchkbox");
				tdTable8.style.display = "none";
				
				var tdTable9=document.getElementById("ctl00_trSubmitGri");
				tdTable9.style.display = "none";
				
				var tdTable10=document.getElementById("ctl00_trmasterback");
				tdTable10.style.display = "none";
				
				
				
							
							
				
				if (window.print) 
				{ 
				    document.getElementById(mast+"liDepartment").disabled = false;
				    document.getElementById(mast+"liGritype").disabled = false;
				    document.getElementById(mast+"liGriOffice").disabled = false;
				    document.getElementById(mast+"liDistrict").disabled = false;
				    document.getElementById(mast+"liConstituency").disabled = false;
				    document.getElementById(mast+"liGriSource").disabled = false;
				    document.getElementById(mast+"liDistrictSender").disabled = false;	
				    document.getElementById(mast+"liApplicantCat").disabled = false;
				    document.getElementById(mast+"chkSC").disabled = false;
				    document.getElementById(mast+"chkDP").disabled = false;	
				    document.getElementById(mast+"liPanchayat").disabled = false;
				    document.getElementById(mast+"liApplicationType").disabled = false;
				      document.getElementById(mast+"radioGriArea").disabled = false;
				       document.getElementById(mast+"liBlockWard").disabled = false;
				        document.getElementById(mast+"RadioApplicantState").disabled = false;
				    		    
				    document.getElementById(mast+"btnprinttop").style.visibility ="hidden"
				    document.getElementById(mast+"btnprintbottom").style.visibility ="hidden"
			        document.getElementById(mast+"imgbtnWISGri").style.visibility ="hidden"
			        
			        
                    if (document.getElementById(mast+"HLanguage").value=='hi-IN')
			        {
                    document.getElementById(mast+"lblSubmitAppHeader").innerHTML = 'अर्जी की प्राप्ति-सूचना' ;
			        document.getElementById(mast+"lblComplaintdetails").innerHTML = 'भेजी गई : ' ;
				    document.getElementById(mast+"lblComplainentDetails").innerHTML = 'अर्जी देने वाले का विवरण : ' ;
				    }
				    else
				    {
				    document.getElementById(mast+"lblSubmitAppHeader").innerHTML = 'Acknowledgement of Grievance' ;
			        document.getElementById(mast+"lblComplaintdetails").innerHTML = 'Submitted to : ' ;
				    document.getElementById(mast+"lblComplainentDetails").innerHTML = 'Senders Details: ' ;
				    }
					window.print();
				} 
				else 
				{
					alert("your browser doesn't support this function");
				}
				    document.getElementById(mast+"liDepartment").disabled = true;
				    document.getElementById(mast+"liGritype").disabled = true;
				    document.getElementById(mast+"liGriOffice").disabled = true;
				    document.getElementById(mast+"liDistrict").disabled = true;
				    document.getElementById(mast+"liConstituency").disabled = true;
				    document.getElementById(mast+"liGriSource").disabled = true;
				     document.getElementById(mast+"liDistrictSender").disabled = true;
				      document.getElementById(mast+"liApplicantCat").disabled = true;
				    document.getElementById(mast+"chkSC").disabled = true;
				    document.getElementById(mast+"chkDP").disabled = true;	
				    document.getElementById(mast+"liPanchayat").disabled = true;
				     document.getElementById(mast+"liApplicationType").disabled = true;
				      document.getElementById(mast+"radioGriArea").disabled = true;
				       document.getElementById(mast+"liBlockWard").disabled = true;
				       document.getElementById(mast+"RadioApplicantState").disabled = true;
				    
				    document.getElementById(mast+"btnprinttop").style.visibility ="visible";
				    document.getElementById(mast+"btnprintbottom").style.visibility ="visible";
			        document.getElementById(mast+"imgbtnWISGri").style.visibility ="visible";
			       
				
			
				var tdTable7=document.getElementById("tblbtnHTMLprint");
				tdTable7.style.display = "";
				
				var tdTable8=document.getElementById("tblchkbox");
				tdTable8.style.display = "";
				
			    var tdTable9=document.getElementById("ctl00_trSubmitGri");
				tdTable9.style.display = "";
				
				var tdTable10=document.getElementById("ctl00_trmasterback");
				tdTable10.style.display = "";
			
			window.location.replace("AuthSubmitGrievance.aspx");	

			}


function PrintGrievanceAck() 
			{
			
			var mast="ctl00_ContentPlaceHolder1_"
								
				var tdTable3=document.getElementById("TabGriCMOne");
				tdTable3.style.display = "none";
							
				var tdTable3=document.getElementById("TabGriCMTtree");
				tdTable3.style.display = "none";
									
				var tdTable7=document.getElementById("tblbtnHTMLprint");
				tdTable7.style.display = "none";
				
				var tdTable8=document.getElementById("tblchkbox");
				tdTable8.style.display = "none";
		

			
				
				if (window.print) 
				{ 
				    document.getElementById(mast+"liDepartment").disabled = false;
				    document.getElementById(mast+"liGritype").disabled = false;
				    document.getElementById(mast+"liGriOffice").disabled = false;
				    document.getElementById(mast+"liDistrict").disabled = false;
				    document.getElementById(mast+"liConstituency").disabled = false;
				    document.getElementById(mast+"liDistrictSender").disabled = false;
				     document.getElementById(mast+"liPanchayat").disabled = false;
				     document.getElementById(mast+"liApplicationType").disabled = false;
				      document.getElementById(mast+"radioGriArea").disabled = false;
				       document.getElementById(mast+"liBlockWard").disabled = false;
				        document.getElementById(mast+"RadioApplicantState").disabled = false;
				    
			        document.getElementById(mast+"liApplicantCat").disabled = false;
				    document.getElementById(mast+"chkSC").disabled = false;
				    document.getElementById(mast+"chkDP").disabled = false;	
				    		    
				    document.getElementById(mast+"btnprinttop").style.visibility ="hidden"
				    document.getElementById(mast+"btnprintbottom").style.visibility ="hidden"
			        document.getElementById(mast+"imgbtnWISGri").style.visibility ="hidden"
			        
			        if (document.getElementById(mast+"HLanguage").value=='hi-IN')
			        {
                    document.getElementById(mast+"lblSubmitAppHeader").innerHTML = 'अर्जी की प्राप्ति-सूचना' ;
			        document.getElementById(mast+"lblComplaintdetails").innerHTML = 'भेजी गई : ' ;
				    document.getElementById(mast+"lblComplainentDetails").innerHTML = 'अर्जी देने वाले का विवरण : ' ;
				    }
				    else
				    {
				    document.getElementById(mast+"lblSubmitAppHeader").innerHTML = 'Acknowledgement of Grievance' ;
			        document.getElementById(mast+"lblComplaintdetails").innerHTML = 'Submitted to : ' ;
				    document.getElementById(mast+"lblComplainentDetails").innerHTML = 'Senders Details: ' ;
				    }
					window.print();
				} 
				else 
				{
					alert("your browser doesn't support this function");
				}
				    document.getElementById(mast+"liDepartment").disabled = true;
				    document.getElementById(mast+"liGritype").disabled = true;
				    document.getElementById(mast+"liGriOffice").disabled = true;
				    document.getElementById(mast+"liDistrict").disabled = true;
				    document.getElementById(mast+"liConstituency").disabled = true;
				    document.getElementById(mast+"liDistrictSender").disabled = true;
				      document.getElementById(mast+"liApplicationType").disabled = true;
				    document.getElementById(mast+"liPanchayat").disabled = true;
				      document.getElementById(mast+"radioGriArea").disabled = true;
				       document.getElementById(mast+"liBlockWard").disabled = true;
				       document.getElementById(mast+"RadioApplicantState").disabled = true;
				    
				    document.getElementById(mast+"liApplicantCat").disabled = true;
				    document.getElementById(mast+"chkSC").disabled = true;
				    document.getElementById(mast+"chkDP").disabled = true;	
				    
				    document.getElementById(mast+"btnprinttop").style.visibility ="visible";
				    document.getElementById(mast+"btnprintbottom").style.visibility ="visible";
			        document.getElementById(mast+"imgbtnWISGri").style.visibility ="visible";
			           
				
				var tdTable3=document.getElementById("TabGriCMOne");
				tdTable3.style.display = "";
				
				var tdTable3=document.getElementById("TabGriCMTtree");
				tdTable3.style.display = "";
									
				var tdTable7=document.getElementById("tblbtnHTMLprint");
				tdTable7.style.display = "";
				
				var tdTable8=document.getElementById("tblchkbox");
				tdTable8.style.display = "";

			}
			
			
function PrintViewGriStatus() 
			{
			
			var mast="ctl00_ContentPlaceHolder1_"
			
			
				
				var tdTable2=document.getElementById("TabGriCMOne");
				tdTable2.style.display = "none";
								
				var tdTable3=document.getElementById("tblSearchCriteria");
				tdTable3.style.display = "none";
		
		
									
				
				if (window.print) 
				{ 
				
				document.getElementById(mast+"lblHeader").innerHTML = '' ;
				window.print();
				} 
				else 
				{
					alert("your browser doesn't support this function");
				}
				    				    
				 var tdTable2=document.getElementById("TabGriCMOne");
				tdTable2.style.display = "";
				       
				
				var tdTable3=document.getElementById("tblSearchCriteria");
				tdTable3.style.display = "";
						
							
			}
			
			
			function PrintViewGriStatusNew() 
			{
			
			var mast="ctl00_ContentPlaceHolder1_"
			 document.getElementById("btnprint").style.visibility ="hidden";
			 document.getElementById("btnclose").style.visibility ="hidden";
			 
				if (window.print) 
				{ 
				window.print();
				} 
				else 
				{
					alert("your browser doesn't support this function");
				} 				    
				 document.getElementById("btnprint").style.visibility ="visible";
				 document.getElementById("btnclose").style.visibility ="visible";
							
			}
			
			


function PrintAddRemGri() 
			{
				
			
			
			var mast="ctl00_ContentPlaceHolder1_";
			document.getElementById("lblHeader").innerHTML = '-- APPLICATION DETAILS -- ' ;
			
			     document.getElementById("btnclose").style.visibility ="hidden";
			     document.getElementById("btnprint").style.visibility ="hidden";
			     

                var varbtnUpdateApplicationType;
                var varbtnUpdateRedTime;
                var varbtnAddMoreGriDetails;
                var varbtnCopyToOtherDept;
                var varbtnUpdateGriType;
                var varbtnUpdateConsituency;
                var varbtnAddAction;
                var varbtnTransfer;


 

			     
			   if  (document.getElementById("btnUpdateApplicationType")!= null )
			       {varbtnUpdateApplicationType="T";
			       document.getElementById("btnUpdateApplicationType").style.display = 'none' ;

		       }
			   if  (document.getElementById("btnUpdateRedTime")!= null)
			       {varbtnUpdateRedTime="T";
			       document.getElementById("btnUpdateRedTime").style.display = 'none' ; 
			   }
			   if  (document.getElementById("btnAddMoreGriDetails")!= null)
			       {varbtnAddMoreGriDetails="T";
			       document.getElementById("btnAddMoreGriDetails").style.display = 'none' ;
			        } 
			   if  (document.getElementById("btnCopyToOtherDept")!= null)
			       {varbtnCopyToOtherDept="T";
			       document.getElementById("btnCopyToOtherDept").style.display = 'none' ;
			       }
			   if  (document.getElementById("btnUpdateGriType")!= null)
			       {varbtnUpdateGriType="T";
			       document.getElementById("btnUpdateGriType").style.display = 'none' ;
			   }
			   if  (document.getElementById("btnUpdateConsituency")!= null)
			       {varbtnUpdateConsituency="T";
			       document.getElementById("btnUpdateConsituency").style.display = 'none' ;   
			   }
			   if  (document.getElementById("btnAddAction")!= null)
			       {varbtnAddAction="T";
			       document.getElementById("btnAddAction").style.display = 'none' ; 
			       }  
			   if  (document.getElementById("btnTransfer")!= null)
			       {varbtnTransfer="T";
			       document.getElementById("btnTransfer").style.display = 'none' ; 
			       }      
			     			
				if (window.print) 
				{ 
				window.print();
				} 
				else 
				{
					alert("your browser doesn't support this function");
				}
				 	 document.getElementById("btnclose").style.visibility ="visible";
				 	 document.getElementById("btnprint").style.visibility ="visible";
				 	 
			   if  (varbtnUpdateApplicationType=="T")
			       document.getElementById("btnUpdateApplicationType").style.display = 'inline' ;
			   
			   if  (varbtnUpdateRedTime=="T")
			       	document.getElementById("btnUpdateRedTime").style.display = 'inline' ;
			   
			   if  (varbtnAddMoreGriDetails=="T")
			       document.getElementById("btnAddMoreGriDetails").style.display = 'inline' ;
			         
			   if  (varbtnCopyToOtherDept=="T")
			       document.getElementById("btnCopyToOtherDept").style.display = 'inline' ; 
			       
			   if  (varbtnUpdateGriType=="T")
			       document.getElementById("btnUpdateGriType").style.display = 'inline' ;
			   
			   if  (varbtnUpdateConsituency=="T")
			       document.getElementById("btnUpdateConsituency").style.display = 'inline' ; 
			   
			   if  (varbtnAddAction=="T")		       
			       document.getElementById("btnAddAction").style.display = 'inline' ;
			         
			   if  (varbtnTransfer=="T")		       
			       document.getElementById("btnTransfer").style.display = 'inline' ;
			       
		       document.getElementById("lblHeader").innerHTML = 'VIEW APPLICATION STATUS' ;
				 	 		    					
			}






