// JavaScript Document

function switchImage(imgSrc) 
{
	$('#slide1').attr("src" , imgSrc);
}


function switchLink(id, url) 
{
	$('#url1').attr("href" , "./includes/hitscounter.php?t=banner&i=" + id + "&u=" + url);
}



// var mySlideList2 = ['image4.gif', 'image5.gif', 'image6.gif'];
// var mySlideShow2 = new SlideShow(mySlideList2, 'slide2', 1000, "mySlideShow2");
function SlideShow(slideList, linkList, urlList, image, url, speed, name)          
{
  this.slideList = slideList;
  this.linkList = linkList;
  this.urlList = urlList;
  this.image = image;
  this.url = url;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
}

SlideShow.prototype.play = SlideShow_play;  
function SlideShow_play()       
{
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
    switchImage(slideList[current]);
	switchLink(linkList[current], urlList[current]);
    clearTimeout(timer);
    timer = setTimeout(name+'.play()', speed);
  }
}



