var userAgent = window.navigator.userAgent;
if(/iPhone/.test(userAgent) || /iPod/.test(userAgent) || /iPad/.test(userAgent)) {
    // No rollovers.
} else {
$('.project, #hero').hover(function () 
	{
		var $hover_offset = "-5";
		if ($(this).hasClass("width2")) {
			$hover_offset = "-10";
		} else if ($(this).hasClass("width3")) {
			$hover_offset = "-15";
		} else if ($(this).hasClass("width4")) {
			$hover_offset = "-25";
		} else if ($(this).hasClass("width5")) {
			$hover_offset = "-35";
		} else {
			$hover_offset = "-5";
		}
		$(this).find('.label').animate({width: 'toggle'}, "fast");
		$(this).find('.project_thumb').animate({left: $hover_offset },{queue:false, duration:200, easing: 'swing'});
		$(this).find('#hero_image_slides').animate({left: $hover_offset },{queue:false, duration:200, easing: 'swing'});
		
	}, function() {
		
		$(this).find('.label').animate({width: 'toggle'}, "fast");
		$(this).find('.project_thumb').animate({left: '0'},{queue:false, duration:200, easing: 'swing'});
		$(this).find('#hero_image_slides').animate({left: '0' },{queue:false, duration:200, easing: 'swing'});
		if ($(this).hasClass("not_selected_project"))
		{ 	
			if ($(this).hasClass("project")) {
				$(this).fadeTo(100, .4);
			} else {
				$(this).fadeTo(500, .4);
			}
		}
		return false;
});
};
// filter buttons and hide hero
$('#filters a').click(function(){
    var selector = $(this).attr('data-filter');
    var $this = $(this);
	if (selector !== "*")
	{
	  	$('.project').not(selector).fadeTo(300, .2).addClass('not_selected_project');
		$('.project').filter(selector).fadeTo(300, 1);
		$('.project').filter(selector).removeClass('not_selected_project');
		$('#hero').not(selector).fadeTo(300, .2).addClass('not_selected_project');
		$('#hero').filter(selector).fadeTo(300, 1);
		$('#hero').filter(selector).removeClass('not_selected_project');
	} 	
	else if (selector == "*") 
	{
		$('.project').fadeTo(100, 1).removeClass('not_selected_project');
		$('#hero').fadeTo(500, 1).removeClass('not_selected_project');
	}
	return false;
});

$('div.project.not_selected_project').live('mouseenter', function(e) {
	$(this).fadeTo(100, 1);
	return false;
});	      
$('#hero.not_selected_project').live('mouseenter', function(e) {
	$(this).fadeTo(500, 1);
	return false;
});	  
	
// switches selected class on buttons
$('#subnav').find('.option-set a').click(function(){
	var $this = $(this);

// don't proceed if already selected
	if ( !$this.hasClass('selected') ) {
		$this.parents('.option-set').find('.selected').removeClass('selected');
		$this.addClass('selected');
	}

});

var $container = $('#projects');
$container.masonry({
  
    itemSelector : '.element',
    columnWidth : 168
  });

