// JavaScript Document

// rotating banner

var SlideShowSpeed = 500;			// duration per image change in msec


var CrossFadeDuration = 2;			// duration of fade-effect in sec

var Picture = new Array();
var Caption = new Array();
var SlideBox = new Array();

var images=document.location+"";
images=images.substring(0,images.lastIndexOf("/")+1)+'images';

if(!window.Picture) alert ("ERR001 [banner.js]: Picture not defined.");
//alert("images: "+images);


var preLoad = new Array();
var plix = new Array();
var pix = 1;
function preLoadSlideShow()
{
	var hss;
	var iss;

	var qss = Picture.length-1;
	for (hss = 1; hss <= qss; hss++)
	{
	   var pss = Picture[hss].length-1;
		plix[hss] = 1;
		preLoad[hss] = new Array();
		for (iss = 1; iss <= pss; iss++)
		{
			preLoad[hss][iss] = new Image();
			preLoad[hss][iss].src = Picture[hss][iss];
		}
	}
}

function runSlideShow(fRandom)
{
	var PictureBox=document.images.PictureBox1;
	var pixn;
	var cnt=0;
	if(fRandom)
	{
		do {	pixn=(1+Math.floor(Math.random()*(Picture.length-1)));	cnt++; } 
		while (pixn==pix);
		pix=pixn;
	}
	//else
	//	pix=1;
	if (document.getElementById)
		PictureBox=document.getElementById("PictureBox"+pix);
	else
		pix=1;	// only animate first box

   if (PictureBox != null)
{
   if (document.all)
   {
      //document.images.PictureBox.style.filter="blendTrans(duration=2)";
      PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
      PictureBox.filters.blendTrans.Apply();
   }


   PictureBox.src = preLoad[pix][plix[pix]].src;
   if (document.all) PictureBox.filters.blendTrans.Play();
}
   plix[pix]++;
   if (plix[pix] > Picture[pix].length-1)	plix[pix]=1;
   if(!fRandom)
   {
		pix++;
		if(pix > Picture.length-1) pix=1;
   }
 
//alert("runSS3");
   tss = setTimeout('runSlideShow('+fRandom+')', SlideShowSpeed);
}
