<!--
//Documento JavaScript por Moisés D. Busanya

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
//Funciones HOMEPAGE
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//

// Función de cambio de fondo dependiendo de la promo

function f_cambia_fondo(v_promo) {
		var v_capa = document.getElementById("fondo");
		var v_fondo = "edge_trailer/edge_trailer_fondo_"+v_promo+".jpg"+ "?id=" + new Date().getTime();
		v_capa.style.backgroundImage = "url(" + v_fondo + ")";
}

// Función de cambio de fondo de menú

function f_menu(v_imagen,v_capa_id) {
		var v_capa = document.getElementById(v_capa_id);
		v_capa.style.backgroundImage = "url(" + v_imagen + ")";
		 if (navigator.appName=="Netscape") {
			v_capa.style.cursor='pointer';
		} else {
			v_capa.style.cursor='hand';
		}
}

// Función de votación por estrellas

function f_estrellas(v_capa_id,v_estrella) {
		var v_capa_1 = document.getElementById(v_capa_id+"_1");
		var v_capa_2 = document.getElementById(v_capa_id+"_2");
		var v_capa_3 = document.getElementById(v_capa_id+"_3");
		var v_capa_4 = document.getElementById(v_capa_id+"_4");
		var v_capa_5 = document.getElementById(v_capa_id+"_5");
		
		v_capa_1.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_2.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_3.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_4.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_5.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		
		if (v_estrella==1)
		{
			
			v_capa_1.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
		
		}
		
		if (v_estrella==2)
		{
			
			v_capa_1.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_2.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
		
		}
		
		if (v_estrella==3)
		{
			
			v_capa_1.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_2.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_3.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
		
		}
		
		if (v_estrella==4)
		{
			
			v_capa_1.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_2.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_3.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_4.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
		
		}
		
		if (v_estrella==5)
		{
			
			v_capa_1.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_2.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_3.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_4.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
			v_capa_5.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_on.jpg)";
		
		}
}

// Función de votación por estrellas (APAGADO)

function f_estrellas_apaga(v_capa_id) {
		var v_capa_1 = document.getElementById(v_capa_id+"_1");
		var v_capa_2 = document.getElementById(v_capa_id+"_2");
		var v_capa_3 = document.getElementById(v_capa_id+"_3");
		var v_capa_4 = document.getElementById(v_capa_id+"_4");
		var v_capa_5 = document.getElementById(v_capa_id+"_5");
		
		v_capa_1.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_2.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_3.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_4.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
		v_capa_5.style.backgroundImage = "url(edge_public/img_edge/edge_star_user_off.jpg)";
}

// Mostrar ocultar combos registro

function mostrar_ocultar(valor) {
 	document.getElementById('v_provincia_s').style.display="none";
 	document.getElementById('v_provincia_f').style.display="none";
 	document.getElementById('v_provincia_u').style.display="none";
 	document.getElementById('v_provincia_i').style.display="none";
	if (valor.value == "Spain") {
		document.getElementById('v_provincia_s').style.display="block";
	} else {
		if (valor.value == "France") {
			document.getElementById('v_provincia_f').style.display="block";
		} else {
		
			if (valor.value == "United States") {
				document.getElementById('v_provincia_u').style.display="block";
			} else {
				document.getElementById('v_provincia_i').style.display="block";
		}
		}
	}
}

function mostrar_ocultar_b(valor) {
 	document.getElementById('v_provincia_s_b').style.display="none";
 	document.getElementById('v_provincia_f_b').style.display="none";
 	document.getElementById('v_provincia_u_b').style.display="none";
 	document.getElementById('v_provincia_i_b').style.display="none";
	if (valor.value == "Spain") {
		document.getElementById('v_provincia_s_b').style.display="block";
	} else {
		if (valor.value == "France") {
			document.getElementById('v_provincia_f_b').style.display="block";
		} else {
		
			if (valor.value == "United States") {
				document.getElementById('v_provincia_u_b').style.display="block";
			} else {
				document.getElementById('v_provincia_i_b').style.display="block";
		}
		}
	}
}

