function checkAgencyDB()
{
	//alert("u arein javascript"+document.agencydbfrm.agencystate.value);

	if( document.agencydbfrm.agencyname.value == "" || document.agencydbfrm.agencyname.value == " ")
	{
		alert("Enter a Agency");
		return;
	}

	/*if( (document.agencydbfrm.agencytype.value == "") || (document.agencydbfrm.agencytype.value == " ") || (document.agencydbfrm.agencytype.value == "selected"))
	{
		alert("Select Agency Type");
		return;
	}*/


	
	if( (document.agencydbfrm.agencystate.value == "") || (document.agencydbfrm.agencystate.value == " ") || (document.agencydbfrm.agencystate.value == '--') || (document.agencydbfrm.agencystate.value == "selected"))
	{
		alert("Select State");
		return;
	}


	/*if( document.agencydbfrm.agencycongdistname.value == ""  || document.agencydbfrm.agencycongdistname.value == " ")
	{
		alert("select Congressional District");
		return;
	}

	if(document.agencydbfrm.agencyrepdistname.value == "" || document.agencydbfrm.agencyrepdistname.value == " ")
	{
		alert("select State Representative District");
		return;
	}

	if( document.agencydbfrm.agencycounty.value == "" || document.agencydbfrm.agencycounty.value == " ")
	{
		alert("Enter County");
		return;
	}

	if( document.agencydbfrm.agencycity.value == "" || document.agencydbfrm.agencycity.value == " ")
	{
		alert("Enter City");
		return;
	}


	if( document.agencydbfrm.agencysaddress.value == "" || document.agencydbfrm.agencysaddress.value == " ")
	{
		alert("Enter street address");
		return;
	}

	if( document.agencydbfrm.agencymaddress.value == "" || document.agencydbfrm.agencymaddress.value == " ")
	{
		alert("Enter Mailing Address");
		return;
	}




	if ( document.agencydbfrm.agencysaddzip.value != ''  || document.agencydbfrm.agencysaddzip.value != "")
	{
		var s1=document.agencydbfrm.agencysaddzip.value;
		reZip1 = new RegExp(/(^\d{5}$)/);
	    if (!reZip1.test(s1)) 
		{
          alert("Street Address Zip Code Is Not Valid - 5 Digits");
          return false;
		}

	}else
	{
		alert("Enter Street Address Zip Code");
          return false;
	}


	if ( document.agencydbfrm.agencymaddzip.value != ''  || document.agencydbfrm.agencymaddzip.value != "")
	{
		var s2=document.agencydbfrm.agencymaddzip.value;
		reZip2 = new RegExp(/(^\d{5}$)/);
	    if (!reZip2.test(s2)) 
		{
          alert("Mailing Address Zip Code Is Not Valid -5 Digits");
          return false;
		}

	}
	else
	{
		alert("Enter Mailing Address Zip Code");
          return false;
	}


	if(document.agencydbfrm.agencyphnoa1.value == '')
	{
		alert("Enter 3 Digit Area Code");
		document.agencydbfrm.agencyphnoa1.focus();
		return false;
	}
	else
	{
		var strng = document.agencydbfrm.agencyphnoa1.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
		{
				alert("The Area Code contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyphnoa1.focus();
				return false;
		}
		if (!(stripped.length == 3)) 
		{
				alert("The Area Code is the wrong length. Make sure to included 3 digit area code.\n");
				document.agencydbfrm.agencyphnoa1.focus();
				return false;
		}
	}

	if(document.agencydbfrm.agencyphnoa2.value == '')
	{
		alert("Enter 1st 3 Digit of Phone Number");
		document.agencydbfrm.agencyphnoa2.focus();
		return false;
	}
	else
	{
		var strng = document.agencydbfrm.agencyphnoa2.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
			{
				alert("The phone number contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyphnoa2.focus();
				return false;
			}
		if (!(stripped.length == 3)) 
			{
				alert("The phone number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyphnoa2.focus();
				return false;
			}
	}

	
			
	if(document.agencydbfrm.agencyphnoa3.value == '')
	{
			alert("Enter Last 4 Digit Phone Number");
			document.agencydbfrm.agencyphnoa3.focus();
			return false;
	}
	else
	{
			var strng = document.agencydbfrm.agencyphnoa3.value;
			var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
			//strip out acceptable non-numeric characters
			if (isNaN(parseInt(stripped))) 
			{
				alert("The phone number contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyphnoa3.focus();
				return false;
			}
			if (!(stripped.length == 4)) 
			{
				alert("The phone number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyphnoa3.focus();
				return false;
			}
	}*/

//	alert("document.agencydbfrm.agencyphno1ext.value"+document.agencydbfrm.agencyphno1ext.value);
	if(document.agencydbfrm.agencyphno1ext.value != '')
	{
//			alert("document.agencydbfrm.agencyphno1ext.value"+document.agencydbfrm.agencyphno1ext.value);
			var strng = document.agencydbfrm.agencyphno1ext.value;
			var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
			//strip out acceptable non-numeric characters
			if (isNaN(parseInt(stripped))) 
				{
					alert("The phone number 1 Extension contains illegal characters. It should contain only numbers");
					document.agencydbfrm.agencyphno1ext.focus();
					return false;
				}
			if (!(stripped.length <= 4)) 
				{
					alert("The phone number Extension is the wrong length. Make sure you included <= 4 Digits.\n");
					document.agencydbfrm.agencyphno1ext.focus();
					return false;
				}
	}	


//	alert("document.agencydbfrm.agencyphnob1.value"+document.agencydbfrm.agencyphnob1.value);
//	alert("document.agencydbfrm.agencyphnob2.value"+document.agencydbfrm.agencyphnob2.value);
//	alert("document.agencydbfrm.agencyphnob3.value"+document.agencydbfrm.agencyphnob3.value);

	if( (document.agencydbfrm.agencyphnob1.value == '') && (document.agencydbfrm.agencyphnob2.value != '') && (document.agencydbfrm.agencyphnob3.value != '') )
	{
		alert("Check Phone Number 2");
		document.agencydbfrm.agencyphnob1.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyphnob1.value != '') && (document.agencydbfrm.agencyphnob2.value == '') && (document.agencydbfrm.agencyphnob3.value != ''))
	{
		alert("Check Phone Number 2");
		document.agencydbfrm.agencyphnob2.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyphnob1.value != '') && (document.agencydbfrm.agencyphnob2.value != '') && (document.agencydbfrm.agencyphnob3.value == ''))
	{
		alert("Check Phone Number 2");
		document.agencydbfrm.agencyphnob3.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyphnob1.value == '') && (document.agencydbfrm.agencyphnob2.value == '') && (document.agencydbfrm.agencyphnob3.value != '') )
	{
		alert("Check Phone Number 2");
		document.agencydbfrm.agencyphnob1.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyphnob1.value != '') && (document.agencydbfrm.agencyphnob2.value == '') && (document.agencydbfrm.agencyphnob3.value == ''))
	{
		alert("Check Phone Number 2");
		document.agencydbfrm.agencyphnob2.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyphnob1.value == '') && (document.agencydbfrm.agencyphnob2.value != '') && (document.agencydbfrm.agencyphnob3.value == ''))
	{
		alert("Check Phone Number 2");
		document.agencydbfrm.agencyphnob3.focus();
		return false;
	}


	if(document.agencydbfrm.agencyphnob1.value != '')
	{
			var strng = document.agencydbfrm.agencyphnob1.value;
			var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
			//strip out acceptable non-numeric characters
			if (isNaN(parseInt(stripped))) 
			{
				alert("The Area Code contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyphnob1.focus();
				return false;
			}
			if (!(stripped.length == 3)) 
			{
				alert("The Area Code is the wrong length. Make sure to included 3 digit area code.\n");
				document.agencydbfrm.agencyphnob1.focus();
				return false;
			}
	}


	if(document.agencydbfrm.agencyphnob2.value != '')
	{
		var strng = document.agencydbfrm.agencyphnob2.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
			{
				alert("The phone number contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyphnob2.focus();
				return false;
			}
		if (!(stripped.length == 3)) 
			{
				alert("The phone number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyphnob2.focus();
				return false;
			}
	}


	if(document.agencydbfrm.agencyphnob3.value != '')
	{
		var strng = document.agencydbfrm.agencyphnob3.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
			{
				alert("The phone number contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyphnob3.focus();
				return false;
			}
		if (!(stripped.length == 4)) 
			{
				alert("The phone number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyphnob3.focus();
				return false;
			}
	}


//alert("document.agencydbfrm.agencyphno2ext.value"+document.agencydbfrm.agencyphno2ext.value);
	if(document.agencydbfrm.agencyphno2ext.value != '')
	{
//		alert("document.agencydbfrm.agencyphno2ext.value"+document.agencydbfrm.agencyphno2ext.value);
			var strng = document.agencydbfrm.agencyphno2ext.value;
			var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
			//strip out acceptable non-numeric characters
			if (isNaN(parseInt(stripped))) 
				{
					alert("The phone number 2 Extension contains illegal characters. It should contain only numbers");
					document.agencydbfrm.agencyphno2ext.focus();
					return false;
				}
			if (!(stripped.length <= 4)) 
				{
					alert("The phone number Extension is the wrong length. Make sure you included <= 4 Digits.\n");
					document.agencydbfrm.agencyphno2ext.focus();
					return false;
				}
	}



	if( (document.agencydbfrm.agencyfaxnoa1.value == '') && (document.agencydbfrm.agencyfaxnoa2.value != '') && (document.agencydbfrm.agencyfaxnoa3.value != '') )
	{
		alert("Check Fax Number 1");
		document.agencydbfrm.agencyfaxnoa1.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnoa1.value != '') && (document.agencydbfrm.agencyfaxnoa2.value == '') && (document.agencydbfrm.agencyfaxnoa3.value != ''))
	{
		alert("Check Fax Number 1");
		document.agencydbfrm.agencyfaxnoa2.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnoa1.value != '') && (document.agencydbfrm.agencyfaxnoa2.value != '') && (document.agencydbfrm.agencyfaxnoa3.value == ''))
	{
		alert("Check Fax Number 1");
		document.agencydbfrm.agencyfaxnoa3.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnoa1.value == '') && (document.agencydbfrm.agencyfaxnoa2.value == '') && (document.agencydbfrm.agencyfaxnoa3.value != '') )
	{
		alert("Check Fax Number 1");
		document.agencydbfrm.agencyfaxnoa1.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnoa1.value != '') && (document.agencydbfrm.agencyfaxnoa2.value == '') && (document.agencydbfrm.agencyfaxnoa3.value == ''))
	{
		alert("Check Fax Number 1");
		document.agencydbfrm.agencyfaxnoa2.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnoa1.value == '') && (document.agencydbfrm.agencyfaxnoa2.value != '') && (document.agencydbfrm.agencyfaxnoa3.value == ''))
	{
		alert("Check Fax Number 1");
		document.agencydbfrm.agencyfaxnoa3.focus();
		return false;
	}



	//alert("document.agencydbfrm.agencyfaxnoa1.value"+document.agencydbfrm.agencyfaxnoa1.value);

	if(document.agencydbfrm.agencyfaxnoa1.value != '')
	{
		//	alert("document.agencydbfrm.agencyfaxnoa1.value"+document.agencydbfrm.agencyfaxnoa1.value);
			var strng = document.agencydbfrm.agencyfaxnoa1.value;
			var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
			//strip out acceptable non-numeric characters
			if (isNaN(parseInt(stripped))) 
			{
				alert("The Area Code contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyfaxnoa1.focus();
				return false;
			}
			if (!(stripped.length == 3)) 
			{
				alert("The Area Code is the wrong length. Make sure to included 3 digit area code.\n");
				document.agencydbfrm.agencyfaxnoa1.focus();
				return false;
			}
	}


	if(document.agencydbfrm.agencyfaxnoa2.value != '')
	{
		var strng = document.agencydbfrm.agencyfaxnoa2.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
			{
				alert("The Fax Number contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyfaxnoa2.focus();
				return false;
			}
		if (!(stripped.length == 3)) 
			{
				alert("The Fax Number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyfaxnoa2.focus();
				return false;
			}
	}


	if(document.agencydbfrm.agencyfaxnoa3.value != '')
	{
		var strng = document.agencydbfrm.agencyfaxnoa3.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
			{
				alert("The Fax Number contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyfaxnoa3.focus();
				return false;
			}
		if (!(stripped.length == 4)) 
			{
				alert("The Fax Number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyfaxnoa3.focus();
				return false;
			}
	}








/*	if(document.agencydbfrm.agencyphno1.value == '')
	{
		alert("Enter 10 Digit Phone Number");
		document.agencydbfrm.agencyphno1.focus();
		return false;
	}
	else
	{
		var strng = document.agencydbfrm.agencyphno1.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
		{
				alert("The phone number contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyphno1.focus();
				return false;
		}
		if (!(stripped.length == 10)) 
		{
				alert("The phone number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyphno1.focus();
				return false;
		}
	}
*/

	if( (document.agencydbfrm.agencyfaxnob1.value == '') && (document.agencydbfrm.agencyfaxnob2.value != '') && (document.agencydbfrm.agencyfaxnob3.value != '') )
	{
		alert("Check Fax Number 2");
		document.agencydbfrm.agencyfaxnob1.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnob1.value != '') && (document.agencydbfrm.agencyfaxnob2.value == '') && (document.agencydbfrm.agencyfaxnob3.value != ''))
	{
		alert("Check Fax Number 2");
		document.agencydbfrm.agencyfaxnob2.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnob1.value != '') && (document.agencydbfrm.agencyfaxnob2.value != '') && (document.agencydbfrm.agencyfaxnob3.value == ''))
	{
		alert("Check Fax Number 2");
		document.agencydbfrm.agencyfaxnob3.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnob1.value == '') && (document.agencydbfrm.agencyfaxnob2.value == '') && (document.agencydbfrm.agencyfaxnob3.value != '') )
	{
		alert("Check Fax Number 2");
		document.agencydbfrm.agencyfaxnob1.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnob1.value != '') && (document.agencydbfrm.agencyfaxnob2.value == '') && (document.agencydbfrm.agencyfaxnob3.value == ''))
	{
		alert("Check Fax Number 2");
		document.agencydbfrm.agencyfaxnob2.focus();
		return false;
	}

	if( (document.agencydbfrm.agencyfaxnob1.value == '') && (document.agencydbfrm.agencyfaxnob2.value != '') && (document.agencydbfrm.agencyfaxnob3.value == ''))
	{
		alert("Check Fax Number 2");
		document.agencydbfrm.agencyfaxnob3.focus();
		return false;
	}




	if(document.agencydbfrm.agencyfaxnob1.value != '')
	{
			var strng = document.agencydbfrm.agencyfaxnob1.value;
			var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
			//strip out acceptable non-numeric characters
			if (isNaN(parseInt(stripped))) 
			{
				alert("The Area Code contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyfaxnob1.focus();
				return false;
			}
			if (!(stripped.length == 3)) 
			{
				alert("The Area Code is the wrong length. Make sure to included 3 digit area code.\n");
				document.agencydbfrm.agencyfaxnob1.focus();
				return false;
			}
	}


	if(document.agencydbfrm.agencyfaxnob2.value != '')
	{
		var strng = document.agencydbfrm.agencyfaxnob2.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
			{
				alert("The Fax Number 2 contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyfaxnob2.focus();
				return false;
			}
		if (!(stripped.length == 3)) 
			{
				alert("The Fax Number 2 is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyfaxnob2.focus();
				return false;
			}
	}


	if(document.agencydbfrm.agencyfaxnob3.value != '')
	{
		var strng = document.agencydbfrm.agencyfaxnob3.value;
		var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
		//strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) 
			{
				alert("The Fax Number 2 contains illegal characters. It should contain only numbers");
				document.agencydbfrm.agencyfaxnob3.focus();
				return false;
			}
		if (!(stripped.length == 4)) 
			{
				alert("The phone number is the wrong length. Make sure you included an area code.\n");
				document.agencydbfrm.agencyfaxnob3.focus();
				return false;
			}
	}



	/*if( document.agencydbfrm.agencydesc.value ==	""  || document.agencydbfrm.agencydesc.value == " ")
	{
		alert("Enter Agency Discription");
		return;
	}

	if( document.agencydbfrm.agencyareaserved.value == ""  || document.agencydbfrm.agencyareaserved.value == " ")
	{
		alert("Enter Areas Served by the Agency");
		return;
	}*/

			document.agencydbfrm.action="index.php?classname=cAddAgency&funct=InsertAgency";
			document.agencydbfrm.submit();




}