var w3c = (document.getElementById) ? 1:0
var ns4 = (document.layers) ? 1:0 ;
var ie4 = (document.all) ? 1:0

var range = "";
var cap = "";
var mutex = 0;
var xplace = 0;
var yplace = 0;
var xmax = 0;
var xmin = 0;
var newsWidth = 0;

var speed = 3; //speed at which the news scrolls
var newsId = "navContent"; //name of the overall news div
var newsClipId = "navigation"; //name of the news clipping div

function redrawScreen() {
location.reload();
return false
}

function shiftTo(obj, x, y) {
if (w3c) {
obj.style.left = x + "px";
obj.style.top = y + "px";
}
else if (ns4) {
obj.moveTo(x,y);
}
else if (ie4) {
obj.style.pixelLeft = x;
obj.style.pixelTop = y;
}
}

function getObject(obj) {
var theObj = eval("document." + range + obj + cap);
return theObj;
}

function scrollRight() {
if (mutex == 1){
var theObj = getObject(newsId);
if (xplace < xmax) {
xplace = xplace + speed;
if (xplace > xmax) {
xplace = xmax;
}
shiftTo(theObj, xplace, yplace);
setTimeout("scrollRight()",25);
}
}
}

function scrollLeft() {
if (mutex == 2){
var theObj = getObject(newsId);
if (xplace > xmin) {
xplace = xplace - speed;
if (xplace < xmin) {
xplace = xmin;
}
shiftTo(theObj, xplace, yplace);
setTimeout("scrollLeft()",25);
}
}
}

function scrollIt(msg, dir) {
window.status = msg;
mutex = dir;
if (mutex == 1) scrollRight();
else if (mutex == 2) scrollLeft();
}

function init() {
if (w3c) {
range = "getElementById(\"";
cap = "\")";
theObj = getObject(newsClipId);
newsWidth = theObj.offsetWidth;
theObj = getObject(newsId);
xmin = (theObj.offsetWidth - newsWidth) * -1;
}
else if (ns4) {
window.captureEvents(Event.RESIZE);
window.onresize = redrawScreen;
theObj = getObject(newsClipId);
newsWidth = theObj.clip.width;
newsId = newsClipId + ".document." + newsId;
theObj = getObject(newsId);
xmin = (theObj.clip.width - newsWidth) * -1;
}
else if (ie4) {
range = "all.";
theObj = getObject(newsClipId);
newsWidth = theObj.offsetWidth;
theObj = getObject(newsId);
xmin = (theObj.offsetWidth - newsWidth) * -1;
}
}