Effect.DefaultOptions.duration=0.3;TooltipManager=Class.create();Object.extend(TooltipManager.prototype,{tooltipDiv:"div_tooltip",tooltipContainer:"tooltip_container",tooltipUpdater:"tooltip_updater",tooltipClose:"tooltip_close",feedURL:URL_BASE+"tooltip/rss",pauseLength:16000,timer:0,currentTitle:0,items:null,tt_id:1,initialize:function(id,url)
{this.items=[];this.tooltipDiv="div_tooltip_"+id;this.tooltipContainer="tooltip_container_"+id;this.tooltipUpdater="tooltip_updater_"+id;this.tooltipClose="tooltip_close_"+id;this.feedURL=URL_BASE+url;this.tt_id=id;new Ajax.Request(this.feedURL,{method:"get",onSuccess:function(response)
{Element.show(this.tooltipContainer);this.parseJSON(response.responseText);this.buildTicker();}.bind(this),onException:function(req,err)
{}});},buildTicker:function()
{if(this.items[this.currentTitle])
{if(true)
{var code='<h2>'+this.items[this.currentTitle]['title']+'</h2>';code+='<p style=" padding:5px"><img style=" padding-right:5px" src="'+IMAGES_URL+'tooltip/'+this.items[this.currentTitle]['image']+'" align="left">'+this.items[this.currentTitle]['description']+'</p>';$(this.tooltipUpdater).innerHTML=code;}
this.start();}},parseJSON:function(text)
{if(text.isJSON())
{var json=text.evalJSON();if(json)
{json.each(function(aItem)
{var title=aItem.title;var image=aItem.image;var description=aItem.description;this.items.push({title:title,description:description,image:image});}.bind(this));}}},start:function()
{this.interval=setInterval(this.showNext.bind(this),this.pauseLength);},stop:function()
{clearInterval(this.interval)},showNext:function()
{if(this.currentTitle<this.items.length-1)
{this.currentTitle=this.currentTitle+1;}
else
{this.currentTitle=0;}
new Effect.Fade(this.tooltipUpdater,{afterFinish:function()
{this.switchData();new Effect.Appear(this.tooltipUpdater);}.bind(this)});},switchData:function()
{if(this.items[this.currentTitle])
{if(true)
{var code='<h2>'+this.items[this.currentTitle]['title']+'</h2>';code+='<p style="padding:5px;font-size:11px;"><img style=" padding-right:5px" src="'+IMAGES_URL+'tooltip/'+this.items[this.currentTitle]['image']+'" align="left">'+this.items[this.currentTitle]['description']+'</p>';$(this.tooltipUpdater).innerHTML=code;}}},close:function()
{this.stop();alert(this.tooltipContainer);Element.remove(this.tooltipContainer);}});