//menu
var empezar = false
var ancla = "ancla"
var capas = new Array("c1","c2","c3","c4","c5","c6","c7","c8","c9","c10","c11")
var retardo 
var ocultar

function muestra(capa){
	xShow(capa);
}
function oculta(capa){
	xHide(capa);
}
function posiciona (){
	posx= xOffsetLeft("ancla")
	posy= xOffsetTop ("ancla")
	for (i=0;i<capas.length;i++){
		xMoveTo(capas[i],posx+5,posy-1)
	}
}
window.onload = function() {
	posiciona()
	empezar = true
}
window.onresize = function() {
	posiciona()
}

function muestra_coloca(capa){
 if (empezar){
	for (i=0;i<capas.length;i++){
		if (capas[i] != capa) xHide(capas[i])
	}
	clearTimeout(retardo)
	xShow(capa)
 }
}

function oculta_retarda(capa){
 if (empezar){
	ocultar =capa
	clearTimeout(retardo)
	retardo = setTimeout("xHide('" + ocultar + "')",100000)
 }
}

function muestra_retarda(ind){
 if (empezar){
	clearTimeout(retardo)
 }
}

var xVersion='3.15.2',xNN4,xOp7,xOp5or6,xIE4Up,xIE4,xIE5,xMac,xUA=navigator.userAgent.toLowerCase();
if (window.opera){
  xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1);
  if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1);
}
else if (document.all && xUA.indexOf('msie')!=-1) {
  xIE4Up=parseInt(navigator.appVersion)>=4;
  xIE4=xUA.indexOf('msie 4')!=-1;
  xIE5=xUA.indexOf('msie 5')!=-1;
}
else if (document.layers) {xNN4=true;}
xMac=xUA.indexOf('mac')!=-1;

function xGetElementById(e) {
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}
function xParent(e,bNode){
  if (!(e=xGetElementById(e))) return null;
  var p=null;
  if (!bNode && xDef(e.offsetParent)) p=e.offsetParent;
  else if (xDef(e.parentNode)) p=e.parentNode;
  else if (xDef(e.parentElement)) p=e.parentElement;
  return p;
}
function xDef() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}
function xStr(s) {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
  return true;
}
function xNum(n) {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='number') return false;}
  return true;
}
function xShow(e) {
  if(!(e=xGetElementById(e))) return;
  if(e.style && xDef(e.style.visibility)) e.style.visibility='visible';
}
function xHide(e) {
  if(!(e=xGetElementById(e))) return;
  if(e.style && xDef(e.style.visibility)) e.style.visibility='hidden';
}
function xZIndex(e,uZ) {
  if(!(e=xGetElementById(e))) return 0;
  if(e.style && xDef(e.style.zIndex)) {
    if(xNum(uZ)) e.style.zIndex=uZ;
    uZ=parseInt(e.style.zIndex);
  }
  return uZ;
}
function xMoveTo(e,iX,iY) {
  xLeft(e,iX);
  xTop(e,iY);
}
function xLeft(e,iX) {
  if(!(e=xGetElementById(e))) return 0;
  var css=xDef(e.style);
  if (css && xStr(e.style.left)) {
    if(xNum(iX)) e.style.left=iX+'px';
    else {
      iX=parseInt(e.style.left);
      if(isNaN(iX)) iX=0;
    }
  }
  else if(css && xDef(e.style.pixelLeft)) {
    if(xNum(iX)) e.style.pixelLeft=iX;
    else iX=e.style.pixelLeft;
  }
  return iX;
}
function xTop(e,iY) {
  if(!(e=xGetElementById(e))) return 0;
  var css=xDef(e.style);
  if(css && xStr(e.style.top)) {
    if(xNum(iY)) e.style.top=iY+'px';
    else {
      iY=parseInt(e.style.top);
      if(isNaN(iY)) iY=0;
    }
  }
  else if(css && xDef(e.style.pixelTop)) {
    if(xNum(iY)) e.style.pixelTop=iY;
    else iY=e.style.pixelTop;
  }
  return iY;
}
function xOffsetLeft(e) {
  if (!(e=xGetElementById(e))) return 0;
  if (xDef(e.offsetLeft)) return e.offsetLeft;
  else return 0;
}
function xOffsetTop(e) {
  if (!(e=xGetElementById(e))) return 0;
  if (xDef(e.offsetTop)) return e.offsetTop;
  else return 0;
}
//

