jQuery(document).ready(function(){
	if (document.URL.indexOf('showcase.html') < 0 && document.URL.indexOf('about-me') < 0) {
		$('#featured').css({
			'width':	$(window).width(),
			'left':		-($(window).width() - 960)/2
		});
		$('.thumb_group').masonry({
			columnWidth: 322, 
			itemSelector: '.thumb' ,
			animate: true,
			animationOptions: {
				duration: 300,
				queue: false
			}
		});
		$('.thumb_group').find('a').fancybox({
			'centerOnScroll':true,
			'overlayColor':'#000',
			'overlayOpacity':0.8,
			'scrolling':'no',
			'autoScale':true,
			'showCloseButton':false,
			'speedIn':500,
			'speedOut':0,
			'changeSpeed':0,
			'onComplete':function() {
			}
		});
		$('a.fancybox').fancybox({
			'centerOnScroll':true,
			'overlayColor':'#000',
			'overlayOpacity':0.8,
			'scrolling':'no',
			'autoScale':true,
			'showCloseButton':false,
			'speedIn':100,
			'speedOut':0,
			'changeSpeed':0,
			'onComplete':function() {
			}
		});
		$('#featuredinner').html('' +
			'<div id=featuredwork>' +
			'<h2>Featured Work</h2>' +
			'<div class=featureworkbox><a href="/2011/12/tabasco-nation.html"><img src="/images/preview-tabasco.jpg"><div class=featureworktitle><div class=featureworktitleinner>TABASCO Nation</div></a></div></div>' +
			'<div class=featureworkbox><a href="/2011/10/the-realm.html"><img src="/images/preview-realm.jpg"><div class=featureworktitle><div class=featureworktitleinner>The Realm</div></a></div></div>' +
			'<div class=featureworkbox><a href="/2011/10/cisco-together.html"><img src="/images/preview-cisco-together.jpg"><div class=featureworktitle><div class=featureworktitleinner>Cisco Together</div></a></div></div>' +
			'<div class=featureworkbox><a href="/2011/10/motorlogs.html"><img src="/images/preview-motorlogs.jpg"><div class=featureworktitle><div class=featureworktitleinner>Motorlogs</div></a></div></div>' +
			'<div class=featureworkbox><a href="/2011/10/toyotacom.html"><img src="/images/preview-toyota.jpg"><div class=featureworktitle><div class=featureworktitleinner>Toyota.com</div></a></div></div>' +
			'<div class=featureworkbox><a href="/2011/10/ogilvy-video-screens.html"><img src="/images/preview-ogilvyvideo.jpg"><div class=featureworktitle><div class=featureworktitleinner>Ogilvy Video Player</div></a></div></div>' +
			'<div class=viewall><a href="/showcase.html">View all ></a></div>' +
			'</div><br style="clear:left"><div class=featuredworkmargin></div>'
		);
	} else if (document.URL.indexOf('showcase.html') > 0) {
		$('#featuredinner').remove();
		$('.asset-body').css({'top': -70});
		$(function(){
			var $isocontainer = $('#isocontainer');
			$isocontainer.isotope({
				itemSelector : '.project',
				masonry: {columnWidth:193}
			});
			var $optionSets = $('#options .option-set'),
			$optionLinks = $optionSets.find('a');
			$optionLinks.click(function(){
				var $this = $(this);
				if ( $this.hasClass('selected') ) {
					return false;
				}
				var $optionSet = $this.parents('.option-set');
				$optionSet.find('.selected').removeClass('selected');
				$this.addClass('selected');
				var options = {},
				key = $optionSet.attr('data-option-key'),
				value = $this.attr('data-option-value');
				value = value === 'false' ? false : value;
				options[ key ] = value;
				if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
					changeLayoutMode( $this, options )
				} else {
					$isocontainer.isotope( options );
				}
				return false;
			});
		});
	} else if (document.URL.indexOf('about-me') > 0) {
		$('#featuredinner').remove();
		$('.asset-body').css({'top': -70});
	}
});

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2890852-1']);
_gaq.push(['_trackPageview']);
(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

