/*
 *	Boy van Amstel
 *	copyright 2010
 *
 *	@author 	Boy van Amstel
 *	@version 	1.0
 *
 *	Changes 1.0:
 *	[03/02/2010]	- First release 
 *
 */

var engine;
engine = setInterval("engineTick()", settings['engine']['update']);

/**********
*
*	jQuery
*
**********/

$(document).ready(function() {

	initInterface();

});

/**********
*
*	Methods
*
**********/

function changeProject(_this) {
	$("#projectsController li a").removeClass("active");
	$(_this).addClass("active");
	var href = $(_this).attr("href").substring(1);
	var target = $("#project"+href);
	if(target.length > 0) {
		$("#projects li:visible").fadeOut(function() {
			$("#project"+href).fadeIn();
		});
	}
}

function checkUrl() {
	var hash = window.location.hash;
	var link = $("#projectsController li a[href=" + hash + "]");
	if(link.length > 0) {
		changeProject(link);
	}
}

function initInterface() {

	/***
	*	Projects
	***/
	
	// Hide all but first
	$("#projects li").not(":first").hide();
	
	// Switch
	$("#projectsController li a").click(function() {
		changeProject(this);
		//return false;
	});
	
	/***
	*	Check url
	***/
	
	checkUrl();

}

/**********
*
*	Engine
*
**********/

function engineTick() {
	
}

