function setupContactGlobal(){$('#contact_nav').click(function(){hideBio();closePress();$.address.value($(this).find("a").attr('rel').substr(0));});$('#contact_button_close').click(function(){$.address.value('');hideContact();});positionContactBlockGlobal();$('#contact').animate({opacity:1},1000);}
function revealContact(){$('#contact_button').animate({opacity:0},500);$('#contact_button').hide();$('#contact #expanded').show();$('#contact #content').show();$('#contact_button_close').show();$('#contact #expanded').animate({opacity:1},1000);$('#contact #content').animate({opacity:1},1000);$('#contact_button_close').animate({opacity:1},2000);$('#map_frame').attr('src','inc/map.php');}
function hideContact(){$('#contact #expanded').hide();$('#contact_button_close').hide();$('#contact_button').css("left",0);$('#contact_button').show();$('#contact_button').animate({opacity:1},1000);_gaq.push(['_trackPageview','EVENT: Contact Us close button pressed']);}
function setupContactHome(){$('#contact_button').mouseover(function(){$('#contact_button').animate({opacity:1,left:0},80);});$('#contact_button').mouseleave(function(){$('#contact_button').animate({left:'-15px',opacity:.75},80);});$('#contact_button').click(function(){$.address.value($(this).attr('rel').substr(0));revealContact();});$('#contact_button_close').click(function(){hideContact();});$('#contact_nav').click(function(){$('#contact_nav').click(function(){$.address.value($(this).find("a").attr('rel').substr(0));});$('#contact_button_close').click(function(){$.address.value('');});});positionContactBlock();$('#contact').animate({opacity:1},1000);}
function positionContactBlock(item){var x=112-$('#container').position().left;x=x>0?x:0;$('#contact').animate({left:x+'px'},10,"swing");projects=[0];for(var i=1;i<=$("#portfolio > *").length;i++){projects.push($('#p'+i).position().top);}
var y=$(window).scrollTop();var c=$('#contact').position().top;var m=80;if(y>projects[current_project]){current_project=current_project+1<projects.length?current_project+1:current_project;}else{}
if(y<projects[current_project-1]){current_project--;}
if(current_selected_project!=0){current_project=parseInt(current_selected_project.substring(1));}
if($('#contact').position().top!=projects[current_project]&&!contact_is_sliding){contact_is_sliding=true;$('#contact').animate({opacity:.1},100).animate({top:projects[current_project]},100,"linear").animate({opacity:1},100,"linear",function(){contact_is_sliding=false;});}}
function positionContactBlockGlobal(){var x=112-$('#container').position().left;var y=$('#team').position().top;x=x>0?x:0;$('#contact').animate({left:x+'px',top:y+'px'},100,"swing");if(!contact_is_sliding){contact_is_sliding=true;$('#contact').animate({opacity:1},100).animate({top:projects[current_project]},100,"linear").animate({opacity:1},100,"linear",function(){contact_is_sliding=false;});}};var contact_is_sliding=false;$(function(){$.address.change(function(e){handleAddressChange(e);});setupBio();setupPress();closeButton();});var config={sensitivity:1,interval:50,over:fadeInPointer,timeout:100,out:fadeOutPointer}
function setupBio(){$('#headshots div').hoverIntent(config);$('#headshots div').click(function(){$.address.value($(this).find("a").attr('rel').substr(0));hideContact();});}
function setupPress(){$('.read').click(function(){$.address.value($(this).find("a").attr('rel').substr(0));hideContact();});}
function handleAddressChange(e){if($.address.value().indexOf('bio')>0){revealBio(e.path.substr(1,2));}
else if($.address.value().indexOf('press')>0){openPress(e.path.substr(1,3));$('#bios .b1 .ind_bio').addClass('revealed');$('#headshots .b1 img.hs_hover').addClass('revealed');}
else{$('#bios .b1 .ind_bio').addClass('revealed');$('#headshots .b1 img.hs_hover').addClass('revealed');}
if($.address.value().indexOf('contact')>0){revealContact();}}
function revealBio(p){hideBio();closePress();$('#bios .'+p+' .ind_bio').addClass('revealed');$('#headshots .'+p+' img.hs_hover').addClass('revealed');$('#headshots .'+p+' img.notch').addClass('hidden');}
function hideBio(){$('#bios .revealed').removeClass('revealed');$('#headshots .revealed').removeClass('revealed');$('#headshots .hidden').removeClass('hidden');}
function fadeInPointer(){$('#headshots .'+$(this).attr("class")+' img.notch').animate({opacity:0},200);$('#headshots .'+$(this).attr("class")+' img.hs_hover').animate({opacity:1},200);}
function fadeOutPointer(){$('#headshots .'+$(this).attr("class")+' img.notch').animate({opacity:1},200);$('#headshots .'+$(this).attr("class")+' img.hs_hover').animate({opacity:0},200);}
function openPress(press){closePress();$('#press #'+press+' .article').slideDown('fast');$.scrollTo('#'+press,700);$('#press #'+press+' .article').animate({opacity:1},200);$('#press #'+press+' .article').addClass('selected');$('#press .read').animate({opacity:1},50);$('#press #'+press+' .read').animate({opacity:0},200);$('#press #'+press+' .close').animate({opacity:1},200);$('#press .hidden').removeClass('hidden');return false;}
function closeButton(){$('.article .close').click(function(){closePress();$('#press #'+$(this).parent().parent().attr('id')+' .read').animate({opacity:1},200);$.scrollTo('#press #'+$(this).parent().parent().attr('id'),500);$.address.value('/');return false;});}
function closePress(){$('#press .selected').addClass('hidden');$('#press .selected').removeClass('selected');$('.hidden').slideUp('fast');}