<!-- Begin
function trimString(theString)
{
	return theString.replace(/^\s*|\s*$/g,"");
}

function checkFriendEmails(theForm)
{
	var retVal = true;
	var x;
	var theElements = theForm.elements;
	for(x in theElements)
	{
		// Trim the spaces
		var tempValue = trimString(theElements[x].value);
		if(theElements[x].name.indexOf("friendemail") >= 0 && tempValue.length > 0)
		{
			retVal = emailCheck(tempValue);
			if(!retVal)
			{
				break;
			}
		}
	}
	return retVal;
}

function validate(theForm)
{
	// First check required stuff - from email and from name
	if( checkrequired(theForm) )
	{
		// Check from email
		if( emailCheck(trimString(theForm.fromemail.value)) )
		{
			// Check all friend emails addresses that were entered
			if( checkFriendEmails(theForm) )
			{
				return true;
			}
		}
	}
	return false;
}

function validateNewsletterForm(theForm)
{
	// First check required stuff - from email and from name
	if( checkrequired(theForm) )
	{
		// Check from email
		if( emailCheck(trimString(theForm.from.value)) )
		{
			return true;
		}
	}
	return false;
}
//  End -->