
function destacar_noticia(not,num)
{
	for (i=0; i<num; i++)
  {
    document.getElementById('noticia'+i).className="noticia_thumbnail";
  }
  document.getElementById('noticia'+not).className="noticia_thumbnail_destacado";
}
function sobre(objeto,raton,color)
{
   objeto.style.cursor=raton;
   objeto.bgColor=color;
}
function fuera(objeto,color)
{
   objeto.bgColor=color;
}
function cambiamos(objeto,propiedad,color)
{
   eval(objeto+".style."+propiedad + " = '"+ color + "'");
}

// Funciones de la página de estadísticas de un jugador
function cambiar_foto()
{
  xajax_cambiar_foto_jug(126,"jugadores");
  setTimeout(cambiar_foto,20000);
} 
function cambia(obj,unid,color,id_tem)
{
  if (obj.id=='' & (obj.seleccionado=='' | obj.seleccionado==null))
  {
    obj.style.background=color;
    obj.id=unid;
    if (id_tem!="0")
      document.getElementById(id_tem).style.background=color;
  }
  else if (obj.seleccionado=='' | obj.seleccionado==null)
  {
    obj.style.background='#FFFFFF';
    obj.id='';
    if (id_tem!="0")
      document.getElementById(id_tem).style.background='#FFFFFF';
  }
}

function cambia_click(obj,unid,color,id_tem)
{
  if (obj.seleccionado=='' | obj.seleccionado==null)
  {
    obj.style.background=color;
    obj.seleccionado=unid;
    if (id_tem!="0")
      document.getElementById(id_tem).style.background=color;
  }
  else
  {
    obj.style.background='#FFFFFF';
    obj.seleccionado='';
    if (id_tem!="0")
      document.getElementById(id_tem).style.background='#FFFFFF';
  }
}


function cambia2(obj,id_tem)
{
  if (obj.id=='' & (obj.seleccionado=='' | obj.seleccionado==null))
  {
    obj.style.background='#FFFFFF';
    if (id_tem!="0")
      document.getElementById(id_tem).style.background='#FFFFFF';
  }
}
function cambia_simple(obj,unid,color)
{
  if (obj.id=='')
  {
    obj.style.background=color;
    obj.id=unid;
  }
  else
  {
    obj.style.background='#FFFFFF';
    obj.id='';
  }
}
function cambia2_simple(obj)
{
  if (obj.id=='')
  {
    obj.style.background='#FFFFFF';
  }
}

function abre(fichero,titulo,opciones)
{
  window.open(fichero,titulo,opciones);
}
function compruebaEmail(form)
{
	var letras = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_"
	correo = form.email.value
	posarroba1 = correo.indexOf("@",0)
	posarroba2 = correo.indexOf("@",posarroba1+1)
	if (posarroba2 != -1 || posarroba1 == -1)
		return false
	partes = correo.split("@")
	for (i=0; i!=2; i++)
		{
		if (partes[i] == "")
				return false
		longitud = partes[i].length
		primeravez = 1
		for (j=0; j<=longitud; j++)
				{
				if (letras.indexOf(partes[i].charAt(j)) == -1)
					return false
				}
		pospunto1 = -1
		pospunto2 = -1
		do {
				pospunto1 = partes[i].indexOf(".",pospunto2)
				pospunto2 = partes[i].indexOf(".",pospunto1+1)
				if (pospunto1 == 0 || (i == 1 && pospunto1 == longitud-1) || (i == 1 && pospunto2 == longitud-1) || pospunto2 == pospunto1+1 || (i == 1 && pospunto1 == -1 && primeravez == 1))
					return false
				if ((pospunto1 == longitud-1 && i == 0) || (pospunto2 == longitud-1 && i == 0))
					return true
				primeravez = 0
				if (pospunto2 == -1)
					pospunto2 = longitud-1
				} while (pospunto1 != -1)
		}
	return true
}
function cargando(mensaje)
{
	xajax.$('cargando_mensaje').innerHTML = mensaje;
	xajax.callback.global.onRequest = function() {xajax.$('cargando').style.display = 'block';}
	xajax.callback.global.beforeResponseProcessing = function() {xajax.$('cargando').style.display = 'none';};
}

function cantera(){
		var stretchers = $$('div.accordion');
		stretchers.each(function(item){item.setStyles({'height': '0', 'overflow': 'hidden','display':'block'});});
		window.onload = function(){ //safari cannot get style if window isnt fully loaded
			var togglers = $$('h3.toggler');
			var bgFx = [];
			togglers.each(function(toggler, i){
				toggler.defaultColor = toggler.getStyle('background-color');			
				bgFx[i] = new Fx.Color(toggler, 'background-color', {wait: false});
			});
	
		var myAccordion = new Fx.Accordion(togglers, stretchers, { opacity: false, start: false, transition: Fx.Transitions.quadOut,onActive: function(toggler, i){
				bgFx[i].toColor('#ffffff'); //Este es el color al seleccionar
				toggler.getFirst().setStyle('color', '#3D127A');
			},
			onBackground: function(toggler, i){
				bgFx[i].clearTimer();
				toggler.setStyle('background-color', toggler.defaultColor);
				toggler.getFirst().setStyle('color', '#ffffff');
			}
		});
		
		//anchors
		function checkHash(){
			var found = false;
			$$('h3.toggler a').each(function(link, i){if (window.location.hash.test(link.hash)){myAccordion.showThisHideOpen(i);found = true;}});
			return found;
		}

		if (!checkHash()) myAccordion.showThisHideOpen(0);
		
		var ball = $E('#header h1');
		var ballStyles = new Fx.Styles(ball, {duration: 800, transition: Fx.Transitions.elasticOut});
		new Drag.Move(ball, { 
			onComplete: function(){
				ballStyles.custom({'top': [this.element.getStyle('top').toInt(), 13], 'left': [this.element.getStyle('left').toInt(), 358]});
			}
		});
	};
	try {Window.disableImageCache();}catch(e){}
}

