function verifica_login_pt(){
	
	if (document.login_topo.username.value=="Nome"){
		msg= "Tem de preencher o campo NOME." + "\n" ;
		window.alert (msg);
		document.login_topo.username.focus(); 
		return false;
	}else if (document.login_topo.username.value==""){
		msg= "Tem de preencher o campo NOME." + "\n" ;
		window.alert (msg);
		document.login_topo.username.focus(); 
		return false;
	}
	return true

	if (document.login_topo.pw.value=="Password"){
		msg= "Tem de preencher o campo PASSWORD." + "\n" ;
		window.alert (msg);
		document.login_topo.pw.focus(); 
		return false;
	}else if (document.login_topo.pw.value==""){
		msg= "Tem de preencher o campo PASSWORD." + "\n" ;
		window.alert (msg);
		document.login_topo.pw.focus(); 
		return false;
	}
	return true	
}


function verifica_login_en(){
	
	if (document.login_topo.username.value=="Name"){
		msg= "You must fill in the field NAME." + "\n" ;
		window.alert (msg);
		document.login_topo.username.focus(); 
		return false;
	}else if (document.login_topo.username.value==""){
		msg= "You must fill in the field NAME." + "\n" ;
		window.alert (msg);
		document.login_topo.username.focus(); 
		return false;
	}
	return true

	if (document.login_topo.pw.value=="Password"){
		msg= "You must fill in the field PASSWORD." + "\n" ;
		window.alert (msg);
		document.login_topo.pw.focus(); 
		return false;
	}else if (document.login_topo.pw.value==""){
		msg= "You must fill in the field PASSWORD." + "\n" ;
		window.alert (msg);
		document.login_topo.pw.focus(); 
		return false;
	}
	return true	
}

function valida_resposta(){
	
	if (document.resposta.nome.value==""){
		msg= "Tem que preencher o campo NOME." + "\n" ;
		window.alert (msg);
		document.resposta.nome.focus(); 
		return false;
	}	
	
	if (document.resposta.data_nasc.value==""){
		msg= "Tem que preencher o campo DATA DE NASCIMENTO." + "\n" ;
		window.alert (msg);
		document.resposta.data_nasc.focus(); 
		return false;
	}
	
	if (document.resposta.email.value!="")
		{
			if (!(valida_email(document.resposta.email.value)))
			{
				document.resposta.email.focus(); 
				return false;
			}
		}
		
	msg= "A sua candidatura vai ser enviada." + "\nIrá ser validada pela equipa de recrutamento";
	window.alert(msg);	
	
	return true
}
<!------------------------------ VALIDA CONTACTOS --------------------------------------->
function valida_contactos_pt(){
	
	if (document.contactos.t_empresa.value==""){
		msg= "Tem que preencher o campo EMPRESA." + "\n" ;
		window.alert (msg);
		document.contactos.t_empresa.focus(); 
		return false;
	}
	
	if (document.contactos.t_contacto.value==""){
		msg= "Tem que preencher o campo CONTACTO." + "\n" ;
		window.alert (msg);
		document.contactos.t_contacto.focus(); 
		return false;
	}
	
	if (document.contactos.t_email.value!="")
	{
		if (!(valida_email(document.contactos.t_email.value)))
		{
				document.contactos.t_email.focus(); 
				return false;
		}
	}
	else
	{
		if(document.contactos.n_telef.value=="")
		{
			msg= "Tem que preencher pelo menos um dos campos obrigatórios (E-mail ou Telefone)." + "\n" ;
			window.alert (msg);
			document.contactos.n_telef.focus(); 
			return false;
		}
	}

	<!--msg= "O seu contacto vai ser enviado." + "\nIrá ser contactado brevemente.";
	<!--window.alert(msg);	-->
	
	return true
}

