(function(a){var e=a(window),D;a(function(){var p=a("#Wrapper"),E=a("body"),t=a("#NaviInfo"),F=a("#InfoContent").children(":last"),u=t.outerWidth(true),v=u+0,q=a("#GridContents").css({position:"relative"}),K=q.children().corner("5px"),w=a("#GridFooter"),L=800+v,M=4E3+v,y=a("#Footer"),N=a("#FooterContents"),O=a("#FooterAddress"),j=[],G="/getGrid.php",z=32,A=a("#More > a"),H=function(b,d,c,k,f,g){j[c]||(j[c]=[j[0][0]]);var o=d.outerWidth(true),h=j[c],i=h[h.length-1];if(o<=i){h.push(i-o);d.stop(true);
switch(b){case 0:d.delay(k*f).animate({top:c*330,left:j[0][0]-i},g,"easeInOutCubic");break;case 1:d.css({top:c*330,left:j[0][0]-i,visibility:"hidden"});setTimeout(function(){d.css({visibility:"visible"})},k*100);break;case 2:d.css({top:c*330,left:j[0][0]-i})}}else H(b,d,c+1,k,f,g)},s=function(b,d,c,k,f,g){d=d||q.children();c=c||0;c>0&&d.css({position:"absolute"});clearTimeout(D);D=setTimeout(function(){var o=e.width()-v,h,i,r,x,B,l;if(o<=800){h=L;l=800}else if(o>=4E3){h=M;l=4E3}else{h=parseInt(o/
200)*200+v;l=h-u}x=h;B=(e.width()-h)/2+"px";q.width(l);if(c==2||c==0)j=[[l]];d.each(function(m){var P=a(this);setTimeout(function(){H(c,P,0,m,f,g)},0)});setTimeout(function(){var m=F.offset().top+F.outerHeight(true);r=j.length*330;i=m<r?r+w.outerHeight(true):m;i+=50;m=(E.width()-h)/2+"px";N.css({left:m});O.css({right:m});p.height(i).width(x+"px").stop(true);t.stop(true);y.stop(true);w.stop(true);if(k){I(300,200);E.scrollTop(0)}if(c==2){p.css({left:B,visibility:"visible"});t.css({left:x-u+"px"});y.css({top:i+
p.offset().top+"px",visibility:"visible"});w.css({width:l-10+"px",top:r+"px"})}else{p.animate({left:B},300,"easeInOutCubic");t.animate({left:x-u+"px"},300,"easeInOutCubic");y.animate({top:i+p.offset().top+"px"},300,"easeInOutCubic");w.animate({width:l-10+"px",top:r+"px"},300,"easeInOutCubic")}},0)},200)},n=function(b,d,c){var k=d||32;if(!c){Q();q.empty();G=b?"/blog/grid/"+b+"/":"/getGrid.php";z=0}a.ajax({url:G,dataType:"html",data:{offset:z,limit:k},error:function(){I()},success:function(f){var g=
f.substring(0,f.length-1);f=f.substring(f.length-1,f.length);g=a(g);(f=="1"?true:false)?A.show():A.hide();q.append(g);if(c){g.css({visibility:"hidden"});s(null,g,1,false,0,0)}else s(null,g,2,true,0,0);g.filter(".grid").corner("5px");z+=k}})},Q=function(){a('<div id="Splash"></div>').appendTo("body").width(e.width()).height(e.height()).css({top:e.scrollTop(),left:e.scrollLeft()});e.scroll(function(){a("#Splash").css({top:e.scrollTop(),left:e.scrollLeft()})})},I=function(){a("#Splash").delay(300).fadeTo(200,
0,function(){a(this).remove();e.unbind("scroll")})};if(a.browser.msie&&a.browser.version=="6.0"){var J=0,C={width:e.width(),height:e.height()};(function(b){var d=function(){if(!J++){var c={width:e.width(),height:e.height()};if(C.width!=c.width||C.height!=c.height){C=c;b()}setTimeout(function(){J=0},0)}setTimeout(d,100)};setTimeout(d,100)})(s)}else e.resize(s);s(null,K,2,true,0,0);a(".gridSort,#More").corner("5px");a(".tagMedia > a").live("click",function(b){b.preventDefault();n("media");return false});
a(".tagEc > a").live("click",function(b){b.preventDefault();n("ec");return false});a(".tagCreative > a").live("click",function(b){b.preventDefault();n("creative");return false});a(".tagEvent > a").live("click",function(b){b.preventDefault();n("event");return false});a(".tagStaff > a").live("click",function(b){b.preventDefault();n("staff");return false});a(".tagAll > a").live("click",function(b){b.preventDefault();n();return false});A.click(function(b){b.preventDefault();n(null,null,true);return false})})})(jQuery);
