
var colorHighlight = "#C8E6F6";
var colorNoHighlight = "white";

var colorToc = "#113666";
var colorTocHighlight = "#c90000";
                
var current;

function init(){
	 current = 0;
	 setBoldCurrent();
}

function contentInit(){
	if (top.index != null){
		top.index.init();
	}
}

function isContentAvailable(){
	if (top.frames["content"] != null){
		initDone = true;
		return true;
	} 
	initDone = false;
	return false;
}

function highlightToc(elem){
		
		var a = elem.getElementsByTagName("a");
		for (var i = 0; i < a.length; i++){
			if (a[i].className.match(/l0/)){
				a[i].style.backgroundImage = "url('../ebImg/img_direktklicks_arrow_on_sportal.gif')";
				a[i].style.backgroundRepeat = "no-repeat";
				a[i].style.backgroundPosition = "3px 3px"; 
			}
			a[i].style.color = colorTocHighlight;
		}

}

function unhighlightToc(elem){
		var a = elem.getElementsByTagName("a");
		for (var i = 0; i < a.length; i++){
			if (a[i].className.match(/l0/)){
				a[i].style.backgroundImage = "url('../ebImg/img_direktklicks_arrow_low_sportal.gif')";
				a[i].style.backgroundRepeat = "no-repeat";
				a[i].style.backgroundPosition = "3px 3px"; 
			}
			a[i].style.color = colorToc;
		}
}

function highlightCToc(elem){
		var elems = elem.getElementsByTagName("a");
		for (var i = 0; i < elems.length; i++){
			elems[i].style.color = colorTocHighlight;
			if (elems[i].className.match(/l0/)){
				elems[i].style.backgroundImage = "url('../ebImg/img_direktklicks_arrow_on_sportal.gif')";
				elems[i].style.backgroundRepeat = "no-repeat";
				elems[i].style.backgroundPosition = "3px 3px"; 
			}
		}
}
function unhighlightCToc(elem){
	if (elem != current){
		var elems = elem.getElementsByTagName("a");
		for (var i = 0; i < elems.length; i++){
			elems[i].style.color = colorToc;
			if (elems[i].className.match(/l0/)){
				elems[i].style.backgroundImage = "url('../ebImg/img_direktklicks_arrow_low_sportal.gif')";
				elems[i].style.backgroundRepeat = "no-repeat";
				elems[i].style.backgroundPosition = "3px 3px"; 
			}
		}
	}
}


function highlight(elem){
	elem.style.backgroundColor = colorHighlight;

}
function unhighlight(elem){
	elem.style.backgroundColor = colorNoHighlight;
}

function setBold(elem){
	if (current){
		unhighlightToc(current);
	}
	var tr = elem;
	while (tr.nodeName != "TR") {
		tr = tr.parentNode;
	}
	current = tr;
	highlightToc(tr);
	top.focus();
	hideOToc(tr);
}

function setBoldPrevious(){
/*
	var iFrame = top.frames["index"];
	if (iFrame.current){
		var prev = iFrame.current.previousSibling;
		while (prev.nodeName != "TR") {
			prev = prev.previousSibling;
		}
		iFrame.setBold(prev);
	}
*/
}

function setBoldNext(){
/*
	var iFrame = top.frames["index"];
	if (iFrame.current){
		var next = iFrame.current.nextSibling;
		while (next.nodeName != "TR") {
			next = next.nextSibling;
		}
		iFrame.setBold(next);
	}
*/
}

function setBoldCurrent(){
		
	var cFrame = top.frames["content"];
	var iFrame = top.frames["index"];
	if (cFrame == null || iFrame == null){
		return;
	}
	if (current){
		unhighlightToc(current);
	}
	var links = iFrame.document.getElementsByTagName("a");
	var loc = (cFrame.location + "").replace(/^.*\//, "");
	var done = false;
	for (var i = 0 ; i < links.length; i++){
		if (links[i].href.replace(/^.*\//, "") == loc){
			highlightToc(links[i].parentNode);
			current = links[i].parentNode.parentNode;
			if (!done){
				hideOToc(links[i].parentNode.parentNode);
			}
			done = true;
		} else {
			unhighlightToc(links[i].parentNode);
		}
	}
	if (!done){
		for (var i = 0 ; i < links.length; i++){
			if (links[i].pathname.replace(/^.*[\/\\]/, "") == loc){
				highlightToc(links[i].parentNode.parentNode); 
				current = links[i];
				if (!done){
					hideOToc(links[i].parentNode.parentNode);
				}
				done = true;
				break;
			}
		}	
	}

}		

function hideOToc(tr){
	var myLevel = tr.className.replace(/l/, "");
	hideOTocBefore(tr.previousSibling, myLevel);
	hideOTocAfter(tr.nextSibling, myLevel, true);
}
function hideOTocBefore(tr, level){
	if (tr != null) {
		if ( tr.nodeType == 1 && tr.className.match(/l[0-9]+/)){
			var myLevel = tr.className.replace(/l/, "");
			if (myLevel > level){
				tr.style.display = "none";
			} else {
			/*table-row is not accepted by IE*/
				tr.style.display = "";
			}
			if (myLevel < level){
				hideOTocBefore(tr.previousSibling, myLevel);
			} else {
				hideOTocBefore(tr.previousSibling, level);
			}
		} else {
			hideOTocBefore(tr.previousSibling, level);
		}
	}
}

function hideOTocAfter(tr, level, ext){
	if (tr != null) {
		if (tr.nodeType == 1 && tr.className.match(/l[0-9]+/)){
			var myLevel = tr.className.replace(/l/, "");
			if (ext && myLevel > level){
				level = myLevel;
			}
			if (myLevel > level){
				tr.style.display = "none";
			} else {
				tr.style.display = "";
			}
			if (myLevel < level){
				hideOTocAfter(tr.nextSibling, myLevel, false);
			} else {
				hideOTocAfter(tr.nextSibling, level, false);
			}
		} else {
			hideOTocAfter(tr.nextSibling, level, ext);
		}
	}
}




	
