function locationHashChanged() {
    if (location.hash) {
        var page = location.hash.substring(1, location.hash.length);
		setpage(page);
    }else{
		setpage("home");
	}
}
var oldhash;
function pollhash(){
	if (oldhash){
		if (location.hash != oldhash){
			locationHashChanged();
		}
	}
	oldhash = location.hash;
}
if ("onhashchange" in window) {
    window.onhashchange = locationHashChanged;
}else{
	setInterval("pollhash()", 100);
}
function calcHeight()
{
    var frame_height = document.getElementById('mainpage').contentWindow.document.body.scrollHeight;
    
    if (frame_height < 450) {
        frame_height = 450;
    }
    
    document.getElementById('mainpage').height = frame_height + 40;
}
function checkpage(){
	if (location.hash){
		var page = location.hash;
		page = page.substring(1, page.length);
		setpage(page);
	}else{
		setpage("home");
	}
}
function setpage(page){
	document.getElementById('mainpage').contentWindow.location.replace(page + ".php");
}