function valida_contactos_en(){
	
	if (document.contactos.t_empresa.value==""){
		msg= "Have to fill in the field FIRM." + "\n" ;
		window.alert (msg);
		document.contactos.t_empresa.focus(); 
		return false;
	}
	
	if (document.contactos.t_contacto.value==""){
		msg= "Have to fill in the field CONTACT." + "\n" ;
		window.alert (msg);
		document.contactos.t_contacto.focus(); 
		return false;
	}
	
	if (document.contactos.t_email.value!="")
	{
			if (!(valida_email_en(document.contactos.t_email.value)))
			{
				document.contactos.t_email.focus(); 
				return false;
			}
	}
	else
	{
		if(document.contactos.n_telef.value=="")
		{
			msg= "Have to fill at least one field (E-mail or Phone Number)." + "\n" ;
			window.alert (msg);
			document.contactos.n_telef.focus(); 
			return false;
		}
	}
	
	<!--msg= "Your contact will be sent." + "\nYou will be contacted shortly.";-->
	<!--window.alert(msg);	-->
	
	return true
}



function verifica_login_es(){
	
	if (document.login_topo.username.value=="Nombre"){
		msg= "Usted debe llenar en el campo Nombre." + "\n" ;
		window.alert (msg);
		document.login_topo.username.focus(); 
		return false;
	}else if (document.login_topo.username.value==""){
		msg= "Usted debe llenar en el campo Nombre." + "\n" ;
		window.alert (msg);
		document.login_topo.username.focus(); 
		return false;
	}
	return true	
	
	if (document.login_topo.pw.value=="Contraseña"){
		msg= "Usted debe llenar en el campo de contraseña." + "\n" ;
		window.alert (msg);
		document.login_topo.pw.focus(); 
		return false;
	}else if (document.login_topo.pw.value==""){
		msg= "Usted debe llenar en el campo de contraseña." + "\n" ;
		window.alert (msg);
		document.login_topo.pw.focus(); 
		return false;
	}
	return true		
	
}

function verifica_pesquisa_pt(){
	
	if (document.pesquisa.pesquisa_global.value==""){
		msg= "Tem que dizer o que pretende PESQUISAR." + "\n" ;
		window.alert (msg);
		document.pesquisa.pesquisa_global.focus(); 
		return false;
	}
	return true
}

function verifica_pesquisa_en(){
	
	if (document.pesquisa.pesquisa_global.value==""){
		msg= "You must say what you want to search." + "\n" ;
		window.alert (msg);
		document.pesquisa.pesquisa_global.focus(); 
		return false;
	}
	return true
}

function verifica_pesquisa_es(){
	
	if (document.pesquisa.t_name.value==""){
		msg= "Usted debe decir lo que quieres buscar." + "\n" ;
		window.alert (msg);
		document.pesquisa.t_name.focus(); 
		return false;
	}
	return true
}

function verifica_contactos_pt(){

	if (document.contactos.nome.value==""){
		msg= "Tem que preencher o campo NOME." + "\n" ;
		window.alert (msg);
		document.contactos.nome.focus(); 
		return false;
	}
	
	if (document.contactos.msg.value==""){
		msg= "Tem que preencher o campo MENSAGEM" + "\n" ;
		window.alert (msg);
		document.contactos.msg.focus(); 
		return false;
	}
	
	msg= "A sua mensagem vai ser enviada." + "\n " ;
	window.alert(msg);
	
	return true

}

function verifica_contactos_en(){

	if (document.contactos.nome.value==""){
		msg= "You must fill in the field NAME." + "\n" ;
		window.alert (msg);
		document.contactos.nome.focus(); 
		return false;
	}
	
	if (document.contactos.msg.value==""){
		msg= "You must fill in the field MESSAGE" + "\n" ;
		window.alert (msg);
		document.contactos.msg.focus(); 
		return false;
	}
	
	msg= "Your message will be sent." + "\n " ;
	window.alert(msg);
	
	return true

}

function verifica_contactos_es(){

	if (document.contactos.nome.value==""){
		msg= "Usted debe rellenar el nombre del campo." + "\n" ;
		window.alert (msg);
		document.contactos.nome.focus(); 
		return false;
	}
	
	if (document.contactos.msg.value==""){
		msg= "Usted debe rellenar el campo del mensaje." + "\n" ;
		window.alert (msg);
		document.contactos.msg.focus(); 
		return false;
	}
	
	msg= "Su mensaje será enviado." + "\n " ;
	window.alert(msg);
	
	return true

}

function verifica_pw_pt(){
	
	if (document.pw.t_pw.value==""){
		msg= "Tem de preencher o campo Password." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	} else if (document.pw.t_pw.value.length<5){
		msg= "O campo password tem de ter pelo menos 5 digitos." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	}
	if (document.pw.t_pw.value!=document.pw.b_pw.value){
		msg= "A password de confirmação não coincide." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	}
	
	return true
}

