	var text = new Array;
	var cant = 1;
	var first = 1;
	var actual = first;
	var busy = false;
	
	
	var fadeController = null;
	var fadeTimer = 20000;
	function automaticFade(){	fade("next"); }
	
	function initializeImages(the_cant, the_first, the_text){
		text = the_text;
		cant = the_cant;
		first = the_first;
		actual = first;
		
		for(i=0; i<cant; i++){
			var obj = document.getElementById("imag"+i);
			if(!obj) continue;
			if (i==first){
				obj.style.MozOpacity=1;
				obj.style.filter='alpha(opacity=100)';
			}
			else{
				obj.style.MozOpacity=0;
				obj.style.filter='alpha(opacity=0)';
			}
		}
		fadeController = setTimeout("automaticFade()", fadeTimer); // CAMBIAR
	}
	
	function initializeImages2(the_cant, the_first, the_text){
		text = the_text;
		cant = the_cant;
		first = the_first;
		actual = first;
		
		for(i=0; i<cant; i++){
			var obj = document.getElementById("imag"+i);
			if(!obj) continue;
			if (i==first){
				obj.style.MozOpacity=1;
				obj.style.filter='alpha(opacity=100)';
			}
			else{
				obj.style.MozOpacity=0;
				obj.style.filter='alpha(opacity=0)';
			}
		}
		fadeController = setTimeout("automaticFade()", fadeTimer); // Comentar para cambio Automatico
	}
	
	function changeTrans(item, newtrans){
		var opac = newtrans * 10;
		var moz = newtrans/10;
		
		var obj = document.getElementById(item);
		
		obj.style.MozOpacity=moz;
		obj.style.filter='alpha(opacity='+opac+')';
		
		if(newtrans == 0 || newtrans==10) busy = false;
		else busy=true;
	}
	
	function makeTransition(item1, item2){
		if(busy) return false;
		
		var timer = 1;
		var speed = 40;

		for(i=10; i>=0;i--){
			setTimeout("changeTrans('"+item1+"',"+i+")",timer*speed);
			timer ++;
		}
		
		for(i=0; i<=10;i++){
			setTimeout("changeTrans('"+item2+"',"+i+")",timer*speed);
			timer ++;
		}
		document.getElementById(item2).className="shown";
		return true;
	}
	
	function getImage(dir){
		var next = actual;
		if (dir == "next") next ++;
		if (dir == "prev") next --;
		
		if (next>=cant) next = 0;
		if (next < 0) next = cant -1;
		
		return next;
	}
	
	function fadeTo(img2){
		var item1 = "imag" + actual;
		var item2 = "imag" + img2;

		if(!item1 || !item2)return false

		if (makeTransition(item1, item2)){
			actual = img2;
			document.getElementById('image_fade_description').innerHTML=text[img2];
		}
		
		if (fadeController)clearTimeout(fadeController); // Comentar para cambio Automatico
		fadeController = setTimeout("automaticFade()", fadeTimer); // Comentar para cambio Automatico
				
	}
	
	function fade(dir){
		fadeTo(getImage(dir));
	}
