function cargaArchivo(archivo, idCapa, parametros)
{  		
	var url = 'http://'+location.host+'/'+archivo;  

	var pars= parametros;  

	var myAjax = new Ajax.Updater(idCapa, url, { method: 'get', parameters: pars});  
}

function aumentaFoto(id)
{
	var altoActual = document.getElementById(id).style.height;
	altoActual = parseInt(altoActual.substr(0,2));
		
	var nuevoAlto = 43;
	
	t1 = new Sequence();
	t1.addChild(new Tween(document.getElementById(id).style,'height',Tween.regularEaseOut,altoActual,nuevoAlto,0.2,'px'));
	t1.start();
	
	var anchoActual = document.getElementById(id).style.width;
	anchoActual = parseInt(anchoActual.substr(0,2));
		
	var nuevoAncho = 69;
	
	t1 = new Sequence();
	t1.addChild(new Tween(document.getElementById(id).style,'width',Tween.regularEaseOut,anchoActual,nuevoAncho,0.2,'px'));
	t1.start();
}

function reestableceFoto(id)
{
	var altoActual = document.getElementById(id).style.height;
	altoActual = parseInt(altoActual.substr(0,2));
		
	var nuevoAlto = 37;
	
	t1 = new Sequence();
	t1.addChild(new Tween(document.getElementById(id).style,'height',Tween.regularEaseOut,altoActual,nuevoAlto,0.2,'px'));
	t1.start();
	
	var anchoActual = document.getElementById(id).style.width;
	anchoActual = parseInt(anchoActual.substr(0,2));
		
	var nuevoAncho = 59;
	
	t2 = new Sequence();
	t2.addChild(new Tween(document.getElementById(id).style,'width',Tween.regularEaseOut,anchoActual,nuevoAncho,0.2,'px'));
	t2.start();
}

function resaltaBreve(idResaltar,maxBreves)
{	
	for(i=1; i<=maxBreves; i++)
	{
		if(i == idResaltar)
		{
			nuevoBackground = '#dffbdd';
			nuevoDisplay = '';
		}
		else
		{
			nuevoBackground = '#fff';
			nuevoDisplay = 'none';
		}
		try{
			document.getElementById('filaBreve-'+i).style.backgroundColor = nuevoBackground;
			document.getElementById('imgBreve-'+i).style.display = nuevoDisplay;
		}catch(e){
			nuevoDisplay = 'none';
		}
	}
}

function muestraNoticiaPrincipal(idMostrar,maxNoticias)
{
	for(i=1; i<=maxNoticias; i++)
	{
		if(i == idMostrar)
		{
			nuevoBackground = '#013002';
			nuevoDisplay = '';
			mostrado=i+1;
		}
		else
		{
			nuevoBackground = '#666';
			nuevoDisplay = 'none';
		}
		
		document.getElementById('botonNoticia-'+i).style.backgroundColor = nuevoBackground;
		document.getElementById('noticia-'+i).style.display = nuevoDisplay;
	}
	
}

function turnarNoticiaPrincipal(actual,maxNoticias){
	
	var siguiente = actual+1;
	if(siguiente>maxNoticias){
		siguiente=1;
	}
	muestraNoticiaPrincipal(siguiente,maxNoticias);
	
	setTimeout("turnarNoticiaPrincipal("+siguiente+","+maxNoticias+")",10000);
}
function crearIntervalo(maximo){
	setTimeout("turnarNoticiaPrincipal("+1+","+maximo+")",10000);
}


function cargaBanner()
{
	document.getElementById('bannerPublicitario').style.display = '';
	//document.getElementById('videoPrincipal').style.display = 'none';
	
	tBanner = new OpacityTween(document.getElementById('bannerPublicitario'),Tween.regularEaseOut,0,100,2);
	tBanner.start();
}

function cierraBanner()
{
	/*
	tBanner2 = new OpacityTween(document.getElementById('bannerPublicitario'),Tween.regularEaseOut,100,0,2);
	tBanner2.start();
	
	tBanner2.onMotionFinished = function ()
	{
	*/
	document.getElementById('bannerPublicitario').style.display='none'; 
	//document.getElementById('videoPrincipal').style.display='';
	//}
}

function muestraTexto(id, texto)
{
	var estado = document.getElementById('textoRecortado-'+id).style.display;
	var nuevoEstado;
	var altoCentro;
	
	if(estado == 'none')
	{
		nuevoEstado = '';
		altoCentro = '700px';
	}
	else
	{
		nuevoEstado = 'none';
		altoCentro = 'auto';
	}
	
	document.getElementById('textoRecortado-'+id).style.display = nuevoEstado;
	document.getElementById('textoCompleto-'+id).style.display = estado;	
	document.getElementById('centro').style.height = altoCentro;
}

function muestraCentros(idCentro)
{	
	var centros = new Array();
	
	centros['universidadHuelva'] = "Facultad del C.E.E.E. Campus Universitario";
	centros['gines'] = "Complejo Formativo Estadio Municipal de Fútbol";
	centros['pabloOlavide'] = "Universidad Pablo de Olavide";
	centros['osuna'] = "Osuna";
	centros['lebrija'] = "Centro Cívico Bas Infante. Estadio Municipal";
	centros['universidadCadiz'] = "Campus Universitario Rio San Pedro. Servicio de Deportes Universidad de Cádiz";
	centros['algeciras'] = "Complejo Deportivo del Patronato Municipal de Deportes";
	centros['estepona'] = "Estadio Municipal Francisco Muñoz Perez y Patronato MUnicipal ";
	centros['malaga'] = "Fundación Deportiva Ayto. de Málaga";
	centros['antequera'] = "Complejo Deportivo Fernando Argüelles";
	centros['loja'] = "Estadio Municipal Lauxa. Pabellon Alfeia";
	centros['facultadGranada'] = "Facultad del Deporte. Universidad de Granada";
	centros['vicar'] = 'Ciudad Deportiva "Juegos del Mediterraneo"';
	centros['universidadJaen'] = 'Campus "Las Lagunillas". Universidad de Jaén';
	
	document.getElementById('textoRedCentro').style.display = '';
	document.getElementById('textoRedCentro').innerHTML = centros[idCentro];
}

function enviaEncuesta(id)
{
	if(id>0){
		if(confirm("¿Está seguro/a de su respuesta?"))
		{
			document.getElementById('f_encuesta'+id).submit();
		}
	}else{
		if(confirm("¿Está seguro/a de su respuesta?"))
		{
			document.f_encuesta.submit();
		}
	}
	
}
function filtraFormulario(formulario)
{
	for(i=1; i<arguments.length; i++)
	{
		if(document.getElementById(arguments[i]).value == "")
		{
			alert('Debe rellenar todos los campos marcados como obligatorios (*).');
			return false;
		}
	}
	
	document.getElementById(formulario).submit();
}