function verifica_pw_en(){
	
	if (document.pw.t_pw.value==""){
		msg= "You must fill in the Password field." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	} else if (document.pw.t_pw.value.length<5){
		msg= "The Password field must have at least 5 digits ." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	}
	if (document.pw.t_pw.value!=document.pw.b_pw.value){
		msg= "The password confirmation does not match." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	}
	
	return true
}

function verifica_pw_es(){
	
	if (document.pw.t_pw.value==""){
		msg= "Usted tiene que llenar el campo Contraseña." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	} else if (document.pw.t_pw.value.length<5){
		msg= "El campo de contraseña debe tener al menos 5 dígitos." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	}
	if (document.pw.t_pw.value!=document.pw.b_pw.value){
		msg= "La confirmación de la contraseña no coincide con." + "\n" ;
		window.alert (msg);
		document.pw.t_pw.focus(); 
		return false;
	}
	
	return true
}

function verifica_rec_pw_en(){
	
	if (!(valida_email_en(document.rec_pw.t_email.value))){
		document.rec_pw.t_email.focus(); 
		return false;
	}	
	return true
}

function verifica_rec_pw_es(){
	
	if (!(valida_email_es(document.rec_pw.t_email.value))){
		document.rec_pw.t_email.focus(); 
		return false;
	}	
	return true
}

function verifica_registo(){

	if (document.registo.t_username.value==""){
		msg= "Tem que preencher o campo Identificação." + "\n" ;
		window.alert (msg);
		document.registo.t_username.focus(); 
		return false;
	} else if (document.registo.t_username.value=="Insira a sua identificação"){
		msg= "Tem que preencher o campo Identificação." + "\n" ;
		window.alert (msg);
		document.registo.t_username.focus(); 
		return false;
	}else if (document.registo.t_username.value.length<5){
		msg= "O campo Identificação tem que ter pelo menos 5 dígitos." + "\n" ;
		window.alert (msg);
		document.registo.t_username.focus(); 
		return false;
	}
	
	if (!(valida_email(document.registo.t_email.value))){
		document.registo.t_email.focus(); 
		return false;
	}
	
	if (document.registo.t_nome.value=="Insira o seu nome"){
		msg= "Tem que preencher o campo NOME ou apagar a mensagem de" + "\n ajuda que se encontra na caixa." ;
		window.alert (msg);
		document.registo.t_nome.focus(); 
		return false;
	}

	return true
}

function verifica_upd_registo(){
	
	if (!(valida_email(document.registo.t_email.value))){
		document.registo.t_email.focus(); 
		return false;
	}
	
	return true
}

function verifica_newsletter_pt(){

	if (document.mailling.nome.value=="Nome"){
		msg= "Tem de preencher o campo nome." + "\n" ;
		window.alert (msg);
		document.mailling.nome.focus(); 
		return false;
	} else if (document.mailling.nome.value==""){
		msg= "Tem de preencher o campo nome." + "\n" ;
		window.alert (msg);
		document.mailling.nome.focus(); 
		return false;
	}
	
	if (document.mailling.email.value=="E-mail"){
		msg= "Tem de preencher o campo E-mail." + "\n" ;
		window.alert (msg);
		document.mailling.email.focus(); 
		return false;
	} else if (document.mailling.email.value==""){
		msg= "Tem de preencher o campo E-mail." + "\n" ;
		window.alert (msg);
		document.mailling.email.focus(); 
		return false;		
	}
	
	if (document.mailling.email.value!="")
		{
			if (!(valida_email_en(document.mailling.email.value)))
			{
				document.mailling.email.focus(); 
				return false;
			}
		}
	
	return true
}


function verifica_newsletter_en(){

	if (document.mailling.nome.value=="Enter your name"){
		msg= "You must fill in the Name field." + "\n" ;
		window.alert (msg);
		document.mailling.nome.focus(); 
		return false;
	} else if (document.mailling.nome.value==""){
		msg= "You must fill in the Name field." + "\n" ;
		window.alert (msg);
		document.mailling.nome.focus(); 
		return false;
	}
	
	if (document.mailling.email.value=="Enter your e-mail"){
		msg= "You must fill in the Email field." + "\n" ;
		window.alert (msg);
		document.mailling.email.focus(); 
		return false;
	} else if (document.mailling.email.value==""){
		msg= "You must fill in the Email field." + "\n" ;
		window.alert (msg);
		document.mailling.email.focus(); 
		return false;		
	}
	
	if (document.mailling.email.value!="")
		{
			if (!(valida_email_en(document.mailling.email.value)))
			{
				document.mailling.email.focus(); 
				return false;
			}
		}
	
	return true
}