// Valida registro

function f_valida_registro() {
 
 	errores="";
	
	var v_reg_edad=document.frm_registro.v_reg_edad.value;
	var v_fecha_js = new Date();
	mes=v_reg_edad.split("/")[0];
	dia=v_reg_edad.split("/")[1];
	anyo=v_reg_edad.split("/")[2];
		
	if (v_reg_edad.length>0) {
		if( (isNaN(dia)==true) || (isNaN(mes)==true) || (isNaN(anyo)==true) )
		{
			errores="The date of birth entered is incorrect.";
			document.getElementById('v_reg_edad').focus();
		}
		if(anyoBisiesto(anyo))
			febrero=29;
		else
			febrero=28;
		
		if ((mes<1) || (mes>12))
		{
			errores= "The month entered in the date of birth is not valid. Please enter the correct month.";
			document.getElementById('v_reg_edad').focus();
		}
		
		if ((mes==2) && ((dia<1) || (dia>febrero)))
		{
			errores= "The day entered in the date of birth is not valid. Please enter the correct day.";
			document.getElementById('v_reg_edad').focus();
		}
		
		if (((mes==1) || (mes==3) || (mes==5) || (mes==7) || (mes==8) || (mes==10) || (mes==12)) && ((dia<1) || (dia>31)))
		{
			errores= "The day entered in the date of birth is not valid. Please enter the correct day.";
			document.getElementById('v_reg_edad').focus();
		
		}
		
		if (((mes==4) || (mes==6) || (mes==9) || (mes==11)) && ((dia<1) || (dia>30)))
		{
		errores= "The day entered in the date of birth is not valid. Please enter the correct day.";
		document.getElementById('v_reg_edad').focus();
		
		}
		
		if ((anyo<1900) || (anyo>2020))
		{
		errores= "The year entered in the date of birth is not valid. Please enter a year between 1900 and 2020.";
		document.getElementById('v_reg_edad').focus();
		
		}
		
		if ((v_fecha_js.getFullYear()-anyo)<13)
		{
		errores= "You must be 13 years old to register as a user in Fantasy Flight Games.";
		document.getElementById('v_reg_edad').focus();
		
		}
	}
	   
	if (document.frm_registro.v_reg_clave.value != document.frm_registro.v_reg_clave_2.value){
	
		errores="The password you have entered doesn't match.";
		document.getElementById('v_reg_clave').focus();
	
	}
		
	if (document.frm_registro.v_reg_email.value != document.frm_registro.v_reg_email_2.value){
	
		errores="The email address you have entered doesn't match.";
		document.getElementById('v_reg_email').focus();
		
	}
		
	if (document.frm_registro.v_reg_nickname.value.length<3){
	
		errores="The player name must be at least three characters long.";
		document.getElementById('v_reg_nickname').focus();
		
	}
		
	if (document.frm_registro.v_reg_clave.value.length<6){
	
		errores="The password must be at least six characters long.";
		document.getElementById('v_reg_clave').focus();
		
	}
	
	var Cadena=document.frm_registro.v_reg_email.value;
		
	Punto = Cadena.substring(Cadena.lastIndexOf('.') + 1, Cadena.length)  
    Dominio = Cadena.substring(Cadena.lastIndexOf('@') + 1, Cadena.lastIndexOf('.'))  
    Usuario = Cadena.substring(0, Cadena.lastIndexOf('@'))  
    Reserv = "@⁄º\"\'*{}\\<>?¿[]áéíóú#·¡!^*;,:"   
      
    valido = true  
      
    for (var Cont=0; Cont<Usuario.length; Cont++) {  
        X = Usuario.substring(Cont,Cont+1)  
        if (Reserv.indexOf(X)!=-1)  
                    valido = false  
    }  
  
    for (var Cont=0; Cont<Punto.length; Cont++) {  
        X=Punto.substring(Cont,Cont+1)  
        if (Reserv.indexOf(X)!=-1)  
            valido = false  
    }  
                          
    for (var Cont=0; Cont<Dominio.length; Cont++) {  
        X=Dominio.substring(Cont,Cont+1)  
        if (Reserv.indexOf(X)!=-1)  
            valido = false  
        }  
  
    if (Punto.length<2 || Dominio <1 || Cadena.lastIndexOf('.')<0 || Cadena.lastIndexOf('@')<0 || Usuario<1) {  
        valido = false  
    }  
	
	if (!valido) {  
        errores="The email is not a correct email."; 
    }  
	
	if (document.frm_registro.v_reg_nickname.value == "" || document.frm_registro.v_reg_clave.value == "" || document.frm_registro.v_reg_clave_2.value == "" || document.frm_registro.v_reg_email.value == "" || document.frm_registro.v_reg_email_2.value == "" || document.frm_registro.v_reg_nombre.value == "" || document.frm_registro.v_reg_apellidos.value == "" || document.frm_registro.v_reg_pais.value == "0" || document.frm_registro.v_reg_seguridad.value == "" || document.frm_registro.v_reg_edad.value == "")
	   errores= "You can't leave a required field blank.";
	   
 	if (errores=="")
	{
		document.frm_registro.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}
					

}

