(function(a){a.extend({cssFixedSupport:"",__scrollBody:"",__control:false,__setting:{startLine:100,scrollTo:0,scrollDuration:500,fadeDuration:[500,100]},__controlHtml:'',__controlAttrs:{offsetX:0,offsetY:49},__anchorKeyWord:"#top",__state:{isVisible:false,shouldVisible:false},__scrollUp:function(){if(!a.cssFixedSupport){a.__control.css({display:"none"})}var b=isNaN(a.__setting.scrollTo)?a.__setting.scrollTo:parseInt(a.__setting.scrollTo);if(typeof(b)=="string"&&a("#"+b).length==1){b=a("#"+b).offset().top}else{b=a.__setting.scrollTo}a.__scrollBody.animate({scrollTop:b},a.__setting.scrollDuration)},keepFixed:function(){var d=a(window),c=d.scrollLeft()+d.width()-a.__control.width()-a.__controlAttrs.offsetX-1412,b=d.scrollTop()+d.height()-a.__control.height()-a.__controlAttrs.offsetY-(window.location.href.indexOf("profile")==-1?225:110);a.__control.css({top:b+"px"})},toggleControl:function(){var b=a(window).scrollTop();if(!a.cssFixedSupport){a.keepFixed()}a.__state.shouldVisible=(b>=a.__setting.startLine)?true:false;if(a.__state.shouldVisible&&!a.__state.isVisible){a.__control.css({display:"block"});a.__state.isVisible=true}else{if(a.__state.shouldVisible==false&&a.__state.isVisible){a.__control.css({display:"none"});a.__state.isVisible=false}}},scrollToTop:function(){a(function(){var b=document.all;a.cssFixedSupport=!b||b&&document.compatMode=="CSS1Compat"&&window.XMLHttpRequest;a.__scrollBody=(window.opera)?(document.compatMode=="CSS1Compat"?a("html"):a("body")):a("html,body");a.__control=a("#scrolltop").html(a.__controlHtml).css({position:a.cssFixedSupport?"fixed":"absolute",bottom:a.__controlAttrs.offsetY,display:"none"}).click(function(){bindRight.freshHide(function(){a.__scrollUp()});return false});if(b&&!window.XMLHttpRequest&&a.__control.text()!=""){a.__control.css({width:a.__control.width()})}a.toggleControl();a('a[href="'+a.__anchorKeyWord+'"]').click(function(){bindRight.freshHide(function(){a.__scrollUp()});return false});a(window).bind("scroll resize",function(){a.toggleControl()})})}})})(jQuery);