function validarCampos()
{
	if (document.getElementById("tfNome").value 					== ""){document.getElementById("tfNome").focus();		alert("Campo 'Nome' por preencher."); 		return false;
	}else if (document.getElementById("tfEmail").value 			    == ""){document.getElementById("tfEmail").focus();		alert("Campo 'E-Mail' por preencher.");		return false;
	}else if (document.getElementById("taMensagem").value 		    == ""){document.getElementById("taMensagem").focus();	alert("Campo 'Mensagem' por preencher.");	return false;}
}

function validarCamposCandicatura()
{
	if (document.getElementById("tfNome").value 							== ""){document.getElementById("tfNome").focus();						alert("Campo 'Nome' por preencher.");						return false;
	}else if (document.getElementById("tfDNascimento").value 				== ""){document.getElementById("tfDNascimento").focus();				alert("Campo 'Data de Nascimento' por preencher.");			return false;
	}else if (document.getElementById("tfNacionalidade").value 			    == ""){document.getElementById("tfNacionalidade").focus();			    alert("Campo 'Nacionalidade' por preencher.");				return false;
	}else if (document.getElementById("tfMorada_1").value 				    == ""){document.getElementById("tfMorada_1").focus();					alert("Campo 'Morada' por preencher.");						return false;
	}else if (document.getElementById("tfCPostal").value 					== ""){document.getElementById("tfCPostal").focus();					alert("Campo 'Código Postal' por preencher.");				return false;
	}else if (document.getElementById("tfLocalidade").value 				== ""){document.getElementById("tfLocalidade").focus();				    alert("Campo 'Localidade' por preencher.");					return false;
	}else if (document.getElementById("ddbCartaConducao").value 			== ""){document.getElementById("ddbCartaConducao").focus();			    alert("Campo 'Carta de condução' por preencher.");			return false;
	}else if (document.getElementById("tfHLCurso").value 					== ""){document.getElementById("tfHLCurso").focus();					alert("Campo 'Curso' por preencher.");						return false;
	}else if (document.getElementById("tfHLMedia").value 					== ""){document.getElementById("tfHLMedia").focus();					alert("Campo 'Classificação do curso' por preencher.");		return false;
	}else if (document.getElementById("tfEPUltima").value 				    == ""){document.getElementById("tfEPUltima").focus();					alert("Campo 'Última empresa' por preencher.");				return false;
	}else if (document.getElementById("tfEPUltimaDataInicio").value 		== ""){document.getElementById("tfEPUltimaDataInicio").focus();		    alert("Campo 'Início' por preencher.");						return false;
	}else if (document.getElementById("tfEPUltimaDataFim").value 			== ""){document.getElementById("tfEPUltimaDataFim").focus();			alert("Campo 'Fim' por preencher.");						return false;
	}else if (document.getElementById("tfEPUltimaFuncao").value			    == ""){document.getElementById("tfEPUltimaFuncao").focus();			    alert("Campo 'Cargo' por preencher.");						return false;
	}else if (document.getElementById("tfEPUltimaFuncaoDescricao").value	== ""){document.getElementById("tfEPUltimaFuncaoDescricao").focus();	alert("Campo 'Descrição do Cargo' por preencher.");			return false;}

	/*
	if (document.getElementById("tfNome").value 					== ""){document.getElementById("tfNome").focus();			alert("Campo 'Nome' por preencher.");					return false;
	}else if (document.getElementById("tfBI").value 				== ""){document.getElementById("tfBI").focus();				alert("Campo 'Bilhete de Identidade' por preencher.");	return false;
	}else if (document.getElementById("tfDNascimento").value 		== ""){document.getElementById("tfDNascimento").focus();	alert("Campo 'Data de Nascimento' por preencher.");		return false;
	}else if (document.getElementById("tfNacionalidade").value 	    == ""){document.getElementById("tfNacionalidade").focus();	alert("Campo 'Nacionalidade' por preencher.");			return false;
	}else if (document.getElementById("tfMorada_1").value 		    == ""){document.getElementById("tfMorada_1").focus();		alert("Campo 'Morada' por preencher.");					return false;
	}else if (document.getElementById("tfCPostal").value 			== ""){document.getElementById("tfCPostal").focus();		alert("Campo 'Código Postal' por preencher.");			return false;
	}else if (document.getElementById("tfLocalidade").value 		== ""){document.getElementById("tfLocalidade").focus();		alert("Campo 'Localidade' por preencher.");				return false;
	}else if (document.getElementById("tfPais").value 			    == ""){document.getElementById("tfPais").focus();			alert("Campo 'País' por preencher.");					return false;
	}else if (document.getElementById("ddbCartaConducao").value 	== ""){document.getElementById("ddbCartaConducao").focus();	alert("Campo 'Carta de condução' por preencher.");		return false;}
	
	var checked=false;
	for (var i=0; i < document.CandidaturaEspontanea.rbHorario.length; i++)
		if (document.CandidaturaEspontanea.rbHorario[i].checked)
			checked=true;

	if(checked==false)
	{
		alert("Campo 'Disponibilidade horário' por preencher.");
		return false;
	}
	*/	
}

function validarCamposRegisto()
{
	if (document.getElementById("tfNome").value 				== ""){document.getElementById("tfNome").focus();			alert("Campo 'Nome' por preencher."); 			return false;
	}else if (document.getElementById("tfMorada").value 		== ""){document.getElementById("tfMorada").focus();		    alert("Campo 'Morada' por preencher."); 		return false;
	}else if (document.getElementById("tfCPostal").value 		== ""){document.getElementById("tfCPostal").focus();		alert("Campo 'Código Postal' por preencher."); 	return false;
	}else if (document.getElementById("tfProfissao").value  	== ""){document.getElementById("tfProfissao").focus();	    alert("Campo 'Profissão' por preencher."); 		return false;
	}else if (document.getElementById("tfEMail").value 		    == ""){document.getElementById("tfEMail").focus();		    alert("Campo 'E-Mail' por preencher.");			return false;
	}else if (document.getElementById("tfContribuinte").value   == ""){document.getElementById("tfContribuinte").focus();   alert("Campo 'Contribuinte' por preencher.");   return false;}
}

function validarCamposRecuperar()
{
	if (document.getElementById("tfEmail").value == "")
	{
		document.getElementById("tfEmail").focus();
		return false;
	}
}

function validarPesquisa()
{
	if (document.getElementById("tfPesquisa").value == "" || document.getElementById("tfPesquisa").value == "Pesquisa"){
		document.getElementById("tfPesquisa").focus();
		return false;
	}
}

function validarNewsletter(){
	if (document.getElementById("tfEMail").value.length == 0)
	{
	    if(detect.indexOf('msie')+1>0)
		{
		    document.getElementById("tfEMail").focus();
		}
		return false;
	}
}

function redirect(url)
{
	window.location = url;
}

function login()
{
    document.getElementById('iUser').style.border = "solid 1px #FF7200";
    document.getElementById('iUser').style.backgroundColor = "#FFEBA6";
    document.getElementById('iUser').focus();
}

function login_out()
{
    document.getElementById('iUser').style.border = "solid 1px #7F9DB9";
    document.getElementById('iUser').style.backgroundColor = "#FFFFFF";
}