// JavaScript Document
	
		
		
	elTiempoPantalla=6000
	
	 function carrusel(numCarrusel, tiempoPantalla)	
 				{
				elTiempoPantalla=tiempoPantalla
				//alert("Carrusel: " + numCarrusel)	
				if (numCarrusel==1) {matrizImagenes=new Array("fondoInicio1.jpg", "fondoInicio2.jpg", "fondoInicio3.jpg", "fondoInicio4.jpg", "fondoInicio5.jpg")}	
				if (numCarrusel==2) {matrizImagenes=new Array("I+D_2.jpg", "I+D_3.jpg", "I+D_4.jpg", "I+D_5.jpg", "I+D_1.jpg", "I+D_6.jpg", "I+D_7.jpg", "I+D_8.jpg", "I+D_9.jpg", "I+D_10.jpg", "I+D_11.jpg")}	
				if (numCarrusel==3) {matrizImagenes=new Array("filosofia01.jpg", "filosofia02.jpg", "filosofia03.jpg", "filosofia04.jpg", "filosofia05.jpg", "filosofia06.jpg", "filosofia07.jpg", "filosofia08.jpg", "filosofia09.jpg", "filosofia10.jpg", "filosofia11.jpg", "filosofia12.jpg", "filosofia13.jpg", "filosofia14.jpg")}					
				if (numCarrusel==4) {matrizImagenes=new Array("HistoriaSimulado.jpg", "historia_1_2_Irun.jpg")}
				if (numCarrusel==5) {matrizImagenes=new Array("HistoriaSimulado2.jpg", "Historia_58_2.jpg", "Historia_58_3.jpg")}
				if (numCarrusel==6) {matrizImagenes=new Array("Historia_64_1.jpg", "Historia_64_2.jpg", "Historia_64_3.jpg", "Historia_64_4.jpg")}
				if (numCarrusel==7) {matrizImagenes=new Array("Historia_77_1.jpg", "Historia_77_1.jpg")}
				if (numCarrusel==8) {matrizImagenes=new Array("historia_87_1.jpg", "historia_87_1.jpg")}
				if (numCarrusel==9) {matrizImagenes=new Array("historia_87_2_1.jpg", "historia_87_2_2.jpg")}
				if (numCarrusel==10) {matrizImagenes=new Array("historia_87_3_1.jpg", "historia_87_3_2.jpg")}
				if (numCarrusel==11) {matrizImagenes=new Array("Historia_88_1.jpg", "Historia_88_2.jpg", "Historia_88_3.jpg")}
				if (numCarrusel==12) {matrizImagenes=new Array("Historia_2000_1.jpg", "Historia_2000_2.jpg", "Historia_2000_3.jpg", "Historia_2000_4.jpg", "Historia_2000_5.jpg")}				
				if (numCarrusel==13) {matrizImagenes=new Array("Historia_2001_1.jpg", "Historia_2001_1.jpg")}
				if (numCarrusel==14) {matrizImagenes=new Array("HistoriaSimulado.jpg", "HistoriaSimulado.jpg")}
				if (numCarrusel==15) {matrizImagenes=new Array("Historia_2003_1.jpg", "Historia_2003_1.jpg")}
				
				
				numImagen=2
				
				//Arranco el bucle...tras seis segundos de espera
				setTimeout("fadeInAmbos('foto1', 'foto2')", elTiempoPantalla)
				}

		function fadeInAmbos(foto1, foto2)
				{			
				//foto1 está delante de foto2 siempre.
				
				decrementoIE=5
				decrementoMozilla=decrementoIE/100.0
				if(IE)
					{
					ahora=document.getElementById(foto1).filters.alpha.opacity
					nuevo=ahora-2
					document.getElementById(foto1).filters.alpha.opacity=nuevo
					}
					else
					{
					ahora=document.getElementById(foto1).style.opacity
					nuevo=ahora-0.05
					document.getElementById(foto1).style.opacity=nuevo
					}		
					if (nuevo<=0)
						{
						clearTimeout(tempo1)
						//la mando atrás, y la pongo a tope de opacidad...
							document.getElementById("capa" + foto1).style.zIndex=1
							document.getElementById("capa" + foto2).style.zIndex=2
							document.getElementById(foto1).src="imagenes/" + matrizImagenes[numImagen]
							numImagen=numImagen+1
							if ((numImagen+1)>matrizImagenes.length){numImagen=0}
		
						if(IE)
							{
							document.getElementById(foto1).filters.alpha.opacity=100
							document.getElementById(foto2).filters.alpha.opacity=100
							}
							else
							{
							document.getElementById(foto1).style.opacity=1
							document.getElementById(foto2).style.opacity=1
							}
						
						//Paro la imagen un rato, y luego llamo a la función, pero cambiando de orden las fotos a las que llamo
						setTimeout("fadeInAmbos('" + foto2 + "', '" + foto1 + "')", elTiempoPantalla)				
						}
					else
						{
						tempo1=setTimeout("fadeInAmbos('" + foto1 + "', '" + foto2 + "')", 5)
						}
				}
				
//========================================================================================================================================================================================

	function muevoCapa()
		{
		if 	(document.getElementById("menuPagina"))
			{
			posActual=document.getElementById("menuPagina").style.left
			if (posActual.indexOf("px")>-1){posActual=posActual.split("px")[0]}
			
			//destino=200
			intervalo=(destino-posActual)/8.0
			posFinal=(parseInt(posActual))+intervalo
						
			document.getElementById("menuPagina").style.left=posFinal + "px"								
			if (Math.abs(intervalo)>2)
				{
				setTimeout("muevoCapa()", 2)
				}		
			}
		}
//========================================================================================================================================================================================

	function fotoFondo(nuevafoto)
		{			
			if (document.getElementById("TablaGeneral"))
				{
				document.getElementById("TablaGeneral").style.background="url(imagenes/" + nuevafoto + ")" 
				document.getElementById("TablaGeneral").style.backgroundRepeat="no-repeat"
				document.getElementById("TablaGeneral").style.backgroundPosition="left bottom"
				document.getElementById("TablaGeneral").style.backgroundPosition="left bottom"
				
				
				}
		}
