/*** quick variable to determine if the client is netscape ***/
var isNetscape = (bAgent.match(/netscape/) == 'netscape');

/*** a reusable/prototyped ScrollableContainer object ***/
function ScrollableContainer() 
{
	this.SCROLL_RATE = 100;			
	this.ReachedMaxScroll = false;
	this.PreviousScrollTop = 0;
	this.div = null;				//div object of the scrollable container
	this.ScrollInterval = null;		
}
/**	scroll function that starts in the barker.
 	In netscape: do not scroll, but change the css to allow a scrollbar. **/
ScrollableContainer.prototype.init = function(divid) 
{
	if(!isNetscape) 
	{
		this.div = document.getElementById(divid);
		this.div.scrollTop = 0;
		this.ScrollInterval = setInterval('ScrollableContainer.scrolldiv()', this.SCROLL_RATE);
	} 
	else 
	{
		this.div.className = "contentcontainer-ns";
	}
}

ScrollableContainer.prototype.scrolldiv = function() 
{
	if(!isNetscape) 
	{
		if (!this.ReachedMaxScroll) 
		{
			this.div.scrollTop = this.PreviousScrollTop;
			this.PreviousScrollTop++;
			this.ReachedMaxScroll = this.div.scrollTop >= (this.div.scrollHeight - this.div.offsetHeight);
		}
		else 
		{
			this.ReachedMaxScroll = (this.div.scrollTop == 0) ? false : true;
			this.div.scrollTop = this.PreviousScrollTop;
			this.PreviousScrollTop--;
		}
	}
}

ScrollableContainer.prototype.pausediv = function() 
{
	if(!isNetscape)
	{
		clearInterval(this.ScrollInterval);
	}
}

ScrollableContainer.prototype.resumediv = function()
{
	if(!isNetscape) 
	{
		this.PreviousScrollTop = this.div.scrollTop;
		this.ScrollInterval    = setInterval('ScrollableContainer.scrolldiv()', this.SCROLL_RATE);
	}
}

/*** Newswire (Control) specific events ***/
var newswireEvents = new Object();

//get Date/Time formated string specific for newswire
newswireEvents.getDateTime = function() 
{
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	var monthName = new Array ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
			
	return monthName[month-1] + "." + day + "." + year;
}

/*** Navigation specific ***/
navHover = function() 
{
	var lis = document.getElementById("channelnavigation").getElementsByTagName("LI");
	for (var i=0; i<lis.length; i++) 
	{
		lis[i].onmouseover=function() 
		{
			this.className+=" iehover";
		}
		
		lis[i].onmouseout=function() 
		{
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", navHover);
