/**
 * Öffnet eine Seite eines bestimmten Moduls;
 * Wird gesteuert von der Funktion loadContent auf der Hauptseite
 */
function loadContentF(site, area, module, cfid, cftoken, optAction, optActionModule) {
	tUrl			= site +"?module="+ module +"&area="+ area +"&CFID="+ cfid +"&CFToken="+ cftoken;
	if (typeof optAction != 'undefined') {
		tUrl	+= '&action='+optAction;
	}
	if (typeof optActionModule != 'undefined') {
		tUrl	+= '&actionmodule='+optActionModule;
	}
	location.href	= tUrl;
}

/**
 * Minimiert und Maximiert einen Panel
 */
function mmPanel(pid, name) {
	par = document.getElementById(name);
	
	for(i=0; i<par.childNodes.length; i++) {
		el = par.childNodes[i];
	
		if (el.nodeName == "TR") {
			if (el.style.display == "none") {
				el.style.display = (navigator.appName == "Microsoft Internet Explorer")?"block":"table-row";
				pid.src = "images/down-arrow.gif";
			}
			else {
				el.style.display = "none";
				pid.src = "images/right-arrow.gif";
			}
		}
	}
}

function getElement(id) {
	return document.getElementById ? document.getElementById(id) :
	document.all ? document.all(id) : null;
}

function getClientWidth() {
	return document.body && typeof document.body.clientWidth != 'undefined' ? 
	document.body.clientWidth : window.innerWidth ? innerWidth : null;
}

function getClientHeight() {
	return document.body && typeof document.body.clientHeight != 'undefined' ? 
	document.body.clientHeight : window.innerHeight ? innerHeight : null;
}

function centerIt(el_id, horiz_offset, vert_offset) {
	if (typeof horiz_offset == 'undefined') horiz_offset = 0;
	if (typeof vert_offset == 'undefined') vert_offset = 0;
	var el = getElement(el_id);
	var cW = getClientWidth();
	//var cH = getClientHeight();
	var cH = 600;
	
	if (cH == 0 && document.documentElement.clientHeight) {
		cH = document.documentElement.clientHeight;
	}
	
	if (el && el.style && cW && cH) {
		var el_lt = (cW - el.offsetWidth) / 2 + horiz_offset;
		var el_tp = (cH - el.offsetHeight) / 2 + vert_offset;
		el.style.left = String(el_lt + 'px');
		el.style.top = String(el_tp + 'px');
	}
}

function innerContent(elname, cont) {
	//if IE 4+
	if (document.all)
		document.all[elname].innerHTML = cont;
	else if (document.getElementById) {
		rng	= document.createRange();
		el	= document.getElementById(elname);
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(cont);
		while (el.hasChildNodes())
			el.removeChild(el.lastChild);
		el.appendChild(htmlFrag);
	}
}

function localCheckForPopupBox(e) {
	if (!e) var e = window.event;
	parent.checkForPopupBox(e);
}

document.onkeydown = localCheckForPopupBox;
