/* Author: Bryan Miller */

$(window).load(function() {
// window has loaded (images, scripts, and everything)

	// animate logo on homepage
	$("#home #logo a").css({
		top: '-100px'
	}).animate({
		top: '6px'
	}, {
		duration: 1000,
		specialEasing: {
			top: 'easeOutBounce'
		}
	});

});


$(function() {
	
	// work page filter
	$('ul#filter a').click(function() {
		$(this).css('outline','none');
		$('ul#filter .current').removeClass('current');
		$(this).parent().addClass('current');
		
		var filterVal = $(this).text().toLowerCase().replace(' ','-');
				
		if(filterVal == 'all') {
			$('ul#portfolio li.hidden').fadeIn('slow').removeClass('hidden');
		} else {
			
			$('ul#portfolio li').each(function() {
				if(!$(this).hasClass(filterVal)) {
					$(this).fadeOut('normal').addClass('hidden');
				} else {
					$(this).fadeIn('slow').removeClass('hidden');
				}
			});
		}
		
		return false;
	});
	
	
	// konami code
	$.konami(function() {
		$('body').append('<script src="/js/mylibs/asteroids.min.js" type="text/javascript"></script>');
	});
	
	
	//homepage slider only init if the window is larger than 960
	if (document.body.clientWidth >= 960) {		
		$('#slider').bxSlider({
			auto: true,
			mode: 'horizontal',
			speed: 500,
			pause: 5000,
			controls: false,
			pager: true,
			randomStart: false,
			easing: 'easeOutQuart'
		});		
	}
	
});
