// JavaScript Carrusel de imágenes published on press


var lista = new Array('images/KIO1_300.jpg', 'images/KIO2casco180.jpg',  'images/carro.jpg', 'images/KIO4lata180x297.jpg', 'images/KIO5mundo180x297.jpg', 'images/KIO6latarefresco180x297.jpg', 'images/KIO7reloj168x297.jpg', 'images/kio8robot180x297.jpg',  'images/KIO9espadas180x326.jpg');

var listalink = new Array('images/KIO1muestra.jpg', 'images/KIO2casco_muestra.jpg', 'images/carro272x457.jpg', 'images/KIO4lata291x480.jpg','images/KIO5mundo291x480.jpg', 'images/KIO6latarefresco291x480.jpg',  'images/KIO7reloj272x480.jpg', 'images/KIO8robot272x448.jpg', 'images/KIO9espadas272x293.jpg'  );

var listadescarga = new Array('download/KIO1.jpg', 'download/KIO2casco.jpg', 'download/carro.jpg', 'download/KIO4lata.jpg', 'download/KIO5mundo.jpg', 'download/KIO6latarefresco.jpg', 'download/KIO7reloj.jpg', 'download/kio8robot.jpg', 'download/kio9espadas.jpg');

var contador = 0;
var tiempo = 0;
var tempor = null;
var muestra = null;
var descarga = null;

function cambio(sen)
{
contador+= sen;
if (contador ==lista.length)
     contador = lista.length-1;
else
    if (contador < 0)
	    contador = 0;
		
document.images.centro.src = lista[contador];		

muestra = document.getElementById("muestra");
muestra.href  = listalink[contador]; 

descarga = document.getElementById("descarga");
descarga.href = listadescarga[contador];

/*document.links.muestra.href = listalink[contador];
document.links.descarga.href = listadescarga[contador];
window.status="Imagen número "+contador;*/

}

function reset()
{
	contador = 0;
	fin = false;
	document.images.centro.src = lista[0]
}

function automat(seg)
{
tiempo = parseInt(seg);
reset();
window.status="Pase automático";
if (isNaN(tiempo) || tiempo <= 0)
    alert("Error en el tiempo")
else
    tempor = setTimeout("pasar()", tiempo)
}
function parar()
{
clearTimeout(tempor);
}
function pasar()
{
cambio(1);
if (contador < lista.length-1)
    tempor = setTimeout("pasar()", tiempo)
}



var ban=0;