function agregar()
{
	if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4))
	{
		var url="http://www.muevetebasket.es/";
		var titulo="MueveteBasket.es";
		window.external.AddFavorite (url,titulo);
	}
	else
	{
		if (navigator.appName == "Netscape") 
		alert ("Presione Crtl+D para agregar MueveteBasket.es a sus Marcadores");
	}
}

function isEmailAddress(theElement, nombre_del_elemento )
{
	var s = theElement.value;
	var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
	if (s.length == 0 ) return true;
	if (filter.test(s))
	return true;
	else
	alert("Ingrese una dirección de correo válida");
	theElement.focus();
	return false;
}

function comentarios()
{		
	if (document.frm_ejemplo.txt_coment.value=='')
	{
		alert("Es obligatorio rellener el campo Comentario.");
		return false;
	}
	else 
	{
		if(document.frm_ejemplo.captcha.value == '')
		{
			alert("Fallo de inserción. Ingrese el código de autentificación.");
			return false;
		}
	}
	
}

function contacto()
{
	if (document.contactar.nombre.value=='')
	{
		alert("Para personalizar la respuesta te agradeceriamos que nos dijeras tu nombre.");
		return false;
	}
	else
	{
		if (document.contactar.mail.value=='')
		{
			alert("Para poder responderte necesitamos una direccion de correo electronico.");
			return false;
		}
		else
		{
			if (document.contactar.mensaje.value=='')
			{
				alert("La consulta que quieras hacernos debes escribirla en el campo mensaje.");
				return false;
			}
			else
			{
				return true;
			}
			return true;
		}
		return true;
	}
}


function comprobar_jugador()
{
	if (document.form_jugador.txt_nombr.value == '')
	{
		alert("Es obligatorio rellenar el campo 'Nombre'.");
		return false;
	}
	else
	{
		if(document.form_jugador.txt_apell.value == '')
		{
			alert("Es obligatorio rellenar el campo 'Apellido'.");
			return false;
		}
		else
		{
			if(document.form_jugador.sel_nivel.value == 0)
			{
				alert("Es obligatorio rellenar el campo 'Nivel'.");
				return false;
			}
			else
			{
				if (document.form_jugador.sel_anio.value == 0)
				{
					alert("Es obligatorio rellenar el campo 'Año Nacimiento'.");
					return false;
				}
				else
				{
					if(document.form_jugador.txt_mail.value == '')
					{
						alert("Es obligatorio rellenar el campo 'Mail'.");
						return false;
					}
					else
						{
							if (document.form_jugador.txt_ciud.value == '')
							{
								alert("Es obligatorio rellenar el campo 'Ciudad'.");
								return false;
							}
							else
								{
									if (document.form_jugador.sel_comun.value == 0)
									{
										alert("Es obligatorio rellenar el campo 'Comunidad'.");
										return false;
									}
										else
										{
							return true;
							}
							return true;
						}
						return true;
					}
					return true;
				}
				return true;					
			}
			return true;
		}
		return true;
	}
}


function comprobar_tecnico()
{
	if (document.form_tecnico.txt_nombr.value == '')
	{
		alert("Es obligatorio rellenar el campo 'Nombre'.");
		return false;
	}
	else
	{
		if(document.form_tecnico.txt_apell.value == '')
		{
			alert("Es obligatorio rellenar el campo 'Apellido'.");
			return false;
		}
		else
		{
			if(document.form_tecnico.sel_nivel.value == 0)
			{
				alert("Es obligatorio rellenar el campo 'Nivel'.");
				return false;
			}
			else
			{
				if (document.form_tecnico.txt_titul.value == '')
				{
					alert("Es obligatorio rellenar el campo 'Titulacion'.");
					return false;
				}
				else
				{
					if(document.form_tecnico.txt_mail.value == '')
					{
						alert("Es obligatorio rellenar el campo 'Mail'.");
						return false;
					}
					else
						{
							if (document.form_tecnico.txt_ciud.value == '')
							{
								alert("Es obligatorio rellenar el campo 'Ciudad'.");
								return false;
							}
							else
								{
									if (document.form_tecnico.sel_comun.value == 0)
									{
										alert("Es obligatorio rellenar el campo 'Comunidad'.");
										return false;
									}
										else
										{
							return true;
							}
							return true;
						}
						return true;
					}
					return true;
				}
				return true;					
			}
			return true;
		}
		return true;
	}
}


