    //------------------------------------------------------
	// JavaScript function to verify if date input is in
	// the right format (mm/dd/yyyy).
	//	Parameter: input string
	//	Return type: boolean
	//------------------------------------------------------
	function dateFormatOK_After(){
	    var dateInput;
		dateInput=document.Formcert.inLowEstDate.value;
		var delim1 = dateInput.indexOf("/");
		var delim2 = dateInput.lastIndexOf("/");
		var yyyy = dateInput.substring(0,delim1);
		var mm = dateInput.substring(delim1 + 1, delim2);
		var dd = dateInput.substring(delim2 + 1, dateInput.length);
		var dtCh= "/";
        var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";

        var yearlength
        
       	
		//slash
		if(delim1 != 4 || delim2 !=7) 
		{
		    alert(errorMessage1)
			return false;
		}	
		//components not positive numbers
		 if(!isPosInt(mm) || !isPosInt(dd) || !isPosInt(yyyy)) 
		 {
			alert(errorMessage1)
			return false;
		}	
		//date valid
		 if(!dateLegal_After(mm, dd, yyyy))
			return false;
		else 
			return true;
	}
	function dateFormatOK_inAfter_inactive(){
	    var dateInput;
		dateInput=document.Formcert.inLowEndDate.value;
		var delim1 = dateInput.indexOf("/");
		var delim2 = dateInput.lastIndexOf("/");
		var yyyy = dateInput.substring(0,delim1);
		var mm = dateInput.substring(delim1 + 1, delim2);
		var dd = dateInput.substring(delim2 + 1, dateInput.length);
		var dtCh= "/";
        var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";

       	
		//slash
		if(delim1 != 4 || delim2 !=7) 
		{
		    alert(errorMessage1)
			return false;
		}	
		//components not positive numbers
		 if(!isPosInt(mm) || !isPosInt(dd) || !isPosInt(yyyy)) 
		 {
	  	    alert(errorMessage1)
			return false;
		 }	
		//date valid
		 if(!dateLegal_After_inactive(mm, dd, yyyy))
			return false;
		else 
			return true;
	}
	
	function dateFormatOK_inBefore(){
	    var dateInput; 
	    dateInput=document.Formcert.inHighEstDate.value;
	    
		var delim1 = dateInput.indexOf("/");
		var delim2 = dateInput.lastIndexOf("/");
		var yyyy = dateInput.substring(0,delim1);
		var mm = dateInput.substring(delim1 + 1, delim2);
		var dd = dateInput.substring(delim2 + 1, dateInput.length);
		var dtCh= "/";
        var strString
		var strValidChars = "0123456789/";
		var strChar;
	    var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";
        var pos1=dateInput.indexOf(dtCh)
		var pos2=dateInput.indexOf(dtCh,pos1+1)
		
        //slash
		if(delim1 != 4 || delim2 !=7) 
		{
		 alert(errorMessage1)
		 return false;
		}	
			
		//components not positive numbers
		 if(!isPosInt(mm) || !isPosInt(dd) || !isPosInt(yyyy)) 
		 {
		   alert(errorMessage1)
		   return false;
		 } 	
			
		//date valid
		
		 if(!dateLegal_inBefore(mm, dd, yyyy))
		 
			return false;
			
		else 
			return true;
			
	}
	
   function dateFormatOK_inBefore_inactive(){
	    var dateInput; 
	    dateInput=document.Formcert.inHighEndDate.value;
	    //alert(document.Formcert.inHighEndDate.value)
		var delim1 = dateInput.indexOf("/");
		var delim2 = dateInput.lastIndexOf("/");
		var yyyy = dateInput.substring(0,delim1);
		var mm = dateInput.substring(delim1 + 1, delim2);
		var dd = dateInput.substring(delim2 + 1, dateInput.length);
		var dtCh= "/";
        var strString
		var strValidChars = "0123456789/";
		var strChar;
	    
        var pos1=dateInput.indexOf(dtCh)
		var pos2=dateInput.indexOf(dtCh,pos1+1)
		//alert(delim1)
		//alert(delim2)
        //slash
        var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";
		if(delim1 != 4 || delim2 !=7) 
		{
		 alert(errorMessage1)
		 return false;
		}	
			
		//components not positive numbers
		 if(!isPosInt(mm) || !isPosInt(dd) || !isPosInt(yyyy)) 
		 {
		   alert(errorMessage1)
		   return false;
		 } 	
			
		//date valid
		
		 if(!dateLegal_inBefore_inactive(mm, dd, yyyy))
		 
			return false;
			
		else 
			return true;
			
	}
	function dateLegal_inBefore_inactive(m, d, y){
		var mm = parseInt(m, 10);
		var dd = parseInt(d, 10);
		var yyyy = parseInt(y, 10);
        var minYear=1753;
		var maxYear=2032;
        var today= new Date();
		var CurrentYear = today.getFullYear();
		//thisYear = (thisYear < 100)? thisYear + 1900 : thisYear
		var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";
        if (yyyy > CurrentYear)
        {
          alert('Please check the date, Before date should be less than or equal to todays date.')
          return false;
        }  
        
		if(mm > 12 || mm < 1)
		{
		    //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
		    alert(errorMessage1)
			return false;
		}	
			

		if((mm == 4 || mm == 6 || mm == 9 || mm == 11) && (dd > 30))
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		}
		if(dd > 31)
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		 } 
			

		if((mm == 2) && ((yyyy % 4) != 0) && (dd > 28))
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		 } 
			
		if((mm == 2) && (dd > 29))
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		 } 
			
         
		if (yyyy==0 || yyyy < minYear)
        {
			alert("Institution information exists after 1753/01/01 and before todays date, please check the date, refine your search, or send a FDIC Information Request using the link in the footer area of this page")
			return false
			
		}
		if(dd == 0 || mm==0 )
		{
		    //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ") 
		    alert(errorMessage1)
		 	return false;
		}
		
	    
		return true;
	}
	
    
	
	//------------------------------------------------------
	// JavaScript function to verify if input date is valid. 
	// month, number of days are checked, simple leap year
	// algorithm is used, and year does not exceed this year.
	//	Parameter: month, date, and year strings
	//	Return type: boolean		
	// Note: this function is used in dateFormatOK()
	//------------------------------------------------------
	function dateLegal_inBefore(m, d, y){
		var mm = parseInt(m, 10);
		var dd = parseInt(d, 10);
		var yyyy = parseInt(y, 10);
        var minYear=1753;
		var maxYear=2032;
        var today= new Date();
		var CurrentYear = today.getFullYear();
		//thisYear = (thisYear < 100)? thisYear + 1900 : thisYear
        //alert(yyyy)
        //alert(mm)
        //alert(dd)
        //alert(CurrentYear)
		//alert((new Date()).getFullYear())
		var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";
	    if (yyyy > CurrentYear)
        {
          alert('Please check the date, Before date should be less than or equal to todays date.')
          return false;
        }  
        
		if(mm > 12 || mm < 1)
		{
		    //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
		    alert(errorMessage1)
			return false;
		}	
			

		if((mm == 4 || mm == 6 || mm == 9 || mm == 11) && (dd > 30))
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		}
		if(dd > 31)
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		 } 
			

		if((mm == 2) && ((yyyy % 4) != 0) && (dd > 28))
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		 } 
			
		if((mm == 2) && (dd > 29))
		{
		  //alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
		  alert(errorMessage1)
		  return false;
		 } 
		if(dd == 0 || mm==0 )
		{
		    //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ") 
		    alert(errorMessage1)
		 	return false;
		}
		
			
         
		if (yyyy==0 || yyyy < minYear)
        {
			alert("Institution information exists after 1753/01/01 and before todays date, please check the date, refine your search, or send a FDIC Information Request using the link in the footer area of this page")
			return false
			
		}
	    
		return true;
	}
	
	
	function dateLegal_After(m, d, y){
		var mm = parseInt(m, 10);
		var dd = parseInt(d, 10);
		var yyyy = parseInt(y, 10);
		var yearlength;
        var minYear=1753;
		var maxYear=2032;
	   var thisYear = (new Date()).getFullYear(); //(new Date()).getYear();
		//thisYear = (thisYear < 100)? thisYear + 1900 : thisYear
        var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";
		//alert((new Date()).getFullYear())
       if(mm > 12 || mm < 1)
       {
        // alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
        alert(errorMessage1)
		 return false;
		}	
			

		if((mm == 4 || mm == 6 || mm == 9 || mm == 11) && (dd > 30))
		{
		    //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
		    alert(errorMessage1)
			return false;
		}	
		 if(dd > 31)
		 {
		    //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
		    alert(errorMessage1)
			return false;
		 }	
			

		if((mm == 2) && ((yyyy % 4) != 0) && (dd > 28))
		{
		   //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
		   alert(errorMessage1)
		   return false;
		}	
			
		 if((mm == 2) && (dd > 29))
		 {
		   //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
		   alert(errorMessage1)
			return false;
		 }	
			
         
		if(dd == 0 || mm==0 )
		{
		     //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ") 
		     alert(errorMessage1)
		 	return false;
		}
		
		
		
        if (yyyy==0 || yyyy<minYear)
        {
			//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
			alert("Office information exists after 1753/01/01, please check the date, refine your search, or send a FDIC Information Request using the link in the footer area of this page")
			return false;
			
		}
	
		return true;
	}
	function dateLegal_After_inactive(m, d, y){
		var mm = parseInt(m, 10);
		var dd = parseInt(d, 10);
		var yyyy = parseInt(y, 10);
        var minYear=1753;
		var maxYear=2032;
       var thisYear = (new Date()).getFullYear(); //(new Date()).getYear();
		//thisYear = (thisYear < 100)? thisYear + 1900 : thisYear
       var errorMessage1="You have entered an invalid date(yyyy/mm/dd). Please,correct the date and retry ";
		//alert((new Date()).getFullYear())
       if(mm > 12 || mm < 1)
       {
         alert(errorMessage1)
         //alert("You have entered an invalid date(yyyy/mm/dd).Please,correct the date and retry ")
		 return false;
		}	
			

		if((mm == 4 || mm == 6 || mm == 9 || mm == 11) && (dd > 30))
		{
		    alert(errorMessage1)
			return false;
		}	
		 if(dd > 31)
		 {
		    alert(errorMessage1)
			return false;
		 }	
		if(dd == 0 || mm==0 )
		{
		     alert(errorMessage1) 
		 	return false;
		}
			

		if((mm == 2) && ((yyyy % 4) != 0) && (dd > 28))
		{
		   alert(errorMessage1)
		   return false;
		}	
			
		 if((mm == 2) && (dd > 29))
		 {
		   alert(errorMessage1)
			return false;
		 }	
			
         
		//if(yyyy > thisYear)
		//	return false;
		
		
        if (yyyy==0 || yyyy<minYear)
        {
			//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
			alert("Office information exists after 1753/01/01, please check the date, refine your search, or send a FDIC Information Request using the link in the footer area of this page")
			return false;
			
		}
	
		return true;
	}
	
	
	
	function dateFormatOK(dateInput){
		var delim1 = dateInput.indexOf("/");
		var delim2 = dateInput.lastIndexOf("/");
		var yyyy = dateInput.substring(0,delim1);
		var mm = dateInput.substring(delim1 + 1, delim2);
		var dd = dateInput.substring(delim2 + 1, dateInput.length);
		//slash
		if(delim1 != 4 || delim2 !=7) 
			return false;
		//components not positive numbers
		else if(!isPosInt(mm) || !isPosInt(dd) || !isPosInt(yyyy)) 
			return false;
		//date valid
		else if(!dateLegal(mm, dd, yyyy))
			return false;
		else 
			return true;
	}

	//------------------------------------------------------
	// JavaScript function to verify if input date is valid. 
	// month, number of days are checked, simple leap year
	// algorithm is used, and year does not exceed this year.
	//	Parameter: month, date, and year strings
	//	Return type: boolean		
	// Note: this function is used in dateFormatOK()
	//------------------------------------------------------
	function dateLegal(m, d, y){
		var mm = parseInt(m, 10);
		var dd = parseInt(d, 10);
		var yyyy = parseInt(y, 10);

		var thisYear = (new Date()).getFullYear(); //(new Date()).getYear();
		//thisYear = (thisYear < 100)? thisYear + 1900 : thisYear

		//alert((new Date()).getFullYear())

		if(mm > 12 || mm < 1)
			return false;

		if((mm == 4 || mm == 6 || mm == 9 || mm == 11) && (dd > 30))
			return false;
		else if(dd > 31)
			return false;

		if((mm == 2) && ((yyyy % 4) != 0) && (dd > 28))
			return false;
		else if((mm == 2) && (dd > 29))
			return false;

		if(yyyy > thisYear)
			return false;

		return true;
	}
	
		function ChangeHeader() {
		  //if (parent.header.document.title != "FDIC: Initial Header")
			parent.header.document.location.replace("header.asp")
		}
		
		function RefreshFrmInstPage(FromWhere)
			{
				//if (FromWhere != "")
				//	{
				//		alert("This page will be refreshed due to a change in the " + FromWhere + "\n\nPlease press the OK button to continue and wait until the page has completely reloaded before entering additional criteria.");
				//	}
				self.document.Formcert.target = "content";
				self.document.Formcert.action = "frm_inst.asp";
				self.document.Formcert.submit();
			}
		
		function submitReset() {
			self.document.location.replace ("frm_inst.asp?resetSelection=True")
		}

		
		function reSubmit() {
			self.document.Formcert.target = "content";
			self.document.Formcert.action = "FindAnInstitution.asp";
			//self.document.FormAll.action = "FindAllList.asp?FindFormType=All";
			self.document.Formcert.submit();
		}
		function submitForm(val) {
		    if (validateForm()) {
		        if (validateCert(self.document.Formcert)) {
		            self.document.Formcert.submit();
		            setTimeout("reSubmit()", 1000)
		        } 
		    }
		}
	function IsNumeric(opt)
   {
   
		var strString
		var strValidChars = "0123456789/";
		var strChar;
		var blnResult = true;
		
		if (opt == 1 )
		{
			strString=document.Formcert.inLowEstDate.value;
			for (i = 0; i < strString.length && blnResult == true; i++)
			   {
			   strChar = strString.charAt(i);
			   if (strValidChars.indexOf(strChar) == -1)
			      {
			      alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
			      document.Formcert.inLowEstDate.focus;
			      blnResult = false;
			      
			     }
			   }
			return blnResult;
			
		}	
		if (opt == 2 )
		{
			strString=document.Formcert.inHighEstDate.value;
			for (i = 0; i < strString.length && blnResult == true; i++)
			   {
			   strChar = strString.charAt(i);
			   if (strValidChars.indexOf(strChar) == -1)
			      {
			      alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
			      document.Formcert.inHighEstDate.focus;
			      blnResult = false;
			      
			     }
			   }
			return blnResult;
		}	
	}	
		function IsNumeric1(opt)
   {
   
		var strString
		var strValidChars = "0123456789/";
		var strChar;
		var blnResult = true;
		
		if (opt == 1 )
		{
			strString=document.Formcert.inLowEndDate.value;
			for (i = 0; i < strString.length && blnResult == true; i++)
			   {
			   strChar = strString.charAt(i);
			   if (strValidChars.indexOf(strChar) == -1)
			      {
			      alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
			      document.Formcert.inLowEndDate.focus;
			      blnResult = false;
			      
			     }
			   }
			return blnResult;
			
		}	
		if (opt == 2 )
		{
			strString=document.Formcert.inHighEndDate.value;
			for (i = 0; i < strString.length && blnResult == true; i++)
			   {
			   strChar = strString.charAt(i);
			   if (strValidChars.indexOf(strChar) == -1)
			      {
			      alert("You have entered an invalid date(yyyy/mm/dd).Please, correct the date and retry ")
			      document.Formcert.inHighEndDate.focus;
			      blnResult = false;
			      
			     }
			   }
			return blnResult;
		}	
	}	

  
		function submitForm2(val) {
		
		if (document.Formcert.inLowEstDate.value > '')
		   {
		   if (!dateFormatOK_After(document.Formcert.inLowEstDate.value)) 
			{
						//alert('Please check the After date. Either the format is incorrect or an invalid date has been entered.')
						//alert('Office information exists after 1753/01/01, please check the date, refine your search, or send a FDIC Information Request using the link in the footer area of this page')
						document.Formcert.inLowEstDate.focus;
						return false;
						
			}
			
		   }		
		
		if (document.Formcert.inHighEstDate.value > '') 
		{
			
					if (!dateFormatOK_inBefore(document.Formcert.inHighEstDate.value))
					 {
						//alert('Please check the date, Before date should be less than or equal to todays date.')
						//document.Formcert.inHighEstDate.focus;
						return false;
					}
			
		}
		
		
		  if(validateForm(self.document.Formcert)){
			self.document.Formcert.submit();
			setTimeout("reSubmit()",1000)
			}
		}
		function setIndex()
		{
			//alert(self.document.Formcert.Period1.selectedIndex);
			self.document.Formcert.inInstStatusIndex.value=self.document.Formcert.inInstStatus.selectedIndex;
			self.document.Formcert.inSortIndex.value=self.document.Formcert.inSort.selectedIndex;
			//self.document.Formcert.Period1Index.value=self.document.Formcert.Period1.selectedIndex;
			self.document.Formcert.MaxRecsIndex.value=self.document.Formcert.MaxRecs.selectedIndex;
		}
		function zip_IsNumeric(zipCode) {
		    var strString
		    var strValidChars = "0123456789.-";
		    var strChar;
		    var blnResult = true;
		    if (zipCode == 1) {
		        strString = self.document.Formcert.inZip.value
		        self.document.Formcert.inZip.focus;
		    }
		    else {
		        strString = zipCode;
		    }
		    if (strString.length != 5) {
		        alert("The Zip Code must be a 5 digit number.  Please try again.");
		        return false;
		    }
		    //  test strString consists of valid characters listed above
		    for (i = 0; i < strString.length && blnResult == true; i++) {
		        strChar = strString.charAt(i);
		        if (strValidChars.indexOf(strChar) == -1) {
		            blnResult = false;
		            alert("The Zip Code must be a 5 digit number.  Please try again.");
		        }
		    }
		    return blnResult;
		}

		function validateForm() {

		    if (!isPosInt(document.Formcert.inZip.value)) {
		//Commented by kavitha on 6/16/11
		       // alert("Zipcode is numeric charcter between 1 to 5 digit.  Please, try it again");
			alert("The Zip Code must be a 5 digit number.  Please try again.");
		        return false
		    }
		    return true;
		}