function verifica_newsletter_es(){

	if (document.mailling.nome.value=="Escriba su nombre"){
		msg= "Usted debe rellenar el campo Nombre." + "\n" ;
		window.alert (msg);
		document.mailling.nome.focus(); 
		return false;
	} else if (document.mailling.nome.value==""){
		msg= "Usted debe rellenar el campo Nombre." + "\n" ;
		window.alert (msg);
		document.mailling.nome.focus(); 
		return false;
	}
	
	if (document.mailling.email.value=="Ingrese su e-mail"){
		msg= "Usted debe rellenar el campo Correo electrónico." + "\n" ;
		window.alert (msg);
		document.mailling.email.focus(); 
		return false;
	} else if (document.mailling.email.value==""){
		msg= "Usted debe rellenar el campo Correo electrónico." + "\n" ;
		window.alert (msg);
		document.mailling.email.focus(); 
		return false;		
	}
	
	if (document.mailling.email.value!="")
		{
			if (!(valida_email_es(document.mailling.email.value)))
			{
				document.mailling.email.focus(); 
				return false;
			}
		}
	
	return true
}


function ano(an){
	getYear() 
	
	var variavel_data=new date(); 
	var an=variavel_data.getYear(); 
	var an="20"+variavel_data.getYear(); 
}

function verifica_pesquisa(){
	
	if (document.pesquisa.t_name.value=="pesquisar..."){
		msg= "Tem que dizer o que pretende PESQUISAR." + "\n" ;
		window.alert (msg);
		document.pesquisa.t_name.focus(); 
		return false;
	}else if (document.pesquisa.t_name.value==""){
		msg= "Tem que dizer o que pretende PESQUISAR." + "\n" ;
		window.alert (msg);
		document.pesquisa.t_name.focus(); 
		return false;
	}
	return true
}

function valida_email(email)
{
	var result = /^.+\@.+\..+$/ ;

	if ((email == null) || (email.length == 0)) {
       	if (valida_email.arguments.length == 1) {
       		alert("Tem que preencher um E-Mail válido.");
       		return false ;
       	} else {
       		if (!(valida_email.arguments[1] == true)) {
       			alert("Tem que preencher um E-Mail válido.");
       		}
       		return (valida_email.arguments[1] == true);
       	}
    } else {
		if (!(result.test(email))) {
			alert("Tem que preencher um E-Mail válido.");
		}
       return result.test(email);
    }
}

function valida_email_en(email)
{
	var result = /^.+\@.+\..+$/ ;

	if ((email == null) || (email.length == 0)) {
       	if (valida_email_en.arguments.length == 1) {
       		alert("You have to fill a valid email.");
       		return false ;
       	} else {
       		if (!(valida_email_en.arguments[1] == true)) {
       			alert("You have to fill a valid email.");
       		}
       		return (valida_email_en.arguments[1] == true);
       	}
    } else {
		if (!(result.test(email))) {
			alert("You have to fill a valid email.");
		}
       return result.test(email);
    }
}

function valida_email_es(email)
{
	var result = /^.+\@.+\..+$/ ;

	if ((email == null) || (email.length == 0)) {
       	if (valida_email_es.arguments.length == 1) {
       		alert("Usted tiene que llenar un correo electrónico válida.");
       		return false ;
       	} else {
       		if (!(valida_email_es.arguments[1] == true)) {
       			alert("Usted tiene que llenar un correo electrónico válida.");
       		}
       		return (valida_email_es.arguments[1] == true);
       	}
    } else {
		if (!(result.test(email))) {
			alert("Usted tiene que llenar un correo electrónico válida.");
		}
       return result.test(email);
    }
}



var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}

function displaylimit(theform,thelimit){
var limit_text='Pode introduzir <b><span id="'+theform.toString()+'">'+thelimit+'</span></b> caracteres!!'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}

