function validate_name(name)
{
	with (name)
	{
		if (value=="" || value==null)
		{
			alert("Name Field cannot be empty!! Please Enter a name!");
			return false;
		}
		else
		{
			return true;
		}
	}
}

function validate_message(comments)
{
	with (comments)
	{
		if (value=="" || value==null || value==" ")
		{
			alert("Message Field cannot be empty!! Please Enter a Message!");
			return false;
		}
		else
		{
			return true;
		}
	}
}

function validate_subject(subject)
{
	with (subject)
	{
		if (value=="" || value==null || value==" ")
		{
			alert("Subject Field cannot be empty!! Please Enter a Subject!");
			return false;
		}
		else
		{
			return true;
		}
	}
}

function validate_email(email)
{
	with (email)
	{
		var RegExpEmail = /\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi;
		if(RegExpEmail.test(value))
		{
	        return true;
	    }
		else
		{
			alert("Invalid Email Address. Please enter a valid Email Address.");
			return false;
		}
	}
}


function validate_form(thisform)
{
	with (thisform)
	{
		if (validate_name(name)==false)
		{
			name.focus();
			return false;
		}
		else
		if (validate_email(email)==false)
		{
			email.focus();
			return false;
		}
		else
		if (validate_subject(subject)==false)
		{
			subject.focus();
			return false;
		}
		else
		if (validate_message(comments)==false)
		{
			comments.focus();
			return false;
		}
	}
}
