/* Configuration variables */

var ticker_char_timeout = 50;
var ticker_item_timeout = 5000;

/* Initialise variables */

var ticker_item		= -1;
var ticker_length	= 0;
var ticker_itemcount	= 0;
var rss_title  		= new Array();

function rsstickerTick()
{
	if(ticker_length == 0)
	{
		ticker_item++;
		ticker_item     = ticker_item % ticker_itemcount;
	}

	rss_title[ticker_item] = rss_title[ticker_item].replace(/&quot;/g,'"');
	rss_title[ticker_item] = rss_title[ticker_item].replace(/al2d: /g,'');
	

	ticker.innerHTML  = rss_title[ticker_item].substring(0,ticker_length);
	
	if(ticker_length != rss_title[ticker_item].length)
	{
		ticker_length++;
		setTimeout("rsstickerTick()", ticker_char_timeout);
	}
	else
	{
		ticker_length = 0;
		setTimeout("rsstickerTick()", ticker_item_timeout);
	}
}

function rsstickerStart() {
	
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	  xmlhttp = new XMLHttpRequest();
	}

	xmlhttp.open("GET", feed ,true);

	xmlhttp.onreadystatechange=function() 
	{
		if (xmlhttp.readyState==4) 
		{
	   		if (xmlhttp.status==200) 
	   		{
		        	xml  = xmlhttp.responseXML.documentElement;

				ticker_itemcount   = xml.getElementsByTagName('item').length;
			    
				for(var i=0; i<ticker_itemcount; i++) 
				{
					if(xml.getElementsByTagName('item')[i].getElementsByTagName('title').length==1)
					{
						rss_title[i]	= xml.getElementsByTagName('item')[i].getElementsByTagName('title')[0].firstChild.data;
					}
				}
	
			        rsstickerTick();
			}
		}
	}
	
	xmlhttp.send(null);
}