// js to handle basic functionality

var active = 0;

function setsmile(element, emoticon) {
	document.getElementById(element).value = document.getElementById(element).value + emoticon;
	document.getElementById(element).focus();
}

function showleft(img) {
	document.getElementById('img_left').src = 'styles/images/' + img;
	document.getElementById('img_left').style.display = 'inline';
}

function show(id) {
	document.getElementById('img' + id).style.display = 'block';
}

function showpart(id) {
	if (active != 0) {
		document.getElementById('img' + active).style.display = 'none';
	}
	active = id;
	document.getElementById('img' + id).style.display = 'block';
} 

function hide(id) {
	if (active == 0 || active != id) {
		document.getElementById('img' + id).style.display = 'none';
	}
} 

function showcontent() {
	document.getElementById('main_content').innerHTML = this.req.responseText;
}

function display(url) {
	document.getElementById('img_left').style.display = 'none';
	document.getElementById('img_left').src = '';
	document.getElementById('main_content').innerHTML = '<p class="heading">Lade ...</p>';
	var request = new net.ContentLoader(url, showcontent);
}

window.onload = function() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i = 0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() {
					this.className += " over";
					document.getElementById('img' + this.id.substring(2)).style.display = 'block';
				}
				node.onmouseout = function() {
					this.className = this.className.replace(" over", "");
					if (active == 0 || active != this.id.substring(2)) {
						document.getElementById('img' + this.id.substring(2)).style.display = 'none';
					}
				}
			}
		}
		for (i = 1; i < 6; i++) {
			navSubRoot = document.getElementById("subnav" + i);
			for (a = 0; a < navSubRoot.childNodes.length; a++) {
				node = navSubRoot.childNodes[a];
				if (node.nodeName == "LI") {
					node.onmouseover = function() {
						this.className += " over";
					}
					node.onmouseout = function() {
						this.className = this.className.replace(" over", "");
					}			
				}
			}
		}
	}
}


