/* Javascript Ticker - written by Canterbury Web Services */
var ns4 = (document.layers)? true : false;
var ns6 = (document.getElementById)? true : false;
var ie4 = (document.all)? true : false;
var ie5 = false;
if (ie4) {
// Microsoft Stupidity Check.
	if (navigator.userAgent.indexOf('MSIE 5')>0) {
		ie5 = true;
	}
	if (ns6) {
		ns6 = false;
	}
}
var coll = "";
var styleObj = "";
if (ie4) {
	coll = "all.";
	styleObj = ".style";
}
function getStyleObject(obj) {
	var theObj;
	if (typeof obj == 'string') {
		if (ns6) {
			theObj = self.document.getElementById(obj).style;
		} else {
			theObj = eval("document."+coll+obj+styleObj);
		}
	} else {
		theObj = obj;
	}
	return theObj;
}
function getObject(obj) {
	var theObj;
	if (typeof obj == 'string') {
		if (ns6) {
			theObj = self.document.getElementById(obj);
		} else {
			theObj = eval("document."+coll+obj);
		}
	} else {
		theObj = obj;
	}
	return theObj;
}

function shiftTo(obj, x, y) {
	var theObj = getStyleObject(obj);
	if (ns4) {
		theObj.moveTo(x, y);
	} else {
		theObj.left = x + "px";
		theObj.top = y + "px";	
	}
	return(theObj);
}

function show(obj) {
	o = getStyleObject(obj);
	o.visibility = "visible";
}

function hide(obj) {
	vis = "hidden";
	if (ns4) {
		vis = "hide";
	}
	o = getStyleObject(obj);
	o.visibility = vis;
}
 
// Ticker - use marquee for ie - and do the rest by steam
var tickleft = 0;
var ticktop = 0;
var tickWidth = 0;
var tareaWidth = 0;
var tickpos = 0;
var tickShift = 20;
var tickScrollAmount = 10;
var tickScrollDelay = 250;
var ison = 0;

function ShowTicker(src)
{// RC removed position:absolute; from both div is="Ttdiv" below - jan/2005
	if (document.all)  { // ie use marquee
		document.write('<div id="Ttdiv" style="left: -5000px; visibility: hidden; z-index:2; width: 100%;"><marquee width="100%" behavior="scroll" direction="left" scrollamount="'+tickScrollAmount+'" scrolldelay="'+tickScrollDelay+'">'+src+'</marquee></div>');
	} else {
		document.write('<div id="Ttdiv" style="position:absolute; top: 0px;left: -5000px; visibility: hidden; z-index:2"><nobr>'+src+'</nobr></div>');
	}
}
function StartTicker()
{
	var theObj = getObject("Tpdiv");
	var txtObj = getObject("Ttdiv");
	if (ns4) {
	        tickleft = theObj.pageX;
	        ticktop = theObj.pageY;
		tareaWidth = 760;
		tickWidth = txtObj.clip.right;
	} else {
		tickleft = theObj.offsetLeft;
		ticktop = theObj.offsetTop;
		tareaWidth = theObj.offsetWidth;
		tickWidth = txtObj.offsetWidth;
	}
	tickpos = tareaWidth;
	if (document.all) {
		tickObj = shiftTo("Ttdiv", tickleft, ticktop);
		show(tickObj);
	} else {
	 	Tickmove();
	}
} 
function Tickset()
{
	tickObj = shiftTo("Ttdiv", tickleft + tickpos, ticktop);
	if (tickpos > 0) {
		cr = tareaWidth - tickpos;
		cl = 0;
	} else {
		if (tareaWidth > tickWidth) {
			cr = tickWidth;
		} else {
			cr = - tickpos + tareaWidth;
		}
		cl = -tickpos;
	}
	if (ns4) {
		document.Ttdiv.clip.right = cr;
		document.Ttdiv.clip.left = cl;
	} else {
		tickObj.clip = "rect(auto "+cr+"px auto "+cl+"px)";
	}
	if (!ison) {
		ison = 1;
		show(tickObj);
	}
}

function Tickmove()
{
	tickpos -= tickScrollAmount;
	if ( tickpos <  - tickWidth) {
		tickpos = tareaWidth - 5;
	}
	Tickset();
	setTimeout("Tickmove()", tickScrollDelay);
}	


