function emailValidate(element) {
    //Validating the email field
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    if (! element.value.match(re)) {
        alert("Invalid email address");
        element.focus();
        element.select();
        return (false);
    }
    return(true);

}
function textValidate(field,alerttxt)
{

	with (field)
	{
		if (value == "") {
			{alert(alerttxt);
			return false}
			}
		else {
			field.action = "submit_contact.php";
			return true}
	}
}

function formValidate()
{
	if (textValidate(document.contactUs.field_n,"Please enter a name.")==false)
		{document.contactUs.field_n.focus();return false}
	else if (textValidate(document.contactUs.field_m,"Please enter a message.")==false)
		{document.contactUs.field_m.focus();return false}
	else if (emailValidate(document.contactUs.field_e)==false)
		{return false;}
	else if (emailValidate(document.contactUs.field_e)==true)
		{
			LVTPAGELOAD.editIpName(document.getElementById('field_n').value,document.getElementById('field_e').value,document.getElementById('field_tele').value,document.getElementById('field_town').value,document.getElementById('field_org').value);
			document.contactUs.action = "submit_contact.php";
		}
}


function pricingFormValidate()
{
	if (textValidate(document.seedPricingForm.field_n,"Please enter a name.")==false)
		{document.seedPricingForm.field_n.focus();return false}
	else if (textValidate(document.seedPricingForm.field_c,"Please enter a country.")==false)
		{document.seedPricingForm.field_v.focus();return false}
	else if (textValidate(document.seedPricingForm.field_v,"Please enter a variety.")==false)
		{document.seedPricingForm.field_v.focus();return false}
	else if (emailValidate(document.seedPricingForm.field_e)==false)
		{return false;}
	else if (emailValidate(document.seedPricingForm.field_e)==true)
		{
			LVTPAGELOAD.editIpName(document.getElementById('field_n').value,document.getElementById('field_e').value)
			document.seedPricingForm.submit();
		}
}

