/**
* Check if a text has a link
*
* @param string sText text to validate
* @param string sElement field label
* @return boolean
*/

function _checkText (sText, sElement)
{
	var pos=sText.indexOf("<a");
	var pos2 = sText.indexOf("http://");
	var pos3 = sText.indexOf("https://");
	var pos4 = sText.indexOf("www.");
	if (pos>=0 || pos2 >=0 || pos3 >=0 || pos4 >=0 )
	{
	    alert('Links are disabled. Please remove the link code from the '+sElement+ ' field.');
		return false;
	}
	return true;
}

/**
* Check all the comment form fields
*
* @param string sAuthor
* @param string sEmail
* @param string sComment
* @return boolean
*/

function checkComment (sAuthor, sEmail, sComment)
{
	return _checkText (sAuthor, 'name') && _checkText (sEmail, 'email')&& _checkText (sComment, 'comment');
}