RSSTicker=Class.create({initialize:function(b,a){this.element=$(b);if(!this.element){return}this.currentItem=0;this.items=[];this.options={tickerLink:"",feedURL:"",pauseLength:2.5,transition:0.5};Object.extend(this,a||{});new Ajax.Request(this.feedURL,{method:"get",onSuccess:function(c){this.parseXML(c.responseXML);this.buildTicker()}.bind(this),onFailure:function(){console.log("Please visit http://www.udp-syria.org/news for the latest news and events.")},onException:function(d,c){}})},parseXML:function(a){$A(a.getElementsByTagName("item")).each(function(b){title=b.getElementsByTagName("title")[0].childNodes[0].nodeValue;descr=b.getElementsByTagName("description")[0].childNodes[0].nodeValue.escapeHTML().truncate(100," more...");link=b.getElementsByTagName("link")[0].childNodes[0].nodeValue;this.items.push({title:title,descr:descr,link:link})}.bind(this))},start:function(){this.interval=setInterval(this.showNext.bind(this),(this.pauseLength+2*this.transition)*1000)},stop:function(){clearInterval(this.interval)},showNext:function(){if(this.currentItem<this.items.length-1){this.currentItem=this.currentItem+1}else{this.currentItem=0}new Effect.Fade(this.element,{duration:this.transition,afterFinish:function(){this.switchData();new Effect.Appear(this.element,{duration:this.transition})}.bind(this)})},buildTicker:function(){if(this.items.length<=1){return}this.switchData();this.start()},switchData:function(){if(!this.items[this.currentItem]){return}this.element.innerHTML=this.items[this.currentItem]["title"];this.element.setAttribute("href",this.items[this.currentItem]["link"])}});HtmlTicker=Class.create({initialize:function(b,a){this.element=$(b);if(!this.element){return}this.currentItem=0;this.items=this.element.childElements();this.options={pauseLength:2.5,transition:0.5};Object.extend(this,a||{});this.buildTicker()},start:function(){this.interval=setInterval(this.showNext.bind(this),(this.pauseLength+2*this.transition)*1000)},stop:function(){clearInterval(this.interval)},showNext:function(){if(this.currentItem<this.items.length-1){this.currentItem=this.currentItem+1}else{this.currentItem=0}new Effect.Fade(this.element,{duration:this.transition,afterFinish:function(){this.switchNode();new Effect.Appear(this.element,{duration:this.transition})}.bind(this)})},buildTicker:function(){if(this.items.length<=1){return}this.switchNode();this.start()},switchNode:function(){if(!this.items[this.currentItem]){return}this.items.each(function(c,b){if(this.currentItem!=b){c.hide()}else{c.show()}}.bind(this));var a=this.items[this.currentItem]}});document.observe("dom:loaded",function(){var b=new RSSTicker("ticker",{tickerLink:"/news/",feedURL:"/news/rss."+$$("html")[0].lang+".xml",pauseLength:2.5,transition:0.5});var a=new HtmlTicker("news",{pauseLength:5.5,transition:0.5})});