var currentLink=0;

function SlideShow(slideList, slideLinks, image, speed, name){
         this.slideList = slideList;
         this.slideLinks = slideLinks;
         this.image = image;
         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 switchImage(imgName, imgSrc){
    if (document.images){
          if (imgSrc != "none"){
               document.images[imgName].src = imgSrc;
          }
    }
}

function switchDiv(divName, divCurrentSelectionName){
	   	var divElement = document.getElementById(divName);
	   	var divNewElement = document.getElementById(divCurrentSelectionName);
	   	if(divElement){
			divElement.innerHTML = divNewElement.innerHTML;   
		}
}

function SlideShow_play(){
         with(this){
                 if(current++ == slideList.length-1) current = 0;
                 switchImage(image, slideList[current]);
				 currentLink = 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 abrirLink(){
	window.open(mySlideLinksGrupo[currentLink],"Parceiros");
}
