<!--
// -----------------------
// GLOBAL VARIABLES
// -----------------------
var nTimeKeeper = parseInt(dServerDate.getUTCSeconds());
//-----------------------
//Object: tick
//DESCRIPTION: Object that handles ticker movement
//ARGUMENTS: None
//RETURN: None
//-----------------------
var tick={
		delay:2500, //delay between messages
		scroll:80,  //scroll time
		msgID:0,
		width:0,  //width
		msgwidth:586,
		node:0,       //ticker node
		pause:0,
		scrollval:10,
		scrollTimer:0,
		startDelay:1000,  //time before scrolling starts
		id:"ticker-message",
		lbl:"ticker-label",
		timeTxt:"time-text",
		txt:"ticker-text",
		updContent:function()
		{
			if (newsTicker.length >0&&this.pause==0)
			{
				var text=unescape(newsTicker[this.msgID][0]);
				this.node.innerHTML=text.replace(/\+/g," ");
				this.node.href=newsTicker[this.msgID][1];
								
				this.scrollMsg();
			}
		},
		init:function()
		{
			var d=document;
			if (newsTicker != null) 
			{
			this.node=d.getElementById? d.getElementById(this.id) : d.all[this.id];
			this.node.style.paddingLeft="5px";
			for (var child=this.node.firstChild;child!=null;child=child.nextSibling)
			{
					if (child.nodeName=='A')
						break;
			}
				this.node=child;
				this.node.innerHTML='';
				this.node.href='';
				this.node.style.clip="rect(0px 0px 0px 0px)";
				this.node.style.position="absolute";
				this.calcMsgArea();
			}
		},
		calcMsgArea:function()
		{
			var d=document;
			// Dynamically calculating the width of the ticker scrolling based on the size of the ticker label image
			if(d.getElementById(this.lbl))
				this.msgwidth=(this.msgwidth-parseInt(d.getElementById(this.lbl).childNodes[0].width));
			 else 
				this.msgwidth=(this.msgwidth-1);
			
			if(d.getElementById(this.timeTxt))
				this.msgwidth=(this.msgwidth-89);
		},
		scrollMsg:function()
		{
			if (this.width<this.msgwidth)
			{
				this.width+=this.scrollval;
				this.node.style.clip="rect(0px "+this.width+"px auto 0px)";
				this.scrollTimer=setTimeout("tick.scrollMsg()",this.scroll);
			}
			else
			{
				this.width=0;
				clearTimeout(this.scrollTimer);
				if (this.msgID==newsTicker.length-1) 
					this.msgID=0;
				else 
					this.msgID++;
				setTimeout("tick.updContent()",this.delay);
			}
		  }
};

// -----------------------
// FUNCTION: fDisplayTime
// DESCRIPTION: A function that displays the ticker clock.
// ARGUMENTS: None
// RETURN: None
// -----------------------
function fDisplayTime(){
	var sTime = '';
	nHours = dServerDate.getUTCHours();
	
	var today = new Date();
	//alert('today is '+today);
	var lsm = new Date;
	var lso = new Date;
	lsm.setMonth(2); // March
	lsm.setDate(31);
	var day = lsm.getDay();// day of week of 31st
	lsm.setDate(31-day); // last Sunday
	//alert('lsm is '+lsm);
	lso.setMonth(9); // October
	lso.setDate(31);
	day = lso.getDay();
	lso.setDate(31-day);
	//alert('lso is '+lso);
	if (today > lsm && today <= lso){
		nHours++;
	}	
	
	if(nHours < 10){
		sTime += '0' + nHours;
	} else {
		sTime += nHours;
		if(sTime == '24'){
			sTime = '00';
		}
	}
	nMinutes = dServerDate.getUTCMinutes();
	if(nMinutes < 10){
		sTime += ':0' + nMinutes;
	} else {
		sTime += ':' + nMinutes;
	}
	document.getElementById('time-text').childNodes[0].innerHTML = sTime;
	fStartClock();
	if(nHours == 0 && nMinutes == 0){
		fCreateDate();
	}
}
// -----------------------
// FUNCTION: fStartClock
// DESCRIPTION: A function that loops the ticker clock to display the correct time.
// ARGUMENTS: None
// RETURN: None
// -----------------------
function fStartClock(){
	dServerDate.setUTCMinutes(nMinutes+1);
	if(nTimeKeeper == 0){
		var nContinuousTimeOut = setTimeout("fDisplayTime()",60000);
	} else {
		var nInitialTimeOut = setTimeout("fDisplayTime()",(60-nTimeKeeper)*1000);
		nTimeKeeper = 0;
	}
}

//FUNCTION: fScrollLeft
//DESCRIPTION: Used to scroll news ticker text from right to left
//ARGUMENTS: None
//RETURN: None
//-----------------------
function fScrollLeft()
{
	tick.pause=0;
	setTimeout("tick.updContent()",tick.delay);
}
//--------------------
//FUNCTION: fPauseScrolling
//DESCRIPTION: Used to pause news ticker text on mouse over on it
//ARGUMENTS: None
//RETURN: None
//-----------------------
function fPauseScrolling()
{
	tick.pause=1;
}
//--------------------
//FUNCTION: fStartTicker
//DESCRIPTION: Used to scroll news ticker text from right to left
//ARGUMENTS: None
//RETURN: None
//-----------------------
function fStartTicker()
{
	tick.init();
	if (newsTicker != null) 
		setTimeout("tick.updContent()",tick.startDelay);
}    