function SlideShow(slideList, slideTextos, slideLinks, image, texto, speed, name){
         this.slideList = slideList;
         this.slideLinks = slideLinks;
         this.slideTextos = slideTextos;
         this.image = image;
         this.texto = texto;
         this.speed = speed;
         this.name = name;
         this.current = 0;
         this.timer = 0;
}

SlideShow.prototype.play = SlideShow_play;
SlideShow.prototype.stop = SlideShow_stop;
SlideShow.prototype.click = SlideShow_click;

function switchDiv(divName, divTextoName, divCurrentSelectionName, currentSelectionTexto){
        document.getElementById(divName).innerHTML = document.getElementById(divCurrentSelectionName).innerHTML;  
		document.getElementById(divTextoName).innerHTML = currentSelectionTexto;  
}

function SlideShow_play(){
         with(this){
                 if(current++ == slideList.length-1) current = 0;
				 switchDiv(image, texto, slideList[current], slideTextos[current]);
                 clearTimeout(timer);
                 timer = setTimeout(name+'.play();', speed);
         }
}

function SlideShow_stop(){
	with(this){
		 clearTimeout(timer);
	}
}

function SlideShow_click(){
	var url = "";
	
	with(this){
		url = slideLinks[current];
	}

	if(url.length > 0){
		window.open(url,"teste");
	}
}

/*function $fade(id, type){

         if(type=="fadein"){
         var n=(typeof arguments[2]!="undefined")?arguments[2]:-10
         var limit=n > 100
         n+=10
         }
         else if(type=="fadeout"){
         var n=(typeof arguments[2]!="undefined")?arguments[2]:110
         var limit=n < 0
         n-=10
         }

         if(limit)
         try{
         $fade_callback()
         return
         }catch(e){return}
        
        document.getElementById(id).style.filter="alpha(opacity="+n+")"
        document.getElementById(id).style.MozOpacity=(n/100)
        document.getElementById(id).opacity=(n/100)
        document.getElementById(id).KhtmlOpacity =(n/100)
        setTimeout("$fade('"+id+"','"+type+"',"+n+")", 100)
}*/
