// <!--

  var topFade = 1;
  var topSpeed = 5000;

  function topBanner(name, current, total) {
    var t = setTimeout("topBannerChange('" + name + "', " + current + ", " + total + ");", topSpeed);
  }

  function topBannerChange(name, current, total) {
    if (current == total) {
      current = 1;
    } else {
      current++;
    }

    topFadeOut(name, current, total)

    var t = setTimeout("topBannerChange('" + name + "', " + current + ", " + total + ");", topSpeed + 800);
  }

  function topFadeOut(name, current, total) {
    document.getElementById('topbanner').style.opacity = topFade;
    document.getElementById('topbanner').style.filter = "alpha(opacity=" + (topFade * 100) + ")";

    topFade = topFade - 0.05;

    if (topFade > 0) {
      var f = setTimeout("topFadeOut('" + name + "'," + current + "," + total + ");", 40);
    } else {
      document.getElementById('topbanner').style.backgroundImage = "url(/images/topbanners/" + name + current + ".jpg)";
      topFadeIn(name, current, total);
    }
  }

  function topFadeIn(name, current, total) {
    document.getElementById('topbanner').style.opacity = topFade;
    document.getElementById('topbanner').style.filter = "alpha(opacity=" + (topFade * 100) + ")";

    topFade = topFade + 0.05;

    if (topFade < 1) {
      var f = setTimeout("topFadeIn('" + name + "'," + current + "," + total + ");", 40);
    }
  }

  var topBannerContents = new Array();
  var topBannerDiv = 'topbanner';

  function topBannerContent(current, total, speed, div) {
    topBannerDiv = div;

    document.getElementById(topBannerDiv).innerHTML = topBannerContents[current];

    topSpeed = speed;

    var t = setTimeout("topBannerContentChange(" + current + ", " + total + ");", topSpeed);
  }

  function topBannerContentChange(current, total) {
    if (current == (total - 1)) {
      current = 0;
    } else {
      current++;
    }

    topContentFadeOut(current, total)

    var t = setTimeout("topBannerContentChange(" + current + ", " + total + ");", topSpeed + 800);
  }

  function topContentFadeOut(current, total) {
    document.getElementById(topBannerDiv).style.opacity = topFade;
    document.getElementById(topBannerDiv).style.filter = "alpha(opacity=" + (topFade * 100) + ")";

    topFade = topFade - 0.05;

    if (topFade > 0) {
      var f = setTimeout("topContentFadeOut(" + current + "," + total + ");", 40);
    } else {
      document.getElementById(topBannerDiv).innerHTML = topBannerContents[current];
      topContentFadeIn(current, total);
    }
  }

  function topContentFadeIn(current, total) {
    document.getElementById(topBannerDiv).style.opacity = topFade;
    document.getElementById(topBannerDiv).style.filter = "alpha(opacity=" + (topFade * 100) + ")";

    topFade = topFade + 0.05;

    if (topFade < 1) {
      var f = setTimeout("topContentFadeIn(" + current + "," + total + ");", 40);
    }
  }

  var newsFade = 1;
  var newsSpeed = 10000;

  function latestNews(name, current, total) {
    var t = setTimeout("latestNewsChange('" + name + "', " + current + ", " + total + ");", newsSpeed);
  }

  function latestNewsChange(name, current, total) {
    latestNewsFadeOut(name, current, total)
  }

  function latestNewsFadeOut(name, current, total) {
    document.getElementById(name + current).style.backgroundColor = "white";
    document.getElementById(name + current).style.opacity = newsFade;
    document.getElementById(name + current).style.filter = "alpha(opacity=" + (newsFade * 100) + ")";

    newsFade = newsFade - 0.05;

    if (newsFade > 0) {
      var f = setTimeout("latestNewsFadeOut('" + name + "'," + current + "," + total + ");", 40);
    } else {
      document.getElementById(name + current).style.display = "none";

      if (current == total) {
        current = 0;
      } else {
        current++;
      }

      document.getElementById(name + current).style.opacity = 0;
      document.getElementById(name + current).style.filter = "alpha(opacity=0)";
      document.getElementById(name + current).style.display = "";

      latestNewsFadeIn(name, current, total);
    }
  }

  function latestNewsFadeIn(name, current, total) {
    document.getElementById(name + current).style.backgroundColor = "white";
    document.getElementById(name + current).style.opacity = newsFade;
    document.getElementById(name + current).style.filter = "alpha(opacity=" + (newsFade * 100) + ")";

    newsFade = newsFade + 0.05;

    if (newsFade < 1) {
      var f = setTimeout("latestNewsFadeIn('" + name + "'," + current + "," + total + ");", 40);
    } else {
      document.getElementById(name + current).style.filter = "";

      var t = setTimeout("latestNewsChange('" + name + "', " + current + ", " + total + ");", newsSpeed - 800);
    }
  }

  // search
  function clearSearch(el) {
    if (el.value == "enter your email address here...") el.value = "";
  }

  function setSearch(el) {
    if (el.value=="") el.value = "enter your email address here...";
  }



  // --------------------------------------------------------------------------
  // page specific js
  // --------------------------------------------------------------------------
  function showGalleryPage(pageid) {
    if (document.getElementById) {
      obj = document.getElementById("gallerypage" + pageid);
      obj.style.display = "";

      for (p=1; p<=10; p++) {
        if (p != pageid) {
          if (document.getElementById("gallerypage" + p)) {
            obj = document.getElementById("gallerypage" + p);
            obj.style.display = "none";
          }
        }
      }
    }
  }

//-->
