function iraequipo(dir,valor){
   location.href=dir+"index.php?seccion=Equipos&subseccion="+valor+"&categoria=clasificacion";
   return true;
}

function ver_convocatoria(valor,restovalor){
    cbnombre=document.getElementById("conv_pnombre");
	masval=restovalor.split("-");
	if(valor!="no"){
		for(ab=0;ab<masval.length;ab++){
			if(ab==valor){
				cbnombre.innerHTML=masval[ab].replace("_"," ");
				document.getElementById("veconvoca_"+valor).style.display="block";
			}else{
				document.getElementById("veconvoca_"+ab).style.display="none";
			}
		}
	}
	return false;
}


function iniequipa(valor){
    for(ab=1;ab<4;ab++){
	    equipa=document.getElementById('lainiequipa_'+ab);
        if(ab==valor){
			equipa.style.display="block";
		}else{
			equipa.style.display="none";
		}
    }
    return false;
}

function despliega(seccion){
   var trocea=seccion.split("_");
   var quever=document.getElementById(trocea[1]+"_"+trocea[0]);
   quever.style.display="block";
}

function repliega(seccion){
   var trocea=seccion.split("_");
   var quever=document.getElementById(trocea[1]+"_"+trocea[0]);
   quever.style.display="none";
}


function menu_seleccion(cual){

   cualcambio=document.getElementById("menu_opcion");
   hazcambio=cualcambio.value;
    if(cual!=cualcambio){   
   /* cambio clasess*/
   document.getElementById("limenu_"+hazcambio).setAttribute("class","nonono"); 
   document.getElementById("limenu_"+cual).setAttribute("class","selected"); 
   
   /* los displays*/
   document.getElementById("menu_"+hazcambio).style.display="none";
   document.getElementById("menu_"+cual).style.display="block";
   
   /*Cambio el hidden */
   cualcambio.value=""+cual+"";
   }
   
   return false;
}


/*          pagina de inicio                   */
function pon_comunicados(ultimo){
            apunta=document.getElementById('cambia_comunicados').value;
            document.getElementById('pscomuni_'+apunta).style.display='block';
			if(apunta==ultimo){
			    apunta.value=0;
			}else{
			    apunta.value=apunta+1;			  
			}
      }

function uh_noticias(num){
	 esta=document.getElementById("tteste_uh").value;
	 
	    document.getElementById("uh_"+esta).style.display="none";
	    document.getElementById("uh_"+num).style.display="block";
		document.getElementById("tteste_uh").value=num;
	 
    return false;
}

function mifeq(num){
	 esta=document.getElementById("mifeq").value;
	 
	    document.getElementById("feq_"+esta).style.display="none";
	    document.getElementById("feq_"+num).style.display="block";
     document.getElementById("feqboton_"+esta).setAttribute("class","nonono"); 
     document.getElementById("feqboton_"+num).setAttribute("class","selected"); 
	 
		document.getElementById("mifeq").value=num;
  return false;
}

/*            historico                         */
function tolatemporada(pos){
    if(document.getElementById("his_"+pos).style.display=="block"){
           document.getElementById("his_"+pos).style.display="none";
	}else{
           document.getElementById("his_"+pos).style.display="block";	
	}
	return false;
}


function quehisto(secion,equipo,valor,dir){
  if(secion=='club'){
    location.href=dir+"index.php?seccion=historico&subseccion=clubhis&od=equipo&equipo="+equipo+"&espacio="+valor;
  }else{
    location.href=dir+"index.php?seccion=historico&subseccion=torn&od="+valor+"&cual="+equipo;
  }
}

