(function(){jQuery(document).ready(function(a){var f,i,l,m,j,g,n,k,e,o,h,d;g=null;f=e=false;d=100;k=0;j=a("a.close img").attr("src");a("#center").masonry({singleMode:true,itemSelector:"div.project",resizeable:false});a("#categories a").each(function(){var b;b=a(this).attr("href").split("/");b=b[b.length-2];return a(this).attr("data-value",b.replace(/-en/,""))});m=a("#center div.project").clone();a("#categories a").bind("click",function(b){b.preventDefault();if(!a(this).hasClass("selected")){a("#categories a").removeClass("selected");
a(this).addClass("selected");b=a(this).attr("data-value");a("#center").html(m);b!=="all"&&a("#center").html(a("#center div.project[data-id~="+b+"]"));a("#center").masonry()}});a('a:contains("INFO")').bind("click",function(b){b.preventDefault();a("#info").show();h();return a("a.close").show()});a("div.image, div.image a").live("click",function(b){if(!f){f=true;b.preventDefault();a(window).scrollTo(0,0);a("#project-description").text("");a("#gallery").remove();a("#overlay").show().css({"background-color":a("body").css("background-color")});
h();b=a(this).attr("data-id");return a.ajax({url:siteurl+"/wp-admin/admin-ajax.php",data:{action:"load-project",project:b}}).success(function(c){a("#project-description").html(c);a("#gallery").detach().appendTo(a("#overlay-content"));a("#project-description:first-child").wrapInner('<div id="inner" />');k=window.setInterval(l,200);if(a("#close")){c=a("#close").text();if(c.length>0){a("a.close").remove();a("#overlay-content").append(i(c))}}a("a.close").show();return o()})}});l=function(){var b,c;b=
0;c=parseInt(a("#gallery").attr("data-id"));a("#gallery img").each(function(){if(this.nodeType===1&&this.tagName.toLowerCase()==="img"&&this.src!=="")if(this.complete||this.readyState===4)return b++});if(b===c){clearInterval(k);return n()}};a("#loading").sprite({fps:16,no_of_frames:4}).active();n=function(){var b,c;e=false;c=null;a("#loading").hide();a("#gallery").show();b=a.makeArray(a("#gallery div"));d=100+b.length;a("#gallery div").each(function(){var p;p=a("img",this).attr("src");if(!e){c=a(this).position();
e=!e}c.top+=10;c.left+=10;return a(this).css({top:c.top+"px",left:c.left+"px","z-index":d--,"background-image":"url("+p+")"})});a("#gallery img").remove();a("#border")&&a("#gallery div").css({"border-color":a("#border").text()});d=100+b.length;a("#gallery div").bind("click",function(){d++;a(this).css({"z-index":d});d++;return a("#overlay .close, #inner").css({"z-index":d})});return a("#gallery div").draggable({containment:"#overlay",start:function(){d++;a(this).css({"z-index":d});d++;return a("#overlay .close, #inner").css({"z-index":d})}})};
a("a.close").live("click",function(b){b.preventDefault();f=false;a("#overlay, #info").hide();a("#gallery, #inner, #close, #border, a.close").remove();a("#loading").show();console.log(j);a("#overlay-content, #info-content").append(i(j));return a("a.close").hide()});i=function(b){return'<a href="#" class="close"><img src="'+b+'" alt="X"></a>'};o=function(){var b,c;if(!e){g=a("#overlay a.close").position();e=!e}if(Math.random()>0.5){b=-Math.round(Math.random()*20);c=-Math.round(Math.random()*20)}else{b=
Math.round(Math.random()*20);c=Math.round(Math.random()*20)}return a("#overlay a.close").css({top:g.top+c+"px",left:g.left+b+"px"})};h=function(){var b;a("#overlay:visible, #info:visible").css({width:a(window).width()+"px",height:a(document).height()+"px"});b=a("#loading:visible");return b.css({left:a(window).width()/2+b.width()/2+"px",top:a(window).height()/2+b.height()/2+"px"})};return a(window).bind("smartresize.resizeOverlay",function(){return h()})})}).call(this);

