// <!--

// Frameset controls

if (self.location.host.indexOf('test') >= 0 || self.location.host.indexOf('turix') >= 0) {
	var WEB_URL = 'http://'+self.location.host+'/dalenades/';
} else if (self.location.href.indexOf('/_test') >= 0) {
	var WEB_URL = 'http://'+self.location.host+'/_test/';
} else {
	var WEB_URL = 'http://'+self.location.host+'/';
}

var tFrames;
function setFrameVars() {
	if (parent.frames.length == 0 || (parent.frames.length > 0 && !parent.frames['navigation'])) {
		return false;
	} else {
		tFrames = top.frames;
		return true;
	}
}
function loadFrameset() {
	if (!setFrameVars()) {
		if (typeof(window['loadFrameSimple']) != 'undefined') {
			top.document.location.replace(WEB_URL+'index.html');
		} else {
			top.document.location.replace(WEB_URL+'?main='+escape(self.location.href));
		}
	}
}
loadFrameset();

// Sub navigation (onload function in pages)

function setSubNavigation(area) {
//	alert(self.name);
	if (top.frames['navigation_sub'].loaded) top.frames['navigation_sub'].setSubNaviActive(area);
//	if (parent.frames['navigation_sub']) parent.frames['navigation_sub'].setNavi();
	return area;
}

function setSubNaviActive(area) {
	var mainFrame = parent.frames['main'].location.href;
	if (mainFrame.indexOf('about/') >= 0) {
		var hasImg = false;
		if (document.getElementById('img_'+area)) {
			hasImg = true;
			var theImg = document.getElementById('img_'+area);
		}
		if (hasImg) {
			if (mainFrame.indexOf('about/statuten.htm') >= 0) {
				theImg.src = WEB_URL+'about/pix/img_statuten_2.jpg';
			} else if (mainFrame.indexOf('about/vorstand.htm') >= 0) {
				theImg.src = WEB_URL+'about/pix/gruender.jpg';
			} else if (mainFrame.indexOf('about/anmeldung.htm') >= 0) {
				theImg.src = WEB_URL+'about/pix/img_anmeldung.jpg';
			} else if (mainFrame.indexOf('about/beitrag.htm') >= 0) {
				theImg.src = WEB_URL+'about/pix/img_beitraege.jpg';
			} else if (mainFrame.indexOf('about/') >= 0) {
				theImg.src = WEB_URL+'about/pix/img_about.jpg';
			}
		}
	}
	var DIVs = document.getElementsByTagName('div');
	if (DIVs.length > 0) {
		for (i=0; i<DIVs.length; i++) {
			DIVs[i].style.visibility = 'hidden';
		}
	}
	if (document.getElementById(area)) {
		var active_div = document.getElementById(area);
		active_div.style.visibility = 'visible';
	}
}

// Popup window
function openWindow(url, name, breite, hoehe, scrollbar) {
	posH = ((screen.width - breite) / 2)
	posV = ((screen.height - hoehe) / 2)

	popUp = window.open(url, name, "toolbar=no,menubar=no,statusbar=no,resizable=yes,scrollbars=" + scrollbar + ",width=" + breite + ",height=" + hoehe + ",left=" + posH + ",top=" + posV);
	popUp.focus();	
}
// -->