//Año bisiesto
function anyoBisiesto(anyo)
{
	if (anyo < 100)
	var fin = anyo + 1900;
	else
	var fin = anyo ;
	
	
	if (fin % 4 != 0)
	return false;
	else
	{
	if (fin % 100 == 0)
	{
	
	if (fin % 400 == 0)
	{
	return true;
	}
	
	else
	{
	return false;
	}
	}
	
	else
	{
	return true;
	}
	}
}

// Valida Configuracion perfil

function f_valida_cfg() {
 
 	errores="";
		   
	if (document.frm_registro.v_reg_clave.value != document.frm_registro.v_reg_clave_2.value){
	
		errores="The password you have entered doesn't match.";
		document.getElementById('v_reg_clave').focus();
	
	}
		
	if (document.frm_registro.v_reg_clave.value.length<6 && document.frm_registro.v_reg_clave_2.value!=""){
	
		errores="The password must be at least six characters long.";
		document.getElementById('v_reg_clave').focus();
		
	}
	
	if (document.frm_registro.v_email.value != document.frm_registro.v_email_2.value){
	
		errores="The email addresses you have entered doesn't match.";
		document.getElementById('v_email').focus();
		
	}
	
	var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;

	if (!(filter.test(document.frm_registro.v_email.value))){
		errores="The email address is incorrect.";
		document.getElementById('v_email').focus();
	}
		
	if (document.frm_registro.v_reg_clave_act.value == "")
	   errores= "You must enter your password to make changes.";
	   
 	if (errores=="")
	{
		document.frm_registro.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}
					

}

// Valida perfil

function f_valida_edita_perfil() {
 
 	errores="";
	
	fckEditor1val = FCKeditorAPI.__Instances['v_firma'].GetHTML();		
	document.getElementById('v_firma').value = fckEditor1val;
		
	if (document.frm_registro.v_reg_pais.value==0 || (document.frm_registro.v_provincia_i.value=="" && document.frm_registro.v_provincia_s.value==0 && document.frm_registro.v_provincia_f.value==0 && document.frm_registro.v_provincia_u.value==0)){
	
		errores="You must enter the country and state.";
		document.getElementById('v_reg_pais').focus();
		
	}
	   
 	if (errores=="")
	{
		document.frm_registro.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}
					

}

// Valida ludoteca

