var slideshowCount = -1;

function getElementsByClassNameIE(tagName, className) {
	var candidates = document.getElementsByTagName(tagName), list = [], i;
	for (i=0; i<candidates.length; i++)
	{
		if (candidates.item(i).className == className)
		{
			list.push(candidates.item(i));
		}
	}
	
	return list;
}

function slideshowRotate() {
   var frames, i, images, currentIndex, nextIndex, current, next;
   
   if (document.getElementsByClassName) {
      frames = document.getElementsByClassName("slideshow");
   }
   else {
      frames = getElementsByClassNameIE("div", "slideshow");
   }

   for (i=0; i<frames.length; i++)
   {
      images = frames[i].children;

      currentIndex = (slideshowCount + images.length) % images.length;
      nextIndex    = (slideshowCount + images.length + 1)% images.length;

      current = images[currentIndex];
      next    = images[nextIndex];

	  current.style.visibility = "hidden";
	  current.style.opacity = "0";
	  if (current.className == "a")
	  {
		  current.children[0].opacity = "0";
		  current.children[0].visibility = "hidden";
	  }
	  
	  next.style.visibility = "visible";
	  next.style.opacity = "1";
	  if (next.className == "a")
	  {
		  next.children[0].opacity = "1";
		  next.children[0].visibility = "visible";
	  }

   }
   slideshowCount++;
   setTimeout("slideshowRotate()", 5000);
}

