if ("onhashchange" in window)
{
	window.onhashchange = function ()
	{
		NavServHashChanged();
	}
}

function NavServHashChanged()
{
	var h = document.location.hash;
	if (h == null) {}
	else
	{
		h = h.replace('#','');
		h = h.replace("->", '/');
		h = h.replace(/-/g,'_');
		NavServPage(h, 'SideMenu');
		NavServPage(h, 'content');
		document.getElementById('content').scrollTop = 0;
	}
}

function NavServPage(page, element)
{
	var xmlhr = new XMLHttpRequest();
	
	xmlhr.onreadystatechange = function()
	{
		if (xmlhr.readyState == 4 && xmlhr.status == 200)
			document.getElementById(element).innerHTML = xmlhr.responseText;
	}
	
	var strPath = "./pages/" + page + ".php?contenttype=" + element;
	
	xmlhr.open("GET", strPath, true);
	xmlhr.send();
}

function NavServPageLoading()
{
	var h = document.location.hash;
	if (h == '')
	{
		NavServPage('startseite', 'SideMenu');
		NavServPage('startseite', 'content');
	}
	else
		NavServHashChanged();
}
