//********************************************************************
//* JavaScript support for Tiger Heron
//********************************************************************

initSite();

function initSite()
{
    baseInitSite();
}

function printStyle(text)
{
    document.write('<style type="text/css">' + text+ '</style>');
}

function createToggle(type, name)
{
    document.write(
	'<p class="selectDetails"><a href="javascript:toggleVis(\'' + name + '\');">' +
	'<img class="plusMinusImg" src="' + Drupal.settings.th.webTop + '/files/pages/' + ((type == "opened") ? "minus.png" : "plus.png") + '"> ' +
	((type == "opened") ? "Hide" : "More") + ' details.</a></p>\n');
}

function toggleVis(name)
{
    eo = document.getElementById("opened" + name);
    ec = document.getElementById("closed" + name);
    if (eo.style.display == "block") {
	eo.style.display = "none";
	ec.style.display = "block";
    }
    else {
	eo.style.display = "block";
	ec.style.display = "none";
    }
}

function switchImage(imgName, imgSrc)
{
  if (document.images) {
    if (imgSrc != "none") {
      document.images[imgName].src = imgSrc;
    }
  }
}

function SlideShow(slideList, image, speed, name)
{
  this.slideList = slideList;
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
}

SlideShow.prototype.play = SlideShow_play;

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