(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);
;/*************************************************
**  jQuery Masonry version 1.0.1
**  copyright David DeSandro, licensed GPL & MIT
**  http://desandro.com/resources/jquery-masonry
**************************************************/
;(function($){$.fn.masonry=function(options,callback){function placeBrick($brick,setCount,setY,setSpan,props){var shortCol=0;for(i=0;i<setCount;i++){if(setY[i]<setY[shortCol])shortCol=i}$brick.css({top:setY[shortCol],left:props.colW*shortCol+props.posLeft});for(i=0;i<setSpan;i++){props.colY[shortCol+i]=setY[shortCol]+$brick.outerHeight(true)}}function masonrySetup($wall,opts,props){props.$bricks=opts.itemSelector==undefined?opts.$brickParent.children():opts.$brickParent.find(opts.itemSelector);if(opts.columnWidth==undefined){props.colW=props.masoned?$wall.data('masonry').colW:props.$bricks.outerWidth(true)}else{props.colW=opts.columnWidth}props.colCount=Math.floor($wall.width()/props.colW);props.colCount=Math.max(props.colCount,1)}function masonryArrange($wall,opts,props){if(!props.masoned)$wall.css('position','relative');if(!props.masoned||opts.appendedContent!=undefined){props.$bricks.css('position','absolute')}var cursor=$('<div />');$wall.prepend(cursor);props.posTop=Math.round(cursor.position().top);props.posLeft=Math.round(cursor.position().left);cursor.remove();if(props.masoned&&opts.appendedContent!=undefined){props.colY=$wall.data('masonry').colY;for(i=$wall.data('masonry').colCount;i<props.colCount;i++){props.colY[i]=props.posTop}}else{props.colY=[];for(i=0;i<props.colCount;i++){props.colY[i]=props.posTop}}if(opts.singleMode){props.$bricks.each(function(){var $brick=$(this);placeBrick($brick,props.colCount,props.colY,1,props)})}else{props.$bricks.each(function(){var $brick=$(this);var colSpan=Math.ceil($brick.outerWidth(true)/props.colW);colSpan=Math.min(colSpan,props.colCount);if(colSpan==1){placeBrick($brick,props.colCount,props.colY,1,props)}else{var groupCount=props.colCount+1-colSpan;var groupY=[0];for(i=0;i<groupCount;i++){groupY[i]=0;for(j=0;j<colSpan;j++){groupY[i]=Math.max(groupY[i],props.colY[i+j])}}placeBrick($brick,groupCount,groupY,colSpan,props)}})}props.wallH=0;for(i=0;i<props.colCount;i++){props.wallH=Math.max(props.wallH,props.colY[i])}$wall.height(props.wallH-props.posTop);callback.call(props.$bricks);$wall.data('masonry',props)}function masonryResize($wall,opts,props){var prevColCount=$wall.data('masonry').colCount;masonrySetup($wall,opts,props);if(props.colCount!=prevColCount)masonryArrange($wall,opts,props)}return this.each(function(){var $wall=$(this);var props=$.extend({},$.masonry);props.masoned=$wall.data('masonry')!=undefined;var previousOptions=props.masoned?$wall.data('masonry').options:{};var opts=$.extend({},props.defaults,previousOptions,options);props.options=opts.saveOptions?opts:previousOptions;callback=callback||function(){};if(props.masoned&&opts.appendedContent!=undefined){opts.$brickParent=opts.appendedContent}else{opts.$brickParent=$wall}if(opts.$brickParent.children().length>0){masonrySetup($wall,opts,props);masonryArrange($wall,opts,props);var resizeOn=previousOptions.resizeable;if(!resizeOn&&opts.resizeable){$(window).bind('resize.masonry',function(){masonryResize($wall,opts,props)})}if(resizeOn&&!opts.resizeable)$(window).unbind('resize.masonry')}else{return this}})};$.masonry={defaults:{singleMode:false,columnWidth:undefined,itemSelector:undefined,appendedContent:undefined,saveOptions:true,resizeable:true},colW:undefined,colCount:undefined,colY:undefined,wallH:undefined,masoned:undefined,posTop:0,posLeft:0,options:undefined,$bricks:undefined,$brickParent:undefined}})(jQuery);
;jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};
;$(document).ready(function(){if(undefined===window.imgsize){}else{console.log("Image Size Cookie: "+imgsize);}
if($("body").attr('id')=="home"){$('#masonry').masonry({columnWidth:129,animate:true});$("#projectnav a").hover(function(){var entry_id=$(this).attr('rel');$("#img_"+entry_id).addClass('this');},function(){var entry_id=$(this).attr('rel');$("#img_"+entry_id).removeClass('this');});$("a.homeslice").hover(function(){var entry_id=$(this).attr('rel');$("#nav_"+entry_id).addClass('this');},function(){var entry_id=$(this).attr('rel');$("#nav_"+entry_id).removeClass('this');});var winH=$(window).height()-95;var winW=$(window).width()-40;var smallest=Math.min(winW,winH);if(smallest>=1000){var howbig=1600;}else if(smallest>=500){var howbig=1000;}else if(smallest>=1){var howbig=500;}
if(howbig!=$.cookie("imgsize")){$.cookie("imgsize",howbig);}}
if($("body").attr('id')=="photo"||$("body").attr('id')=="thumbs"){$("#headerinner").css({opacity:0});$("#scale").css({opacity:0});$("#header .contact").animate({opacity:0},100);var nav_height=$("#projectnavhr").offset();$("#nav").css({'opacity':0}).hide();$("#header").hoverIntent(function(){$("#headerinner").animate({'height':nav_height.top+12+'px'},100);$("#nav").slideDown(100).animate({opacity:1},100);$("#header h2").animate({opacity:0},100);$("#header .contact").animate({opacity:1},100);var new_nav_height=$("#projectnavhr").offset();$("#headerinner").animate({'height':new_nav_height.top+12+'px'},100);},function(){$("#nav").slideUp(100).animate({opacity:0},100);$("#headerinner h2").animate({opacity:1},300);$("#headerinner").animate({'height':'50px'},100);$("#header .contact").animate({opacity:0},100);});}
if($("body").attr('id')=="photo"){refigure();$(document).keydown(function(e){if(e.keyCode==37){window.location=$("#prev").attr('href');return false;}
if(e.keyCode==39){window.location=$(".nextlink").attr('href');return false;}
if(e.keyCode==38){window.location="/";return false;}
if(e.keyCode==40){window.location=$("#thumbnaillink").attr('href');return false;}});}
if($("body").attr('id')=="thumbs"){$(document).keydown(function(e){if(e.keyCode==37){window.location=$("#photothumbnails a:last").attr('href');return false;}
if(e.keyCode==39){window.location=$("#photothumbnails a:first").attr('href');return false;}});}});$(window).load(function(){refigure();$("#headerinner").css({opacity:1});$("#scale").css({opacity:1});refigure();});$(window).resize(function(){refigure();});var resizer=function(){var slice=$("#headerinner").height()+40;var winH=$(window).height()-80;var winW=$(window).width()-40;var img=$('#scale img');var json=$.parseJSON(img.attr('rel'));var imgW=json.width;var imgH=json.height;var photo_file=json.photo_file;var over=imgW/imgH;var under=imgH/imgW;$('#header').css({'width':winW});$('#scale').css({'width':winW});$('#scale').css({'height':winH});if(winW/winH>=over){if(winH<=imgH){if(winH>425){img.css({'width':'auto'});img.css({'height':winH});}}else{if(winH>425){img.css({'width':imgW});img.css({'height':imgH});}}}else{if(winW<imgW){if(winW>425){img.css({'width':winW,'height':'auto'});}}else{if(winW>425){img.css({'width':imgW,'height':imgH});}}}
if(img.width()>0){$('#headerinner').css({'width':img.width()});$('#scale p').css({'width':img.width()});$('.nav').css({'width':img.width()-$("h1").width()-2});}else{$('#headerinner').css({'width':winW});$('#scale p').css({'width':winW});$('.nav').css({'width':winW-$("h1").width()-2});}
var smallest=Math.min(winW,winH);if(smallest>=1000){var howbig=1600;}else if(smallest>=500){var howbig=1000;}else if(smallest>=1){var howbig=500;}
if(howbig!=$.cookie("imgsize")){if(winW/winH>=over){var url="/images/phpthumb/phpthumb.php?src="+photo_file+"&q=90&w="+howbig;}else{var url="/images/phpthumb/phpthumb.php?src="+photo_file+"&q=90&h="+howbig;}
$("#scale img").attr('src',url);$.cookie("imgsize",howbig);}}
function refigure(){if($("body").attr('id')=="photo"){resizer();setTimeout(resizer,50);}}
