function verifica_AGM_en(){
	
	if (document.Registo_AGM.nome1.value==""){
		msg= "You need to fill in the LAST NAME field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome1.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.nome2.value==""){
		msg= "You need to fill in the FIRST NAME field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome2.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.empresa.value==""){
		msg= "You need to fill in the Name of Association field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.empresa.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.morada.value==""){
		msg= "You need to fill in the Adress field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.morada.focus(); 
		return false;
	} else if (document.Registo_AGM.morada.value.length<4){
		msg= "The Adress must have at least 4 digits." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.morada.focus(); 
		return false;
	}	
	
	
	if (document.Registo_AGM.cidade.value==""){
		msg= "You need to fill in the City field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.cidade.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.pais.value==""){
		msg= "You need to fill in the COUNTRY field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.pais.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.cpostal.value==""){
			msg= "You need to fill in the ZIP CODE field." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.cpostal.focus(); 
			return false;	
	  }	
	
	if (document.Registo_AGM.tel.value==""){
			msg= "You need to fill in the TELEPHONE field." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.tel.focus(); 
			return false;	
	  }
	  
	if (document.Registo_AGM.fax.value==""){			
	 	msg= "You need to fill in the FAX field." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.fax.focus(); 
			return false;	
	}
	
	if (document.Registo_AGM.email.value==""){			
	 	msg= "You need to fill in the EMAIL field." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.email.focus(); 
			return false;	
	} else if (document.Registo_AGM.email.value!=""){
		if (!(valida_email_en(document.Registo_AGM.email.value))){
		document.Registo_AGM.email.focus(); 
		return false;
		}	
	}
	
	if ((document.Registo_AGM.spouse.value=="1") && (document.Registo_AGM.nome1a.value=="")){
		msg= "You need to fill in the LAST NAME (SPOUSE) field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome1a.focus(); 
		return false;
	}
	
	if ((document.Registo_AGM.spouse.value=="1") && (document.Registo_AGM.nome2a.value=="")){
		msg= "You need to fill in the FIRST NAME (SPOUSE) field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome2a.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.arrivdat.value==""){
		msg= "You need to fill in the ARRIVAL DATE field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.arrivdat.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.depdat.value==""){
		msg= "You need to fill in the DEPARTURE DATE field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.depdat.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.nnoites.value==""){
		msg= "You need to fill in the NUMBER OF NIGHTS field (only numeric)." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.depdat.focus(); 
		return false;
	 }else{
			if (isNaN(document.Registo_AGM.nnoites.value)){
				msg= "NUMBER OF NIGHTS field needs to be numeric." + "\n" ;
				window.alert (msg);
				document.Registo_AGM.nnoites.focus(); 
				return false;
			}
	 }
	
	if (document.Registo_AGM.nvoo1.value==""){
		msg= "You need to fill in the FLIGHT NUMBER field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nvoo1.focus(); 
		return false;
	}
	
		if (document.Registo_AGM.nvoo2.value==""){
		msg= "You need to fill in the FLIGHT NUMBER field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nvoo2.focus(); 
		return false;
	}

	if (document.Registo_AGM.time1.value==""){
		msg= "You need to fill in the TIME ARRIVAL field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.time1.focus(); 
		return false;
	}

	if (document.Registo_AGM.time2.value==""){
		msg= "You need to fill in the TIME DEPARTURE field." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.time2.focus(); 
		return false;
	}
	
	return true
}

