var pictures = new Array('lg_branche', 'lg_friends', 'lg_immo', 'lg_search', 'lg_umzug');
var myimages = new Array();
for ( var i = 0; i < pictures.length; i++) {
	myimages[i] = new Image();
	myimages[i].src = "assets/img/" + pictures[i] + ".gif";
}
function show(showOnlyID, fatherID) {
	var ELEMENT_NODE = 1;
	var fatherRef = document.getElementById(fatherID);
	for (i = 0; i < fatherRef.childNodes.length; i++)
		if (fatherRef.childNodes[i].nodeType == ELEMENT_NODE)
			fatherRef.childNodes[i].style.display = "none";
	document.getElementById(showOnlyID).style.display = "block";
}
function movep(id_name, img_src) {
	var ref = document.getElementById(id_name);
	ref.style.background = 'url(\'' + img_src + '\') no-repeat 0 12px';
}
function initHide() {
	show('allgemein', 'info');
}
function popupWindows() {
	if (!document.getElementsByTagName) {
		return;
	}
	var scrW = screen.availWidth;
	var scrH = screen.availHeight;
	var anchors = document.getElementsByTagName("a");
	for ( var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		var linkDest = anchor.getAttribute("href");

		var relIndex = anchor.getAttribute("rel");
		if (relIndex) {
			var relSplit = relIndex.split("|");
		} else {
			var relSplit = '';
		}
		var windowAttributes = "";
		if (relSplit[0] == "popup") {
			if (relSplit[1] > scrW) {
				pW = scrW - 10;
			} else {
				pW = relSplit[1];
			}
			if (relSplit[2] > scrH) {
				pH = scrH - 40;
			} else {
				pH = relSplit[2];
			}
			scrX = (scrW - pW - 10) * .5;
			scrY = (scrH - pH - 30) * .5;
			var windowAttributes = "width=" + pW + ",height=" + pH + ",left=" + scrX + ",top=" + scrY + ",screenX=" + scrX + ",screenY=" + scrY;
			windowAttributes += ",location=" + relSplit[4] + ",resizable=" + relSplit[4] + ",scrollbars=" + relSplit[4];
			anchor.setAttribute("href", "javascript:popupWin('" + linkDest + "','" + windowAttributes + "')");
		}
	}
}
function initialize() {
	popupWindows();
}
window.onload = initialize;
