var managerURL = "/manager/";

//hightlights the entry in the menu and updates to two top-frames
function updateEnvironment(menu, entry, page) {

	//open menu and highlight entry
	if (parent.menu) {
		parent.menu.openMenu(menu, false);
		parent.menu.selectEntry(menu, entry);
	}
	
	//show title of 2nd-level category
	if (parent.topone) {
		var url  = managerURL + "layout/topone.php?id=" + entry;
		var oldUrl = parent.topone.location.href;
		if (oldUrl.indexOf(url) == -1) {
//			alert("reload topone\n old:" + oldUrl + "\n new:" + url + "\n index:" + oldUrl.indexOf(url));
			parent.topone.location.href = url;
		}
	}
	
	//show correct 3rd-level menu
	if (parent.toptwo) {
		var url  = managerURL + "layout/toptwo.php?pageid=" + page;
		var oldUrl = parent.toptwo.location.href;
		if (oldUrl.indexOf(url) == -1) {
//			alert("reload toptwo\n old:" + oldUrl + "\n new:" + url + "\n index:" + oldUrl.indexOf(url));
			parent.toptwo.location.href = url;
		}
	}
}

//opens new window of the specified size and with the given html-document in it
function openNewWindow(url, width, height, scrollbars)
{
	scrollbars = (scrollbars) ? "yes" : "no";
	var dingsda = window.open(url, 'newOne', 'resizable=yes,scrollbars='+scrollbars+',status=yes,width='+width+',height='+height);
}


function showComment(pageid) {
	open(managerURL + "notes/notes.php?pageid=" + pageid, "commWin","resizable=yes,width=510,height=400,screenX=50,screenY=50,scrollbars=yes,status=yes");
}

function writeComment(pageid) {
	open(managerURL + "notes/notes.php?pageid=" + pageid + "&action=composenew","commWin","resizable=yes,width=510,height=400,screenX=50,screenY=50,scrollbars=yes,status=yes");
}

function printPage(page) {
	open(page + "?layout=print", "printWin", "resizable=yes,width=800,height=600,screenX=50,screenY=50,scrollbars=yes,status=yes");
}

