var App = {
	module: function() {
		var modules = {};
		return function(name) {
			if(modules[name]) {
				return modules[name];
			}
			return modules[name] = { Views: {} };
		};
	}()
};
jQuery(function($) {
	var Application = App.module('application');
	Init = new Application.Router();
	Backbone.history.start({pushState: true});
	
	var pathname = window.location.pathname.substr(1);
	if(pathname.length) {
		$('#header nav a[href*="' + pathname + '"]')
			.parent()
			.addClass('active')
			.siblings()
			.removeClass('active');
	}

	$('#header nav a').bind('click', function(e) {
		$this = $(this);
		e.preventDefault();
		$this.parent().addClass('active').siblings().removeClass('active');
		Init.navigate($this.attr('href'), true);
	});
});