function comprobar_club()
{
	if (document.form_club.txt_nombr.value == '')
	{
		alert("Es obligatorio rellenar el campo 'Nombre'.");
		return false;
	}
	else
	{
		if(document.form_club.sel_nivel.value == 0)
		{
			alert("Es obligatorio rellenar el campo 'Nivel'.");
			return false;
		}
		else
		{
			if(document.form_club.txt_mail.value == '')
			{
				alert("Es obligatorio rellenar el campo 'Mail'.");
				return false;
			}
			else
			{
				if (document.form_club.txt_ciud.value == '')
				{
					alert("Es obligatorio rellenar el campo 'Ciudad'.");
					return false;
				}
				else
				{
					if (document.form_club.sel_comun.value == 0)
					{
						alert("Es obligatorio rellenar el campo 'Comunidad'.");
						return false;
					}
					else
						{
						return true;
					}
					return true;
				}
				return true;					
			}
			return true;
		}
		return true;
	}
}


function comprobar_evento()
{
	if (document.form_evento.txt_nombr.value == '')
	{
		alert("Es obligatorio rellenar el campo 'Nombre'.");
		return false;
	}
	else
	{
		if(document.form_evento.txt_descr.value == '')
		{
			alert("Es obligatorio rellenar el campo 'Descripcion'.");
			return false;
		}
		else
		{
			if (document.form_evento.txt_ciud.value == '')
			{
				alert("Es obligatorio rellenar el campo 'Ciudad'.");
				return false;
			}
			else
			{
				if (document.form_evento.sel_comun.value == 0)
				{
					alert("Es obligatorio rellenar el campo 'Provincia'.");
					return false;
				}
				else
				{
					if (document.form_evento.sel_tipo.value == 0)
					{
						alert("Es obligatorio rellenar el campo 'Tipo'.");
						return false;
					}
					else
					{				
						if (document.form_evento.txt_fech.value == '00/00/0000')
						{
							alert("Es obligatorio rellenar el campo 'Fecha'.");
							return false;
						}
						else
							{
							return true;
						}
						return true;						
						}
					return true;
				}
				return true;					
			}
			return true;
		}
		return true;
	}
}

function comprobar_pabellon()
{
	if (document.form_pabellon.txt_nombr.value=='')
	{
		alert("Es obligatorio rellenar el campo 'Nombre pabellon'.");
		return false;
	}
	else
	{
		return true;
	}
}

