
var featuredwork=undefined;var selectedthumbnail=undefined;var fadeSpeed='fast';var isFading=false;var currentID="";function urlencode(str){str=escape(str);str=str.replace(/\+/g,'%2B');str=str.replace(/%20/g,'+');str=str.replace(/\*/g,'%2A');str=str.replace(/\//g,'%2F');str=str.replace(/@/g,'%40');return str;}
function urldecode(str){str=str.replace('+',' ');str=unescape(str);return str;}
jQuery.Thumbnail=function(id,tgt){if(id!="work-featured"){var featured=false;if(id==featuredwork)featured=true;var datasource=$('#'+id);var thumbnail=datasource.children('img.portfolio-thumbnail').clone();$(thumbnail).Thumbnail({source:datasource,isfeatured:featured,target:tgt});}};jQuery.fn.Thumbnail=function(settings){settings=jQuery.extend({id:"",source:"",title:"",client:"",network:"",components:"",url:"",screenshot:"",target:"",isfeatured:false,selected:false},settings);return this.each(function(){var $this=jQuery(this);settings.id=settings.source.attr('id');settings.title=settings.source.children('div.portfolio-title').html();settings.client=settings.source.children('div.portfolio-client').html();settings.network=settings.source.children('div.portfolio-network').html();settings.components=settings.source.children('div.portfolio-components').html();settings.url=settings.source.children('a.portfolio-link');settings.screenshot=settings.source.children('div.portfolio-featured').attr('title');$this.attr('id','thumb_'+settings.source.attr('id'));$this.appendTo('#content-thumbnails-inner');var onclick=function(){if(!$this.hasClass('isselected')){$this.siblings('.isselected').removeClass('portfolio-thumbnail-active');$this.siblings('.isselected').removeClass('isselected');settings.target.fadeOut(fadeSpeed,function(){settings.target.Description(settings);});$this.addClass('portfolio-thumbnail-active');$this.addClass('isselected');showScreenshot(settings);currentID=settings.id;try{urchinTracker('/view/'+currentID);}catch(e){}}};var onmouseover=function(){if(!$this.hasClass('isselected'))$this.toggleClass('portfolio-thumbnail-active');};var onmouseout=function(){if(!$this.hasClass('isselected'))$this.toggleClass('portfolio-thumbnail-active');};$this.bind("click",onclick);$this.bind("mouseover",onmouseover);$this.bind("mouseout",onmouseout);settings.url.bind("click",openWork);});};jQuery.fn.Description=function(settings){settings=jQuery.extend({source:undefined,title:undefined,client:undefined,components:undefined,url:undefined,screenshot:undefined,isfeatured:false},settings);return this.each(function(){var $this=jQuery(this);var titleStr=settings.isfeatured?'Featured Project: ':'Project: ';$this.children('div.portfolio-title').html(settings.title?'<strong>'+titleStr+'</strong>'+settings.title:'');$this.children('div.portfolio-client').html(settings.client?'<strong>Client: </strong>'+settings.client:'');$this.children('div.portfolio-network').html(settings.network?'<strong>Network: </strong>'+settings.network:'');$this.children('div.portfolio-components').html(settings.components);$('#'+$this.attr('id')+' div.portfolio-link').empty();settings.url.clone(true).appendTo('#'+$this.attr('id')+' div.portfolio-link');$this.fadeIn(fadeSpeed);});}
var newPath="";var linkTarget="";function showScreenshot(settings){newPath=settings.screenshot;if(!$('#screenshot').is('img')){var screenshot=document.createElement('img');$(screenshot).attr('id','screenshot');$(screenshot).appendTo('#content-main-inner');$(screenshot).hide();$(screenshot).bind('load',fadeInScreenshot);$('#screenshot').attr('src',settings.screenshot);$('#screenshot').bind('click',launchWork);}
else{fadeOutScreenshot();}
linkTarget=settings.url;$('#screenshot').attr('alt',settings.title);}
function fadeInScreenshot(){$('#screenshot').fadeIn(fadeSpeed);$('#content-main-loader').fadeOut(fadeSpeed);}
function fadeOutScreenshot(){$('#screenshot').fadeOut(fadeSpeed,loadScreenShot);$('#content-main-loader').fadeIn(fadeSpeed);}
function loadScreenShot(){$('#screenshot').attr('src',newPath);}
function launchWork(){linkTarget.trigger('click');}
function openWork(){try{urchinTracker('/launch/'+currentID);}catch(e){}
var vidlink=this;if($(this).attr('rel').match(/mediabox/)){$('#videoplayerdesc').text($(this).attr('title'));$('#videobox').fadeIn('fast',function(){animateVideo(vidlink)});return false;}
else if($(this).attr('rel')=='website'){window.location=$(this).attr('href');return false;}}
function animateVideo(vidlink){var dims=$(vidlink).attr('rel').match(/[0-9]+/g);var width=dims[0];var height=dims[1];var displayHeight=Number(height)+20;$('#videoplayerswf').animate({width:width+"px",height:displayHeight+"px"},"fast",function(){$('#videoplayerclose').width(width+"px");$('#videoplayerdesc').width(width+"px");moveVideo(vidlink);});}
function moveVideo(vidlink){var top="-"+$('#videoplayer').outerHeight()/2+"px";var left="-"+$('#videoplayer').outerWidth()/2+"px";$('#videoplayer').animate({top:top,left:left},"fast",function(){writeVideo(vidlink)});}
function writeVideo(vidlink){var dims=$(vidlink).attr('rel').match(/[0-9]+/g);var width=dims[0];var height=dims[1];var flashHeight=Number(height)+19;var so=new SWFObject($('#mediaplayerpath').text(),'flvplayer',width,flashHeight,'8','#000000');if(so.installedVer.major<8)$('#videoplayerswf').html('You need <a href="http://www.adobe.com/go/EN_US-H-GET-FLASH">Adobe Flash Player</a> to view this video.');so.addParam("allowfullscreen","true");so.addParam("menu","false");so.addVariable("shownavigation","true");so.addVariable("autostart","true");so.addVariable("width",width);so.addVariable("height",flashHeight);so.addVariable("displaywidth",width);so.addVariable("displayheight",height);so.addVariable("backcolor","0x000000");so.addVariable("frontcolor","0x999999");so.addVariable("lightcolor","0xFFFFFF");so.addVariable("screencolor","0x000000");so.addVariable("enablejs","true");so.addVariable("file",$(vidlink).attr('href'));so.write('videoplayerswf');}
function closeVideo(){$('#videobox').fadeOut('fast',function(){$('#videoplayerswf').empty();});}
function createVideoBox(){var videobox=document.createElement('div');var videooverlay=document.createElement('div');var videoplayer=document.createElement('div');var videoplayerdesc=document.createElement('div');var videoplayerclose=document.createElement('div');var videoplayerswf=document.createElement('div');var outerplayer=document.createElement('div');var closelink=document.createElement('a');$(videobox).attr('id','videobox');$(videooverlay).attr('id','videooverlay');$(videoplayer).attr('id','videoplayer');$(videoplayerclose).attr('id','videoplayerclose');$(videoplayerswf).attr('id','videoplayerswf');$(videoplayerdesc).attr('id','videoplayerdesc');$(outerplayer).attr('id','outerplayer');$(closelink).attr('id','videocloselink');$(closelink).text('close');$(closelink).attr('href','#');$(closelink).click(function(){closeVideo();return false;});$(videobox).css('position','absolute');$(videobox).css('z-index','10');$(videobox).css('width','100%');$(videobox).css('height','100%');$(videobox).css('top','0px');$(videobox).css('left','0px');$(videooverlay).css('position','absolute');$(videooverlay).css('z-index','11');$(videooverlay).css('width','100%');$(videooverlay).css('height','100%');$(videooverlay).css('background-color','#000000');$(videooverlay).css('opacity','.90');$(outerplayer).css('position','absolute');$(outerplayer).css('z-index','12');$(outerplayer).css('top','50%');$(outerplayer).css('left','50%');$(videoplayer).css('position','absolute');$(videoplayer).css('z-index','13');$(videoplayer).css('padding','20px');$(videoplayer).css('background-color','#000000');$(videoplayer).css('top','-155px');$(videoplayer).css('left','-260px');$(videoplayerswf).css('width','480px');$(videoplayerswf).css('height','270px');$(videoplayerswf).css('padding','5px 0px');$(videobox).appendTo('body');$(videooverlay).appendTo('#videobox');$(outerplayer).appendTo('#videobox');$(videoplayer).appendTo('#outerplayer');$(videoplayerclose).appendTo('#videoplayer');$(closelink).appendTo('#videoplayerclose');$(videoplayerswf).appendTo('#videoplayer');$(videoplayerdesc).appendTo('#videoplayer');$(videobox).hide();}
$(document).ready(function(){if($('#showthumbnails').attr('title')=='true'){featuredwork=$('#work-featured').text();var descriptiontarget=$('#bottom-portfolio');$('#work').children().each(function(){new jQuery.Thumbnail($(this).attr('id'),descriptiontarget);});$('#thumb_'+featuredwork).click();createVideoBox();}
$("a[rel=website]").each(function(){$(this).attr('href','frames.html#'+urlencode($(this).attr('href')));});});$(window).load(function(){var scrolltarget=$('#scrolltarget').attr('title');if(scrolltarget)$(scrolltarget).jScrollPane({showArrows:true,scrollbarWidth:12,arrowSize:12,scrollbarMargin:0});});