function f_valida_edita_ludoteca() {
 
	errores="";
	
	if (document.frm_registro.v_top_1.value==document.frm_registro.v_top_2.value || document.frm_registro.v_top_1.value==document.frm_registro.v_top_3.value || document.frm_registro.v_top_1.value==document.frm_registro.v_top_4.value || document.frm_registro.v_top_1.value==document.frm_registro.v_top_5.value){
	
		if (document.frm_registro.v_top_2.value>0 || document.frm_registro.v_top_3.value>0 || document.frm_registro.v_top_4.value>0 || document.frm_registro.v_top_5.value>0){
		
		errores="Two Tops can't be the same.";
		
		}
		
	}
	
	if (document.frm_registro.v_top_2.value==document.frm_registro.v_top_3.value || document.frm_registro.v_top_2.value==document.frm_registro.v_top_4.value || document.frm_registro.v_top_2.value==document.frm_registro.v_top_5.value){
	
		if (document.frm_registro.v_top_3.value>0 || document.frm_registro.v_top_4.value>0 || document.frm_registro.v_top_5.value>0){
		
		errores="Two Tops can’t be the same.";
		
		}
		
	}
	
	if (document.frm_registro.v_top_3.value==document.frm_registro.v_top_4.value || document.frm_registro.v_top_3.value==document.frm_registro.v_top_5.value){
	
		if (document.frm_registro.v_top_4.value>0 || document.frm_registro.v_top_5.value>0){
		
		errores="Two Tops can’t be the same.";
		
		}
		
	}
	
	if (document.frm_registro.v_top_4.value==document.frm_registro.v_top_5.value){
	
		if (document.frm_registro.v_top_5.value>0){
		
		errores="Two Tops can’t be the same.";
		
		}
		
	}
		
	if (document.frm_registro.v_top_1.value==0 && (document.frm_registro.v_top_2.value>0 || document.frm_registro.v_top_3.value>0 || document.frm_registro.v_top_4.value>0 || document.frm_registro.v_top_5.value>0)){
	
		errores="You can’t add a Top greater than Top 1 without defining Top 1 first.";
		
	}
	
	if (document.frm_registro.v_top_2.value==0 && (document.frm_registro.v_top_3.value>0 || document.frm_registro.v_top_4.value>0 || document.frm_registro.v_top_5.value>0)){
	
		errores="You can’t add a Top greater than Top 2 without defining Top 2 first.";
		
	}
	
	if (document.frm_registro.v_top_3.value==0 && (document.frm_registro.v_top_4.value>0 || document.frm_registro.v_top_5.value>0)){
	
		errores="You can’t add a Top greater than Top 3 without defining Top 3 first.";
		
	}
	
	if (document.frm_registro.v_top_4.value==0 && (document.frm_registro.v_top_5.value>0)){
	
		errores="You can’t add a Top greater than Top 4 without defining Top 4 first.";
		
	}
	
	if (document.frm_registro.v_top_1.value==0 && document.frm_registro.v_top_2.value==0 && document.frm_registro.v_top_3.value==0 && document.frm_registro.v_top_4.value==0 && document.frm_registro.v_top_5.value==0){
	
		errores="";
		
	}
	   
 	if (errores=="")
	{
		document.frm_registro.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}

}

// Valida Buscador amigos

function f_busca_amigos() {
 
 	errores="";
		
	if (document.frm_registro.v_buscar_ami_j.value=="" && document.frm_registro.v_buscar_ami_c.value=="" && document.frm_registro.v_buscar_ami_p.value==""){
	
		errores="You must enter a concrete concept for the search.";
		
	}
	   
 	if (errores=="")
	{
		document.frm_registro.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}
					

}

// Valida Aceptar amigos

function f_valida_amigos() {
 
 	errores="";
		
	
	   
 	if (errores=="")
	{
		document.frm_registro.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}
					

}

// Valida tema foro

function f_valida_tema() {
	
	var errores="";
	
	fckEditor1val = FCKeditorAPI.__Instances['v_texto'].GetHTML();		
	document.getElementById('v_texto').value = fckEditor1val;
	
	if ((document.frm_crear_tema.v_titulo_tema.value == "")||(document.frm_crear_tema.v_texto.value == "")) {
		errores="The Post of Topic can’t be left blank.";
	 }
	 
	 if (document.frm_crear_tema.v_texto.value.length < 25) {
		errores="The post is too short to be published.";
	 }
	 
	 if (errores=="")
	{
				
		document.frm_crear_tema.submit();
	}
	else
	{
		
	 	document.getElementById('v_envio').value = 0;
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}

}

