change=10;
num_faders=8;
num_mouseovers=8;
ms=0;
framerate=100;
direction=0;
cycle_time=9000;

currfade =new Array(0,    0,    0,    0,    0,    0,    0,    0,    0);
starttime=new Array(0, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500);
stoptime =new Array(0, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000);

function StartAnim() {
  // Hide mouseovers
  for (i=1; i<=num_mouseovers; i++) 
  {
  	normal(i);
  }
  
  setTimeout("fadeit()", 0);
}

function fadeit() {
  ms+=framerate;
  ms = ms % 9000;
  for (i=1;i<=num_faders;i++) 
  {
    direction=(ms<starttime[i])?0:((ms>stoptime[i])?-1:1);
    fade(i);
  }
  setTimeout("fadeit()", framerate);
}

function fade(n) 
{
  Name='img'+n;
  currfade[n]+=(direction*change);
  // 1-99 rather than 0-100 for compatibility reasons.
  if (currfade[n]>99) 
  {
  	currfade[n]=99;
  }
  if (currfade[n]<1) 
  {
  	currfade[n]=1;
  }
  
  if(navigator.appName == "Microsoft Internet Explorer")
  {
	  obj = document.getElementById(Name);
	  if(obj == null)
	  {
	  	return;
	  }
	  obj.style.filter="alpha(opacity="+ currfade[n] + ");";
  }
  else
  {
  	obj = document.getElementById(Name);
  	if(obj == null)
  	{
  		return;
  	}
  	document.getElementById(Name).style.MozOpacity=currfade[n]/100;
  }
}

function highlight(n)
{
	obj = document.getElementById("img"+n);
	if (obj == null) return;
	obj.style.display = "none"; 
	
	obj = document.getElementById("img"+n+"b");
	if (obj == null) return;
	obj.style.display = "block";
}

function normal(n)
{
	obj = document.getElementById("img"+n);
	if (obj == null) return;
	obj.style.display = "block"; 
	
	obj = document.getElementById("img"+n+"b");
	if (obj == null) return;
	obj.style.display = "none";
}
