
//Container for ticker. Modify its STYLE attribute to customize style:
var tickercontainer='<div id="container" style=" margin-left:75px; width:250px; height:47px; color:#072B0D; font:15px verdana; font-smooth: always; text-decoration:none; padding-top:17px; padding-left:6px; font-weight:bold; border:none;"></div>'

//Specify path to xml file
var xmlsource="ticker.xml"

////No need to edit beyond here////////////
//load xml file
/*if (window.ActiveXObject)
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
else if (document.implementation && document.implementation.createDocument)
var xmlDoc= document.implementation.createDocument("","doc",null);



alert("b4loaded");
xmlDoc.load(xmlsource)
alert("loaded");
}*/
var xmlDoc=loadXMLDoc(xmlsource);
if (typeof xmlDoc!="undefined")

document.write(tickercontainer);
function loadXMLDoc(dname)
{
if (window.XMLHttpRequest)
  {
  xhttp=new XMLHttpRequest();
  }
else
  {
  xhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}





//Regular expression used to match any non-whitespace character
var notWhitespace = /\S/

function init_ticker(){
//Cache "messages" element of xml file


tickerobj=xmlDoc.getElementsByTagName("xmlticker")[0]


//REMOVE white spaces in XML file. Intended mainly for NS6/Mozilla
for (i=0;i<tickerobj.childNodes.length;i++){
if ((tickerobj.childNodes[i].nodeType == 3)&&(!notWhitespace.test(tickerobj.childNodes[i].nodeValue))) {
tickerobj.removeChild(tickerobj.childNodes[i])
i--
}
}

var msgsobj=tickerobj.childNodes[1]


if (msgsobj.getAttribute("url")!=null){
themessage='<a class = "newslink" href="'+msgsobj.getAttribute("url")+'"'
if (msgsobj.getAttribute("target")!=null)
themessage+=' target="'+msgsobj.getAttribute("target")+'"'
themessage+='>'
}
themessage+=msgsobj.firstChild.nodeValue
if (msgsobj.getAttribute("url")!=null)
themessage+='</a>'

//document.getElementById("container").innerHTML=tickerobj.childNodes[1].firstChild.nodeValue
document.getElementById("container").innerHTML = themessage;
msglength=tickerobj.childNodes.length
currentmsg=2
themessage=''
setInterval("rotatemsg()",tickerobj.childNodes[0].firstChild.nodeValue)
}

function rotatemsg(){
var msgsobj=tickerobj.childNodes[currentmsg]
if (msgsobj.getAttribute("url")!=null){
themessage='<a class = "newslink" href="'+msgsobj.getAttribute("url")+'"'
if (msgsobj.getAttribute("target")!=null)
themessage+=' target="'+msgsobj.getAttribute("target")+'"'
themessage+='>'
}
themessage+=msgsobj.firstChild.nodeValue
if (msgsobj.getAttribute("url")!=null)
themessage+='</a>'


//Rotate msg and display it in DIV:
document.getElementById("container").innerHTML=themessage
currentmsg=(currentmsg<msglength-1)? currentmsg+1 : 1
themessage=''
}

function fetchxml(){

if (xmlDoc.readyState==4)
init_ticker()
else
setTimeout("fetchxml()",10)
}


if (window.ActiveXObject)
fetchxml()
else if (typeof xmlDoc!="undefined")

init_ticker();
// JavaScript Document
