(function(a){a.timothysaccenti=a.extend(function(b){return a.timothysaccenti.init.call(this,b)},{init:function(b){var c=this;a.timothysaccenti.fonts();a.timothysaccenti[!IS_IPHONE?"searchForm":"searchFormIphone"]();if(IS_IPHONE){a(window).load(function(){setTimeout(function(){window.scrollTo(0,1)},200)})}if(IS_HOME){a.timothysaccenti.intro()}if(IS_HOME||IS_SINGLE||IS_ERROR){return a.fadeGroup(".cat-item, .page_item","*")}else{a("#header .cat-item:not(.current-cat), #header .page_item:not(.current_page_item)").addClass("inactive");a(".inactive").live("mouseenter",function(d){a(this).stop(true).animate({opacity:1})}).live("mouseleave",function(d){a(this).stop(true).animate({opacity:0.5})})}a.each(a.timothysaccenti.modules,function(e){var d=this.call(c,b)});a.timothysaccenti.rebootFromHash();a.timothysaccenti.catchBackButton()},modules:{},shareLinks:'<a class="send-a capsule" target="_blank" title="Email" href="mailto:?subject=Timothy Saccenti- %TITLE%&body=%LINK%">Email</a><a class="send-a capsule" target="_blank" title="Twitter"  href="http://twitter.com/home?status=Timothy+Saccenti-+%TITLE%+%LINK%">Twitter</a><a class="send-b capsule" title="Facebook" target="_blank" href="http://www.facebook.com/sharer.php?u=%LINK%&t=Timothy+Saccenti-+%TITLE%">Facebook</a><a class="send-c capsule" title="Tumblr" target="_blank" href="http://tumblr.com/share?v=3&u=%LINK%&t=Timothy+Saccenti-+%TITLE%&s=">Tumblr</a><a class="send-d capsule" title="Delicious" target="_blank" href="http://delicious.com/save?url=%LINK%&title=Timothy+Saccenti-+%TITLE%">Delicious</a><div class="clear"></div>',fonts:function(b){Cufon.replace(b||".capsule, .page_item, .cat-item, #subnav span, h1, figcaption, .blog-meta span, button#submit",{fontFamily:"MonoFat",hover:true})},searchForm:function(){var f=a("li.search"),b,h=a("#search-text"),g="",e=a("#search-form b"),c=e.text(),d=function(){a.timothysaccenti.fonts("#search-form>b")},i=function(j){if(j&&j.keyCode){if(j.keyCode==8){log("del");e.html(a("cufontext",e).text().slice(1,-1)+"_")}else{if(j.keyCode==13){h.val(a("cufontext",e).text().slice(0,-1).toLowerCase());if(h.val()==""){j.preventDefault()}else{clearInterval(b);return}}}h.val("");d()}if(g==h.val()){return}else{e.html((h.val().length>1?"":a("cufontext",e).text().slice(0,-1))+h.val().toUpperCase()+"_");h.val("");d();g=""}};if(h.val()){e.html(h.val()+"_")}f.css({minWidth:f.width()-10});h.val("").focus(function(){h.val("");f.toggleClass("active");if(a("cufontext",e).text()==c){e.html("_");d()}b=setInterval(i,50)}).blur(function(j){clearInterval(b);f.toggleClass("active");if(a("cufontext",e).text()=="_"){e.html(c);d()}}).keydown(i)},searchFormIphone:function(){var d=a("li.search"),e=a("#search-text"),c=a("#search-form b"),b=c.text();c.click(function(f){e.show().focus();c.hide()});e.val(b).focus(function(){d.toggleClass("active");e.val("").width(150)}).blur(function(f){d.toggleClass("active");e.width(70).hide();c.show()})},intro:function(){if(a("#demo").length){var h=0,d=0,b=false,f=a("#demo img"),e=function(c){a(this).height(a(window).height()).css("opacity",0.2);if(++d==f.length){g()}},g=function(){a("#header").css({position:"relative",zIndex:2});a("#demo").css({width:"100%",position:"absolute",zIndex:1,top:0});setInterval(function(){f.eq(h).hide();h++;if(h>f.length-1){h=0}if(!b){f.eq(h).show()}},75)};f.each(function(c){var i=a(this).hide();if(!i.height()){i.load(e)}else{e.call(this)}});a("#header").mouseenter(function(){b=true}).mouseleave(function(){b=false})}else{if(a("#homepage").length){a("body"+a.browser.msie?", html":"").css({overflow:"hidden"});a(window).resize(function(n){var l=a("#homepage img"),o=a(window),i={w:o.width(),h:o.height()},k={w:l.width(),h:l.height()},j=k.w/k.h,c=i.w/i.h,m=(j<c)?{w:i.w,h:k.h*(i.w/k.w)}:{w:k.w*(i.h/k.h),h:i.h};l.attr("width",m.w).attr("height",m.h).css({top:Math.round((i.h-m.h)/2),left:Math.round((i.w-m.w)/2)}).addClass("bleed").remove().appendTo("#homepage").hide().fadeTo(1000,1);Cufon.replace("#homepage",{fontFamily:"MonoFat",hover:true})}).resize()}}}},net.theantenna.utils.hashManager)})(jQuery);$.extend($.timothysaccenti.modules,{subnav:$.extend(function(a){return $.timothysaccenti.modules.subnav.init.call($("#subnav"),a)},{init:function(b){var c=this;if(IS_PAGE){return $.timothysaccenti.modules.viewer.view.info.call(this)}var a=$.cookie("timothysaccenti.listMode")==1?"list":"thumbreel";$.timothysaccenti.modules.subnav.view[a].init.call(this);$("#listmodeon").click(function(d){d.preventDefault();if($("#subnav").hasClass("list")){return}$.timothysaccenti.modules.subnav.view.list.init.call(c);$.cookie("timothysaccenti.listMode",1,{path:"/"})});$("#listmodeoff").click(function(d){d.preventDefault();if($("#subnav").hasClass("thumbreel")){return}$.timothysaccenti.modules.subnav.view.thumbreel.init.call(c);$.cookie("timothysaccenti.listMode",0,{path:"/"})});$("#sortTitle").click(function(h){h.preventDefault();var d=function(f,e){return $(f).attr("name")>$(e).attr("name")?1:-1},g=$("#subnav-wrapper a").removeClass("b").sort(d);g.filter(":even").addClass("b");g.appendTo($("#subnav-wrapper"));$.timothysaccenti.modules.subnav.view.list.addContent.call(c,g)});$("#sortYear").click(function(h){h.preventDefault();var d=function(f,e){return $(f).attr("rev")<$(e).attr("rev")?1:-1},g=$("#subnav-wrapper a").removeClass("b").sort(d);g.filter(":even").addClass("b");g.appendTo($("#subnav-wrapper"));$.timothysaccenti.modules.subnav.view.list.addContent.call(c,g)});$("#subnav-wrapper a").live("click",function(d){if(IS_IPHONE){window.scrollTo(0,1)}var f=$(this);net.theantenna.utils.hashManager.updateHash(f.attr("href"));$("#subnav-wrapper a.active").removeClass("active");f.blur().addClass("active");$.timothysaccenti.modules.viewer.launch.call(this,d);if(c.hasClass("thumbreel")){$("#subnav-wrapper").slidescroll("option","speed",0)}}).live("mouseenter",function(d){if(IS_IPHONE||$("#subnav").hasClass("list")){return}var f=$(this);$("#subnav-title").html(f.attr("name")).show();$.timothysaccenti.fonts("#subnav-title");f.stop(true).animate({opacity:1});$("#subnav-wrapper a").not(this).stop(true).animate({opacity:0.7})}).live("mouseleave",function(d){if(IS_IPHONE||$("#subnav").hasClass("list")){return}$("#subnav-title").hide();$("#subnav-wrapper a:not(.active)").stop(true).animate({opacity:$("#viewer").hasClass("launched")?0.2:1});$("#subnav-wrapper a.active").stop(true).animate({opacity:1})});$("#subnav-title").hide();$.timothysaccenti.modules.subnav.load.call(this,$("#more a").attr("href"));return this.data("timothysaccenti.subnav",{view:a})},load:function(a){if(!a){return}var b=this;$.ajax({dataType:"HTML",type:"GET",data:a.indexOf("inline=true")<0?{inline:true}:{},url:a,success:function(g){var f=$("<div>").html(g),e=$("#subnav-wrapper a",f),d=$("#more a",f).attr("href");e.appendTo("#subnav-wrapper");var c=b.hasClass("list")?"list":"thumbreel";$.timothysaccenti.modules.subnav.view[c].addContent.call(b,e);$.timothysaccenti.fonts("#subnav .capsule");e.filter("a[href="+location.hash.toString()+"]").click().mouseleave();$.timothysaccenti.modules.subnav.load.call(b,d)}})},view:{thumbreel:{init:function(){this.addClass("thumbreel").removeClass("list");$("#listmodeon").addClass("inactive").mouseleave();$("#listmodeoff").removeClass("inactive");$("#info-marker").insertBefore("#subnav");$("#subnav img").show();$.timothysaccenti.modules.subnav.view.thumbreel.addContent.call(this,$("#subnav a"));$("#sortNav").hide();if(IS_IPHONE){$("#subnav-left, #subnav-right").addClass("deactivated").click(function(a){a.preventDefault()});return}$("#subnav-wrapper").slidescroll("destroy").slidescroll({selector:"a",direction:1}).slidescroll("start");$("#subnav-left, #subnav-right")[!$("#subnav-wrapper").slidescroll("hasContent")?"addClass":"removeClass"]("deactivated");this.mouseenter(function(a){if(!$("#subnav-wrapper").slidescroll("isStarted")){$("#subnav-wrapper").slidescroll("start")}}).mouseleave(function(a){$("#subnav-wrapper").slidescroll("option","speed",$("#viewer").hasClass("launched video")?0:1).slidescroll("option","direction",1)});$("#subnav-right").click(function(a){a.preventDefault()}).mouseover(function(a){$("#subnav-wrapper a").stop(true).animate({opacity:1});$("#subnav-wrapper").slidescroll("option","speed",0)}).mouseleave(function(a){$("#subnav-wrapper a.active").mouseleave();if(!$("#viewer").hasClass("launched video")){$("#subnav-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",-1)}}).mousedown(function(a){$("#subnav-wrapper").slidescroll("option","direction",1).slidescroll("option","speed",10).slidescroll("start")}).mouseup(function(a){$("#subnav-wrapper").slidescroll("option","speed",0)});$("#subnav-left").click(function(a){a.preventDefault()}).mouseover(function(a){$("#subnav-wrapper a").stop(true).animate({opacity:1});$("#subnav-wrapper").slidescroll("option","speed",0)}).mouseleave(function(a){$("#subnav-wrapper a.active").mouseleave();if(!$("#viewer").hasClass("launched video")){$("#subnav-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",1)}}).mousedown(function(a){$("#subnav-wrapper").slidescroll("option","speed",10).slidescroll("option","direction",-1).slidescroll("start")}).mouseup(function(a){$("#subnav-wrapper").slidescroll("option","speed",0)});if($("#viewer").hasClass("launched")){$("#subnav-wrapper a.active").mouseleave()}this.stop().height(0).animate({height:125},{duration:1000})},addContent:function(c){var a=this.width(),b=$("#viewer").hasClass("launched")?0.2:1;c.each(function(e){var f=$(this).removeClass("capsule").removeClass("b").css("display","inline-block").fadeTo("slow",b),d=$("img",f);f.css({width:d.width(),height:d.height()});$("span",f).show();$("b",f).hide();if(d.offset().left>a||b==0.2){return true}d.animate({opacity:0},{duration:0}).delay(e*200).animate({opacity:b},{duration:"slow"})});this.stop().animate({height:125})}},list:{init:function(){$("#listmodeon").removeClass("inactive");$("#listmodeoff").addClass("inactive").mouseleave();$("#info-marker").insertBefore("#viewer");$("#subnav-wrapper").slidescroll("destroy").css({left:0});$("#subnav").removeClass("thumbreel").addClass("list").add("#subnav-right,#subnav-left").unbind();$.timothysaccenti.modules.subnav.view.list.addContent.call(this,$("#subnav a"));$.timothysaccenti.fonts("#subnav .capsule");$("#sortNav").show();$("#subnav-title").hide();$("#subnav-left, #subnav-right").addClass("deactivated").click(function(a){a.preventDefault()})},addContent:function(a){var c=this.height();a.each(function(d){var e=$(this).stop(true,true).addClass("capsule").css({width:"auto",height:"auto",opacity:1});$("img,span",e).hide();$("b",e).show()});a.filter(":even").addClass("b");var b=this.css("height","auto").height();a.each(function(d){var e=$(this);e.hide().delay(d*25).fadeIn("def")})}}}})});$.extend($.timothysaccenti.modules,{viewer:$.extend(function(a){return $.timothysaccenti.modules.viewer.init.call(this,a)},{init:function(a){$("#info").live("click",function(b){b.preventDefault();if($(this).hasClass("deactivated")){return}if(IS_IPHONE){window.scrollTo(0,1)}$("#info-overlay .bg").height($("#info-overlay").height());$("#info-overlay").fadeIn().find("h1").css("top",$("#info-marker").offset().top)});$("#overlay-close, #info-overlay .bg").live("click",function(b){b.preventDefault();$("html,body").stop(true).animate({scrollTop:0});$("#info-overlay").fadeOut()});swfobject.embedSWF(TEMPLATE_DIR+"/swf/timothysaccenti.viewer.swf","fsviewer","100%","100%","9.0.45",TEMPLATE_DIR+"/swf/expressInstall.swf",null,{bgcolor:"000000",allowFullScreen:"true",allowScriptAccess:"sameDomain",wmode:"transparent"});$(net.theantenna.fsviewer.id).bind("mouseenter.fsviewer",function(b){$(".fullscreen").addClass("hover")}).bind("mouseleave.fsviewer",function(b){$(".fullscreen").removeClass("hover")});return this.data("viewer",{})},launch:function(){var b=$(this),a=!b.attr("data-vid")?"stills":"video";$("#loader").appendTo($("#viewer").removeClass().addClass("launched "+a)).fadeIn();$.ajax({type:"GET",data:{inline:true},url:b.attr("rel"),success:function(e){var g=$("h2 a",e).text(),c=$("#viewer-wrapper");$("#viewer-nav").show();$("#loader").hide();$("#viewer-title").html(g);$.timothysaccenti.fonts("#viewer-nav h2");$.timothysaccenti.modules.viewer.view[a].call(b,e);$("#share-options").html($.timothysaccenti.shareLinks.replace(/%TITLE%/g,escape(g)).replace(/%LINK%/g,escape(window.location.href)));$.timothysaccenti.fonts("#share-options .capsule");var f=$.trim($("#info",e).html()),d=$("<div>").html(f).children("br, .post-edit-link").remove().end().contents().length;if(d){$("#info-overlay h1").html(f).find("a").attr("target","_blank").end().append('<a id="overlay-close" href="#">(Close)</a>');$.timothysaccenti.fonts("#info-overlay h1");$("#info").removeClass("deactivated")}else{$("#info").addClass("deactivated")}}})},view:{info:function(){if(IS_IPHONE){$("#subnav-right, #subnav-left").addClass("deactivated").click(function(a){a.preventDefault()});return}$("#subnav-wrapper").slidescroll({selector:"span",direction:1}).slidescroll("start");if(!$("#subnav-wrapper").slidescroll("hasContent")){$("#subnav-left, #subnav-right").addClass("deactivated")}$("#subnav").mouseleave(function(a){$("#subnav-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",1)});$("#subnav-right").click(function(a){a.preventDefault()}).mouseover(function(a){$("#subnav-wrapper").slidescroll("option","speed",0)}).mouseleave(function(a){$("#subnav-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",1)}).mousedown(function(a){$("#subnav-wrapper").slidescroll("option","direction",1).slidescroll("option","speed",10)}).mouseup(function(a){$("#subnav-wrapper").slidescroll("option","speed",0)});$("#subnav-left").click(function(a){a.preventDefault()}).mouseover(function(a){$("#subnav-wrapper").slidescroll("option","speed",0)}).mouseleave(function(a){$("#subnav-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",1)}).mousedown(function(a){$("#subnav-wrapper").slidescroll("option","speed",10).slidescroll("option","direction",-1)}).mouseup(function(a){$("#subnav-wrapper").slidescroll("start")})},stills:function(f){var h=$("img",f),a=$("#viewer-wrapper");if(!IS_IPHONE&&h.length){while(h.length<5){h=h.add(h.clone())}}a.html(h);var b=[],c=[],i=a.width(),e=$("img",a);e.each(function(j){var l=$(this),k=l.attr("data-big");if(!c[k]){c[k]=1;b.push(k)}if(l.offset().left>=i){return true}if(l.height()){l.animate({opacity:0},{duration:0}).delay(j*200).animate({opacity:1},{duration:"slow"})}});$("#fakevidcontrols, #viewer>a, #viewer-left, #viewer-right, #viewer-title").show();a.slidescroll("destroy");$("#viewer, #viewer-right, #viewer-left").unbind();if(IS_IPHONE){$(".fullscreen").hide();$("#viewer-right, #viewer-left").addClass("deactivated").click(function(j){j.preventDefault()});return}var d=$(".fullscreen");if(h.length){$(".fullscreen").show();$("#fsviewer-wrapper").css({width:d.outerWidth(true)});var g=net.theantenna.fsviewer;if(g.flash instanceof jQuery){$(g.id).one("ready.fsviewer",function(){g.flash.setFiles(b)})}else{g.flash.setFiles(b)}$("#viewer-left,#viewer-right").removeClass("deactivated");a.slidescroll({direction:-1,maxSpeed:20,hotspotW:350}).slidescroll("start")}else{d.hide();$("#info").click();$("#viewer-left, #viewer-right").addClass("deactivated")}$("#viewer").mouseleave(function(j){$("#viewer-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",-1)});$("#viewer-right").click(function(j){j.preventDefault()}).mouseover(function(j){$("#viewer-wrapper").slidescroll("option","speed",0)}).mouseleave(function(j){$("#viewer-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",-1)}).mousedown(function(j){$("#viewer-wrapper").slidescroll("option","speed",25).slidescroll("option","direction",1)}).mouseup(function(j){$("#viewer-wrapper").slidescroll("option","speed",0)});$("#viewer-left").click(function(j){j.preventDefault()}).mouseover(function(j){$("#viewer-wrapper").slidescroll("option","speed",0)}).mouseleave(function(j){$("#viewer-wrapper").slidescroll("option","speed",1).slidescroll("option","direction",-1)}).mousedown(function(j){$("#viewer-wrapper").slidescroll("option","speed",25).slidescroll("option","direction",-1)}).mouseup(function(j){$("#viewer-wrapper").slidescroll("option","speed",0)})},video:function(b){var c=$.trim(this.attr("data-vid")),a=$("#viewer-wrapper");if(IS_IPHONE){a.html('<div id="player"><h1><a href="http://bitcast-a.bitgravity.com/projectgamerz/timothysaccenti/iphone/'+c+'"style="display:block;width:255px;height:144px;"id="ipad"><br/>Click to<br/> Launch video</a></h1></div>'),$f("ipad",TEMPLATE_DIR+"/swf/flowplayer.commercial-3.2.5.swf").ipad();}else{a.html('<div id="player"><h1><a href="http://bitcast-a.bitgravity.com/projectgamerz/timothysaccenti/'+c+'"style="display:block;width:640px;height:360px;"id="ipad"><br/>Click to<br/> Launch video</a></h1></div>'),$f("ipad",TEMPLATE_DIR+"/swf/flowplayer.commercial-3.2.5.swf").ipad();}if(!IS_IPHONE){swfobject.embedSWF(TEMPLATE_DIR+"/swf/timothysaccenti.player.swf","player","100%","540","10.0.0",TEMPLATE_DIR+"/swf/expressInstall.swf",{src:"http://bitcast-a.bitgravity.com/projectgamerz/timothysaccenti/"+c+"",isIE:$.browser.msie},{menu:"false",bgcolor:"#000000",allowScriptAccess:"sameDomain",allowFullScreen:"true"},{id:"player",name:"player"});swfobject.createCSS("#player","outline:none")}else{$.timothysaccenti.fonts("#player h1");$("#player h1").hide(0).delay(100).fadeIn()}$("#fakevidcontrols, #viewer>a, #viewer-left, #viewer-right, .fullscreen").hide();a.slidescroll("destroy");$("#viewer, #viewer-right, #viewer-left").unbind();if($("html").hasClass("win")){$("#info-marker").insertBefore("#viewer-nav")}}}})});
