function verifica_contactos() {
	if(isEmpty('nome', 'Nome', 'ContactosForm') &&
	isEmpty('email', 'E-mail', 'ContactosForm') &&
	isEmail('email', 'E-mail', 'ContactosForm') &&
	isEmpty('morada', 'Morada', 'ContactosForm') &&
	isEmpty('assunto', 'Assunto', 'ContactosForm') &&
	isEmpty('mensagem', 'Mensagem', 'ContactosForm')){			

	return true;
	}

	return false;
}

function verifica_recomendacao() {
	if(isEmpty('name_from', 'O seu nome', 'RecommendForm') &&
	isEmpty('email_from', 'O seu e-mail', 'RecommendForm') &&
	isEmail('email_from', 'O seu e-mail', 'RecommendForm') &&
	isEmpty('name_to', 'Para', 'RecommendForm') &&
	isEmpty('email_to', 'E-mail', 'RecommendForm') &&
	isEmail('email_to', 'E-mail', 'RecommendForm') &&
	isEmpty('captcha', 'C\xF3digo de verificação', 'RecommendForm')) {			
	return true;
	}
	return false;
}

function verifica_mailing() {
	if(isEmpty('name', 'O seu nome', 'MailingForm') &&
	isEmpty('email', 'O seu e-mail', 'MailingForm') &&
	isEmail('email', 'O seu e-mail', 'MailingForm') &&
	isEmpty('captcha', 'C\xF3digo de verificação', 'MailingForm')) {			
	return true;
	}
	return false;
}

// Base
// Verify field is empty, false focus it
function isEmpty(field, name, form)
{
	
	var argv = isEmpty.arguments;

	if (argv[2]=='' || argv[2]==null)
	{
		argv[2]=0;
	}

	x = document.forms[argv[2]].elements[argv[0]];

	if (x == undefined || x.value == '0' || x.value == '')
	{
    	alert ('O campo "' + argv[1] + '" \xE9 de preenchimento obrigat\xF3rio.');
		x.focus();
	    return false;
	}

	return true;
}

//verifies field is numeric
function isNumeric(field, name, form)
{
	x = document.forms[form].elements[field];
	if (x.value == "")
	{
		return true;
	}
	
	if (x.value.match (/[^\d^\.]/))
	{
		alert("O campo " + name + " não é numérico!");
        x.focus();
		return false;
	}

	return true;
}

function isEmail(field, name, form)
{

	var argv = isEmail.arguments;

	if (argv[2]=='' || argv[2]==null)
	{
		argv[2]=0;
	}

	var email = document.forms[argv[2]].elements[argv[0]];
	valid = /^.*\@.*\..*$/i;

	if (email.value.search (valid) == -1)
	{
		alert("O campo " + argv[1] + " não é correto!");
		email.focus();
		return false;
	}
	return true;
}


/* Script Aumentar/Diminuir Fonte by http://www.mundoblogger.com.br/ */
//<![CDATA[
function fontMais(){
	var obj = document.getElementById("textoFonte");
	if (obj.style.fontSize==""){obj.style.fontSize="12px"};
	if (obj.style.fontSize=="10px"){obj.style.fontSize = "12px";}
	else if (obj.style.fontSize=="12px"){obj.style.fontSize = "15px";}
	else if (obj.style.fontSize=="15px"){obj.style.fontSize = "17px";}
	//limite a 17px
	//else if (obj.style.fontSize=="17px"){obj.style.fontSize = "19px";}
	//else if (obj.style.fontSize=="19px"){obj.style.fontSize = "21px";}
}
function fontMenos(){
	var obj = document.getElementById("textoFonte");
	if (obj.style.fontSize==""){obj.style.fontSize="12px"};
	if (obj.style.fontSize=="21px"){obj.style.fontSize = "19px";}
	else if (obj.style.fontSize=="19px"){obj.style.fontSize = "17px";}
	else if (obj.style.fontSize=="17px"){obj.style.fontSize = "15px";}
	else if (obj.style.fontSize=="15px"){obj.style.fontSize = "12px";}
	//else if (obj.style.fontSize=="12px"){obj.style.fontSize = "10px";}
}
//]]>