function mas_foto(esmas,total){
    if(total==1){
	
	}else{
	    estevalor=document.getElementById(esmas+"_notfoto").innerHTML;
	    estevalor=parseInt(estevalor);
		for(a=0;a<total;a++){
		   if(a==estevalor){
		       document.getElementById("not_fg_"+a).style.display="block";
		       document.getElementById("not_fotop_"+a).style.border="2px solid #222";
		   }else{
		       document.getElementById("not_fg_"+a).style.display="none";
		       document.getElementById("not_fotop_"+a).style.border="0";
		   }
		}
		if(estevalor==(total-1)){
		   document.getElementById("menos_notfoto").innerHTML=(estevalor-1);
		   document.getElementById("mas_notfoto").innerHTML="0";
		}else if(estevalor==0){
		   document.getElementById("menos_notfoto").innerHTML=(total-1);
		   document.getElementById("mas_notfoto").innerHTML="1";
		}else{
		   document.getElementById("menos_notfoto").innerHTML=(estevalor-1);
		   document.getElementById("mas_notfoto").innerHTML=(estevalor+1);
		}
	}
	return false;
}
function abajo_foto(estemas,total){
    if(total==1){
	
	}else{
	    estevalor=parseInt(estemas);
		for(a=0;a<total;a++){
		   if(a==estevalor){
		       document.getElementById("not_fg_"+a).style.display="block";
		       document.getElementById("not_fotop_"+a).style.border="2px solid #222";
		   }else{
		       document.getElementById("not_fg_"+a).style.display="none";
		       document.getElementById("not_fotop_"+a).style.border="0";
		   }
		}
		if(estevalor==(total-1)){
		   document.getElementById("menos_notfoto").innerHTML=(estevalor-1);
		   document.getElementById("mas_notfoto").innerHTML="0";
		}else if(estevalor==0){
		   document.getElementById("menos_notfoto").innerHTML=(total-1);
		   document.getElementById("mas_notfoto").innerHTML="1";
		}else{
		   document.getElementById("menos_notfoto").innerHTML=(estevalor-1);
		   document.getElementById("mas_notfoto").innerHTML=(estevalor+1);
		}
	}
	return false;
}

function validaolvido(){
  tal=document.getElementById("olvido_con").style;
  if(tal.display=="block"){
     tal.display="none";
  }else{
    tal.display="block";
  }
  return false;
}

function verificaimagen(donde){
//linclean name del formulario
      var numtexto=donde.length;
      if(donde.substring(numtexto-4,numtexto)==".jpg" || donde.substring(numtexto-4,numtexto)==".JPG" || donde.substring(numtexto-5,numtexto)==".jpeg" || donde.substring(numtexto-5,numtexto)==".JPEG" ){
          return true;
      }else{
         alert("La imagen no es JPG");
         limpiarinputfile();
         return false;
      }
}

function validareg(){
   var nombre=document.forms.registroformu.nombre.value;
   var apellidos=document.forms.registroformu.apellidos.value;
   var email=document.forms.registroformu.email.value;
   var telefono=document.forms.registroformu.telefono.value;
   var nickuser=document.forms.registroformu.nickuser.value;
   var contra=document.forms.registroformu.contra.value;
   var doscontra=document.forms.registroformu.doscontra.value;
    if(nombre=="" || apellidos=="" || email=="" || telefono=="" || nickuser=="" || contra==""){
	  alert("Rellena todos los campos");
	  return false;
	}else if(contra!=doscontra){
	  alert("Las contraseņas no coinciden");
	  return false;
	}else{
       if(/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(email)){ 
			return true;
	   }else{ 
			alert("El email no es valido"); 
			return false;
	   }
	}	
}

function vecomentario_cartelera(num){
    cual=document.getElementById("carteinfo_"+num);
	if(cual.style.display=="none"){
	    cual.style.display="block";
	}else{
	    cual.style.display="none";
	}
	return false;
}


function verestad(num){
  var verjug=document.getElementById("jugest_"+num);
  verjug.style.display="block";
  for(a=0;a<30;a++){
    este=document.getElementById("jugest_"+a);
	if(este && a!=num){ este.style.display="none";}
  }
  return false;
}

