var activeId = 0;

function loadPage(id) {
	if (id == activeId) { return false; }
	toggle("loading");
	content.setTimeout(10000);
	content.getPage(id, activeId, function() {
		activeId = id;
		location.href = "#" + id;
		toggle("loading");
		
//OPTIONS
		//formHover(); //crashes IE (at least under linux)
		//if (activeId == 19) {
		//	runTour();
		//}

	});
};

addLoadEvent(function() {
	toggle("loading");
	if (window.location.href.indexOf('#') >= 0) {
		var hrefId = parseInt(window.location.href.split('#')[1]);
		if ((hrefId >= 1) && (hrefId <= content.numPages())) {
			loadPage(hrefId);
		} else {
			loadPage(1);
		}
	} else {
		loadPage(1);
	}
});