var Doug = window.Doug || {};

$.extend(Doug, {
	_loadContent: function(hash) {
		$(".content").html("");
		$(".close").hide();	
		var filename = hash.replace("!", "");
		if (filename != "") {
			filename = "contents/" + filename + ".html";
			$.get(filename, function (data, textStatus, XMLHttpRequest) {
				if (textStatus == "success") {
					$(".content").html(data);
					//$(".featured").slideDown("easeInOutCubic");
					$(".featured").show();
					$(".close").show();
				}
			}, "html");
		}
	},
	loadContent: function(hash) {
		Doug._loadContent(hash);
		/*
		if ($(".featured").length > 0) {
			$(".featured").slideUp("fast", function() {
				Doug._loadContent(hash);
			});
		} else {
			Doug._loadContent(hash);
		}
		*/
	},
	init: function() {
		$.history.init(Doug.loadContent);
	}
});

$(document).ready(function() {
	Doug.init();
});