function solojrn(num,tot){
    if(num==0){
	}else{
		document.getElementById("vecal_completo").style.display="block";
		for(a=1;a<tot;a++){
		   if(a==num){
				 document.getElementById("vj_"+a).style.display="block";
		   }else{
				 document.getElementById("vj_"+a).style.display="none";
		   }
		}
	}
    return false;
}
function jr_todo(todo){
    document.getElementById("vecal_completo").style.display="none";
	for(a=1;a<todo;a++){
        document.getElementById("vj_"+a).style.display="block";
	}
    return false;
}

function equ_vejorn(equipo,num,dir){
   if(num!=0){
    location.href=dir+"index.php?seccion=Equipos&subseccion="+equipo+"&categoria=cronicas&jornada="+num;
	}
}
function muestragaleria(texto,lugar){
   mObj = document.getElementsByTagName("body")[0].appendChild(document.createElement("div"));
	mObj.id = "Container_grande";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	mObj.style.height = document.documentElement.scrollHeight + "px";
	mObj.style.width = document.documentElement.scrollWidth + "px";

	
	
	
	// creamos DIV que hara de alert 
	alertObj = mObj.appendChild(document.createElement("div"));
	alertObj.id = "alertFoto";
	// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
	if(document.all && !window.opera){ alertObj.style.top = document.documentElement.scrollTop + "px";}
	// center the alert box
	alertObj.style.left = (document.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
	
	// create an H2 element as the title bar
	h2 = alertObj.appendChild(document.createElement("h2"));
	h2.appendChild(document.createTextNode(texto));
	
	
	divenvio = alertObj.appendChild(document.createElement("p"));
	divenvio.setAttribute("class","quitajug");
	btn = divenvio.appendChild(document.createElement("a"));
	btn.id = "closeBtn";
	btn.appendChild(document.createTextNode("cerrar"));
	btn.href = "#";
	btn.onclick = function() { quitalerta();return false; }
	
	msg = alertObj.appendChild(document.createElement("img"));
    msg.setAttribute("src",lugar);
	msg.setAttribute("alt",texto);
	return false;
}


function validasocio(){
   var nombre=document.forms.haztesocio.nombre.value;
   var apellidos=document.forms.haztesocio.apellidos.value;
   var direccion=document.forms.haztesocio.direccion.value;
   var localidad=document.forms.haztesocio.localidad.value;
   var email=document.forms.haztesocio.email.value;
   var telefono=document.forms.haztesocio.telefono.value;
   var acepto=document.forms.haztesocio.acepto.value;
   if(acepto!="on"){
       alert("Acepta las condiciones");
       return false;
   }else if(nombre=="" || apellidos=="" || direccion=="" || localidad=="" || email=="" || telefono==""){
       alert("Debes rellenar todos los campo");
       return false;
   }else{
    if(/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/.test(email)){
     return true;
   }else{
       alert("Email invalido");
       return false;
   }
   }
   
}

function vetienda(va){
   esta=document.getElementById("estoytienda").value;
   document.getElementById("producto_"+esta).style.display="none";
   document.getElementById("producto_"+va).style.display="block";
   document.getElementById("estoytienda").value=va;
   return false;
}


function enciendef(a){
     document.getElementById(a).style.display="block";
     document.getElementById("enciende_"+a).style.display="none";
     document.getElementById("recoge_"+a).style.display="block";
   return false;
}

function apagaf(a){
     document.getElementById(a).style.display="none";
     document.getElementById("enciende_"+a).style.display="block";
     document.getElementById("recoge_"+a).style.display="none";
   return false;
}

function valolvido(){
   con=document.getElementById("con").value;
   recon=document.getElementById("re_con").value;
   if(con==recon){
     return true;
   }else{
      alert("No coinciden contrase&ntilde;as");
      return false;
   }
}

/*  VEr equipos clasificacion  */

function dainfo(nu){
    document.getElementById("uau_"+nu).style.display="block";
    return false;
}
function cierra_clasequi(nu){
    document.getElementById("uau_"+nu).style.display="none";
	return false;
}