// Valida respuesta foro

function f_valida_respuesta() {
	
	var errores="";
	
	fckEditor1val = FCKeditorAPI.__Instances['v_texto'].GetHTML();		
	document.getElementById('v_texto').value = fckEditor1val;
	
	if (document.frm_crear_tema.v_texto.value == "") {
		errores="The Message can’t be left blank.";
	 }
	 
	 if (document.frm_crear_tema.v_texto.value.length < 25) {
		errores="The post is too short to be published.";
	 }
	 
	 if (errores=="")
	{
				
		document.frm_crear_tema.submit();
	}
	else
	{
		
	 	document.getElementById('v_envio').value = 0;
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}

}

// Valida reporte foro

function f_valida_reporte() {
	
	var errores="";
	
	fckEditor1val = FCKeditorAPI.__Instances['v_texto'].GetHTML();		
	document.getElementById('v_texto').value = fckEditor1val;
	
	if (document.frm_crear_tema.v_texto.value == "") {
		errores="The Message can’t be left blank.";
	 }
	 
	 if (errores=="")
	{
				
		document.frm_crear_tema.submit();
	}
	else
	{
		
	 	document.getElementById('v_reportar').value = 0;
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}

}

// Valida mover tema foro

function f_valida_mover() {
	
	var errores="";
	 
	 if (document.frm_mover_tema.v_foro_final.value == 0) {
		errores="Choose the Forum you want.";
	 }
	 
	 if (errores=="")
	{
				
		document.frm_mover_tema.submit();
	}
	else
	{
		
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}

}

// Valida reporte comentario

function f_valida_reporte_news() {
	
	var errores="";
	
	fckEditor1val = FCKeditorAPI.__Instances['v_texto'].GetHTML();		
	document.getElementById('v_texto').value = fckEditor1val;
	
	if (document.frm_crear_tema.v_texto.value == "") {
		errores="The Message can't be left blank.";
	 }
	 
	 if (errores=="")
	{
				
		document.frm_crear_tema.submit();
	}
	else
	{
		
	 	document.getElementById('v_reportar').value = 0;
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}

}

//Contador de caracteres

function f_contador (campo, cuentacampo, limite) {
if (campo.value.length > limite) campo.value = campo.value.substring(0, limite);
else cuentacampo.value = limite - campo.value.length;
}

//Redimensiona pagina de perfil

function f_redimensiona(altura,capa){
	
	var valor = document.getElementById(capa).offsetHeight;
	
	if (valor<altura){
		
		document.getElementById(capa).style.height="730px";
	
	}
	
}

//Valida cambia categoría noticias
function f_cambia_categoria() {
	
	if(document.getElementById('news_cat').value!="0"){
			
		window.location.href="edge_news.asp?etyn=1&ecan="+document.getElementById('news_cat').value+"&epn=0";
		
	}
	
}

//Atencion Jugador

function f_atencion(){
	
	var errores="";
	
	if (document.frm_registro.v_nombre.value=="" || document.frm_registro.v_email.value=="" || document.frm_registro.v_mensaje.value=="" || document.frm_registro.v_asunto.value==0) {
		
			errores="You can't leave a required field blank."
		
	}
	
	var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;

	if (!(filter.test(document.frm_registro.v_email.value))){
		errores="The email address is incorrect.";
		document.getElementById('v_email').focus();
	}
	
	 if (errores=="") {
				
		document.frm_registro.action="edge_atencion.asp";
		document.frm_registro.submit();
		
	}
	else
	{
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}
	
}

// Ask Rules Page

function f_faq(){
	
	var errores="";
	
	if (document.frm_registro.v_nombre.value=="" || document.frm_registro.v_email.value=="" || document.frm_registro.v_mensaje.value=="" || document.frm_registro.v_asunto.value=="0") {
		
			errores="You can't leave a required field blank."
		
	}
	
	var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;

	if (!(filter.test(document.frm_registro.v_email.value))){
		errores="The email address is incorrect.";
		document.getElementById('v_email').focus();
	}
	
	 if (errores=="") {
				
		document.frm_registro.action="edge_faq.asp";
		document.frm_registro.submit();
		
	}
	else
	{
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}
	
}

