function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
			{alert(alerttxt);return false;}
		else {return true;}
	}
}

function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="")
			{alert(alerttxt);return false;}
		else {return true}
	}
}

function validate_form2(thisform)
{
	with (thisform)
	{
		if (validate_email(txtEmail,"The e-mail address is not valid.")==false)
			{txtEmail.focus();return false;}
			
		if (chkUKPaxReport.checked == false && chkCapacityReport.checked == false && chkEmissionsReport.checked == false)
		    {alert("Please select a type of report.");return false;}
	}
}

function validate_form3(thisform)
{
	with (thisform)
	{
        if (validate_required(txtName,"The name field must be completed before an email can be sent.")==false)
			{txtName.focus();return false;}
			
		if (validate_required(txtCompany,"The company field must be completed before an email can be sent.")==false)
			{txtName.focus();return false;}
	
		if (validate_email(txtEmail,"The e-mail address is not valid.")==false)
			{txtEmail.focus();return false;}
			
	}
}