function changewall(page, antpage)
{
	
	var list = new Array('images/wall15.jpg', 'images/wall16.jpg', 'images/wall17.jpg', 'images/wall18.jpg', 'images/wall19.jpg', 'images/wall20.jpg', 'images/wall21.jpg', 'images/wall22.jpg', 'images/wall23.jpg', 'images/wall24.jpg', 'images/wall25.jpg', 'images/wall30.jpg', 'images/wall26.jpg', 'images/wall27.jpg' );
	
	var listshow = new Array('download/WallpaperMundoA600x450.jpg', 'download/WallpaperMundoB600x450.jpg', 'download/WallpaperMundoC600x450.jpg', 'download/WallpaperMundoD600x450.jpg', 'download/WallpaperLataA600x450.jpg', 'download/WallpaperLataB600x450.jpg', 'download/WallpaperLataC600x450.jpg', 'download/600x450refresco.jpg', 'download/WallpaperRelojA600x450.jpg', 'download/WallpaperRelojB600x450.jpg', 'download/WallpaperRelojC600x450.jpg', 'download/600x450reloj.jpg', 'download/WallpaperRobotA600x450.jpg', 'download/WallpaperKatanaA600x450.jpg', 'download/WallpaperKatanaB600x450.jpg', 'download/WallpaperKatanaC600x450.jpg');
	
	var listdownload = new Array('download/WallpaperMundoA1024-768.jpg', 'download/WallpaperMundoA1280-800.jpg', 'download/WallpaperMundoA1440-900.jpg', 'download/WallpaperMundoA1920-1200.jpg', 'download/WallpaperMundoB1024-768.jpg', 'download/WallpaperMundoB1280-800.jpg', 'download/WallpaperMundoB1440-900.jpg', 'download/WallpaperMundoB1920-1200.jpg', 'download/WallpaperMundoC1024-768.jpg', 'download/WallpaperMundoC1280-800.jpg', 'download/WallpaperMundoC1440-900.jpg', 'download/WallpaperMundoC1920-1200.jpg', 'download/1024x768mundo.jpg', 'download/1280X800MUNDO.jpg', 'download/1440X900MUNDO.jpg', 'download/1920x1200MUNDO.jpg', 'download/WallpaperLataA1024x768.jpg', 'download/WallpaperLataA1280x800.jpg', 'download/WallpaperLataA1440x900.jpg', 'download/WallpaperLataA1920x1200.jpg', 'download/WallpaperLataB1024x768.jpg', 'download/WallpaperLataB1280x800.jpg', 'download/WallpaperLataB1440x900.jpg', 'download/WallpaperLataB1920x1200.jpg', 'download/WallpaperLataC1024x768.jpg', 'download/WallpaperLataC1280x800.jpg', 'download/WallpaperLataC1440x900.jpg', 'download/WallpaperLataC1920x1200.jpg', 'download/1024x768refresco.jpg', 'download/1280x800refresco.jpg', 'download/1440x900refresco.jpg', 'download/1920x1200refresco.jpg', 'download/WallpaperRelojA1024x768.jpg', 'download/WallpaperRelojA1280x800.jpg', 'download/WallpaperRelojA1440x900.jpg', 'download/WallpaperRelojA1920x1200.jpg', 'download/WallpaperRelojB1024x768.jpg', 'download/WallpaperRelojB1280x800.jpg', 'download/WallpaperRelojB1440x900.jpg', 'download/WallpaperRelojB1920x1200.jpg', 'download/WallpaperRelojC1024x768.jpg', 'download/WallpaperRelojC1280x800.jpg', 'download/WallpaperRelojC1440x900.jpg', 'download/WallpaperRelojC1920x1200.jpg', 'download/1024x768reloj.jpg', 'download/1280x800reloj.jpg', 'download/1440x900reloj.jpg', 'download/1920x1200reloj.jpg', 'download/WallpaperRobotA1024x768.jpg', 'download/WallpaperRobotA1280x800.jpg', 'download/WallpaperRobotA1440x900.jpg', 'download/WallpaperRobotA1920x1200.jpg');		
	
	if(page==2)
		{
			elem1=document.getElementById('page');
			elem2=document.getElementById('page');

			images = elem1.getElementsByTagName('img');
			linkss = elem2.getElementsByTagName('a');
			
			for(i=2; i < images.length-9; i++){
				images[i].style.visibility="hidden";
				
			}
			for(i=2; i < linkss.length-7; i++){
				linkss[i].style.visibility="hidden";
			}		
						
			//Change the image
			document.images.one.src = list[0];		 		
			images[2].style.visibility="visible";
			/*document.links.s1.href=listshow[0];*/
			var tempdownload = document.getElementById("s1");
            tempdownload.href = listshow[0];
			
			document.images.two.src = list[1]; 		
			images[3].style.visibility="visible";
			/*document.links.s2.href=listshow[1];*/
			var tempdownload = document.getElementById("s2");
            tempdownload.href = listshow[1];
			
			document.images.three.src = list[2];		 		
			images[4].style.visibility="visible";
			/*document.links.s3.href=listshow[2];	*/
			var tempdownload = document.getElementById("s3");
            tempdownload.href = listshow[2];

			document.images.four.src = list[3];		 		
			images[5].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s4");
            tempdownload.href = listshow[3];
			
			
			
			
			document.images.five.src = list[4];		 		
			images[6].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s5");
            tempdownload.href = listshow[4];
			
			document.images.six.src = list[5];		 		
			images[7].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s6");
            tempdownload.href = listshow[5];
			
			document.images.seven.src = list[6];		 		
			images[8].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s7");
            tempdownload.href = listshow[6];
			
			document.images.eight.src = list[7];		 		
			images[9].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s8");
            tempdownload.href = listshow[7];
			
			
			document.images.nine.src = list[8];		 		
			images[10].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s9");
            tempdownload.href = listshow[8];
			
			
			document.images.ten.src = list[9];		 		
			images[11].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s10");
            tempdownload.href = listshow[9];
			
			/*document.images.eleven.src = list[10];		 		
			images[12].style.visibility="visible";		
			var tempdownload = document.getElementById("s11");
            tempdownload.href = listshow[10];*/
						
			
			document.images.twelve.src = list[10];		 		
			images[13].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s12");
            tempdownload.href = listshow[10];
						
						
			document.images.tt.src = list[11];		 		
			images[14].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s13");
            tempdownload.href = listshow[11];
						
			document.images.ft.src = list[12];		 		
			images[15].style.visibility="visible";
			/*document.links.s4.href=listshow[3];*/	
			var tempdownload = document.getElementById("s14");
            tempdownload.href = listshow[12];						
			
/*			document.links.d1.href = listdownload[0];	
			var tempdownload = document.getElementById("d1");
            tempdownload.href = listdownload[0];			
						
/*			document.links.d2.href = listdownload[1];			
			var tempdownload = document.getElementById("d1");
            tempdownload.href = listdownload[0];
			
/*			document.links.d3.href = listdownload[2];
			var tempdownload = document.getElementById("d1");
            tempdownload.href = listdownload[0];
			
			/*document.links.d4.href = listdownload[3];
			var tempdownload = document.getElementById("d1");
            tempdownload.href = listdownload[0];
							
			/*document.links.d5.href = listdownload[4];	
			var tempdownload = document.getElementById("d1");
            tempdownload.href = listdownload[0];
			
			/*document.links.d6.href = listdownload[5];
			var tempdownload = document.getElementById("d1");
            tempdownload.href = listdownload[0];
			
			/*document.links.d7.href = listdownload[6];
			var tempdownload = document.getElementById("d1");
            tempdownload.href = listdownload[0];
			
			document.links.d8.href = listdownload[7];
						
			document.links.d9.href = listdownload[8];				
			document.links.d10.href = listdownload[9];			
			document.links.d11.href = listdownload[10];
			document.links.d12.href = listdownload[11];	
			
			document.links.d13.href = listdownload[12];				
			document.links.d14.href = listdownload[13];			
			document.links.d15.href = listdownload[14];
			document.links.d16.href = listdownload[15];	*/
			
			var j=1;
			for(i=0; i<41; i++)//actualiza los links de descarga para los diferentes tamaños
			{
				
				
				tempdownload = document.getElementById("d"+j);
            	tempdownload.href = listdownload[i];
				/*if(i==41)
					j= j + 4;
				else
				    j++;*/
					j++;
			}
			var j=45;
			var temp=40;
			for(i=45; i<56; i++)
			{
				
				
				tempdownload = document.getElementById("d"+j);
            	tempdownload.href = listdownload[temp];
				/*if(i==41)
					j= j + 4;
				else
				    j++;*/
					j++;
					temp++;
			}
			
			
			for(i=2; i <77; i++){ //muestra los links de descarga para los diferentes tamaños
				linkss[i].style.visibility="visible";
			}								

		/*	tempdownload = document.getElementById("d56");
			tempdownload.style.visibility = "hidden";
			
			
			tempdownload =  document.getElementById("d55");
			tempdownload.style.visibility = "hidden";
            */
					 		

		/*	document.links.d56.style.visibility = "hidden";
			document.links.d55.style.visibility = "hidden";*/
			j=2;
			for(i=1; i<=4; i++)
			{
				tempdownload = document.getElementById("s"+j);
				tempdownload.href = listshow[i];
				j++;
			}			
			/*document.links.s2.href=listshow[1];
			document.links.s3.href=listshow[2];
			document.links.s4.href=listshow[3];
			document.links.s5.href=listshow[4];*/
			
			tempdownload = document.getElementById("s8");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("s9");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("s10");
			tempdownload.style.visibility = "hidden";
			
			
			tempdownload = document.getElementById("d41");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("d42");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("d43");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("d44");
			tempdownload.style.visibility = "hidden";

			/*tempdownload = document.getElementById("s12");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("s13");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("s14");
			tempdownload.style.visibility = "hidden";
		
			
			
			tempdownload = document.getElementById("ft");
			tempdownload.style.visibility = "hidden";*/			
				
			
			
			/*document.getElementById('prev').style.visibility = "visible";*/
			document.getElementById('next').style.visibility = "hidden";
			
			
			
/*			document.getElementById('next').onclick = "javascript:changewall(3)";*/

			if(antpage==3)
			{
				document.getElementById('ant3').style.visibility = "hidden";
				tempdownload = document.getElementById("nextbutton");			
				tempdownload.style.visibility = "visible";
				document.getElementById('nextbutton').innerHTML += '<input id="next2" name="next2" type="button" value="Siguiente >>" style="border: #ffc527 1px solid; font-family: Verdana; font-size: 10px; background-color: #FEFEFE; font-weight: bold;  margin-right:15px; visibility: hidden;" onclick="javascript:changewall(3, 2)"/>';

				}
			else				
				{document.getElementById('nextbutton').innerHTML += '<input id="next2" name="next2" type="button" value="Siguiente >>" style="border: #ffc527 1px solid; font-family: Verdana; font-size: 10px; background-color: #FEFEFE; font-weight: bold;  margin-right:15px"; onclick="javascript:changewall(3, 2)"/>';
			
				}
			
			if(antpage==1)	{
				document.getElementById('prevbutton').innerHTML += '<input id="prev" name="prev" type="button" value="<< Anterior" style="border: #ffc527 1px solid; font-family: Verdana; font-size: 10px; background-color: #FEFEFE; font-weight: bold; margin-left:20px; margin-top:10px" onclick="javascript:document.location.href=\'wallpaper.html\'"/>';
				document.images.eleven.src = "";				
			}
			else {
			tempdownload = document.getElementById("prev");
			tempdownload.style.visibility = "visible";
			
			
			}	
			
			
			/*document.links.change2.style.visibility = "visible";*/
			
		}
		else
			if(page==3)
			{
				var list = new Array('images/wall27.jpg', 'images/wall28.jpg', 'images/wall29.jpg', 'images/wall31.jpg', 'images/wall32.jpg', 'images/wall33.jpg', 'images/wall34.jpg', 'images/wall35.jpg', 'images/wall36.jpg', 'images/wall37.jpg');
	
	           var listshow = new Array('download/WallpaperRobotB600x450.jpg', 'download/WallpaperRobotC600x450.jpg', 'download/600x450robot.jpg', 'download/WallpaperKatanaA600x450.jpg', 'download/WallpaperKatanaB600x450.jpg', 'download/WallpaperKatanaC600x450.jpg', 'download/600x450espadas.jpg', 'download/WallpaperEmbA600x450.jpg','download/WallpaperEmbB600x450.jpg','download/WallpaperEmbC600x450.jpg');
	
				var listdownload = new Array('download/WallpaperRobotB1024x768.jpg', 'download/WallpaperRobotB1280x800.jpg', 'download/WallpaperRobotB1440x900.jpg', 'download/WallpaperRobotB1920x1200.jpg', 'download/WallpaperRobotC1024x768.jpg', 'download/WallpaperRobotC1280x800.jpg', 'download/WallpaperRobotC1440x900.jpg', 'download/WallpaperRobotC1920x1200.jpg', 'download/1024x768robot.jpg', 'download/1280x800robot.jpg', 'download/1440x900robot.jpg', 'download/1920x1200robot.jpg', 'download/WallpaperKatanaA1024x768.jpg', 'download/WallpaperKatanaA1280x800.jpg', 'download/WallpaperKatanaA1440x900.jpg', 'download/WallpaperKatanaA1920x1200.jpg', 'download/WallpaperKatanaB1024x768.jpg', 'download/WallpaperKatanaB1280x800.jpg', 'download/WallpaperKatanaB1440x900.jpg', 'download/WallpaperKatanaB1920x1200.jpg', 'download/WallpaperKatanaC1024x768.jpg', 'download/WallpaperKatanaC1280x800.jpg', 'download/WallpaperKatanaC1440x900.jpg', 'download/WallpaperKatanaC1920x1200.jpg', 'download/1024x768espadas.jpg', 'download/1280x800espadas.jpg', 'download/1440x900espadas.jpg', 'download/1920x1200espadas.jpg', 'download/WallpaperEmbA1024x768.jpg', 'download/WallpaperEmbA1280x800.jpg', 'download/WallpaperEmbA1440x900.jpg', 'download/WallpaperEmbA1920x1200.jpg', 'download/WallpaperEmbB1024x768.jpg', 'download/WallpaperEmbB1280x800.jpg', 'download/WallpaperEmbB1440x900.jpg', 'download/WallpaperEmbB1920x1200.jpg', 'download/WallpaperEmbC1024x768.jpg', 'download/WallpaperEmbC1280x800.jpg', 'download/WallpaperEmbC1440x900.jpg', 'download/WallpaperEmbC1920x1200.jpg');				
				
				elem1=document.getElementById('page');
				elem2=document.getElementById('page');
	
				images = elem1.getElementsByTagName('img');
				linkss = elem2.getElementsByTagName('a');
				
				for(i=2; i < images.length-8; i++){
					images[i].style.visibility="hidden";
					
				}
				for(i=2; i < linkss.length-7; i++){
					linkss[i].style.visibility="hidden";
				}
				
				//Change the images
				document.images.one.src = list[0];		 		
				images[2].style.visibility="visible";
				/*document.links.s1.href=listshow[0];*/
				var tempdownload = document.getElementById("s1");
				tempdownload.href = listshow[0];
				
				
				document.images.two.src = list[1]; 		
				images[3].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s2");
				tempdownload.href = listshow[1];
				
				
				document.images.three.src = list[2]; 		
				images[4].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s3");
				tempdownload.href = listshow[2];
				
				document.images.four.src = list[3];		 		
				images[5].style.visibility="visible";
				/*document.links.s1.href=listshow[0];*/
				var tempdownload = document.getElementById("s4");
				tempdownload.href = listshow[3];
				
				
				document.images.five.src = list[4]; 		
				images[6].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s5");
				tempdownload.href = listshow[4];
				
				
				document.images.six.src = list[5]; 		
				images[7].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s6");
				tempdownload.href = listshow[5];
				
				document.images.seven.src = list[6]; 		
				images[8].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s7");
				tempdownload.href = listshow[6];
				
				document.images.eight.src = list[7]; 		
				images[9].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s8");
				tempdownload.href = listshow[7];
				
				document.images.nine.src = list[8]; 		
				images[10].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s9");
				tempdownload.href = listshow[8];
				
				document.images.ten.src = list[9]; 		
				images[11].style.visibility="visible";
				/*document.links.s2.href=listshow[1];*/
				var tempdownload = document.getElementById("s10");
				tempdownload.href = listshow[9];
				
				var j=1;
			for(i=0; i<47; i++)//actualiza los links de descarga para los diferentes tamaños
			{
				tempdownload = document.getElementById("d"+j);
            	tempdownload.href = listdownload[i];
				j++;
			}
			
			for(i=2; i <52; i++){ //muestra los links de descarga para los diferentes tamaños
				linkss[i].style.visibility="visible";
			}		
			
			tempdownload = document.getElementById("s4");
			tempdownload.style.visibility = "hidden";	
			tempdownload = document.getElementById("s5");
			tempdownload.style.visibility = "hidden";	
			tempdownload = document.getElementById("s8");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("s9");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("s10");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("d55");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("d56");
			tempdownload.style.visibility = "hidden";	
			
			tempdownload = document.getElementById("nextbutton");
			tempdownload.style.visibility = "hidden";
			tempdownload = document.getElementById("prev");
			tempdownload.style.visibility = "hidden";
			
			
			/*document.getElementById('prev').onclick = "javascript:changewall(2, 3)";*/
				
/*			document.getElementById('next').onclick = "javascript:changewall(3)";*/

			
			if(ban==0)
				document.getElementById('prevbutton').innerHTML += '<input id="ant3" name="ant3" type="button" value="<< Anterior" style="border: #ffc527 1px solid; font-family: Verdana; font-size: 10px; background-color: #FEFEFE; font-weight: bold;  margin-right:15px; "; onclick="javascript:changewall(2, 3)"/>';
			else
				document.getElementById('ant3').style.visibility = "visible";
				
			ban=1;
			}					
		
			

		

}

