// Generiere Übergabe-Parameter
WEBROOT = document.URL.replace(/\\/g,"/")
WEBROOT = WEBROOT.slice(0,WEBROOT.lastIndexOf("/"))
window.focus()
if (window.location.search != ""){
var PARAMETER = new Array();
Expression = /(.+)=(.+)/;

searchstring = window.location.search
searchstring = searchstring.substring(1,searchstring.length)
searchstring = encodePara(unescape(searchstring))
namevaluepair = searchstring.split("&")
for (i=0; i<namevaluepair.length; i++){
	Expression.exec(namevaluepair[i]);
	PARAMETER[RegExp.$1] = RegExp.$2;
	}
}

function initSite(){
	IMAGEOBJECTS = new Array()
	for (x=0; x<document.images.length; x++){
		if (document.images[x].src.indexOf("_0.") != -1){
		IMAGEOBJECTS[document.images[x].name+"0"] = new Image()
		IMAGEOBJECTS[document.images[x].name+"0"].src = document.images[x].src
		IMAGEOBJECTS[document.images[x].name+"1"] = new Image()
		IMAGEOBJECTS[document.images[x].name+"1"].src = document.images[x].src.replace("_0.","_1.")
		}
	}
}

function changeimg (wich,source){
	if (IMAGEOBJECTS [wich+source]){
		document.images[wich].src = IMAGEOBJECTS [wich+source].src
	}
}
function infotext (wich){
	if (document.getElementById("infofield")) {document.getElementById("infofield").innerHTML = wich}
}
function writePARAMETER(wich){
	if (PARAMETER[wich]){document.write(PARAMETER[wich])}
}
function encodePara(wich){
	newString = wich.replace(/\+/g," ")
	return newString
}
function genhiddenPARAMETER(wich){
	if (wich == "allPARAMETER"){
		for (var currentItem in PARAMETER){
			document.write("<input type='hidden' name='"+currentItem+"' value='"+PARAMETER[currentItem]+"' border='0'>")
		}
	} else {
		if (PARAMETER[wich]){
			document.write("<input type='hidden' name='"+wich+"' value='"+PARAMETER[wich]+"' border='0'>")
		}
	}
}
function $ID(id){
	result = document.getElementById(id)
	return result
}
function $NAME(name){
	result = document.getElementByName(name)
	return result
}
function $TAGNAME(tagname){
	result = document.getElementsByTagName(tagname)
	return result
}
function $FORMFIELD(name){
	tmp = name.split(".")
	result = null
	try	{
		if (tmp.length == 1) result = document.forms[0][tmp[0]]
		if (tmp.length == 2) result = document.forms[tmp[0]][tmp[1]]
		if (tmp.length == 3) result = document.forms[tmp[0]][tmp[1]][tmp[2]]
	} catch (e) {}
	return result
}
function $OBJECT(name){
	result = null
	try{
		result = eval(name)
	} catch (E){}
	return result
}
var $NODE = {
	getClassName : function (objekt){
		if(objekt.getAttribute("className")!=null) return objekt.getAttribute("className")
		if(objekt.getAttribute("class")!=null) return objekt.getAttribute("class")
		return null
	},
	getParentByClassName : function (node,cName){
		while (node.parentNode){
			node = node.parentNode
			if (node.getAttribute("class") == cName || node.getAttribute("classname") == cName) return node
		}
		return null;
	},
	getParentWithId : function(node){
		return $ID(this.parentId(node))
	},
	getParentId : function(node){
		curNode = node.parentNode
		while (curNode != null && curNode.id == ""){
			curNode = curNode.parentNode
		}
		return curNode.id
	},
	getNextSiblingByClassName : function (node,cName){
		var nextSib = node
		while ((nextSib = nextSib.nextSibling) != null){
			if ($GET.className(nextSib) == cName) return nextSib
		}
		return null
	},
	getChildsByClassName : function (node,cName){
		var result = new Array()
		childs = node.childNodes	
		for (i=0;i<childs.length;i++){
			try{
				if (this.getClassName(childs[i]) == cName) result.push(childs[i])
			} catch (e){}
		}
		return result
	},
	getChildsByTagName : function (node,tagName){
		tagName = tagName.toUpperCase()
		var result = new Array()
		childs = node.childNodes	
		for (i=0;i<childs.length;i++){
			try{
				if (childs[i].tagName.toUpperCase() == tagName) {
					result.push(childs[i])
				}
			} catch (e){}
		}
		return result
	},
	getChildNodeByTagName : function (childNodes,tagname){
		tagName = tagName.toUpperCase()
		var result=null
		for (cn=0;cn<childNodes.length;cn++){
			if (childNodes[cn].tagName.toUpperCase() == tagname) result = childNodes[cn]
		}
		return result
	},
	setClassName : function (obj,className){
		obj.setAttribute("className",className)
		obj.setAttribute("class",className)
	}
}
var $DISPLAY = {
	hide : function(wich){
		wich.style.display = "none"	
	},
	show : function(wich,type){
		if (type == null) type = ""
		wich.style.display = type	
	},
	toggleDisplay : function (wich){
		if (wich.style.display == "none"){
			this.show(wich)
		} else {
			this.hide(wich)
		}
	}
}
var $STRING = {
	replace : function (theString,oldString,newString){
		var i
		var tmp = theString.split(oldString)
		var result = ""
		for (i=0;i<tmp.length;i++){
			if (result != "") result += newString
			result += tmp[i]
		}
		return result	
	}	
}
var $CREATE = {
	link : function (lable,path,theclass,title){
		var link = this.element("a",theclass)
		link.appendChild(this.text(lable))
		link.href = path
		if (title != null) link.title = title
		return link
	},
	jsLink : function (lable,func,theclass,title){
		var link = this.element("a",theclass)
		link.appendChild(this.text(lable))
		if (func != null) {
			link.onclick = func
		}
		link.href = "#"
		if (title != null) link.title = title
		return link
	},
	element : function (typ,theclass){
		var obj = document.createElement(typ)
		if (theclass != null) $NODE.setClassName(obj,theclass)
		return obj
	},
	text : function (text){
		if (text == "") {
			var tmp = this.element("span",null)
			tmp.innerHTML = "&nbsp;"
			return tmp
		}
		return document.createTextNode(text)
	}
}

