// JavaScript Document

function validate_txtfield(field, e)
{
	with (field)
	{
		if (value == null || value == "") 
		{
			document.getElementById(e).style.visibility = "visible";
			return false;
		}
		else
		{
			document.getElementById(e).style.visibility = "hidden";
			return true;
			
		}
	}
}

function validate_email(field, e)
{
	with (field)
	{
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")

		if (apos<1||dotpos-apos<2) 
		{
			
			document.getElementById(e).style.visibility = "visible";
			return false;
		}
		else
		{
			document.getElementById(e).style.visibility = "hidden";
			return true;					
		}
	}
}

function validate_message(field, e)
{
	with (field)
	{
		if (value == null || value == "") 
		{
			document.getElementById(e).style.visibility = "visible";
			return false;
		}
		else
		{
			document.getElementById(e).style.visibility = "hidden";
			return true;
			
		}
	}
}

function validate_form(thisform)
{
	var valid = true;
	
	with (thisform)
	{
		if (validate_txtfield(txtname,"mf_name") != true)
		{
			valid = valid && false;
		}

		if(validate_email(txtemail, "mf_email") != true)
		{
			valid = valid && false;
		}
		
		if(validate_message(txtmsg, "mf_message") != true)
		{
			valid = valid && false;
		}
		
		return valid;
			
	}
}