(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"y",duration:1};a.window=function(d){return c(window).scrollable()};c.fn.scrollable=function(){return this.map(function(){var g=this.parentWindow||this.defaultView,e=this.nodeName=="#document"?g.frameElement||g:this,f=e.contentDocument||(e.contentWindow||e).document,d=e.setInterval;return e.nodeName=="IFRAME"||d&&c.browser.safari?f.body:d?f.documentElement:this})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this.scrollable().each(function(){var m=this,k=c(m),l=f,j,h={},n=k.is("html,body");switch(typeof l){case"number":case"string":if(/^([+-]=)?\d+(px)?$/.test(l)){l=b(l);break}l=c(l,this);case"object":if(l.is||l.style){j=(l=c(l)).offset()}}c.each(d.axis.split(""),function(r,s){var t=s=="x"?"Left":"Top",v=t.toLowerCase(),q="scroll"+t,o=m[q],p=s=="x"?"Width":"Height",u=p.toLowerCase();if(j){h[q]=j[v]+(n?0:o-k.offset()[v]);if(d.margin){h[q]-=parseInt(l.css("margin"+t))||0;h[q]-=parseInt(l.css("border"+t+"Width"))||0}h[q]+=d.offset[v]||0;if(d.over[v]){h[q]+=l[u]()*d.over[v]}}else{h[q]=l[v]}if(/^\d+$/.test(h[q])){h[q]=h[q]<=0?0:Math.min(h[q],g(p))}if(!r&&d.queue){if(o!=h[q]){i(d.onAfterFirst)}delete h[q]}});i(d.onAfter);function i(o){k.animate(h,e,d.easing,o&&function(){o.call(this,f,d)})}function g(p){var o="scroll"+p,q=m.ownerDocument;return n?Math.max(q.documentElement[o],q.body[o]):m[o]}}).end()};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);jQuery.fn.topLink=function(a){a=jQuery.extend({min:1,fadeSpeed:200,ieOffset:50},a);return this.each(function(){var b=$(this);b.css("display","none");$(window).scroll(function(){if(!jQuery.support.hrefNormalized){b.css({position:"absolute",top:$(window).scrollTop()+$(window).height()-a.ieOffset})}if($(window).scrollTop()>=a.min){b.fadeIn(a.fadeSpeed)}else{b.fadeOut(a.fadeSpeed)}})})};$(document).ready(function(){$("#top-link").topLink({min:200,fadeSpeed:400}).click(function(a){a.preventDefault();$.scrollTo(0,300)})});