window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var a=[].slice.call(arguments);(typeof console.log==="object"?log.apply.call(console.log,console,a):console.log.apply(console,a))}};(function(e){function h(){}for(var g="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),f;f=g.pop();){e[f]=e[f]||h}})((function(){try{console.log();return window.console}catch(a){return window.console={}}})());(function(a){var c=a.event,b;c.special.smartresize={setup:function(){a(this).bind("resize",c.special.smartresize.handler)},teardown:function(){a(this).unbind("resize",c.special.smartresize.handler)},handler:function(f,e){var h=this,i=arguments;f.type="smartresize";b&&clearTimeout(b);b=setTimeout(function(){jQuery.event.handle.apply(h,i)},e==="execAsap"?0:100)}};a.fn.smartresize=function(d){return d?this.bind("smartresize",d):this.trigger("smartresize",["execAsap"])};a.fn.masonry=function(e,d){var f={getBricks:function(i,g,h){var j=h.itemSelector===undefined;g.$bricks=h.appendedContent===undefined?j?i.children():i.find(h.itemSelector):j?h.appendedContent:h.appendedContent.filter(h.itemSelector)},placeBrick:function(p,r,s,q,n){r=Math.min.apply(Math,s);for(var l=r+p.outerHeight(true),o=s.length,j=o,g=q.colCount+1-o;o--;){if(s[o]==r){j=o}}p.applyStyle({left:q.colW*j+q.posLeft,top:r},a.extend(true,{},n.animationOptions));for(o=0;o<g;o++){q.colY[j+o]=l}},setup:function(i,g,h){f.getBricks(i,h,g);if(h.masoned){h.previousData=i.data("masonry")}h.colW=g.columnWidth===undefined?h.masoned?h.previousData.colW:h.$bricks.outerWidth(true):g.columnWidth;h.colCount=Math.floor(i.width()/h.colW);h.colCount=Math.max(h.colCount,1)},arrange:function(k,g,i){var l;if(!i.masoned||g.appendedContent!==undefined){i.$bricks.css("position","absolute")}if(i.masoned){i.posTop=i.previousData.posTop;i.posLeft=i.previousData.posLeft}else{k.css("position","relative");var j=a(document.createElement("div"));k.prepend(j);i.posTop=Math.round(j.position().top);i.posLeft=Math.round(j.position().left);j.remove()}if(i.masoned&&g.appendedContent!==undefined){i.colY=i.previousData.colY;for(l=i.previousData.colCount;l<i.colCount;l++){i.colY[l]=i.posTop}}else{i.colY=[];for(l=i.colCount;l--;){i.colY.push(i.posTop)}}a.fn.applyStyle=i.masoned&&g.animate?a.fn.animate:a.fn.css;g.singleMode?i.$bricks.each(function(){var h=a(this);f.placeBrick(h,i.colCount,i.colY,i,g)}):i.$bricks.each(function(){var o=a(this),q=Math.ceil(o.outerWidth(true)/i.colW);q=Math.min(q,i.colCount);if(q===1){f.placeBrick(o,i.colCount,i.colY,i,g)}else{var n=i.colCount+1-q,h=[];for(l=0;l<n;l++){var r=i.colY.slice(l,l+q);h[l]=Math.max.apply(Math,r)}f.placeBrick(o,n,h,i,g)}});i.wallH=Math.max.apply(Math,i.colY);k.applyStyle({height:i.wallH-i.posTop},a.extend(true,[],g.animationOptions));i.masoned||setTimeout(function(){k.addClass("masoned")},1);d.call(i.$bricks);k.data("masonry",i)},resize:function(i,g,h){h.masoned=!!i.data("masonry");var j=i.data("masonry").colCount;f.setup(i,g,h);h.colCount!=j&&f.arrange(i,g,h)}};return this.each(function(){var k=a(this),g={};g.masoned=!!k.data("masonry");var i=g.masoned?k.data("masonry").options:{},l=a.extend({},a.fn.masonry.defaults,i,e),j=i.resizeable;g.options=l.saveOptions?l:i;d=d||function(){};f.getBricks(k,g,l);if(!g.$bricks.length){return this}f.setup(k,l,g);f.arrange(k,l,g);!j&&l.resizeable&&a(window).bind("smartresize.masonry",function(){f.resize(k,l,g)});j&&!l.resizeable&&a(window).unbind("smartresize.masonry")})};a.fn.masonry.defaults={singleMode:false,columnWidth:undefined,itemSelector:undefined,appendedContent:undefined,saveOptions:true,resizeable:true,animate:false,animationOptions:{}}})(jQuery);var aside={contactSlide:function(){$("#form").hide();$("#contact a").click(function(){$("#form").slideToggle("slow",function(){$("form input:first",this).focus()});return false})},contactForm:function(){$("#name").keypress(function(){$("#name-error").fadeOut("slow");$(this).removeClass("error-highlight")});$("#email").keypress(function(){$("#email-error").fadeOut("slow");$("#email-wrong").fadeOut("slow");$(this).removeClass("error-highlight")});$("#comment").keypress(function(){$("#comment-error").fadeOut("slow");$("#comment-short").fadeOut("slow");$(this).removeClass("error-highlight")});$("#name").blur(function(){$("#name-error").fadeOut("slow");$(this).removeClass("error-highlight")});$("#email").blur(function(){$("#email-error").fadeOut("slow");$("#email-wrong").fadeOut("slow");$(this).removeClass("error-highlight")});$("#comment").blur(function(){$("#comment-error").fadeOut("slow");$("#comment-short").fadeOut("slow");$(this).removeClass("error-highlight")});$(".submit").click(function(){var a=$("input[name=name]","#form"),h=a.val(),f=$("input[name=email]","#form"),i=f.val(),g=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/,d=$("textarea[name=comment]","#form"),b=d.val(),e=d.val().length;if(h==""){a.addClass("error-highlight");$("#name-error").fadeIn("slow");return false}else{a.removeClass("error-highlight");$("#name-error").fadeOut("fast")}if(i==""){f.addClass("error-highlight");$("#email-short").fadeOut("fast");$("#email-error").fadeIn("slow");return false}else{if(!g.test(i)){f.addClass("error-highlight");$("#email-error").fadeOut("fast");$("#email-short").fadeIn("slow");return false}else{f.removeClass("error-highlight");$("#email-error").fadeOut("fast");$("#email-short").fadeOut("slow")}}if(b==""){d.addClass("error-highlight");$("#comment-error").fadeIn("slow");return false}else{if(e<5){d.addClass("error-highlight");$("#comment-short").fadeIn("slow");return false}else{d.removeClass("error-highlight");$("#comment-error").fadeOut("slow");$("#comment-short").fadeOut("slow")}}var c="name="+h+"&email="+i+"&comment="+encodeURIComponent(b);$(".text").attr("disabled","true");$("#loading").show();$.ajax({url:"lib/process.php",type:"GET",data:c,cache:false,success:function(j){if(j==1){$(".text").css("color","#a3a5aa").attr("disabled","true");$(".submit").addClass("disabled").attr("disabled","true");$("#loading").hide();$("#done").fadeIn("slow")}else{alert("Oooops, unexpected error. Try to send an email at zerots[at]karmiczero.com")}}});return false;event.preventDefault()})}};var content={rolloverEffect:function(){$(".grayscale").hover(function(){$(this).stop().animate({opacity:"0"},"slow")},function(){$(this).stop().animate({opacity:"1"},"slow")})},animateBoxes:function(){var b=[445,510];$("#insider").masonry({columnWidth:5,singleMode:false,resizable:true,animate:true,saveOptions:true});function a(){$(".expanded").each(function(d){var e=$(this).data("size");$(this).find(".work-full").hide("slow");$(this).find(".work-preview").show("slow");$(this).find(".work-full").html("");$(this).animate({width:(e[0]||100),height:(e[1]||"auto")},function(){$("#insider").masonry()}).removeClass("expanded")})}function c(){var d=$(".expanded").length-1;$(".expanded").each(function(e){var f=$(this).data("size");$(this).find(".work-full").hide("slow");$(this).find(".work-preview").show("slow");$(this).animate({width:(f[0]||100),height:(f[1]||"auto")},function(){if(e>=d){$("#insider").masonry()}}).removeClass("expanded")})}$(".work-wrapper").click(function(){if(!$(this).is(".expanded")){var d=($(this).attr("data-size"))?$(this).attr("data-size").split(","):b;$(this).data("size",[$(this).width(),$(this).height()]).animate({width:d[0],height:d[1]},function(){$(this).find(".work-preview").hide("slow");$(this).find(".work-full").show("slow");$("#insider").masonry()});c();$(this).addClass("expanded")}})}};$(document).ready(function(){aside.contactSlide();aside.contactForm();content.rolloverEffect();content.animateBoxes()});
