// This is the only variable you'll have to modify, it controls the speed of the scrolling.
// You can enter a value from 1 to 5. The higher the value, the faster it scrolls.
speed = 1;

// Browser sniffing
var isDOM = (document.getElementById) ? 1:0;
var isIE4 = (document.all && !isDOM) ? 1:0;
var isNN4 = (document.layers) ? 1:0;

// Variables for DIV handling
var d,e,s,p,newsBox,newsBoxTop,newsBoxHeight,newsDiv,newsDivTop,newsDivBottom,newsDivHeight,lim;

// Motion variables
var scrollTimer = "";
var spd = new Array(90,70,50,30,10,5);

// Returns the DIV with the appropriate handlers
function getDiv(div) {
theDiv = eval(d + div + e + s);
return theDiv;
}

// Declare DIV handlers
function init() {
if (isDOM) {
	d = "document.getElementById(\'";
	e = "\')";
	s = ".style";
	p = "px";
	newsDiv = getDiv('news');
	newsDivHeight = document.getElementById('news').offsetHeight;
	newsBox = getDiv('newsbox');
	newsBoxHeight = parseInt(newsBox.height);
	lim = 200;
	}
else if (isIE4) {
	d = "document.all[\'";
	e = "\']";
	s = ".style";
	p = "px";
	newsDiv = getDiv('news');
	newsDivHeight = document.all.news.offsetHeight;
	newsBox = getDiv('newsbox');
	newsBoxHeight = parseInt(newsBox.height);
	lim = 30;
	}
else if (isNN4) {
	d = "document.layers[\'";
	e = "\']";
	s = "";
	p = "";
	newsDiv = document.newsbox.document.layers.news;
	newsDivHeight = document.newsbox.document.layers.news.clip.height;
	newsBox = getDiv('newsbox');
	newsBoxHeight = document.layers.newsbox.clip.height;
	lim = 30;
	}
newsBoxTop = parseInt(newsBox.top);
newsScroller();
}

//Scrolls it
function newsScroller() {
newsDivTop = parseInt(newsDiv.top);
newsDivBottom = (newsDivTop + newsDivHeight) + lim;
if (newsDivBottom > newsBoxTop) {
	newsDivTop--;
	newsDiv.top = newsDivTop;
	scrollTimer = setTimeout("newsScroller()",spd[speed]);
	}
else {
	newsDivTop = newsBoxHeight;
	newsDiv.top = newsDivTop;
	scrollTimer = setTimeout("newsScroller()",spd[speed]);
	}
}

// Stops onmouseover and starts back onmouseout
function controlScroll(action) {
if (action == 'stop') {
	clearTimeout(scrollTimer);
	}
else if (action == 'start') {
	scrollTimer = setTimeout("newsScroller()",spd[speed]);
	}
}