
//v1.0
/*

	<script src="js/multislide.js" type="text/javascript"></script>
	<script type="text/javascript" >	
	var list = ['image_name'[,...]];
	
	var slide = new SlideShow(list, 'slide', 700, "slide",1,4);
	</script>
		
	<body onLoad="slide.play();">

*/

function SlideShow(slideList, slideListAnchor,listAlt, image, speed, name, min, max){
  this.slideList = slideList;
  this.slideListAnchor = slideListAnchor;
  this.listAlt = listAlt;
  
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
  this.min = min;
  this.max = max;
  this.em = this.min;
  this.current = this.max-1;
}

SlideShow.prototype.play = SlideShow_play;  

function SlideShow_play(){
  with(this){
    if(current++ == slideList.length-1) current = 0;
    switchImage(image+em, slideList[current], image+"_anchor"+em, slideListAnchor[current], listAlt[current]);
    clearTimeout(timer);
	em++;
	if(em>max)em=min;
    timer = setTimeout(name+'.play()', speed);
  }
}

function switchImage(imgName, imgSrc, anchorName, anchorRef, anchorTitle){
  if (document.images){
    if (imgSrc != "none"){
      document.getElementById(imgName).src = imgSrc;
    }
	
	if (anchorRef != "none" && anchorRef != ""){
      document.getElementById(anchorName).href = anchorRef;
	  document.getElementById(anchorName).title = anchorTitle;
	  document.getElementById(anchorName).style.cursor = "pointer";
	  document.getElementById(anchorName).target = "_blank";
    }else{
		document.getElementById(anchorName).href = "#";
		document.getElementById(anchorName).title = anchorTitle;
		document.getElementById(anchorName).style.cursor = "inherit";
		document.getElementById(anchorName).target = "_self";
	}
	
  }
}