function f_valida_comentario() {
	
	var errores="";
	
	fckEditor1val = FCKeditorAPI.__Instances['v_comentario'].GetHTML();		
	document.getElementById('v_comentario').value = fckEditor1val;
	
	if (document.frm_crear_comentario.v_comentario.value.length < 25) {
		errores="The comment is too short to be published.";
	 }
	
	if (document.frm_crear_comentario.v_comentario.value == "") {
		errores="The comment can't be left blank.";
	 }
	 
	 if (errores=="")
	{
				
		document.frm_crear_comentario.submit();
	}
	else
	{
		errores="\nError in the form:\n\n"+errores;
		alert(errores);
	}

}

function f_borra_comentario(v_id_noticia,v_id_comentario) {
	
	v_borrar=confirm("Are you sure that you want to erase this comment?");
 	
	if (v_borrar) {
 		window.location.href="edge_news.asp?eidn="+v_id_noticia+"&eidb="+v_id_comentario;             
	}            

}

// Valida mensajeria privada

function f_valida_envia_mail() {
 
 	errores="";
		
	if (document.frm_mensajes.v_mensaje.value=="" || document.frm_mensajes.v_mensaje.value.length < 20){
	
		errores="The message is too short to be send.";
		document.getElementById('v_mensaje').focus();
		
	}
	   
 	if (errores=="")
	{
		document.frm_mensajes.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}
					

}

// Valida invitación

function f_valida_envia_invitacion() {
 
 	errores="";
		
	if (document.frm_mensajes.v_mensaje.value=="" || document.frm_mensajes.v_mensaje.value.length < 20){
	
		errores="The message is too short to be send.";
		document.getElementById('v_mensaje').focus();
		
	}
	   
 	if (errores=="")
	{
		document.frm_mensajes.submit();
	}
	else
	{
	 	errores="\nFantasy Flight Games warns:\n\n"+errores;
		alert(errores);
	}
					

}

function nif(dni) {
  numero = dni.substr(0,dni.length-1);
  let = dni.substr(dni.length-1,1);
  numero = numero % 23;
  letra='TRWAGMYFPDXBNJZSQVHLCKET';
  letra=letra.substring(numero,numero+1);
  if (letra!=let) {
    return false;
  }else{
    return true;
  }
}

//+++++++++++++++++++++++++++++++++++++++++++//
//Estas funciones son de AJAX
//+++++++++++++++++++++++++++++++++++++++++++//

function llamada (url, id_contenedor)
{
    var pagina_requerida = false;
	//alert(url);
    if (window.XMLHttpRequest)
    {
        //Si es Mozilla, Safari etc
        pagina_requerida = new XMLHttpRequest ();
    } else if (window.ActiveXObject)
    {
        //pero si es IE
        try 
        {
            pagina_requerida = new ActiveXObject ("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            //en caso que sea una versión antigua
            try
            {
                pagina_requerida = new ActiveXObject ("Microsoft.XMLHTTP");
            }
            catch (e)
            {
            }
        }
    } 
    else
    return false;
    pagina_requerida.onreadystatechange = function ()
    {
        //función de respuesta
        cargarpagina (pagina_requerida, id_contenedor);
    }
    pagina_requerida.open ('GET', url, true); //asignamos los métodos open y send
    pagina_requerida.send (null);
}
//Todo es correcto y ha llegado el momento de poner la información requerida
//en su sitio en la pagina xhtml
function cargarpagina (pagina_requerida, id_contenedor)
{
    if (pagina_requerida.readyState == 4 && (pagina_requerida.status == 200 || window.location.href.indexOf ("http") == - 1))
    document.getElementById (id_contenedor).innerHTML = pagina_requerida.responseText;
}

//-->