
if(typeof(NotaSlide)=="undefined"){
	
	function NotaSlide()
	{
		this.Slide			=	gSlide.length;
		this.slides			=	new Array();
		this.slides_text	=	new Array();
		this.slides_alto	=	new Array();
		this.timerID		=	null;
		this.waitID			=	null;
		this.activeIndex	=	1;
		this.auto			=	true;
		this.hasSlides		=	false;
		this.direction		=	1
		this.slideTime		=	15000;
		this.checkTime		=	60000;
		this.slideHeight	=	0;
		this.SlideID		=	"";
		this.SlideStrict	=	true;
		this.pageActive		=	null;
	

		this.Add = function(pSlideID){
			var oCapa  =  MM_findObj(pSlideID,document);
			if(oCapa){

				this.slides[this.slides.length] = oCapa;

				this.hasSlides=true;
			}
			
		}

		this.Next = function(o){
			var n;
			
			try{
				
				if(o.hasSlides){					

					//ocultar todas las imagenes
					n = (o.activeIndex-1)
					
					if(n>=0){
						if(o.slides[n]!=null && o.slides[n]!=undefined){
							o.slides[n].style.display='none';
						}
					}
					
					if(o.direction==1){
						o.activeIndex++;
						if(o.activeIndex>o.slides.length) o.activeIndex=1;
					}else{
						o.activeIndex--;
						if(o.activeIndex<1) o.activeIndex=o.slides.length;
					}

					
					
					//mostrar la imagen correspondiente al indice
					o.slides[o.activeIndex-1].style.display='block';

					this.setActivePage(o.activeIndex);
				

					//alert(o.activeIndex);
					if(o.timerID!=null)
						clearInterval(o.timerID);
				
					
					if(o.auto){
						var _index = o;
						o.timerID = setTimeout(function(){ o.Next(o) },o.slideTime);
					}

				}else{
					if(o.timerID!=null)
						clearInterval(o.timerID);
					
				}
			}catch(e){
				alert("ERROR:" + e.description);
			}
			
		}

		this.setFirst = function(o){
			
			o.auto=true;		//pasarlo a manual
			o.activeIndex=0;	//no hay ninguna activa
			o.direction=1;		//setear para que avance			
			o.Next(o);			//setear datos de la primer imagen
			
			
		}

		this.Check = function(o){
			//alert("volviendo a automatico");
			o.auto = true;
			o.direction=1; //setear para que avance
			o.Next(o);
		}

		this.PrevImage = function(o){

			if(typeof(o)=="undefined")
				o = this.Slide;

			if(o.timerID!=null)
				clearInterval(o.timerID);
			
			if(gSlide[this.Slide].waitID!=null)
				clearTimeout(o.waitID);

			//setear que ya no es automatico el desplazamiento
			o.auto = false;

			//usar como control para saber si ya dejo de clickear y asi volver a manual
			var _index = o;
			o.waitID = setTimeout(function(){ window.o.Check(o) },o.checkTime);

			o.direction=-1;//setear para que retroceda
			o.Next(o);
		}

		this.NextImage = function(o){

			if(typeof(o)=="undefined")
				o = this.Slide;


			if(o.timerID!=null)
					clearInterval(o.timerID);
			

			if(o.waitID!=null)
				clearTimeout(o.waitID);

			//setear que ya no es automatico el desplazamiento
			o.auto = false;

			//usar como control para saber si ya dejo de clickear y asi volver a manual
			var _index = o;
			o.waitID = setTimeout(function(){ window.o.Check(o) },o.checkTime);

			o.direction=1; //setear para que avance
			o.Next(o);
		}

		this.Start  = function(){
			
			if(this.hasSlides){			

				this.setFirst(this); //setear datos de la primer imagen
				
			}
		}

		this.Pause  = function(){
			/*if(gSlide[this.Slide].hasSlides){

				if(gSlide[this.Slide].timerID!=null)
					clearInterval(gSlide[this.Slide].timerID);
			

				//disparar el timer
				var _index = this.Slide;

				//gSlide[this.Slide].timerID = setTimeout(function(){ window.gSlide[_index].Next(_index) },gSlide[this.Slide].slideTime);
			}*/
		}

		this.showItem = function(index){
			var n=0;
			this.auto=false;		//pasarlo a manual
			this.direction=1;		//setear para que avance			

			if(this.hasSlides){
				//ocultar todas las imagenes
				n = (this.activeIndex-1);
				
				if(n>=0){
					if(this.slides[n]!=null && this.slides[n]!=undefined){
						this.slides[n].style.display='none';
					}
				}

				this.activeIndex = index;
				
				this.slides[this.activeIndex-1].style.display='block';
				this.setActivePage(index);


				if(this.timerID!=null)
					clearInterval(this.timerID);

				
				var o = this;
				o.waitID = setTimeout(function(){ o.Check(o) },o.checkTime);

			}
		}

		this.setActivePage = function(index){
			var obj = MM_findObj("note_slide_page_"+index);
			
			
			if(this.pageActive!=null){
				this.pageActive.className='note_slide_page';
			}else{
				if(index!=1){
					this.pageActive = MM_findObj("note_slide_page_1");
					this.pageActive.className='note_slide_page';
				}

			}

			if(obj){
				obj.className = 'note_slide_page_active';
				this.pageActive = obj;
			}
		}

	}
}

