var newsTimer=null;var newsTimerValue=13200;var neffects=new Array();var last_id=0;var ndelta=0;function startNews(){$A(neffects).each(function(a){if(a){$(a).finish()}});neffects[1]=new Effect.Parallel([new Effect.Appear("newstitle",{from:1,to:1})],{duration:0,delay:0});neffects[2]=new Effect.Parallel([new Effect.Move("newstitle",{sync:true,x:0,y:0,mode:"absolute"})],{duration:0.9,delay:0});neffects[3]=new Effect.Parallel([new Effect.Appear("newslogo",{sync:true,from:0,to:1})],{duration:0.9,delay:0.9});neffects[4]=new Effect.Parallel([new Effect.Fade("newslogo",{sync:true,from:1,to:0})],{duration:0.9,delay:12.4});neffects[5]=new Effect.Parallel([new Effect.Move("newstitle",{sync:true,x:0,y:15,mode:"absolute"})],{duration:0.9,delay:13.3})}function getNews(){new Ajax.Request("/news/show_hot/"+last_id+"/"+ndelta,{parameters:{id:last_id,delta:ndelta},onComplete:function(b){ndelta=1;for(i=1;i<neffects.length;i++){neffects[i].finish()}var a=b.responseJSON;last_id=a.News.id;$("newstitle_a").update(a.News.short_text);$("newslogo_a").update(a.User.tm_name);$("newstitle_a").title=a.News.short_text.stripScripts().stripTags();$("newslogo_a").title=a.News.short_text.stripScripts().stripTags();$$("a.fn_text").each(function(c){c.href=a.News.link;c.target="_blank";c.onmouseover=function(){stopNews()};c.onmouseout=function(){newsTimer=setTimeout(function(){getNews()},newsTimerValue)}}.bind(this));startNews();clearTimeout(newsTimer);newsTimer=setTimeout(function(){getNews()},newsTimerValue)}})}function NextNews(){ndelta=1;getNews()}function PrevNews(){ndelta=-1;getNews()}function stopNews(){neffects[1].finish();neffects[2].finish();neffects[3].finish();neffects[4].cancel();neffects[5].cancel();clearTimeout(newsTimer)}document.observe("dom:loaded",function(){if($("newstitle_a")){getNews()}});