function verifica_AGM_es(){
	
	if (document.Registo_AGM.nome1.value==""){
		msg= "Es necesario rellenar el campo APELLIDO." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome1.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.nome2.value==""){
		msg= "Es necesario rellenar el campo NOMBRE." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome2.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.empresa.value==""){
		msg= "Es necesario llenar el campo Nombre de la Asociación." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.empresa.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.morada.value==""){
		msg= "Es necesario rellenar el campo Dirección." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.morada.focus(); 
		return false;
	} else if (document.Registo_AGM.morada.value.length<4){
		msg= "La dirección debe tener al menos 4 dígitos." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.morada.focus(); 
		return false;
	}	
	
	
	if (document.Registo_AGM.cidade.value==""){
		msg= "Usted necesita llenar en el campo Ciudad." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.cidade.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.pais.value==""){
		msg= "Usted necesita llenar en el campo País." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.pais.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.cpostal.value==""){
			msg= "Es necesario rellenar el campo CÓDIGO POSTAL." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.cpostal.focus(); 
			return false;	
	  }	
	
	if (document.Registo_AGM.tel.value==""){
			msg= "Es necesario rellenar el campo TELÉFONO." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.tel.focus(); 
			return false;	
	  }
	  
	if (document.Registo_AGM.fax.value==""){			
	 	msg= "Es necesario rellenar el campo FAX." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.fax.focus(); 
			return false;	
	}
	
	if (document.Registo_AGM.email.value==""){			
	 	msg= "Es necesario rellenar el campo E-MAIL." + "\n" ;
			window.alert (msg);
			document.Registo_AGM.email.focus(); 
			return false;	
	} else if (document.Registo_AGM.email.value!=""){
		if (!(valida_email_en(document.Registo_AGM.email.value))){
		document.Registo_AGM.email.focus(); 
		return false;
		}	
	}
	
	if ((document.Registo_AGM.spouse.value=="1") && (document.Registo_AGM.nome1a.value=="")){
		msg= "Es necesario rellenar el campo APELLIDO (cónyuge)." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome1a.focus(); 
		return false;
	}
	
	if ((document.Registo_AGM.spouse.value=="1") && (document.Registo_AGM.nome2a.value=="")){
		msg= "Es necesario rellenar el campo NOMBRE (cónyuge)." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nome2a.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.arrivdat.value==""){
		msg= "Es necesario rellenar el campo FECHA DE LLEGADA." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.arrivdat.focus(); 
		return false;
	}
	
	if (document.Registo_AGM.depdat.value==""){
		msg= "Es necesario rellenar el campo FECHA DE SALIDA." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.depdat.focus(); 
		return false;
	}
	 
	 if (document.Registo_AGM.nnoites.value==""){
		msg= "Es necesario rellenar el campo NOCHE(S) (sólo numérico)." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.depdat.focus(); 
		return false;
	 }else{
			if (isNaN(document.Registo_AGM.nnoites.value)){
				msg= "El campo NOCHE(S)tiene que ser numérico." + "\n" ;
				window.alert (msg);
				document.Registo_AGM.nnoites.focus(); 
				return false;
			}
	 }
	
	if (document.Registo_AGM.nvoo1.value==""){
		msg= "Es necesario rellenar el campo NÚMERO DE VUELO." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nvoo1.focus(); 
		return false;
	}
	
		if (document.Registo_AGM.nvoo2.value==""){
		msg= "Es necesario rellenar el campo NÚMERO DE VUELO." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.nvoo2.focus(); 
		return false;
	}

	if (document.Registo_AGM.time1.value==""){
		msg= "Es necesario rellenar el campo HORA DE LLEGADA." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.time1.focus(); 
		return false;
	}

	if (document.Registo_AGM.time2.value==""){
		msg= "Es necesario rellenar el campo HORA DE SALIDA." + "\n" ;
		window.alert (msg);
		document.Registo_AGM.time2.focus(); 
		return false;
	}
	
	return true
}

function verifica_how_to_join_en(){
	
	if (document.how_to_join.name_organisation.value==""){
		msg= "You must fill in the field Name Organisation." + "\n" ;
		window.alert (msg);
		document.how_to_join.name_organisation.focus(); 
		return false;
	}
	
	if (document.how_to_join.activities.value==""){
		msg= "You must fill in the field Activities." + "\n" ;
		window.alert (msg);
		document.how_to_join.activities.focus(); 
		return false;
	}
	
	if (document.how_to_join.country.value==""){
		msg= "You must fill in the field Country." + "\n" ;
		window.alert (msg);
		document.how_to_join.country.focus(); 
		return false;
	}
	
	if (!(valida_email_en(document.how_to_join.email.value))){
		document.how_to_join.email.focus(); 
		return false;
	}	

	if (document.how_to_join.name_contact.value==""){
		msg= "You must fill in the field Name Contact Person." + "\n" ;
		window.alert (msg);
		document.how_to_join.name_contact.focus(); 
		return false;
	}
	
	if (document.how_to_join.kg_tobacco.value==""){
		msg= "You must fill in the field Annual Tobacco Production in kg." + "\n" ;
		window.alert (msg);
		document.how_to_join.kg_tobacco.focus(); 
		return false;
	}
	
	msg= "Your message will be sent." + "\n " ;
	window.alert(msg);

	return true		

}

