//<!--
// ticker-jquery-xxx.js
var uri="/ajax-asp/ticker/";var anchorId="#ticker";var anchorText="";var tickTime=6000;var timeout=3000;var auto=60000;var hoverTimeout=55;var timeobj;var textLinks=[];var links=[];var text=[];var max=0;var tickCount=0;var tobj;links[0]='#';text[0]='Please wait, loading news items...';
function tickergate(){
	repeatrequest();textticker();
	$(anchorId).mouseover(function(){
		clearTimeout(timeobj);
	}).mouseout(function(){
		timeobj=setTimeout(textticker,hoverTimeout);
	});
}
function repeatrequest(){
	$.get(uri,function(data){
		populateArrayTicker(data);
	});
	setTimeout(repeatrequest, auto);
}
function populateArrayTicker(txt){
	if(txt){
		textLinks=txt.split("~");max=textLinks.length-1;
		for(var n=0;n<max;n++){
			var q=textLinks[n].split("@");
			links[n]=q[0];
			text[n]=q[1];
		}
	}else{
		max=0;links[0]='#';text[0]='Data retrieval error! Request will be retried in 60 seconds.';
	}
}
function textticker() {
	$(anchorId).fadeOut('fast',function(){
		if(tickCount>max||tickCount==max){
			tickCount=0; 
		}
		if(text[tickCount]){
			anchorText=text[tickCount];
			if(anchorText.length>86){anchorText=anchorText.substring(0,84)+"...";}
			$(anchorId).html(anchorText).attr('href',links[tickCount]).fadeIn('fast');
		}else{
			$(anchorId).html('failure: tickCount='+tickCount+', links[tickCount]='+links[tickCount]+', max='+max+', textLinks.length='+textLinks.length);
		}
		tickCount++;
	});	
	timeobj=setTimeout(textticker,tickTime);
}
//End ticker functions
//-->