var oldStatus = new Array();
function changePic(link, type) {


	var div = link.parentNode.parentNode;
	var overpic;
	if (type == 'over') {
		overpic = (div.id == 'navi_left') ? 'fileadmin/img/navOver_li.gif' : 'fileadmin/img/navOver_re.gif';
	} else if (type == 'hit_li') {
		overpic = 'fileadmin/img/navHit_li.gif';
	} else if (type == 'hit_re') {
		overpic = 'fileadmin/img/navHit_re.gif';
	}
	var bulletsdiv = document.getElementById('bullet').childNodes;
	var bullets = new Array();
	for (var i = 0; i < bulletsdiv.length; i++) {
		if (bulletsdiv[i].tagName == 'IMG') {
			bullets[bullets.length] = bulletsdiv[i];
		}
	}
	var childsdiv = div.childNodes;
	var childs = new Array();
	for (var i = 0; i < childsdiv.length; i++) {
		if (childsdiv[i].tagName == 'LI') {
			childs[childs.length] = childsdiv[i];
		}
	}
	for (var i = 0; i < childs.length; i++) {
		if (childs[i].firstChild == link) {
			if (type == 'out') overpic = oldStatus[i];
			if (type == 'over') oldStatus[i] = bullets[i].src;
			bullets[i].src = overpic;
		}
	}
}
function menuRollOver(link) {
	changePic(link, 'over');
}
function menuRollOut(link) {
	changePic(link, 'out');
}
function menuInit() {
	var divLi = document.getElementById('navi_left');
	var li = divLi.childNodes;
	//alert(div.length);
	for (var i = 0; i < li.length; i++) {
		if (li[i].className == 'hit') {
			changePic(li[i].firstChild, 'hit_li');
			return;
		}
	}
	var div = document.getElementById('navi_right');
	var li = div.childNodes;
	//alert(div.length);
	for (var i = 0; i < li.length; i++) {
		if (li[i].className == 'hit') {
			changePic(li[i].firstChild, 'hit_re');
			return;
		}
	}
}

function popup(link, width, height, specialoptions) {
	if(specialoptions)
		specialoptions=","+specialoptions;
	win = window.open(link.href, 'popup', 'width=' + width + 'px,height=' + height + 'px, scrollbars=yes, resizable=yes' + specialoptions);
	win.focus();
	return false;
}
function imagePopup(image) {
	return popup(image, 10, 10, 'scrollbars=no, resizable=no');
}






function t3prepareLinks() {
	for(var i=0; i < document.links.length; ++i) {
		var link = document.links[i];
		if (link.target.toLowerCase() == 'bild' || link.target.toLowerCase() == 'textbild' || link.target.toLowerCase().substr(0,3) == 'pop') {
			// alert(link.target);
			document.links[i].onclick = new Function("evt", "return t3popup(this, '" + link.target.toLowerCase() + "')"); 
		}
	}
}
var t3popwin;
function t3popup(link, add) {
	var addProps = '';
	if (t3popwin) t3popwin.close();
	if (add == 'textbild') {
		addProps += ',scrollbars=yes,resizable=yes'
	}
	var trenner = "?";
	if (link.href.indexOf("?") > 0) trenner = "&";
	var url = link.href + trenner + "type=" + add;
	t3popwin = window.open(url, "t3popup", "width=10px, height=10px" + addProps);
	t3popwin.focus();
	return false;
}
function t3preparePopup() {
	if (!window.location.search) {
		//alert('noSearch');
		return;
	}
	var type = window.location.search;
	type = type.substr(type.lastIndexOf('=')+1);
	if (!type) {
		alert('noType');
		return;
	}
	if (type.substr(0,3) == 'pop') {
		width= type.substring(3, type.indexOf('x'));
		height= type.substring(type.indexOf('x') + 1);
		//alert(width + " ---- " + height);
		resizeTo(width, height);
		return;
	}
	var width = document.getElementsByTagName('img')[0].width;
	var height = document.getElementsByTagName('img')[0].height;
	if (type == 'textbild') {
		width += 28;
		height += 165;
	} else {
		width += 9;
		height += 80;
		//t3removeDiv('popuptext');
	}
	resizeTo(width, height);

}
function t3removeDiv(id) {
	document.body.removeChild(document.getElementById(id));
}