var menuItem = null;
var params = "";
function getParams () {
	if (window.location.protocol == "http:")
		params = window.location.search;
	else {
		var url = window.location.href;
		var s = url.indexOf ("?");
		if (s >= 0)
			params = url.substring (s, url.length);
	}
	if (params.length > 0)
		// remove questionmark
		params = params.substring (1, params.length);
}
function parseParams (actualItem) {
	// reset
	menuItem = null;
	params = "";
	getParams ();
	if (params.length > 0) {
		// Split the string at each "&" and put the parts into an array
		var inArray = params.split ("&");
		var outArray = new Array ();
		// Loop through each part in turn
		for (var i = 0; i <= inArray.length - 1; i++) {
			// Get the key and value side of each part
			var key = inArray[i].substring(0, inArray[i].indexOf("="));
			var value = inArray[i].substring(inArray[i].indexOf("=") + 1, params.length);
			// test key
			if (key == actualItem)
				menuItem = value;
			else
				// put in array for further processing
				outArray[outArray.length] = inArray[i];
		}
		// put the paraemters together again
		params = outArray.join ("&");
	}
	return (params.length > 0 || menuItem != null);
}
function writeMainFrameSet (defaultItem) {
	if (parseParams ("menu")) {
		// default menu item
		if (!menuItem) menuItem = defaultItem;
		// build main frame URI
		var mainFrameSet = menuItem + "/" + menuItem + "-frames.html?" + params;
		// add anchor
		mainFrameSet += window.location.hash;
		// write individual frameset with relayed search parms
		document.write ('<frameset cols="15,*" frameborder="0" framespacing="0" border="0">');
		document.write ('	<frame name="leftFrame" title="Linker Rand" src="left.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" noresize>');
		document.write ('	<frameset rows="78,*,20" frameborder="0" framespacing="0" border="0">');
		document.write ('		<frame name="topFrame" title="Hauptmen&uuml;" src="head.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" noresize>');
		document.write ('		<frame name="mainFrame" title="Themenbereich" src="' + mainFrameSet + '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" noresize>');
		document.write ('		<frame name="bottomFrame" title="Unterer Rand" src="bottom.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" noresize>');
		document.write ('	</frameset>');
		document.write ('</frameset>');
	}
}
function writeSubFrameSet (defaultMenu, defaultContent) {
	if ((window.location.protocol == "http:") && parseParams ("lang")) {
		if (menuItem && menuItem.length) // menuItem = lang
			var lang = menuItem;
	}
	if (parseParams ("thema")) {
		// build menu frame URI
		var frameItem = window.parent.menuItem;
		if (!frameItem) frameItem = defaultMenu;
		var frameURI = frameItem + "-menu.html";
		// default menu item
		if (!menuItem) menuItem = defaultContent;
		// content URI
		var contentURI = menuItem + ".html";
		// test language
		if (lang)
			// absolute 
			contentURI = "/" + lang + "/" + frameItem + "/" + contentURI;
		// add relayed search parameters
		if (params.length)
			contentURI += "?" + params;
		// add anchor
		contentURI += window.location.hash;
		// write individual frameset with relayed search parms
		document.write ('<frameset rows="20,*" frameborder="0" framespacing="0" border="0">');
		document.write ('	<frame name="menuFrame" title="Unterme&uuml;" src="' + frameURI + '" scrolling="no" noresize frameborder="0" marginwidth="0" marginheight="0">');
		document.write ('	<frame name="themaFrame" title="Inhalt" src="' + contentURI + '" frameborder="0" marginwidth="0" marginheight="0" noresize>');
		document.write ('</frameset>');
 	}
}
// special javascript for bodos.html
function resizeIE () {
	if (window.bodoFrame && window.bodoFrame.resizeToFit)
		window.bodoFrame.resizeToFit();
}
function writeBodoFrameSet (defaultPage) {
	if (parseParams ("inhalt")) {
		// default page
		if (!menuItem) menuItem = defaultPage;
		// content URI with relayed search parameters
		var pageURI = menuItem + ".html?" + params;
		// write individual frameset with relayed search parms
		document.write ('<frameset cols="340,*" frameborder="0" framespacing="0" border="0">');
		document.write ('	<frame name="bodoFrame" id="bodoFrame" title="Bodos Bunker-Bericht" src="bbb.html" frameborder="0" marginwidth="0" marginheight="0" noresize>');
		document.write ('	<frame name="bbb" title="Inhalt" src="' + pageURI + '" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto" noresize>');
		document.write ('</frameset>');
		// special javascript for bodos.html
		document.write ('window.onresize="if (window.bodoFrame && window.bodoFrame.resizeToFit) window.bodoFrame.resizeToFit();"');
 	}
}