var slideshow=new Array();
var slideNav=new Array();
var curImage=0;
var numImages=1;

if (!document.getElementById)
    document.getElementById = function() { return null; }

function preload(num)
{
  for (i=0; i<numImages; i++)
  	{
    slideshow[i]=new Image();
    slideshow[i].src="campaign/hero_"+(i+1)+".jpg";
	}
}

function transformPicture(filterFunction)
{
  if (document.images)
  {
    curImage++;
    if (curImage>=numImages) {
      curImage = 0;
	  targLinkOn = "hero_" + 1;
	  targLinkOff = "hero_" + numImages;
	} else {
	  targLinkOn = "hero_" + (curImage+1);
	  targLinkOff = "hero_"+ curImage;
	}

    if (filterFunction==null)
      filterFunction="blendTrans(duration=2.0)"

    var canBeFiltered=false;
    if (document.images.hero && document.images.hero.style && 
      document.images.hero.style.filters)
    {
      canBeFiltered=true;
      target=document.images.hero;
    }
    if (document.getElementById("hero"))
    {
      target= document.getElementById("hero");
      canBeFiltered=true;
    }
			
    if (slideshow[curImage].complete)
    {
      if (canBeFiltered)
      {
        target.style.filter=filterFunction;
	if (target.filters && target.filters[0])
        {
          target.filters[0].Apply();
          target.filters[0].Play();
        }
      } 
      document.images.hero.src=slideshow[curImage].src;
    }	
  }
}

function loadPictures() {
	play = setInterval("transformPicture()",5000);
}

function gotoSlide(num) {
	document.images.hero.src=slideshow[num-1].src;
	clearInterval(play);
	for (i=0; i<slideNav.length; i++) {
		if (slideNav[i].className == "slideOn") {
			slideNav[i].className = "slideOff";
		}
	}
	slideNav[num-1].className="slideOn";
}
