
function isEmailAddr(email)
{
	
	var result = false
	var theStr = new String(email)
	var index = theStr.indexOf("@");
	if (index > 0)
	{
		var pindex = theStr.indexOf(".",index);
		if ((pindex > index+1) && (theStr.length > pindex+1))
		result = true;
	}
	return result;
}

function check()
{	
	if(document.add.comment_from.value == "")
	{
		alert("From Name not given.");
		document.add.comment_from.focus();
		return false;
	}

	if(document.add.comment_from_email.value == "")
	{
		alert("Email not given.");
		document.add.comment_from_email.focus();
		return false;
	}

	if(!isEmailAddr(document.add.comment_from_email.value))
	{
		alert("Email format not correct.");
		document.add.comment_from_email.focus();
		return false;
	}
	
	if(document.add.comment_from_contact.value == "")
	{
		alert("Contact not given.");
		document.add.comment_from_contact.focus();
		return false;
	}

	if(document.add.comment_from_country.value == "")
	{
		alert("Country not given.");
		document.add.comment_from_country.focus();
		return false;
	}

	if(document.add.comment_title.value == "")
	{
		alert("Title not given.");
		document.add.comment_title.focus();
		return false;
	}

	if(document.add.comment_desc.value == "")
	{
		alert("Description not given.");
		document.add.comment_desc.focus();
		return false;
	}





}