function cagenda()
{
	if (document.agenda.p.value=='0') location.href="agenda-basket.php";
	if (document.agenda.p.value=='alava') location.href="agenda-basket.php?p=alava";
	if (document.agenda.p.value=='albacete') location.href="agenda-basket.php?p=albacete";
	if (document.agenda.p.value=='alicante') location.href="agenda-basket.php?p=alicante";
	if (document.agenda.p.value=='almeria') location.href="agenda-basket.php?p=almeria";							
	if (document.agenda.p.value=='asturias') location.href="agenda-basket.php?p=asturias";				
	if (document.agenda.p.value=='avila') location.href="agenda-basket.php?p=avila";
	if (document.agenda.p.value=='badajoz') location.href="agenda-basket.php?p=badajoz";				
	if (document.agenda.p.value=='barcelona') location.href="agenda-basket.php?p=barcelona";				
	if (document.agenda.p.value=='burgos') location.href="agenda-basket.php?p=burgos";				
	if (document.agenda.p.value=='caceres') location.href="agenda-basket.php?p=caceres";				
	if (document.agenda.p.value=='cadiz') location.href="agenda-basket.php?p=cadiz";				
	if (document.agenda.p.value=='cantabria') location.href="agenda-basket.php?p=cantabria";				
	if (document.agenda.p.value=='castellon') location.href="agenda-basket.php?p=castellon";
	if (document.agenda.p.value=='ceuta') location.href="agenda-basket.php?p=ceuta";				
	if (document.agenda.p.value=='ciudadreal') location.href="agenda-basket.php?p=ciudadreal";
	if (document.agenda.p.value=='lacoruna') location.href="agenda-basket.php?p=lacoruna";
	if (document.agenda.p.value=='cuenca') location.href="agenda-basket.php?p=cuenca";
	if (document.agenda.p.value=='gerona') location.href="agenda-basket.php?p=gerona";
	if (document.agenda.p.value=='granada') location.href="agenda-basket.php?p=granada";
	if (document.agenda.p.value=='guadalajara') location.href="agenda-basket.php?p=guadalajara";
	if (document.agenda.p.value=='guipuzcoa') location.href="agenda-basket.php?p=guipuzcoa";
	if (document.agenda.p.value=='huelva') location.href="agenda-basket.php?p=huelva";
	if (document.agenda.p.value=='huesca') location.href="agenda-basket.php?p=huesca";
	if (document.agenda.p.value=='baleares') location.href="agenda-basket.php?p=baleares";
	if (document.agenda.p.value=='jaen') location.href="agenda-basket.php?p=jaen";
	if (document.agenda.p.value=='leon') location.href="agenda-basket.php?p=leon";
	if (document.agenda.p.value=='lerida') location.href="agenda-basket.php?p=lerida";				
	if (document.agenda.p.value=='lugo') location.href="agenda-basket.php?p=lugo";				
	if (document.agenda.p.value=='madrid') location.href="agenda-basket.php?p=madrid";				
	if (document.agenda.p.value=='malaga') location.href="agenda-basket.php?p=malaga";			
	if (document.agenda.p.value=='melilla') location.href="agenda-basket.php?p=melilla";			
	if (document.agenda.p.value=='murcia') location.href="agenda-basket.php?p=murcia";				
	if (document.agenda.p.value=='navarra') location.href="agenda-basket.php?p=navarra";
	if (document.agenda.p.value=='orense') location.href="agenda-basket.php?p=orense";
	if (document.agenda.p.value=='palencia') location.href="agenda-basket.php?p=palencia";
	if (document.agenda.p.value=='laspalmas') location.href="agenda-basket.php?p=laspalmas";
	if (document.agenda.p.value=='pontevedra') location.href="agenda-basket.php?p=pontevedra";
	if (document.agenda.p.value=='larioja') location.href="agenda-basket.php?p=larioja";
	if (document.agenda.p.value=='salamanca') location.href="agenda-basket.php?p=salamanca";
	if (document.agenda.p.value=='segovia') location.href="agenda-basket.php?p=segovia";
	if (document.agenda.p.value=='sevilla') location.href="agenda-basket.php?p=sevilla";
	if (document.agenda.p.value=='soria') location.href="agenda-basket.php?p=soria";
	if (document.agenda.p.value=='tarragona') location.href="agenda-basket.php?p=tarragona";
	if (document.agenda.p.value=='tenerife') location.href="agenda-basket.php?p=tenerife";
	if (document.agenda.p.value=='teruel') location.href="agenda-basket.php?p=teruel";
	if (document.agenda.p.value=='toledo') location.href="agenda-basket.php?p=toledo";
	if (document.agenda.p.value=='valencia') location.href="agenda-basket.php?p=valencia";
	if (document.agenda.p.value=='valladolid') location.href="agenda-basket.php?p=valladolid";
	if (document.agenda.p.value=='vizcaya') location.href="agenda-basket.php?p=vizcaya";	
	if (document.agenda.p.value=='zamora') location.href="agenda-basket.php?p=zamora";					
	if (document.agenda.p.value=='zaragoza') location.href="agenda-basket.php?p=zaragoza";
}

function cambia_pagina_equipo(temporada)
{
 	equipo = document.plantillas.p.options[document.plantillas.p.selectedIndex].value;
 	url = "equipo";
	location.href=equipo;
		//alert(equipo);
}

function cambia_clasificacion_categoria(temporada)
{
 	equipo = document.plantillas.p.options[document.plantillas.p.selectedIndex].value;
 	url = "equipo";
	location.href=equipo;
		//alert(equipo);
}

function cbolsa()
{
	if (document.bolsa.sel_categ.value=='1') location.href="bolsa.php?sel_categ=1";
	if (document.bolsa.sel_categ.value=='2') location.href="bolsa.php?sel_categ=2";
	if (document.bolsa.sel_categ.value=='3') location.href="bolsa.php";
}

function zapas()
{
	if (document.zapatillas.sel_categ.value=='prec') location.href="index.php?o=prec";
	if (document.zapatillas.sel_categ.value=='valor') location.href="index.php?o=valor";
	if (document.zapatillas.sel_categ.value=='vent') location.href="index.php?o=vent";
}

function hl(element)
{
    element.style.backgroundColor = "#FFFF53";
}

function uhl(element)
{
    element.style.backgroundColor = "";
}
