$(function() {
	//setPaneHeight();
	setContainerWidth();
	fixFooter();
	
	$.localScroll.defaults.axis = 'x';
	
	$.localScroll.hash({
		queue: true,
		duration:1000,
		offset: {left: 0},
	});
	
	$.localScroll({
		queue: true,
		duration: 1000,
		offset: {left: 0},
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modifieds
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	});

	Cufon.replace(".pane .content h2")(".pane .content .pages a")("#blogSidebar .section h3")("#blog .content .post .entry-title")("#blog .content .page-title")("#blog .content .post .entry-content h1")("#hoursTable td h3")("#hoursTable td a");

});

$(window).resize(function() {
	//setPaneHeight();
	fixFooter();
});

function setContainerWidth() {
	var width = 0;
	var children = $("#container .row").children();
	
	children.each(function(i, el) { 
		width += $(el).outerWidth(); 
	});
	
	$("#container").width(width);
}

function fixFooter() {
	var height = $(window).height()-700;
	$("#footer").height(height);
}

function scrollDirection() {
	var newY = $(window).scrollTop();
	var newX = $(window).scrollLeft();
	
	if(newX > posX) {
		// scrolling right
		return true;
	} else if(newX < posX) {
		// scrolling left
		return true;
	} else {
		return false;
	}
}
