// TarrantIT 2004 Hanoi
var BaseDir="images/";
var timeOn = 200;   
var timeOff = 8000;  //8000
var timeStart = 10000; // 10000
var fadeTimeOn = .5;
var fadeTimeOff = .5;
//
var LegendCount=0;
var imgLegend = null;
var divLegend = null;
var RotatingNow = false;
var AddInc = 0;
// the cords for the box within which the adds display
var ShowBoundsBox = false;
var addLeft =10;
var addTop =10;
var addWidth =900;
var addHeight =900;
var addDims = 125;
var imgOff = null;
var addVisible = false;

var aAddImages = new Array("FourexMan.jpg", "schooner2.gif");
var aAddAlts = new Array("The Fourex Man", "A pot please");
var aAdds = new Array();
function AddRotatorSetup(delay)
{
	if (RotatingNow) return;
	if (ShowBoundsBox) DrawBox();
	imgLegend = document.getElementById("imgLegend");
	divLegend = document.getElementById("divLegend");
	for (var i=0; i<aAddImages.length; i++)
	{	
		aAdds[i]=new Image;
		aAdds[i].src=BaseDir+aAddImages[i];
	}
	imgOff = new Image();
	imgOff.src = BaseDir+"1X1.gif";
	RotatingNow = true;
	Intro();
}
function Intro()
{
	setTimeout("StartAdds()",timeStart);	
}
function DrawBox()
{
	if (! ShowBoundsBox) return;
	var tblBox = document.getElementById("tblBox");
	tblBox.style.width=addWidth;
	tblBox.style.height=addHeight;
	tblBox.style.top=addTop;
	tblBox.style.left=addLeft;
}
function StartAdds()
{
	RotateAddOn();
}
function RotateAddOn()
{
	if (document.all)
	{
		imgLegend.style.filter='blendTrans(duration='+ fadeTimeOn +')';
		imgLegend.filters.blendTrans.Apply();
	}
	divLegend.style.top=addTop+(Math.floor(Math.random()*(addHeight-addDims)));
	divLegend.style.left=addLeft+(Math.floor(Math.random()*(addWidth-addDims)));
		
	imgLegend.src=aAdds[AddInc].src;
	imgLegend.alt=aAddAlts[AddInc];
			
	if (AddInc < aAddImages.length -1)
		AddInc++;
	else
		AddInc=0;
	
	if (document.all)
	{ 
		imgLegend.filters.blendTrans.Play();
	}
	setTimeout("RotateAddOff()", timeOn);
	addVisible = true;
}

function RotateAddOff()
{
	if (document.all)
	{
		imgLegend.style.filter='blendTrans(duration='+ fadeTimeOff +')';
		imgLegend.filters.blendTrans.Apply();
	}
	imgLegend.src = imgOff.src;
	imgLegend.title="";
	
	if (document.all) 
	{
		imgLegend.filters.blendTrans.Play();
	}
	addVisible = false;
	LegendCount++;
	setTimeout("RotateAddOn()", timeOff); 
}