var bSubmit = false;

function CheckFields(optionValue)
	{
		//Check if the procedure has already been clicked
		if (bSubmit == true)
		{
			return;
		}
		bSubmit = true;
		
		with (document.frmContact)
		{
			

			if (txtFName.value == "")
			{
				alert("You have not entered your Name.  Please correct and submit again.");
				txtFName.focus();
				bSubmit = false;
				return;
			}			

			if (txtEmail.value == "") 
			{
				alert("You have not entered your Email Address. Please correct and submit again.");
				txtEmail.focus();
				bSubmit = false;
				return;
			}
			
			if(isEmail(txtEmail.value) == false)
			{
				alert("You have not entered a valid Email Address. Please correct and submit again.");
				txtEmail.focus();
				bSubmit = false;
				return;
			}			
	
			submit();
		}
	}

var bSubmit2 = false;

function CheckFields2(optionValue)
	{
		//Check if the procedure has already been clicked
		if (bSubmit2 == true)
		{
			return;
		}
		bSubmit2 = true;
		
		with (document.frmContact2)
		{
			

			if (txtFName2.value == "")
			{
				alert("You have not entered your Name.  Please correct and submit again.");
				txtFName2.focus();
				bSubmit2 = false;
				return;
			}			

			if (txtEmail2.value == "") 
			{
				alert("You have not entered your Email Address. Please correct and submit again.");
				txtEmail2.focus();
				bSubmit2 = false;
				return;
			}
			
			if(isEmail(txtEmail2.value) == false)
			{
				alert("You have not entered a valid Email Address. Please correct and submit again.");
				txtEmail2.focus();
				bSubmit2 = false;
				return;
			}			
	
			submit();
		}
	}		
	
function isEmail(str) 
	{
		// are regular expressions supported?
		var supported = 0;
		if(window.RegExp){
		  var tempStr = "a";
		  var tempReg = new RegExp(tempStr);
		  if(tempReg.test(tempStr)) supported = 1;
		}
		if (!supported) 
		  return(str.indexOf(".") > 2) && (str.indexOf("@") > 0);
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		return (!r1.test(str) && r2.test(str));
	}
	