String.prototype.trim = function()
{
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

function verificar_campos_Adesao(theForm)
{
	var strTemp;

	strTemp = new String(theForm.nome.value);
	if (strTemp.trim().length == 0)
	{
		alert("Por favor introduza o seu Nome.");
		theForm.nome.focus();
		return false;
	}

	if (checkemail(theForm) == false)
	{
		theForm.eMail.focus();
		return false;
	}


	strTemp = new String(theForm.obs.value);
	if (strTemp.trim().length == 0)
	{
		alert("Por favor introduza as observações.");
		theForm.obs.focus();
		return false;
	}
}

var testresults

function checkemail(theForm)
{
	var str = theForm.eMail.value
	var filter=/^.+@.+\..{2,3}$/
	if (filter.test(str))
		testresults=true
	else
	{
		
		alert("Por favor, preencha correctamente o campo de e-mail")
		testresults=false
		theForm.eMail.focus();
	}
	return testresults;
}

function ValidateSearch(frmSearch)
{
	var strTemp;

	strTemp = new String(frmSearch.search.value);
	if (strTemp.trim().length <= 2) {
		alert("Por favor, introduza uma palavra com mais de 2 letras.");
		return(false);
	}
	else {
		return(true);
	}
}
