function ValidateRequired(field, alertTxt)
{
	with (field)
	{
		if (value == null || value == "" || value.toLowerCase() == "email" || value.toLowerCase() == "name")
		{
			alert(alertTxt);
			return false;
		}
		else
		{
			return true;
		}
	}
}

function ValidateEmailRequired(emailField, alertTxt)
{
	with (emailField)
	{
		apos = value.indexOf("@");
		dotpos = value.lastIndexOf(".");
		if (apos < 1 || (dotpos - apos) < 2)
		{
			alert(alertTxt);
			return false;
		}
		else
		{
			return true;
		}
	}
 
}

function ValidateForm(form)
{
	with (form)
	{
		if (ValidateRequired(oxMailName, "Your name is required.") == false)
		{
			oxMailName.className = "form required";
			oxMailName.focus();
			return false;
		}
		else
		{
			oxMailName.className = "form";
		}
		if (ValidateRequired(oxMailEmail, "Your email is required.") == false)
		{
			oxMailEmail.className = "form required";
			oxMailEmail.focus();
			return false;
		}
		else
		{
			oxMailEmail.className = "form";
		}
		if (ValidateEmailRequired(oxMailEmail, "The email you entered is not a valid address.") == false)
		{
			oxMailEmail.className = "form required";
			oxMailEmail.focus();
			return false;
		}
		else
		{
			oxMailEmail.className = "form";
		}
	}
	return true;
}

function AttemptSubmitOfForm()
{
	var oxMailForm = document.getElementById('oxMailContactForm');
	var canSubmit = ValidateForm(oxMailForm);
	if (canSubmit)
	{
		oxMailForm.submit();
	}
}
