(function(f){f(function(){var w=new Date();w.setFullYear(w.getFullYear()+1);f.cookies.setOptions({expiresAt:w});if(!(f.browser.msie&&parseInt(f.browser.version)<7)){b();u();v();g();p();h();o();s();q();m(d)}i()});var e=100,l=0,n=50,c=5,d="raptorNL",b=function(){f("#menu").addClass("js").find(".parent").hoverIntent({over:function(){f(this).find("ul").slideDown(e)},out:function(){f(this).find("ul").slideUp(e)},timeout:l,sensitivity:c,interval:n})},u=function(){var w=f("#s");if(w.val()==""){w.addClass("inactive").val("Search...")}w.focus(function(){var x=f(this);if(x.hasClass("inactive")){x.val("").removeClass("inactive")}}).blur(function(){var x=f(this);if(f.trim(x.val())==""){x.addClass("inactive").val("Search...")}});f("#searchform").submit(function(x){if(w.val()==""||w.hasClass("inactive")){x.preventDefault()}})},v=function(){f("textarea").autoResize({animate:true,animateDuration:e}).trigger("change")},g=function(){f("#sidebar .widget h2").attr("title","Click to collapse").addClass("expanded").click(function(){var w=f(this);if(w.hasClass("expanded")){a(w,true)}else{if(w.hasClass("collapsed")){j(w,true)}}}).each(function(){var w=f(this);if(f.cookies.get("widget-"+w.parent().attr("id"))=="collapsed"){a(w)}})},j=function(x,w){x.removeClass("collapsed").addClass("expanded").attr("title","Click to collapse").parent().children("ul, div").slideDown(w?e:0);f.cookies.set("widget-"+x.parent().attr("id"),"expanded")},a=function(x,w){x.parent().children("ul, div").slideUp(w?e:0,function(){x.attr("title","Click to expand").removeClass("expanded").addClass("collapsed")});f.cookies.set("widget-"+x.parent().attr("id"),"collapsed")},p=function(){f("#preferences, #admin-links").each(function(){var w=f(this).find("ul");w.data("origMargin",w.css("margin-right"))}).show().hoverIntent({over:function(){var w=f(this).find("ul");w.animate({marginRight:"0"},e)},out:function(){var w=f(this).find("ul");w.animate({marginRight:w.data("origMargin")},e)},timeout:l,sensitivity:c,interval:n})},i=function(){f("#content a:not(:has(img))").each(function(){var w=this.rel,x=this.href,y=window.location.protocol+"//"+window.location.hostname;if(w.indexOf("external")<0&&x.indexOf(y)!=0){this.rel=w==""?"external":w+" external"}else{if(w=="footnote"&&x.indexOf(y)==0&&x.indexOf("#")>0){f(this).click(function(){refId=this.href.substr(x.indexOf("#"));f(".ref").removeClass("selected");f(refId).addClass("selected")})}}});f(".emailaddress").each(function(){var w=f(this);w.removeClass("emailaddress").find(".hidden").remove();var x=w.text();w.replaceWith('<a href="mailto:'+x+'" rel="e-mail">'+x+"</a>").attr({title:""})});f(".imaddress").each(function(){f(this).attr("title",null).find(".hidden").remove()})},h=function(){f("#colorPicker a").click(function(w){t(f(this).attr("rel"));w.preventDefault()})},t=function(w){f("body").removeClass("color-blue color-green color-purple color-red");switch(w){default:case"orange":f.cookies.set("theme-color","orange");break;case"red":case"blue":case"green":case"purple":f("body").addClass("color-"+w);f.cookies.set("theme-color",w);break}},o=function(){f("#fontSizePicker a").click(function(w){r(f(this).attr("rel"));w.preventDefault()})},r=function(w){f("body").removeClass("fontSize-s fontSize-m fontSize-l fontSize-xl");switch(w){default:f("body").addClass("fontSize-m");f.cookies.set("theme-fontSize","m");break;case"s":case"m":case"l":case"xl":f("body").addClass("fontSize-"+w);f.cookies.set("theme-fontSize",w);break}},s=function(){var w=f.cookies.get("theme-animations");f("#animPicker a").click(function(x){k(f(this).attr("rel"));x.preventDefault()});k(w)},k=function(w){if(w=="off"){f.fx.off=true}else{f.fx.off=false;w="on"}f.cookies.set("theme-animations",w)},q=function(){f("#share").addClass("js").hover(function(){f(this).find("ul").fadeIn(e)},function(){f(this).find("ul").fadeOut(e)})},m=function(w){f("#header").append('<div class="twitter"><div class="tweep"><a href="http://twitter.com/'+w+'" title="Follow me!">@'+w+'</a></div><div class="tweet loading">Fetching tweet...</div></div>').find(".twitter").twitter(w)}})(jQuery);