var effectsManager=(function(){var f=[],c=[],b=null,a=0,d;function e(g){if(g){b=g;var h=$("#star");d=h.find(".tooltip");if(!d.length){d=$('<p class="tooltip"></p>').appendTo(h);}h.hover(function(){var i=typeof(g.title)=="function"?g.title():g.title;i=i.split("|");i=i[a%i.length];d.html(i);$(this).addClass("hover");},function(){$(this).removeClass("hover");}).click(function(){b.toggle();a++;});if("init" in g){g.init();}}}$(function(){if("IS_IE6" in window){return;}var k=[],h=/\beffect-([\w\-]+)/ig,j=document.body.className||"",g;while(g=h.exec(j)){k.push(g[1].toLowerCase());}if(k.length){var i=k.length==1?k[0]:k[Math.floor(Math.random()*k.length)];if(i=="random"){e(c[Math.floor(c.length*Math.random())]);}else{$.each(f,function(l,m){if(m.id.toLowerCase()==i){e(m);return false;}});}}});return{registerEffect:function(g){f.push(g);if(g.is_common){c.push(g);}},setTitle:function(j,h){for(var g=0;g<f.length;g++){if(f[g].id==j){f[g].title=h;break;}}},getTooltip:function(){return d;}};})();(function(){effectsManager.registerEffect({id:"bye-bye",title:"До свиданья, кнопка!",is_common:true,toggle:function(){var a=$("#star"),b=a.offset();a.appendTo(document.body).addClass("clicked").css("position","absolute").css(b);$t(a).tween({top:$(window).height()+100,time:0.8,transition:"easeinexpo",onComplete:function(){a.remove();}});}});})();(function(){var e=30,c=43;c/=180*Math.PI;function d(f,i,g){var h=$('<div class="effect-star-halo"></div>').css({left:f,top:i}).appendTo(document.body);$t(h).tween({opacity:0,time:1,transition:"linear",delay:g||0,onComplete:function(){h.remove();}});}function b(){var g=$("#star-inner"),j=g.offset();g.appendTo(document.body).css(j);g=g[0];var i=$(window).height()+200,h=Math.tan(c)*i,f=g.offsetLeft,k=g.offsetTop;$t(g).tween({left:-h,top:i,time:1,transition:"easeinexpo",onUpdate:function(){var p=g.offsetLeft,o=g.offsetTop,u=p-f,t=o-k,l=Math.sqrt(u*u+t*t),s=Math.sqrt(f*f+k*k);var m=Math.round(l/e),n=l/m;for(var q=0;q<m;q++){var r=q*n;d(f-r*Math.cos(c),k+r*Math.sin(c+Math.PI/2),q*0.01);}f=p;k=o;},onComplete:function(){setTimeout(function(){if(!$.browser.msie){$(g).css({opacity:0,left:"",top:""}).appendTo("#star").animate({opacity:1},500);}else{$(g).css({left:"",top:""}).appendTo("#star");}a=false;},1000);}});}var a=false;effectsManager.registerEffect({id:"drop-star",title:"На удачу",toggle:function(){if(!a){b();a=true;}}});})();$(function(){var a="ex-w",j="expand-phrase-expanded",m="#fff",c={time:0.2,transition:"linear"},b=0.012,h={time:0.8,transition:"easeinoutcubic",onComplete:function(){$(this).css("height","");}};function l(p,s,q){if(q){for(var r=0,o=p.length;r<o;r++){if(s.call(p[r],r,p[r])===false){break;}}}else{for(var r=p.length-1;r>=0;r--){if(s.call(p[r],r,p[r])===false){break;}}}}function d(p,q){var r=document.createElement("div");r.innerHTML=p;var o=document.createDocumentFragment();if(q){o.appendChild(document.createTextNode(" "));}while(r.firstChild){o.appendChild(r.firstChild);}return o;}function i(o){return !(/[^\s\n\r]/).test(o);}function g(p){var o=/^\s/;if(p.hasChildNodes()&&p.nodeName!="A"){l(p.childNodes,function(r,s){g(s);});}else{if(p.nodeType==1&&p.nodeName=="A"){$(p).addClass(a);}else{if(p.nodeType==3&&!i(p.nodeValue)){var q=p.nodeValue.replace(/([^\u0020\n\r\t]+)/g,'<span class="'+a+'">$1</span>');p.parentNode.replaceChild(d(q,o.test(q)),p);}}}}function f(p){p=$(p);var o=p.find(".expand-phrase-rest");if(!o.length){return;}g(o[0]);p.find(".icon.collapse").click(e);}function e(){var p=$(this),o=p.parents(".expand-phrase");if(o.hasClass(j)){k(o);}else{n(o);}}function n(o){var s=o.find("."+a),r=s.css("color");s.css({color:m});var q=o[0].offsetHeight;o.addClass(j);var p=o[0].offsetHeight;o.css("height",q);$t(o,h).tween({height:p});s.each(function(t,u){$t(u,c).tween({color:r,delay:0.8+t*b});});}function k(p){var s=p.find("."+a);var r=p[0].offsetHeight;p.removeClass(j);var q=p[0].offsetHeight;p.css("height",r);p.addClass(j);var o=s.length-1;s.each(function(t,u){$t(u,c).tween({color:m,delay:(o-t)*b});});$t(p,h).tween({height:q,delay:o*b+c.time,onComplete:function(){p.removeClass(j).css("height","");s.css("color","");}});}$(".expand-phrase").each(function(){f(this);}).parent(".refreshable-content").registerRefreshCallback(function(){$(".expand-phrase",this).each(function(){f(this);});});});(function(){var b="http://"+window.location.host+"/";var a="Media Stars";if(window.sidebar||window.external){effectsManager.registerEffect({id:"favorites",title:"Страницу — в избранное!",is_common:true,toggle:function(){if(window.sidebar){window.sidebar.addPanel(a,b,"");}else{if(window.external){window.external.AddFavorite(b,a);}}}});}})();(function(){var h=[15,6,21,5,5,4],c=60,n={width:0,height:0},f=false,m=[];function d(p,o){return(o-p)*Math.random()+p;}function b(){n.width=$(window).width();n.height=$("#page").height();}function e(s,o,t){var p=s*c,q=Math.floor(h[s]*Math.random())*c;var r=$('<div class="fw-particle"><ins class="png"></ins></div>');r.find("ins").css({left:-q,top:-p});
r.appendTo(document.body);this.elem=r;this.x=o;this.y=t;this.vx=-d(30,50);this.vy=-d(8,30);this.gx=d(0.3,0.9);this.gy=d(1,4);m.push(this);this.move();}e.prototype={move:function(){this.elem.css({left:this.x,top:this.y});this.x+=this.vx;this.y+=this.vy;this.vx+=this.gx;this.vy+=this.gy;},destroy:function(){this.elem.remove();for(var o=0;o<m.length;o++){if(m[o]==this){m.splice(o,1);break;}}},isVisible:function(){return !(this.x+c<0||this.y>n.height);}};function l(o,p){var q=$("#star").offset(),p=p||0;function r(){new e(p,q.left,q.top);o--;if(0<o--){setTimeout(r,d(5,10));g();}}r();}function k(){for(var o=m.length-1;o>=0;o--){var q=m[o];q.move();if(!q.isVisible()){q.destroy();}}if(m.length&&f){setTimeout(k,30);}else{f=false;}}function g(){if(!f){f=true;k();}}function a(){f=false;}function j(){$(window).resize(b);b();}effectsManager.registerEffect({id:"firework-8march",title:"8 марта",is_common:true,init:j,toggle:function(){l(80,0);}});effectsManager.registerEffect({id:"firework-snow",title:"Снег",is_common:true,init:j,toggle:function(){l(80,1);}});effectsManager.registerEffect({id:"firework-23feb",title:"23 февраля",is_common:true,init:j,toggle:function(){l(80,2);}});var i=false;effectsManager.registerEffect({id:"firework-newyear",title:"С наступающим!",is_common:true,init:j,toggle:function(){l(80,i?3:1);i=!i;}});effectsManager.registerEffect({id:"firework-stars",title:"Звёзды",is_common:true,init:j,toggle:function(){l(80,3);}});effectsManager.registerEffect({id:"firework-hearts",title:"Сердечки",is_common:true,init:j,toggle:function(){l(80,4);}});effectsManager.registerEffect({id:"firework-dollars",title:"Доллары",is_common:true,init:j,toggle:function(){l(80,5);}});effectsManager.registerEffect({id:"firework-stars-dollars",title:"Звёзды-Доллары",is_common:true,init:j,toggle:function(){l(80,i?3:5);i=!i;}});})();(function(){var b,k;function h(){b=$(window).width();k=$(window).height();}function i(){var n=$('<div class="flying-object flying-football"></div>').css({bottom:b,left:Math.round(Math.random()*(b-200))}).appendTo(document.body);$t(n).tween({bottom:0,time:1.5,transition:"easeoutbounce"}).tween({bottom:-n.height(),delay:3,time:0.6,transition:"easeincubic",onComplete:function(){n.remove();}});}function m(){var o=250,n=100;var p=$('<div class="flying-object flying-hat"></div>').css({top:k/2,left:b+o}).appendTo(document.body);$t(p,{time:5,transition:"linear",onComplete:function(){p.remove();}}).percent(function(r){var q=(1-r)*(b+o),s=k/2+Math.sin(r*Math.PI*6)*n;p.css({left:q,top:s});});}var d={p0:[315,45],p1:[55,290],p2:[466,426],p3:[975,-65]};var f={p0:[765,23],p1:[1013,70],p2:[472,360],p3:[-105,405]};function a(o,p,q){var n=new Image;n.onload=function(){var t=$(n).addClass("flying-object");var s=n.width,r=n.height;t.css({left:0,top:0,width:1,height:1}).appendTo(document.body);$t(n).percent(function(u){t.css({width:u*s*q,height:u*r*q,left:jTweener.Utils.bezier3(u,p.p0[0],p.p1[0],p.p2[0],p.p3[0]),top:jTweener.Utils.bezier3(u,p.p0[1],p.p1[1],p.p2[1],p.p3[1])});},{transition:"easeincubic",time:1.7,onComplete:function(){t.remove();}});};n.src=o;}function j(){a("/f/i/effects/ufo.png",d,2);}function l(){c=Math.floor(Math.random()*e.length);}var e=[i,m,j],g=[],c=0;effectsManager.registerEffect({id:"flying-objects",title:"Мяч!::Шляпа!:: ",is_common:true,init:function(){$(window).resize(h);g=this.title.split("::");l();if(g[c]){this.title=g[c];}},toggle:function(){h();e[c]();l();if(g[c]){this.title=g[c];effectsManager.getTooltip().html(this.title);}}});})();(function(){var b=1.1,a=0;effectsManager.registerEffect({id:"increase-font",title:"Крупче!",is_common:true,init:function(){a=parseInt($("#content").css("font-size"));},toggle:function(){a=Math.round(a*b);$("#content").css("font-size",a);}});})();(function(){var d=false,i="/f/i/effects/big-cursor.png",c=null,k={width:0,height:0},m={width:0,height:0},h={left:0,top:0},f={width:0,height:0},b=$('<div id="ef-large-cursor"></div>');function a(){m.width=$(document.body).width();m.height=$("#page").height()+2;}function l(n,o){h.left=n;h.top=o;b.css(h);e();}function e(){var o=m.width-b[0].offsetLeft,n=m.height-b[0].offsetTop;var p={width:Math.min(k.width*1.5,o),height:Math.min(k.height*1.5,n)};if(p.width!=f.width||p.height!=f.height){f.width=p.width;f.height=p.height;b.css(f);}}function j(){$(c).css({width:0,height:0});b.show();$t(c).tween(k,{time:1.2,transition:"easeoutelastic"});}function g(){$t(c).tween({width:0,height:0,time:0.5,transition:"easeinback",onComplete:function(){d=false;b.hide();}});}effectsManager.registerEffect({id:"large-cursor",title:"Большой курсор",is_common:true,init:function(){c=new Image;c.onload=function(){k.width=c.width,k.height=c.height;c.className="png";};c.src=i;b.append(c).hide().appendTo(document.body);$(window).resize(a);$(document).mousemove(function(n){if(d){l(n.pageX,n.pageY);}});b.click(function(){if(d){g();}});a();},toggle:function(n){d=!d;if(d){j();l(n.pageX,n.pageY);
}else{g();}}});})();(function(){var l=300,j=300,b=-400,a=400,A=0,u=15,f=20,r=0,g=0.06,n=false,C=document,s=$('<div id="effect-mouse"></div>').css({left:b,top:a}),h,q,c=Math.PI/180,i,o,y,w,v,m="";if(C.createStyleSheet){C.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!C.namespaces.rvml&&C.namespaces.add("rvml","urn:schemas-microsoft-com:vml");var B=function(e){return C.createElement("<rvml:"+e+' class="rvml">');};}catch(x){var B=function(e){return C.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');};}}function z(){i=document.createElement("canvas");i.width=200;i.height=200;s.appendTo(document.body);o=new Image;o.src=s.css("background-image").replace(/^url\(['"]?|['"]?\)$/g,"");if(i.getContext){v=i.getContext("2d");s.append(i);}if($.browser.msie){y=B("image");y.src="/f/i/effects/mouse-01.png";w=B("image");w.src="/f/i/effects/mouse-02.png";s.append(y).append(w);}s.remove();}function d(){var E=parseInt(s.css("backgroundPosition").split(/\s+/)[1]),e=h.frameSize().y,D=([A,E]).join(":");if(D==m){return;}v.save();v.clearRect(0,0,i.width,i.height);v.translate(i.width/2,i.height/2);v.rotate(A*c);v.drawImage(o,0,Math.abs(E),o.width,e,-o.width*0.3,-e*0.2,o.width,e);m=D;v.restore();}function k(D){var e=parseInt((s.css("backgroundPosition")||"0 0").split(/\s+/)[1]);y.style.rotation=A-15;w.style.rotation=A-15;if(e){y.style.visibility="hidden";w.style.visibility="visible";}else{w.style.visibility="hidden";y.style.visibility="visible";}}var p=($.browser.msie)?k:d;function t(){var E=l-b,D=j-a,G=Math.sqrt(E*E+D*D),F=Math.atan2(D,E);if(Math.abs(G)>u){G=u;}else{G*=0.3;}r=Math.min(r+g,1);G*=r;if(r<0){return;}var e=Math.cos(F)*G,I=Math.sin(F)*G;if(Math.abs(E)>2||Math.abs(D)>2){b+=e;a+=I;s.css({left:b,top:a});var H=F/Math.PI*180+95;h.frameDelay((1-G/u)*50+60);A=H;p();if(!h.isAnimating()){h.start();}}else{h.stop();r=-3;}}effectsManager.registerEffect({id:"mouse",title:"Мышь",is_common:true,init:function(){$(document).mousemove(function(e){l=e.pageX;j=e.pageY;});h=spriteAnimation(s[0],160,320,"backgroundPositionY");h.frameDelay(80);if($.browser.msie){s.addClass("ie");}z();},toggle:function(){if(!n){s.appendTo(document.body);q=setInterval(t,30);n=true;}else{s.remove();n=false;clearInterval(q);}}});})();(function(){var d=false,g=false,f={time:1,namespace:"effect-phrase",transition:"linear"},b,a;function c(){d=true;a.each(function(){$t(this).tween(f,{color:$(this).data("hl-color")});});}function e(){d=true;a.each(function(){$t(this).tween(f,{color:$(this).data("old-color"),onComplete:function(){$(this).css("color","");}});});}effectsManager.registerEffect({id:"phrase",title:"Подсветить фразу",is_common:false,init:function(){b=$("#content");a=b.find(".highlight, a").andSelf();b.find(".effect-phrase-word").each(function(){$(this).css("color",$(this).css("color"));});a.each(function(){var i=$(this),h=i.css("color"),j=jTweener.Utils.Color.blend(jTweener.Utils.getRGB("#fff"),jTweener.Utils.getRGB(h),0.1);i.data("old-color",h).data("hl-color",j);});jTweener.addNSAction({onComplete:function(){d=false;}},f.namespace);},toggle:function(){if(d){return;}if(g){e();}else{c();}g=!g;}});})();(function(){effectsManager.registerEffect({id:"random-page",title:"Пойти туда, не знаю куда",is_common:true,toggle:function(){var a=$("a");if(a.length){window.location.href=a.eq(Math.floor(a.length*Math.random())).attr("href");}}});})();(function(){effectsManager.registerEffect({id:"reload",title:"Перезагрузка",is_common:false,toggle:function(){$(".refreshable .icon.refresh").click();}});})();effectsManager.registerEffect({id:"search-engine-yandex",title:"Угадайте, на каком месте мы в Яндексе!",is_common:true,toggle:function(){window.open("http://yandex.ru/yandsearch?text=media+stars","_blank");}});effectsManager.registerEffect({id:"search-engine-google",title:"Угадайте, на каком месте мы в Гугле!",is_common:true,toggle:function(){window.open("http://www.google.ru/search?q=media+stars","_blank");}});(function(){var c=[],g=33,j="backgroundPositionX",h="backgroundPositionY",l={x:["left",j],y:["top",h]},u=0;var v=navigator.userAgent.toLowerCase();var t=/msie/.test(v)&&!/opera/.test(v);function f(y,w){if(y.style[w]){return y.style[w];}else{if(t){return y.currentStyle[w];}else{if(document.defaultView&&document.defaultView.getComputedStyle){w=w.replace(/([A-Z])/g,"-$1").toLowerCase();var x=document.defaultView.getComputedStyle(y,"");return x&&x.getPropertyValue(w);}else{return null;}}}}function d(y,x){for(var w=0;w<y.length;w++){if(y[w]===x){return true;}}return false;}function r(y){var w=[];if(typeof(y)=="string"){y=y.split(/\s|,/);}for(var x=0;x<y.length;x++){if(y[x]){w.push(y[x].replace(/\-(\w)/g,function(A,z){return z.toUpperCase();}));}}return w;}function s(){return(new Date).getTime();}function n(x){var w={width:0,height:0};if(typeof(x)=="number"||typeof(x)=="string"){w.width=w.height=parseInt(x,10);}else{w.width=x.width||0;
w.height=x.height||0;}w.x=w.width;w.y=w.height;return w;}function o(){if(c.length){var x=s();for(var w=0;w<c.length;w++){if(c[w].time<=x){e(c[w].sprite,c[w]);c[w].time=x+Math.abs(c[w].sprite.frameDelay());}}setTimeout(o,5);}}function e(H,F){var y=(H.frameDelay()<0)?"right":"left",G=H.getProperties(),x,A=H.elem;if(k(G)){x=q(H.elem);}for(var D=0;D<G.length;D++){var B=G[D],z=m(B),w=F.cur_frame[B]+(y=="left"?1:-1);if(w>=F.frame_count[z]){w=0;}else{if(w<0){w=F.frame_count[z]-1;}}F.cur_frame[B]=w;}for(var D=0;D<G.length;D++){var B=G[D];if(B!=j&&B!=h){A.style[B]=(-H.frameSize()[m(B)]*F.cur_frame[B])+"px";}}if(x){var E=(j in F.cur_frame)?-H.frameSize().x*F.cur_frame[j]:x[j];var C=(h in F.cur_frame)?-H.frameSize().y*F.cur_frame[h]:x[h];A.style.backgroundPosition=E+"px "+C+"px";}}function q(y){var x=f(y,"backgroundPosition"),w={backgroundPositionX:0,backgroundPositionY:0};if(x){x=x.split(" ",2);w[j]=parseInt(x[0],10);w[h]=parseInt(x[1],10);}return w;}function p(w){w.time=0;c.push(w);if(c.length==1){o();}}function a(x){for(var w=0;w<c.length;w++){if(c[w].id==x){c.splice(w,1);break;}}}function k(w){return d(w,j)||d(w,h);}function m(w){return d(l.y,w)?"y":"x";}function i(C,y,B){var w={},A;if(k(B)){A=q(C);}for(var z=0;z<B.length;z++){var x=B[z];var D=(x.indexOf("background")!=-1)?A[x]:(f(C,x)||0);D=(D=="auto")?0:parseInt(D,10);w[x]=Math.round(D/y[m(x)]);}return w;}function b(y,A,E,C){A=n(A);E=n(E);C=r(C);var D=false,z=g,w=++u;var x={start:function(){if(!D){p(B);D=true;}},stop:function(){if(D){a(w);D=false;}},isAnimating:function(){return D;},frameDelay:function(F){if(arguments.length){z=parseInt(F,10);}return z;},elem:y,getProperties:function(){return C;},frameSize:function(F){if(arguments.length){A=n(F);B.frame_count.x=(E.width/A.width);B.frame_count.y=(E.height/A.height);}return A;}};var B={frame_count:{x:0,y:0},cur_frame:i(y,A,C),sprite:x,time:0,id:w};x.frameSize(A);return x;}window.spriteAnimation=b;})();(function(){var a,e,d="swap-list",b=false;jTweener.addNSAction({onComplete:function(){a.find(".article-list-freezed").each(function(){e.append($(this).find("dt, dd"));}).remove();a.css("height","");b=false;}},d);function g(j,l){var i=j[0];var k={top:l,new_top:0,width:i.offsetWidth,height:i.offsetHeight,elem:i};j.css({top:k.top,position:"absolute",width:k.width});return k;}function f(){var i=[],j=0;e.find("dt").each(function(l,o){var m=$('<dl class="article-list article-list-freezed"></dl>');m.append($(this).clone());m.append($(this).next("dd").clone());a.append(m);var k=g(m,j);j+=k.height;i.push(k);});a.css("height",j);e.empty();return i;}function h(l){var j=[],n=[];for(var m=0;m<l.length;m++){n.push(m);}while(n.length){var k=Math.floor(n.length*Math.random());j.push(n[k]);n.splice(k,1);}return j;}function c(j,i){var k=new Array(j.length),l=0;$.each(i,function(m,p){var o=j[p];o.new_top=l;l+=o.height;e.append(o.elem);});$.each(j,function(m,o){$t(o.elem).tween({top:o.new_top,delay:Math.random()*0.1,time:0.8,transition:"easeinoutcubic",namespace:d});});}effectsManager.registerEffect({id:"swap-services",title:"Порядок не важен!",is_common:false,init:function(){a=$("#content");e=a.find(".article-list");},toggle:function(){if(!b){var i=f();c(i,h(i));b=true;}}});})();(function(){var b=[],a=-1;function c(){a=(a+1)%b.length;}effectsManager.initTranslate=function(e,d){b.push({title:e,url:d});};effectsManager.registerEffect({id:"translate",title:function(){return b[a].title;},init:function(){c();$("#content").addClass("refreshable-content").wrap('<div id="content-wrap" class="refreshable refreshable-large"></div>');initRefreshable();},toggle:function(){$("#content").attr("refresh-url",b[a].url);$("#content-wrap").trigger("refresh");c();}});})();