var Zigzag={url:"",thumbItems:[],init:function(){$("#nav").lavaLamp({fx:"easeOutBounce",speed:700});$("#posts").serialScroll({items:".entry-post",prev:"#prev",next:"#next",offset:0,start:0,duration:-1100,force:true,stop:true,lock:false,cycle:false,easing:"easeOutQuint",axis:"y",onBefore:Zigzag.beforePostsScroll});$("#thumbs-items").serialScroll({items:"li",prev:"#thumbs-slide-scrollleft",next:"#thumbs-slide-scrollright",offset:-222,start:0,duration:-2000,force:true,stop:true,lock:false,step:5,cycle:false,easing:"easeOutExpo",onBefore:Zigzag.beforeSlideScroll,onAfter:Zigzag.afterSlideScroll});$("#thumbs-items img").reflect({height:0.24,opacity:0.3});$(".colorbox").colorbox();this.discoverThumbnails()},beforePostsScroll:function(e,elem,pane,items,pos){var postId=$(elem).attr("id").substr(5);$("#prev span,#next span").removeClass("off");if(pos==0){$("span","#prev").addClass("off")}else{if(pos==items.length-1){$("span","#next").addClass("off")}}Zigzag.gotoThumbnail(postId);Zigzag.showPreview(postId)},showPreview:function(postId){$(".preview-current").fadeOut("slow",function(){$(this).removeClass("preview-current")});$("*","#preview-"+postId).show();$("#preview-"+postId).fadeIn("slow",function(){$(this).addClass("preview-current")})},discoverThumbnails:function(){$("li","#thumbs-items").each(function(i,node){Zigzag.thumbItems.push($(node).attr("id").substr(6))});try{Zigzag.gotoThumbnail($(".entry-post:first-child","#posts").attr("id").substr(5))}catch(e){}},gotoThumbnail:function(postId){var index=$.inArray(postId,Zigzag.thumbItems);if(index>=0){$("#thumbs-items").trigger("notify",[index+1]);$("#thumbs-items").trigger("goto",[index]);$("li","#thumbs-items").removeClass("current");$("#thumb-"+postId).addClass("current")}}};$(function(){Zigzag.init()});