var i;
var imagenes = new Array("images/foto1roja.jpg","images/foto1azul.jpg","images/foto3azul.jpg","images/foto4azul.jpg","images/foto2roja.jpg","images/foto3roja.jpg","images/foto4roja.jpg","images/foto1verde.jpg","images/foto2verde.jpg","images/foto3verde.jpg","images/foto4verde.jpg");
var lista_imagenes = new Array();

for(i in imagenes){
lista_imagenes[i] = new Image();
lista_imagenes[i].src = imagenes[i]; }

var tempor = null;
		var contador=0;	
		x=1;
		function cambiar_foto(nfoto){
			if(nfoto==1&&x<4)
				{
					x++;
					cambiar_fondo("roja.jpg");
				}
			if(nfoto==0&&x>1)
				{
					x--;
					cambiar_fondo("roja.jpg")
				}
		}

		function cambiar_fondo(imagen){
		imagen="url('images/foto"+x+imagen+"')";
			var navegador = navigator.appName;
		
			document.getElementById('cap2').style.backgroundImage=imagen;
			
				if (navegador == "Microsoft Internet Explorer"){
					
						tempor = setTimeout("aumentar_opa(0)",1);
					}
				else{
					
					
						tempor = setTimeout("most(0)",1);
					
				}
				return false;
		}
		//IE
		function aumentar_opa(n){	
			document.getElementById('cap2').style.display="block";
			document.getElementById('cap2').style.filter='alpha(opacity='+n+')';
			n=n+5;
			if(n<100)
				tempor = setTimeout("aumentar_opa("+n+")",1);
			else{
					imagen=document.getElementById('cap2').style.backgroundImage;
					document.getElementById('cap1').style.backgroundImage=imagen;
					document.getElementById('cap2').style.filter='alpha(opacity=0)';
				}
			return false;
		}
		
		//nestcape
		function most(n){	
			document.getElementById('cap2').style.display="block";
			document.getElementById('cap2').style.opacity = n;
			n=n+0.05;
			if(n<1)
				tempor = setTimeout("most("+n+")",1);
			else{
					imagen=document.getElementById('cap2').style.backgroundImage;
					document.getElementById('cap1').style.backgroundImage=imagen;
					document.getElementById('cap2').style.opacity = 0;
				}
				return false;
		}
