var banner;
var owner;
var top;
var strings;
var index;
var table;
var delay;
function StartScrollingBanner(e,s,d)
{
// initialize global variables.
delay = d;
strings = s;
index = 0;
// Find the parent table and make sure it has a fixed height.
owner = FindTable(e);
if (owner == null || owner.height == 0)
{
alert("Your banner must be inside a fixed height table.");
return;
}
// insert another table with the styles needed to do the right
// relative positioning and clipping.
e.innerHTML = "
";
banner = document.all("_banner");
table = FindTable(banner);
top = -owner.height;
window.setTimeout("HandleScroll()",delay);
}
function FindTable(e)
{
var table = e;
while (table != null && table.tagName != "TABLE" )
table = table.parentElement;
return table;
}
function HandleScroll()
{
var done = false;
if (top == -owner.height)
{
if (strings[index] == null)
{
index = 0;
window.setTimeout("HandleShamelessPlug()",delay);
return;
}
banner.innerHTML = "" + strings[index] + "";
index = index + 1;
table.bgColor = ""; // clear color set in HandleShamelessPlug
top = owner.height;
}
banner.style.top = top;
top = top - 1;
var timeout = (top == 0) ? 1000 : delay;
window.setTimeout("HandleScroll()",timeout);
}
function HandleShamelessPlug()
{
table.bgColor = "black";
banner.style.top = 0;
top = -owner.height;
window.setTimeout("HandleScroll()",2000);
}
function RandomColor()
{
var color = "#";
var i;
for (i = 0; i < 3; i++)
color += RandomComponent();
return color;
}
function RandomComponent()
{
var i = Math.round(Math.random() * 255);
return i.toString(16);
}