// Copyright (c) 2009, Fast Lane Institute for Knowledge Transfer

if(typeof FL_NewsTickerNG=='undefined')
{var FL_NewsTickerNG=Class.create();FL_NewsTickerNG.prototype={initialize:function(config)
{this.config=config;if(!this.config.tickerspeed)
{this.config.tickerspeed=5;}
this.tickernode=$(config.nodename);this.itemsnode=$$('#'+config.nodename+' ol')[0];this.nextbtn=$$('#'+config.nodename+' .nextbtn')[0];Event.observe(window,'load',this.initTicker.bind(this));},pause:function()
{if(this.pe)
{this.pe.stop();}},cont:function()
{this.pe=new PeriodicalExecuter(this.newsChanger.bind(this),this.config.tickerspeed);},initTicker:function()
{if(!this.tickernode||!this.itemsnode)
{CMS.raiseError(2500,'newsticker '+this.config.nodename+' not found');return;}
this.items=$$('#'+this.config.nodename+' ol li');if(!this.items.length)
{return;}
this.items[this.curitem=0].addClassName('active');Event.observe(this.itemsnode,'mouseover',this.pause.bind(this));Event.observe(this.itemsnode,'mouseout',this.cont.bind(this));if(this.nextbtn)
{Event.observe(this.nextbtn,'click',this.step.bind(this));}
this.cont();},step:function()
{this.pause();this.newsChanger(null);this.cont();},newsChanger:function(pe)
{this.items[this.curitem].removeClassName('active');if(this.curitem==(this.items.length-1))
{this.curitem=0;}
else
{this.curitem++;}
this.items[this.curitem].addClassName('active');}};}