
function validate(thisform)
{
	
	var msgAlert = "";
	if(thisform.txt_name.value=="") msgAlert+="Name is required";
	else
	{
		if(thisform.txt_email.value=="") msgAlert+="Email is required";
		else
		{
			  if (ValidateEmail(thisform.txt_email.value)) msgAlert+="Valid Email is required";
			  else
			  {
					if(thisform.txt_comment.value=="") msgAlert+= "Comments are Required";
			  }
		}
	}
	
	if (msgAlert != "")
			{
				//alert ("Following issues:\n\n"+msgAlert);
				document.getElementById("msg").innerHTML = msgAlert;
				return false;
			}
			else return true;
}

/***************************Check for Email ids***************************************/
function ValidateEmail(email)
	{
		AtPos = email.indexOf("@")
		StopPos = email.lastIndexOf(".")
		to_return = false;
		
		if (email == "") {
			to_return = true;
		}
		
		if (AtPos == -1 || StopPos == -1) {
			to_return = true;
		}
		
		if (StopPos < AtPos) {
			to_return = true;
		}
		
		if (StopPos - AtPos == 1) {
			to_return = true;
		}
		
		return to_return;
	}
	