function verifica_how_to_join_es(){
	
	if (document.how_to_join.name_organisation.value==""){
		msg= "Usted debe rellenar el campo Nombre Organización." + "\n" ;
		window.alert (msg);
		document.how_to_join.name_organisation.focus(); 
		return false;
	}
	
	if (document.how_to_join.activities.value==""){
		msg= "Usted debe llenar en el campo de Actividades." + "\n" ;
		window.alert (msg);
		document.how_to_join.activities.focus(); 
		return false;
	}
	
	if (document.how_to_join.country.value==""){
		msg= "Usted debe llenar en el campo de País." + "\n" ;
		window.alert (msg);
		document.how_to_join.country.focus(); 
		return false;
	}
	
	if (!(valida_email_es(document.how_to_join.email.value))){
		document.how_to_join.email.focus(); 
		return false;
	}	

	if (document.how_to_join.name_contact.value==""){
		msg= "Usted debe rellenar el campo Nombre Persona de Contacto." + "\n" ;
		window.alert (msg);
		document.how_to_join.name_contact.focus(); 
		return false;
	}
	
	if (document.how_to_join.kg_tobacco.value==""){
		msg= "Usted debe llenar en el campo de la producción anual de tabaco en kg." + "\n" ;
		window.alert (msg);
		document.how_to_join.kg_tobacco.focus(); 
		return false;
	}
	
	msg= "Su mensaje será enviado." + "\n " ;
	window.alert(msg);

	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 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_login2_en(){
	
	if (document.login.username2.value=="Name"){
		msg= "You must fill in the field NAME." + "\n" ;
		window.alert (msg);
		document.login.username2.focus(); 
		return false;
	}else if (document.login.username2.value==""){
		msg= "You must fill in the field NAME." + "\n" ;
		window.alert (msg);
		document.login.username2.focus(); 
		return false;
	}
	return true

	if (document.login.pw2.value=="Password"){
		msg= "You must fill in the field PASSWORD." + "\n" ;
		window.alert (msg);
		document.login.pw2.focus(); 
		return false;
	}else if (document.login.pw2.value==""){
		msg= "You must fill in the field PASSWORD." + "\n" ;
		window.alert (msg);
		document.login.pw2.focus(); 
		return false;
	}
	return true	
}

function verifica_login2_es(){
	
	if (document.login.username2.value=="Nombre"){
		msg= "Usted debe llenar en el campo Nombre." + "\n" ;
		window.alert (msg);
		document.login.username2.focus(); 
		return false;
	}else if (document.login.username2.value==""){
		msg= "Usted debe llenar en el campo Nombre." + "\n" ;
		window.alert (msg);
		document.login.username2.focus(); 
		return false;
	}
	return true	
	
	if (document.login.pw2.value=="Contraseña"){
		msg= "Usted debe llenar en el campo de contraseña." + "\n" ;
		window.alert (msg);
		document.login.pw2.focus(); 
		return false;
	}else if (document.login.pw2.value==""){
		msg= "Usted debe llenar en el campo de contraseña." + "\n" ;
		window.alert (msg);
		document.login.pw2.focus(); 
		return false;
	}
	return true		
	
}

function verifica_pesquisa_pt(){
	
	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 verifica_pesquisa_en(){
	
	if (document.pesquisa.t_name.value==""){
		msg= "You must say what you want to search." + "\n" ;
		window.alert (msg);
		document.pesquisa.t_name.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_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_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_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); 
}
}

