
function ctRotatorBridgeRss20(url,readyCallback){this.url=url;this.readyCallback=readyCallback;}
var pattern=/([a-zA-Z0-9]+)*: (.*),(.*),(.*)/;ctRotatorBridgeRss20.prototype={getDataSource:function(){var readyCallback=this.readyCallback;var dataSource=[];$.get(this.url,{},function(data){$(data).find('channel item').each(function(){var e=$(this);var text=e.find('title').text();var result=pattern.exec(text);var img="blank";if(result!=null){img=result[2];img=img.replace(/ /g,"-");}
dataSource.push({title:e.find('title').text(),url:e.find('link').text(),tip:e.find('description').text(),image:img});});readyCallback(dataSource);$('#rssfeed').removeClass('loading');},'xml');return dataSource;}};function ctRotatorBridgeNewsRss20(url,readyCallback){this.url=url;this.readyCallback=readyCallback;}
var pattern=/([a-zA-Z0-9]+)*: (.*),(.*),(.*)/;ctRotatorBridgeNewsRss20.prototype={getDataSource:function(){var readyCallback=this.readyCallback;var dataSource=[];$.get(this.url,{},function(data){$(data).find('channel item').each(function(){var e=$(this);var text=e.find('title').text();var result=pattern.exec(text);dataSource.push({title:e.find('title').text(),url:e.find('link').text(),tip:e.find('description').text()});});readyCallback(dataSource);$('#newsrssfeed').removeClass('loading');},'xml');return dataSource;}};(function($){$.fn.ctRotator=function(dataSource,options){options=$.extend({showCount:5,speed:6000,fadeInSpeed:750,fadeOutSpeed:250,fadeEffect:true,useTooltip:false,shuffle:false,itemRenderer:function(item){if(item.url==null){return'<li class="ctrotator-item">'+item.title+'</li>';}else{if(item.image==null){return'<li class="ctrotator-item"><a href="'+item.url+'">'+item.title+'</a></li>';}else{return'<li class="ctrotator-item"><a href="'+item.url+'" style="background-image: url(/images/rss/'+item.image+'.jpg)">'+item.title+'</a></li>';}}},tooltipOptions:{}},options);if(options.showCount<1){throw('options.showCount must be greater than 0');}
return this.each(function(){$(this).empty();doRotating(dataSource,this,options);});};function doRotating(dataSource,container,options){var rotator=new ctRotatorList(dataSource,options.shuffle);var showCount=options.showCount;for(var i=0;i<showCount;i++){insertItem(rotator.gotoNext(),container,options);}
updateRotation(rotator,container,options);}
function updateRotation(rotator,container,options){var item=rotator.gotoNext();var newLi=insertItem(item,container,options);if(options.fadeEffect){newLi.hide();var inSpeed=options.fadeInSpeed;var outSpeed=options.fadeOutSpeed;$(container).children(':last').fadeOut(outSpeed,function(){$(this).remove()
newLi.fadeIn(inSpeed,function(){setTimeout(function(){updateRotation(rotator,container,options)},options.speed);});});}else{$(container).children(':last').remove();setTimeout(function(){updateRotation(rotator,container,options)},options.speed);}}
function insertItem(item,container,options){var rendered=options.itemRenderer(item);var newLi=$(rendered);if(newLi.size()==0){newLi=$('<li></li>').append(rendered);}
$(container).prepend(newLi);if(options.useTooltip){newLi.tooltip($.extend({fade:50,delay:800,opacity:1,bodyHandler:function(){return item.tip;}},options.tooltipOptions));}
return newLi;}
function ctRotatorList(list,shuffle){this.cursor=0;this.list=list;this.shuffle=shuffle==null?false:shuffle;if(this.shuffle){this.list=this.shuffleArray(this.list);}}
ctRotatorList.prototype={gotoNext:function(){if(this.cursor>=this.getCount()-1){this.cursor=0;}else{this.cursor++;}
return this.list[this.cursor];},getCount:function(){return this.list.length;},shuffleArray:function(o){for(var j,x,i=o.length;i;j=parseInt(Math.random()*i),x=o[--i],o[i]=o[j],o[j]=x);return o;}};})(jQuery);