function changeClassOver(obj, classNameOver, classNameOut)
{
	if(obj.className.indexOf(classNameOver)>=0)
		obj.className = obj.className.replace(classNameOver, classNameOut)
}

function changeClassOut(obj, classNameOver, classNameOut)
{
	if(obj.className.indexOf(classNameOut)>=0)
		obj.className = obj.className.replace(classNameOut, classNameOver)
}

function findPos(obj) {
	var curleft = curtop = 0;
	var curwidth = curheigt = 0;
	
	curwidth = obj.offsetWidth;
	curheight = obj.offsetHeight;
	
	//alert(obj.offsetParent.offsetLeft)
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		curwidth = obj.offsetWidth;
		curheight = obj.offsetHeight;
		while (obj = obj.offsetParent) 
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	//top, right, bottom, left
	return [curtop, (curleft+curwidth), (curtop+curheight), curleft];
}

function showImage(index)
{
	oParent = document.getElementById('shadow'+index);
	oImg = document.getElementById('image'+index);
	
	pos = findPos(oParent)
	height = pos[0]-365;
	if(height>=0)
	{
		oImg.className = "imageBig";
		oImg.style.top = height+"px"
	}
	else
	{
		oImg.className = "imageBigDown";
		oImg.style.top = pos[0]+45+"px";
	}
	
	oImg.style.left = pos[3]+"px";
	oImg.style.display = "block";
}

function hideImage(index)
{
	img = document.getElementById('image'+index);
	img.style.display = "none";
}

function toggleFolder(obj, objForChild, imgUrl)
{
	displayStyle = openChilds(obj.parentNode);
	
	child = objForChild.firstChild;
	plusUrl = imgUrl+'plus.gif';
	minusUrl = imgUrl+'minus.gif';
	//change the image
	if(displayStyle=='none')
	{
		child.alt = objForChild.title = "\xF6ffnen";
		window.setTimeout("setImageSrc(child, plusUrl)",200);
		if(objForChild.parentNode.className == "siteMapItemActive")
			objForChild.parentNode.className = "siteMapItem"
		
	}
	else
	{
		child.alt = objForChild.title = "schli\xDFen";
		window.setTimeout("setImageSrc(child, minusUrl)",200);
		if(objForChild.parentNode.className == "siteMapItem")
			objForChild.parentNode.className = "siteMapItemActive"
	}
}

function setImageSrc(obj, val)
{
	obj.src = val;
}

function openChilds(obj)
{
	//obj is parent
	//oImg is clicked image	
	toggleCheck = false;
	//default
	displayStyle = 'none';
	
	for(i=0; i<obj.childNodes.length; i++)
	{
		if(obj.childNodes[i].nodeName=='DIV')
		{
			if(!toggleCheck)
			{//check which style does first node have 

				if( obj.childNodes[i].style.display=='' || obj.childNodes[i].style.display == 'none' ) 
				{//inverse if is same as default
					displayStyle = 'block';
				}
				toggleCheck=true;
			}
			obj.childNodes[i].style.display = displayStyle;
		}
	}
	return displayStyle;
}

