var stactive = '';
var substactive = '';
var timer;

var onLoadFunctionList = [];
var onUnloadFunctionList = [];
/* registriert eine Funktion, die bei document.onload ausgeführt werden soll */
function registerOnLoadFunction (refFunction) {
	onLoadFunctionList.push(refFunction);
}
function registerOnUnloadFunction (refFunction) {
	onUnloadFunctionList.push(refFunction);
}

/* führt alle registrierten Funktionen bei document.onload aus */
function startOnLoadFunctions () {
	for (var i=0; i<onLoadFunctionList.length;i++) {
		onLoadFunctionList[i]();
	}
}
function startOnUnloadFunctions () {
	for (var i=0; i<onUnloadFunctionList.length;i++) {
		onUnloadFunctionList[i]();
	}
}


function CheckOnOffAll (action,name) {
	name=name+"[]";
	var len = document.getElementsByName(name).length;
	for (var i = 0; i < len; i++) {
		document.getElementsByName(name)[i].checked = action;
	}
}

function ieGotoURL () {
	if (document.all && typeof(event)!="undefined" && event.srcElement.parentElement.parentElement.id=="selected") {
		document.location.href=event.srcElement.parentElement.parentElement.href;
	}
}

function st_blende_elm_ein(node)
{
	node.style.display = 'block';
	node.style.visibility = '';
}


function st_blende_elm_aus(node)
{
	node.style.display = 'none';
	node.style.visibility = 'hidden';
}


function st_blendeeinaus(elm)
{
	var node = document.getElementById(elm);
	var state = node.style.display;
	node.style.display = state != 'block' ? 'block' : 'none';
	node.style.visibility = state != 'block' ? '' : 'hidden';
	return node.style.display;
}

function st_blendeein(elm)
{
	var node = document.getElementById(elm);
	var state = node.style.display;
	node.style.display = 'block';
	node.style.visibility = '';
}

function st_blendeaus(elm)
{
	var node = document.getElementById(elm);
	var state = node.style.display;
	node.style.display = 'none';
	node.style.visibility = 'hidden';
}

function st_Getlaenge(elm,max,infoelm)
{
	var node=elm;
	var aktuelleLaenge=max-(node.value.length);
	document.getElementById(infoelm).innerHTML='Verbleibende Zeichen: '+aktuelleLaenge;
}

function st_trim (zeichenkette) {
 	return zeichenkette.replace (/^\s+/, '').replace (/\s+$/, '');
}

function st_ask (question) {

    var action = question + '?';
    if(window.confirm(action)) {
		return true;
	}
	return false;
}


var wmtt = null;
function st_showhelp(element,id){
	wmtt = document.getElementById("help" + id);
	document.onmousemove = st_update;
	wmtt.style.display = "block";
}

function st_hidehelp(elm,id){
	document.onmousemove = null;
	document.getElementById("help" + id).style.display = "none";
}

function st_update(e) {
	if (typeof window.pageYOffset != 'undefined') {
	   	x = (document.all) ? window.event.x + window.pageXOffset : e.pageX;
		y = (document.all) ? window.event.y + window.pageYOffset  : e.pageY;
	}
	else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
		x = (document.all) ? window.event.x + document.documentElement.scrollLeft : e.pageX;
		y = (document.all) ? window.event.y + document.documentElement.scrollTop  : e.pageY;
	}
	else if (typeof document.body != 'undefined') {
	   	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
		y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	}
	if (wmtt != null) {
		wmtt.style.left = (x+10) + "px";
		wmtt.style.top 	= (y+10) + "px";
	}
}

function externalLinks() {  
 if (!document.getElementsByTagName) return;  
 var anchors = document.getElementsByTagName("a");  
 for (var i=0; i<anchors.length; i++) {  
   var anchor = anchors[i];  
   if (anchor.getAttribute("href") &&  
       anchor.getAttribute("rel") == "external")  
     anchor.target = "_blank";  
 }  
}  
registerOnLoadFunction(externalLinks);



