$(document).ready(function(){if(typeof(Project)!='undefined')Project.init();if(typeof(Contact)!='undefined')Contact.init();if(typeof(Article)!='undefined')Article.init();if(typeof(Studio)!='undefined')Studio.init();if(typeof(Award)!='undefined')Award.init();if(typeof(About)!='undefined')About.init();if(typeof(OPX)!='undefined')OPX.init();});$(function(){if(typeof(Overlay)!='undefined')Overlay.init();});var OPX={hoverInstances:[],init:function(){if($.scrollTo&&typeof(SCROLL_TO)!='undefined'&&$(SCROLL_TO).length>0){$.scrollTo(SCROLL_TO,800);};$('.in-page').inPageScroll();this._toggleHover();this._emailEncrypt('[@]');this._externalLinks();},_externalLinks:function(){$("a[href^='http']").each(function(){if(this.href.indexOf(location.hostname)==-1){$(this).click(function(){if(typeof(pageTracker)!='undefined'){var str=OPX.getHostname(this.href);if(str.length>0){if(str.substring(0,4).toLowerCase()=='www.')str=str.substring(4);pageTracker._trackPageview('/outgoing/'+str);}};window.open(this.href);return false;});}});},_toggleHover:function(){$.each(this.hoverInstances,function(){if($(this).length)$(this).hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});});},_emailEncrypt:function(separator){separator=(typeof separator=='string')?separator:'[@]';$('a.mailto').each(function(){var e=this.href.replace(separator,'@'),t=this.href.replace('mailto:','');if(t==$(this).text())$(this).text(e.replace('mailto:',''));this.href=e;});},getHostname:function(str){var re=new RegExp('^(?:f|ht)tp(?:s)?\://([^/]+)','im');return str.match(re)[1].toString();},escapeHTML:function(string,quote_style){var hash_map=new Object(),symbol='',tmp_str='',entity='';tmp_str=string.toString();if(false===(hash_map=this.get_html_translation_table('HTML_SPECIALCHARS',quote_style))){return false;};hash_map["'"]='&#039;';for(symbol in hash_map){entity=hash_map[symbol];tmp_str=tmp_str.split(symbol).join(entity);};return tmp_str;},get_html_translation_table:function(table,quote_style){var entities=new Object(),hash_map=new Object(),decimal=0,symbol='',constMappingTable=new Object(),constMappingQuoteStyle=new Object(),useTable=new Object(),useQuoteStyle=new Object();constMappingTable[0]='HTML_SPECIALCHARS';constMappingTable[1]='HTML_ENTITIES';constMappingQuoteStyle[0]='ENT_NOQUOTES';constMappingQuoteStyle[2]='ENT_COMPAT';constMappingQuoteStyle[3]='ENT_QUOTES';useTable=!isNaN(table)?constMappingTable[table]:table?table.toUpperCase():'HTML_SPECIALCHARS';useQuoteStyle=!isNaN(quote_style)?constMappingQuoteStyle[quote_style]:quote_style?quote_style.toUpperCase():'ENT_COMPAT';if(useTable!=='HTML_SPECIALCHARS'&&useTable!=='HTML_ENTITIES'){throw new Error("Table: "+useTable+' not supported');};entities['38']='&amp;';if(useTable==='HTML_ENTITIES'){entities['160']='&nbsp;';entities['161']='&iexcl;';entities['162']='&cent;';entities['163']='&pound;';entities['164']='&curren;';entities['165']='&yen;';entities['166']='&brvbar;';entities['167']='&sect;';entities['168']='&uml;';entities['169']='&copy;';entities['170']='&ordf;';entities['171']='&laquo;';entities['172']='&not;';entities['173']='&shy;';entities['174']='&reg;';entities['175']='&macr;';entities['176']='&deg;';entities['177']='&plusmn;';entities['178']='&sup2;';entities['179']='&sup3;';entities['180']='&acute;';entities['181']='&micro;';entities['182']='&para;';entities['183']='&middot;';entities['184']='&cedil;';entities['185']='&sup1;';entities['186']='&ordm;';entities['187']='&raquo;';entities['188']='&frac14;';entities['189']='&frac12;';entities['190']='&frac34;';entities['191']='&iquest;';entities['192']='&Agrave;';entities['193']='&Aacute;';entities['194']='&Acirc;';entities['195']='&Atilde;';entities['196']='&Auml;';entities['197']='&Aring;';entities['198']='&AElig;';entities['199']='&Ccedil;';entities['200']='&Egrave;';entities['201']='&Eacute;';entities['202']='&Ecirc;';entities['203']='&Euml;';entities['204']='&Igrave;';entities['205']='&Iacute;';entities['206']='&Icirc;';entities['207']='&Iuml;';entities['208']='&ETH;';entities['209']='&Ntilde;';entities['210']='&Ograve;';entities['211']='&Oacute;';entities['212']='&Ocirc;';entities['213']='&Otilde;';entities['214']='&Ouml;';entities['215']='&times;';entities['216']='&Oslash;';entities['217']='&Ugrave;';entities['218']='&Uacute;';entities['219']='&Ucirc;';entities['220']='&Uuml;';entities['221']='&Yacute;';entities['222']='&THORN;';entities['223']='&szlig;';entities['224']='&agrave;';entities['225']='&aacute;';entities['226']='&acirc;';entities['227']='&atilde;';entities['228']='&auml;';entities['229']='&aring;';entities['230']='&aelig;';entities['231']='&ccedil;';entities['232']='&egrave;';entities['233']='&eacute;';entities['234']='&ecirc;';entities['235']='&euml;';entities['236']='&igrave;';entities['237']='&iacute;';entities['238']='&icirc;';entities['239']='&iuml;';entities['240']='&eth;';entities['241']='&ntilde;';entities['242']='&ograve;';entities['243']='&oacute;';entities['244']='&ocirc;';entities['245']='&otilde;';entities['246']='&ouml;';entities['247']='&divide;';entities['248']='&oslash;';entities['249']='&ugrave;';entities['250']='&uacute;';entities['251']='&ucirc;';entities['252']='&uuml;';entities['253']='&yacute;';entities['254']='&thorn;';entities['255']='&yuml;';};if(useQuoteStyle!=='ENT_NOQUOTES'){entities['34']='&quot;';};if(useQuoteStyle==='ENT_QUOTES'){entities['39']='&#39;';};entities['60']='&lt;';entities['62']='&gt;';for(decimal in entities){symbol=String.fromCharCode(decimal);hash_map[symbol]=entities[decimal];};return hash_map;},debug:function(obj){if(typeof(obj)==="object"){var output=[];for(var name in obj){if(obj.hasOwnProperty(name)){output.push(name.toString()+" = "+obj[name].toString());}};return output.join("\n");};}};var About={init:function(){if($('#our-approach').length){$('#our-approach-content-inner').css({position:'relative',height:$('#our-approach-content-inner').height()});$('#our-approach-content').height($('#our-approach-content-inner li:first').height());$('#our-approach-navigation a:first').addClass('active');$('#our-approach-navigation a').click(this._toggle);}},_toggle:function(){var $el=$('#our-approach-content'),$nav=$('#our-approach-navigation a');$nav.removeClass('active');$(this).addClass('active');$el.stop().animate({height:$($(this).attr('href')).height()},{queue:false,duration:600});$('#our-approach-content').scrollTo($(this).attr('href'),600,{axis:'y',queue:false});return false;}};var Overlay={init:function(){this._container=$('#asset-meta').addClass('ui-asset-meta');this._content=$('.meta-content',this._container);if(this._container.length){if(this._content.length){this._desc=$('.description',this._content);this._related=$('.related',this._content);this._resize();};this._appendOverlay();this._defaults();}},_defaults:function(){if(this._content.length&&!this._container.hasClass('ui-state-active')){this._content.hide();this._overlay.css({height:parseInt(Overlay._containerSize.fullheight-Overlay._size.fullheight)+'px'});}},_appendOverlay:function(){this._updateSize();this._overlay=$('<div></div>').addClass('ui-meta-outer').css({width:this._containerSize.fullwidth+'px',height:this._containerSize.fullheight+'px',opacity:0.9}).insertBefore(this._container);},_appendTrigger:function(){this._trigger=$('<a href="#toggle-view"><span>Show/Hide</span></a>').addClass('ui-meta-toggle').appendTo(this._container);$('h2, .ui-meta-toggle',this._container).attr('title','Click to toggle project information...').css('cursor','pointer').click(this._toggle);},_toggle:function(event){var $_self=Overlay._container,$_overlay=Overlay._overlay,$_content=Overlay._content;if($_content.is(':hidden')){$_overlay.stop().animate({height:Overlay._containerSize.fullheight+'px'},400,function(){$_content.fadeIn(400);$_self.addClass('ui-state-active');});}else{$_content.fadeOut(400,function(){$_overlay.stop().animate({height:parseInt(Overlay._containerSize.fullheight-Overlay._size.fullheight)+'px'},400);$_self.removeClass('ui-state-active');});};return false;},_resize:function(){if(this._related.length||this._desc.length){if(this._related.length){var d=$('.related-inner',this._related).DOMsize();this._related.width(d.width);if(this._desc.length){var d=this._related.DOMsize();this._desc.width(this._container.width()-d.fullwidth+'px');$('h2',this._container).width(this._desc.width());};};this._updateSize();this._appendTrigger();};},_updateSize:function(){this._containerSize=this._container.DOMsize();if(this._content.length)this._size=this._content.DOMsize();}};var Project={init:function(){if($('#work-hub').length){OPX.hoverInstances.push($('#work-hub .content-inner'));}},_toggleInit:function(){this._hubInstance={};$('#work-hub .content-inner').each(function(){var cat=this.id,items=0;Project._hubInstance[cat]={defaultSize:$(this).DOMsize()};$('ul li',this).each(function(i){items=i+1;if(items>3)$(this).addClass('ui-toggle-item').hide();});Project._hubInstance[cat].size=$(this).DOMsize();if(items>3)$('<a href="#toggle">Show more</a>').addClass('ui-toggle').appendTo($('.title',this)).click(Project._hubToggle);});},_hubToggle:function(event){var $_container=$(event.target).parents('.content-inner'),$_items=$('ul li.ui-toggle-item',$_container);if($_container.hasClass('ui-state-active')){$_items.fadeOut('normal',function(){$_container.stop().animate({height:Project._hubInstance[$_container.attr('id')].size.height+'px'},400,function(){$(this).removeClass('ui-state-active');$(event.target).text('Show more');$.scrollTo(document.body,800);});});}else{$_container.stop().animate({height:Project._hubInstance[$_container.attr('id')].defaultSize.height+'px'},400,function(){$(this).addClass('ui-state-active');$_items.fadeIn('normal',function(){$.scrollTo($(this),800);$(event.target).text('Show less');});});};return false;}};var Article={init:function(){this._container=$('#article-list');if(this._container.length){this._items=$('li.article',Article.container);this._title='.title';this._collapsible='.meta';this._content='.meta-content';this._footer='.footer';this._state={open:'icon-plus',close:'icon-minus'};this._items.each(function(){var $self=$(this);$('<a href="#'+this.id+'"><span>toggle</span></a>').addClass('icon icon-plus').appendTo($('.title',this));$footer=$('<li></li>').addClass('close').appendTo($(Article._footer,this));$('<a href="#close">Close</a>').addClass('in-page').appendTo($footer).click(function(){$(Article._title,$self).trigger('click');});$(Article._title,this).click(Article._toggle);$(Article._collapsible,this).css('height',$(Article._collapsible,this).height()+'px').hide().find(Article._content).hide();});if(typeof(ARTICLE_OPEN)!='undefined'>2&&$(ARTICLE_OPEN).length){$(this._title,$(ARTICLE_OPEN)).trigger('click');}}},_toggle:function(event){var $self=$(this).parent(),$list=$self.parent(),$el=$(Article._collapsible,$self);if($el.is(':hidden')){if($('li.article:visible',$list).length){$('li.article:visible',$list).each(function(){$(this).removeClass('active').find(Article._collapsible).slideUp('fast').find(Article._content).fadeOut('fast');$('.icon',this).addClass(Article._state.open).removeClass(Article._state.close);});};$self.addClass('active').find(Article._collapsible).slideDown('fast',function(){$(Article._content,this).fadeIn('fast',function(){$('.icon',$self).removeClass(Article._state.open).addClass(Article._state.close);$.scrollTo($self,600);$(Article._footer,$self).show();});});}else{$self.removeClass('active').find(Article._content).fadeOut('fast',function(){$(Article._footer,$self).hide();$el.slideUp('fast');$('.icon',$self).addClass(Article._state.open).removeClass(Article._state.close);});};return false;}};var Studio={init:function(){if($('#in-the-studio').length){$('a#rss-feed').click(function(){pageTracker._trackPageviews('/studio/rss/');return true;});if($('#in-the-studio-list').length){this._container='#in-the-studio-list';this._item='.item';this._overview='.overview';this._footer='.footer';this._asset='.asset';this._gallery_inc='.include-gallery';this._gallery='.gallery';this._max_height=178;this._text={more:'Show more',less:'Show less'};$(this._item,$(this._container)).each(this._appendToggle);}}},_appendToggle:function(event){var $self=$(this),size=$(Studio._overview,this).DOMsize(),assetSize=$(Studio._asset,this).DOMsize(),incGallery=$(Studio._gallery_inc,this).length,truncate=(size.height>Studio._max_height)?true:false,uid=this.id.substring(1);if(truncate||incGallery){var $footer=$(Studio._footer,this),$toggle=$('a',$footer).addClass('ui-toggle').text(Studio._text.more).show();if(truncate){$footer.addClass('ui-fade');$(this).pngFix();$(Studio._overview,this).height(Studio._max_height);};$toggle.click(function(event){var $asset=$(Studio._asset,$self),gallerySize=($(Studio._gallery,$asset).length)?$(Studio._gallery,$asset).height():0;if($(Studio._overview,$self).height()>Studio._max_height||$asset.height()>assetSize.height){$footer.addClass('ui-fade');$toggle.text(Studio._text.more);$self.pngFix();if(gallerySize){$asset.stop().animate({height:assetSize.height+'px'},400);};if(size.height>Studio._max_height){$(Studio._overview,$self).stop().animate({height:Studio._max_height+'px'},400);}}else{if(size.height<=Studio._max_height&&gallerySize){$toggle.text(Studio._text.less);$asset.animate({height:parseInt(assetSize.height+gallerySize)},400,function(){$.scrollTo($self,600);});}else{$(Studio._overview,$self).stop().animate({height:size.height+'px'},400,function(){$footer.removeClass('ui-fade');$toggle.text(Studio._text.less);if(gallerySize){$asset.animate({height:parseInt(assetSize.height+gallerySize)},400,function(){$.scrollTo($self,600);});}else if(incGallery&&!gallerySize&&typeof(GALLERY_URL)!='undefined'&&uid.length==15){var $gallery=$('<ul class="gallery"></ul>').append('<li class="ui-loader">Loading images...</li>').appendTo($asset);$asset.stop().animate({height:assetSize.height+$gallery.height()},400,function(){$.get(GALLERY_URL,{'uid':uid},function(data){var $data=$(data).appendTo($asset),gallery_height=$data.height();$gallery.fadeOut('normal',function(){$gallery.replaceWith($data);$asset.stop().animate({height:parseInt(assetSize.height+gallery_height)+'px'},400,function(){$.scrollTo($self,600);});});},'html');});}else{$.scrollTo($self,600);}});}};return false;});$(Studio._asset+' a:first',this).click(function(){$toggle.trigger('click');return false;});}else{$('a',$(Studio._footer,this)).hide();};}};var Award={init:function(){if($('#awards-and-publications-container').length){OPX.hoverInstances.push($('#awards-and-publications li.row'));if(location.hash.length>5)$(location.hash).each(this._highlight);}},_highlight:function(){var p=$('div:first',this).offset(),d=$('div:first',this).DOMsize();$(this).css({position:'relative',zIndex:51});var c={position:'absolute',zIndex:50,width:parseInt(d.width+12)+'px',height:parseInt(d.height+12)+'px',top:parseInt(p.top-6)+'px',left:parseInt(p.left-6)+'px'};$('<div id="award-underlay"></div>').css(c).prependTo(document.body);}};var Contact={init:function(){var $map=$('#map');if($map.length&&typeof(LATITUDE)!='undefined'&&typeof(LONGITUDE)!='undefined'){if(GBrowserIsCompatible()){var map=new GMap2(document.getElementById('map'));var point=new GLatLng(LATITUDE,LONGITUDE);map.removeMapType(G_HYBRID_MAP);map.addControl(new GLargeMapControl3D());map.addControl(new GMapTypeControl());map.addControl(new GOverviewMapControl());map.setCenter(new GLatLng(LATITUDE,LONGITUDE),15);var bounds=new GLatLngBounds();var baseIcon=new GIcon();baseIcon.iconSize=new GSize(65,32);baseIcon.iconAnchor=new GPoint(16,32);baseIcon.shadow='/_images/map-shadow.png';baseIcon.shadowSize=new GSize(67,35);baseIcon.image="/_images/map-pointer.png";var point=new GLatLng(LATITUDE,LONGITUDE);var marker=new GMarker(point,{icon:baseIcon});map.addOverlay(marker);bounds.extend(point);map.setZoom(map.getBoundsZoomLevel(bounds)-2);map.setCenter(bounds.getCenter());};this._mapInfo();};},_mapInfo:function(){var $c=$('#map-info'),h=($c.height()+parseInt($c.css('padding-top'))+parseInt($c.css('padding-bottom')))+'px',d={width:$c.width()+'px',height:'0px',opacity:0.7},$o=$('<div id="map-info-overlay"></div>').css(d).insertBefore($c.css('height','0px'));$('a',$c).attr({target:'_blank'}).css('background-color','transparent');$o.animate({height:h},'slow');$c.animate({height:h},'slow');}};var BREADCRUMB_TITLE_POSTFIX=' : OPX';var BREADCRUMB_MAX_ITEMS=8;var BREADCRUMB_MAX_CHARS=80;var Breadcrumb={init:function(){this._titlePostfix=BREADCRUMB_TITLE_POSTFIX;this._trail=new Array();this._getTrailFromCookie();this._addPage();if($('#breadcrumb').length){$('#breadcrumb').append(this._display());}},_addPage:function(){if(BREADCRUMB_MAX_ITEMS<=this._trail.length){this._trail.shift();};if(this._trail.length<1||window.location.pathname!=this._trail[this._trail.length-1].url){var documentTitle=document.title.toString();var page=new Object();page['title']=documentTitle.substring(0,documentTitle.indexOf(' :'));page['url']=window.location.pathname.toString();this._trail.push(page);this._writeCookie();}},_writeCookie:function(){var cookieStr='breadcrumb=';for(var i=0;i<this._trail.length;i++){cookieStr+=escape(this._trail[i]['url']+'*|*'+this._trail[i]['title'])+'^|)';};cookieStr+='; path=/';document.cookie=cookieStr;},_getTrailFromCookie:function(){var cookie=document.cookie.match(new RegExp('(^|;)\\s*'+'breadcrumb'+'=([^;\\s]*)'));cookie=(cookie?unescape(cookie[2]):null);if(cookie){var components=cookie.split('^|)');for(var i=0;i<components.length;i++){var pageParts=components[i].split('*|*');if(typeof(pageParts[0])!='undefined'&&typeof(pageParts[1])!='undefined'){var contents=new Object();contents['url']=pageParts[0];contents['title']=pageParts[1];this._trail[i]=contents;}}}},_display:function(){var strCount='',$list=$('<ul></ul>');for(var i=this._trail.length-1;i>=0;i--){strCount+=this._trail[i]['title'];if(strCount.length<BREADCRUMB_MAX_CHARS){var $item=$('<li></li>'),$seperator=$('<span class="separator">/</span>');if(i!=this._trail.length-1){$('<a href="'+this._trail[i]['url']+'"></a>').text(this._trail[i]['title']).appendTo($item);$seperator.appendTo($item);}else{$item.text(this._trail[i]['title']);};$list.prepend($item);}};return $list;}};(function($){$.fn.DOMsize=function(){var e=$(this),w=e.width(),h=e.height(),vb=(parseInt(e.css("border-top-width"))+parseInt(e.css("border-bottom-width"))),vp=(parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom"))),hb=(parseInt(e.css("border-left-width"))+parseInt(e.css("border-right-width"))),hp=(parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")));return{fullheight:h+((isNaN(vb))?0:vb)+((isNaN(vp))?0:vp),fullwidth:w+((isNaN(hb))?0:hb)+((isNaN(hp))?0:hp),height:(isNaN(h))?0:h,width:(isNaN(w))?0:w,verticalBorder:(isNaN(vb))?0:vb,horizontalBorder:(isNaN(hb))?0:hb,verticalPadding:(isNaN(vp))?0:vp,horizontalPadding:(isNaN(hp))?0:hp};};$.fn.inPageScroll=function(){return this.each(function(){var hash=$(this).attr('href');if(hash.substring(0,1)=='#'&&$(hash).length>0){$(this).click(function(){$.scrollTo(hash,800);return false;});}});};$.fn.pngFix=function(options){options=$.extend({blankgif:'/_images/spacer.gif'},options);var ie55=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var ie6=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if($.browser.msie&&(ie55||ie6)){$(this).find("img[src$=.png]").each(function(){$(this).attr('width',$(this).width());$(this).attr('height',$(this).height());var prevStyle='';var strNewHTML='';var imgId=($(this).attr('id'))?'id="'+$(this).attr('id')+'" ':'';var imgClass=($(this).attr('class'))?'class="'+$(this).attr('class')+'" ':'';var imgTitle=($(this).attr('title'))?'title="'+$(this).attr('title')+'" ':'';var imgAlt=($(this).attr('alt'))?'alt="'+$(this).attr('alt')+'" ':'';var imgAlign=($(this).attr('align'))?'float:'+$(this).attr('align')+';':'';var imgHand=($(this).parent().attr('href'))?'cursor:hand;':'';if(this.style.border){prevStyle+='border:'+this.style.border+';';this.style.border='';};if(this.style.padding){prevStyle+='padding:'+this.style.padding+';';this.style.padding='';};if(this.style.margin){prevStyle+='margin:'+this.style.margin+';';this.style.margin='';};var imgStyle=(this.style.cssText);strNewHTML+='<span '+imgId+imgClass+imgTitle+imgAlt;strNewHTML+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;strNewHTML+='width:'+$(this).width()+'px;'+'height:'+$(this).height()+'px;';strNewHTML+='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+$(this).attr('src')+'\', sizingMethod=\'scale\');';strNewHTML+=imgStyle+'"></span>';if(prevStyle!=''){strNewHTML='<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:'+$(this).width()+'px;'+'height:'+$(this).height()+'px;'+'">'+strNewHTML+'</span>';};$(this).hide();$(this).after(strNewHTML);});$(this).find("*").each(function(){var bgIMG=$(this).css('background-image');if(bgIMG.indexOf(".png")!=-1){var iebg=bgIMG.split('url("')[1].split('")')[0];$(this).css('background-image','none');$(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+iebg+"',sizingMethod='scale')";}});$(this).find("input[src$=.png]").each(function(){var bgIMG=$(this).attr('src');$(this).get(0).runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+bgIMG+'\', sizingMethod=\'scale\');';$(this).attr('src',options.blankgif);});};};})(jQuery);