window.animateObjects = new Array();
window.isExplorer = false;

if (navigator.appName.search(/microsoft/i) == 0)
   window.isExplorer = true;

function switchImage(objIndex)
{
  var o = window.animateObjects[objIndex];
  if (o.state == 0) {
    if (o.current == o.max) o.current = 0; else o.current++;
    if (isExplorer) {
        o.image.style.filter="blendTrans(duration=1)";
        o.image.filters.blendTrans.Apply();
        o.image.style.visibility = "visible";
        o.image.filters.blendTrans.Play();
    }
    o.state = 1;
    o.tmr = setTimeout("switchImage("+o.index+")", 7500);
  } else {
    if (isExplorer) {
        o.image.style.filter="blendTrans(duration=1)";
        o.image.filters.blendTrans.Apply();
        o.image.style.visibility = "hidden";
        o.image.filters.blendTrans.Play();
    }
    o.state = 0;
    o.tmr = setTimeout("switchImage("+o.index+")", 1250);
    o.image.src = o.images[o.current].src;
  }

}

function animateObject()
{

  if (this.max > 0)
    this.tmr = setTimeout("switchImage("+this.index+")", 4000);
}

function stopObject()
{
  clearTimeout(this.tmr);
}

function addObject(o)
{
  window.animateObjects[animateObjects.length] = o;
  return animateObjects.length - 1;
}

function ImageAnimation()
{
  var args = ImageAnimation.arguments;
  if (args.length < 2) return null;
  this.image = args[0];
  this.images = new Array();
  for (i=1; i<args.length; i++) {
    this.images[i-1] = new Image();
    this.images[i-1].src = args[i];
  }
  this.image.src = this.images[0].src;
  this.Animate = animateObject;
  this.Stop = stopObject;
  this.current = 1;
  this.max = this.images.length - 1;
  this.tmr = null;
  this.state = 1;
  this.type = "ImageAnimation";
  this.index = addObject(this);

  return this;
}

