(function(){$(function(){$("#contact-form").submit(function(){$form=$(this);$('<div id="cfo"/>').css({position:"absolute",top:$form.offset().top+"px",left:$form.offset().left+"px",width:$form.width()+"px",height:$form.height()+"px",background:"#FFF url(/wp-content/themes/james.padolsey/images/loading.gif) no-repeat center",opacity:0}).appendTo("body").animate({opacity:0.7});$.ajax({type:"POST",url:$form.attr("action")+"?ajax=ajax",data:$form.serialize(),success:function(a){if(a.indexOf("success")>
-1){$('<div id="cfo-message"/>').html(a).appendTo("body").css({top:$form.offset().top+$form.height()/2-$("#cfo-message").height()/2-10+"px",left:$form.offset().left+$form.width()/2-$("#cfo-message").width()/2-10+"px"}).fadeIn();$("#cfo").css({background:"#FFF"});$("li:eq(0) ul",$form).remove();$(":text,textarea",$form).val("SENT")}else{$("#cfo").animate({opacity:0},function(){$(this).remove()});$("li:eq(0) ul",$form).remove();$("li:eq(0)",$form).append(a)}}});return false})})})();
(function(){$.fn.clearOnFocus=function(){return this.focus(function(){this.value=this.value===this.defaultValue?"":this.value}).blur(function(){this.value=this.value===""||/^\s+$/.test(this.value)?this.defaultValue:this.value})};$(function(){$("#rss-email,#s").clearOnFocus().each(function(){var a=$(this);a.parents("form:eq(0)").submit(function(){return a[0].value!==a[0].defaultValue})})})})();
$(function(){$('<div class="color-tip"/>').css({position:"absolute",zIndex:999,border:"1px solid white",width:"30px",height:"30px",display:"none"}).appendTo("body");$("span.color-value").css({cursor:"pointer",textDecoration:"underline"}).hover(function(){$(".color-tip").css({background:$(this).text(),display:"block"})},function(){$(".color-tip").css({display:"none"})}).mousemove(function(a){$(".color-tip").css({top:a.pageY+5+"px",left:a.pageX+5+"px"})})});
$(function(){$("#content p a, #banner p a, .post-content ul a").filter(function(){return!$(this).parents(".social").length&&this.hostname&&this.hostname!==location.hostname}).css({backgroundImage:"url(/wp-content/themes/james.padolsey/images/external.png)",backgroundPosition:"right center",backgroundRepeat:"no-repeat",padding:"0 15px 0 0"})});
$(function(){$(".bar")[0]&&!$(".commentlist")[0]&&$("#main .post-content").each(function(){var a=$(this).find(".bar > a:eq(0)").attr("href");$("p:last:not(.postmetadata)",this).append('&nbsp;(<a href="'+a+'">Continue Reading...</a>)')})});
$(function(){$("#comment, #message").each(function(){var b=false,c=$(this),d;$('<div class="handle"/>').css({cursor:"s-resize",width:$(this).outerWidth()}).mousedown(function(f){b=true;d=f.pageY-$(this).offset().top;c.addClass("resizing");$("body").css("cursor","s-resize");return false}).insertAfter(this);$(document).mousemove(function(f){if(b){f=f.pageY-c.offset().top-(c.outerHeight()-c.height())-d;f>100&&c.height(f)}}).mouseup(function(){b=false;$("body").css("cursor","");c.removeClass("resizing")})});
var a=$("#allowed-tags h4"),e=a.siblings("p").hide();a.css({cursor:"pointer"}).append("&nbsp;&raquo;").click(function(){e.toggle()})});
var JSHTML={config:{flag:"",delimiters:["{{","}}"],fragmentCallback:function(){}},parse:function(){for(var a=this.config,e=RegExp("\\s*?"+a.flag+"\\s*?"+a.delimiters[0]+"(.+)"+a.delimiters[1]+""),b=(arguments[0]||document.documentElement).childNodes,c=b.length,d,f,h=function(g){var j=document.createElement("div"),i=document.createDocumentFragment();for(j.innerHTML=g.replace(/^\s+|\s+$/g,"");g=j.firstChild;)i.appendChild(g);try{a.fragmentCallback.call(i)}catch(k){setTimeout(function(){throw Error(k);
},0)}return i};c--;){d=b[c];if(d.nodeType!==8)arguments.callee.call(this,d);else if(f=e.exec(d.data.replace(/[\n\r]/g,""))){fragment=h(f[1]);d.parentNode.replaceChild(fragment,d)}}}};JSHTML.parse();
function onKonamiCode(a){var e=function(){var d=[38,38,40,40,37,39,37,39,66,65];onKonamiCode.requireEnterKey&&d.push(13);return d}(),b=function(){b.codes=b.codes||Array.apply({},e);b.reset=function(){b.codes=null};return b.codes},c=function(d){if(b()[0]==(d||window.event).keyCode){b().shift();if(!b().length){b.reset();a()}}else b.reset()};window.addEventListener?window.addEventListener("keydown",c,false):document.attachEvent("onkeydown",c)}
onKonamiCode(function(){var a=$("<iframe/>").bind("load",function(){var b=this;window.scroll(0,0);setTimeout(function(){$(b).animate({top:0,opacity:1},1400,function(){e.show()});$("body,html").css("overflow","hidden")},500)}).attr({src:"http://www.youtube.com/watch?v=Q5im­0Ssyyus",frameborder:0,id:"kiframe"}).css({top:-$(window).height(),height:$(window).height(),opacity:0}).appendTo("body"),e=$("<div>Aahhh! Get me out of here!</div>");e.attr("id","koutofhere").click(function(){$("body,html").css("overflow",
"auto");a.animate({top:-$(window).height()},1E3,function(){$(this).remove()});$(this).remove()}).appendTo("body")});
(function(a){a.fn.superLink=function(e){e=e||"a:first";return this.each(function(){var b=a(this),c=a(e,b).clone(true),d=a(this).data("events")&&a(this).data("events").mouseout;if(d){a.each(d,function(f,h){c.mouseout(function(g){h.call(b,g)})});delete a(this).data("events").mouseout}if(d=a(this).data("events")&&a(this).data("events").mouseover){a.each(d,function(f,h){c.mouseover(function(g){h.call(b,g)})});delete a(this).data("events").mouseover}b.mouseover(function(){c.show()});c.click(function(){c.blur()}).mouseout(function(){c.hide()}).css({position:"absolute",
top:b.offset().top,left:b.offset().left,backgroundColor:"#FFF",display:"none",opacity:0,width:b.outerWidth(),height:b.outerHeight(),padding:0}).appendTo("body")})}})(jQuery);$(function(){$("p.video").each(function(){$("a",this).length===1&&$(this).superLink()})});(function(){var a=document.body,e=document.documentElement;$(window).unbind("scroll").scroll(function(){a.style.backgroundPosition="0px "+-(Math.max(e.scrollTop,a.scrollTop)/8)+"px"})})();
