$(document).ready(function(){
	
	// Set #top height to match header height since we are using a fixed header;
	var headerHeight = $('header').outerHeight();
	var subnavHeight = $('#subnav').outerHeight();
	var totalHeight = headerHeight + subnavHeight;
	$('#top').css({'height':totalHeight});
	$('#subnav').css({'top':headerHeight});
	
	$('a[href*=#]').bind('click', function(){
		var $href = $(this).attr('href')
		if ($href=="#top")
		{
			$('html,body').animate({scrollTop: $($(this).attr('href')).offset().top}, 1200, 'easeInOutExpo');
		} else {
			$('html,body').animate({scrollTop: $($(this).attr('href')).offset().top - totalHeight}, 1200, 'easeInOutExpo');
		}
		
		return false;
	});
	
});

