/////////////////////////////////////////////////////////////////////////////////////////////
// This Javascript puts an RSS newsfeed in a tickertape box with random background colors  //
// You must set the variable rss_source before calling this script                         //
//   and put onLoad="GetNewsSource()" inside the <body> tag                                //
// Copyright (C) Keiron White, November 2004                                               //
/////////////////////////////////////////////////////////////////////////////////////////////

 var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
 var ie = (typeof window.ActiveXObject != 'undefined');
 var rss;

var sText="";
var i=0;
var iNews=0;

if (moz) {
   rss = document.implementation.createDocument("", "doc", null);
 } else if (ie) {
   rss = new ActiveXObject("Microsoft.XMLDOM");
   rss.async = false;
 }

var colors= new Array('#000000','#006600','#666600', '#660066', '#006666', '#000066', '#660000', '#444444', '#0066CC');

function change(i) {
//    var color = colors[Math.floor(colors.length*Math.random())];
//    var color = '#999999';
//    if (document.layers)
//        window.document.layers['id' + i].bgColor = color;
//    else if (document.all)
//        window.document.all['id' + i].style.background = color;
}

function GetNewsSource(){
rss.load(rss_source);
var itemNodes = rss.getElementsByTagName("item");
var iMax = itemNodes.length;
change(0);

sText = itemNodes(iNews).getElementsByTagName("title").item(0).text;
sDesc = itemNodes(iNews).getElementsByTagName("description").item(0).text;
myTicker.href = itemNodes(iNews).getElementsByTagName("link").item(0).text;
ticker();
iNews+=1;
if(iNews==iMax){
iNews=0;
}
window.setTimeout("GetNewsSource()", (90*sDesc.length +8000));
}

function ticker(){
i+=1;
myTicker.innerHTML = "<B><FONT size='+1' color='#5666A0'>NEW! - </FONT><FONT color='#FF0000'>" + sText + ": </FONT></B>" + sDesc.substring(0,i) + "_";
if(i<sDesc.length){
window.setTimeout("ticker()",90);
}
else{
myTicker.innerHTML = "<B><FONT size='+1' color='#5666A0'>NEW! - </FONT><FONT color='#FF0000'>" + sText + ": </FONT></B>" + sDesc.substring(0,i) + " - <B><FONT color='#008800'>Click here...</FONT></B>";
i=0;
}
}
