	var Index = 0;
	var TotImages = 0;
	var IdxInicial = 0;
	var timeOutId = 0;
	var delayTime = 3000;
	var LightBox_compat = 'NO';
	
	/* Allow set the total of the images in the array */
	function setTotalImages(Tot) {
		TotImages = Tot;
	}
	
	/* Allow set the start index of the array */
	function setIndex(Idx) {
		Index = Idx;
	}
	
	/* Allow set the start index of the array */
	function setIdxInicial(Idx) {
		IdxInicial = Idx;
	}
		
	/* Increment the index a dislpay the next image */
	function nextImage() {
		if(Index < TotImages) {
            if(LightBox_compat=='YES') {
              document.getElementById('Capa'+Index).style.display='none';
            }
			
            Index = Index + 1;
			  
            if(LightBox_compat=='YES') {
		      document.getElementById('Capa'+Index).style.display='block';
            }
		} else {
            if(LightBox_compat=='YES') {
              document.getElementById('Capa'+Index).style.display='none';
            }
			
			Index = IdxInicial;
			  
            if(LightBox_compat=='YES') {
		      document.getElementById('Capa'+Index).style.display='block';
            }		
		}
		reloadImage(Index);
		return false;
	}
		
	/* Decrement the index a dislpay the previous image */
	function previousImage() {
		if(Index > IdxInicial) {
            if(LightBox_compat=='YES') {
              document.getElementById('Capa'+Index).style.display='none';
            }
			
            Index = Index - 1;
			  
		    if(LightBox_compat=='YES') {
              document.getElementById('Capa'+Index).style.display='block';
            }
		} else {
            if(LightBox_compat=='YES') {
              document.getElementById('Capa'+Index).style.display='none';
            }
			
			Index = TotImages;
			  
            if(LightBox_compat=='YES') {
		      document.getElementById('Capa'+Index).style.display='block';
            }		
		}
		reloadImage(Index);
		return false;
	}

	/* Reload the div tags, the image div and the copete div */
	function reloadImage(Index) {
		DivImage = document.getElementById("HNImgSubHome");
		DivImage2 = document.getElementById("HNImgNota");
		DivTitulo = document.getElementById("HNTitulo");
		DivBajada = document.getElementById("HNBajada");

		DivImage.innerHTML = Images[Index];
		DivImage2.innerHTML = Images2[Index];
		DivTitulo.innerHTML = Titulos[Index];
		DivBajada.innerHTML = Epigrafes[Index];
	}
	
	/* Estados del Slide:
		1	=>	play
		0	=>	pausa
		-1	=>	stop
	*/
	var slideStat = -1;
	/* Set up the scrolling */
	function play() {
		slideStat = 1;
		clearTimeout(timeOutId);
		slideNext();
		DivPlayPausa = document.getElementById("divPlayPause");
		if(DivPlayPausa) {
			DivPlayPausa.innerHTML = "";
			DivPlayPausa.innerHTML = "<a href='JavaScript: void();' onClick='JavaScript: pause(); return false;'><img src='/images/botones/hom_play_stop.gif' hspace='3' border='0' /></a>";
		}
	}
	
	/* Allow pause the scrolling */
	function pause() {
		slideStat = 0;
		clearTimeout(timeOutId);
		timeOutId = 0;
		DivPlayPausa = document.getElementById("divPlayPause");
		if(DivPlayPausa) {
			DivPlayPausa.innerHTML = "";
			DivPlayPausa.innerHTML = "<a href='JavaScript: void();' onClick='JavaScript: play(); return false;'><img src='/images/botones/hom_play_stop.gif' hspace='3' border='0' /></a>";
		}
	}
	
	/* Reload periodically the images */
	function slideNext() {
		if(slideStat == 1) {
			if(timeOutId != 0) {
				nextImage();
			}
			timeOutId = setTimeout('slideNext()', delayTime);
		}
	}