var tempor = null;
var contador=2;
var anterio=0;
var navegador = navigator.appName;

	function cambiar_fondo(){
			
			imagen="url("+dirImg+contador+".jpg)";
			document.getElementById('cap2').style.backgroundImage=imagen;
			
				if (navegador == "Microsoft Internet Explorer"){
						document.getElementById('cap2').style.filter='alpha(opacity=0)';
						tempor = setTimeout("aumentar_opa(1)",3000);
					}
				else{
						document.getElementById('cap2').style.opacity = 0;
						tempor = setTimeout("most(0.01)",3000);
				}
				return false;
		}
		
		//IE
		function aumentar_opa(n){	
			document.getElementById('cap2').style.display="block";
			document.getElementById('cap2').style.filter='alpha(opacity='+n+')';
			n=n+0.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)';
					if(contador<cantImg)
						contador=contador+1;
					else
						contador=1;
					imagen="url("+dirImg+contador+".jpg)";
					document.getElementById('cap2').style.backgroundImage=imagen;
					tempor = setTimeout("aumentar_opa(1)",2000);
				}
			return false;
		}
		
		//nestcape
		function most(n){
			if(anterio!=1){
			document.getElementById('cap2').style.display="block";
			document.getElementById('cap2').style.opacity = n;
			n=n+0.005;
			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;
					if(contador<cantImg)
						contador=contador+1;
					else
						contador=1;
					imagen="url("+dirImg+contador+".jpg)";
					document.getElementById('cap2').style.backgroundImage=imagen;
					tempor = setTimeout("most(0.01)",2000);
					
				}
			}
			anterio=0;
			return false;
		}		
