/**
 * 
 * @author frbk.misc@gmail.com
 *
 */

var currentSection = '';

function init(e) {
	// initialize RSH
	dhtmlHistory.initialize();
	
	// add ourselves as a listener for history
	// change events
	dhtmlHistory.addListener(handleHistoryChange);
	
	// determine our current location so we can
	// initialize ourselves at startup
	var initialLocation = dhtmlHistory.getCurrentLocation();
	
	// if no location specified, use the default
	if (initialLocation == '' || initialLocation == undefined || initialLocation == null) {
		initialLocation = 'home';
		dhtmlHistory.add('home', {url:'home.php'});
		updateUI('home', {url:'home.php'});
	} else {
		// now initialize our starting UI
		updateUI(initialLocation, null);	
	}
}

/** Set the cookie to store style information */
window.onunload = function(e) {
	var title = getActiveStyleSheet();
	createCookie("style_academia", title, 365);
	
	var title = cookie ? cookie : getPreferredStyleSheet();
	setActiveStyleSheet(title);
}

//window.onload = init;

var cookie = readCookie("style_academia");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);