var subContent = "";
var subContent2 = "";
var subContent3 = "";
var prevLink = "";
var prevLink2 = "";
var txtLActiveColor = "#FFFFFF";
var txtLActiveWeight = "bold";

var tickerTime = 10000; // INTERVALLZEIT, WIE LANGE EINE TICKERNACHRICHT STEHEN BLEIBT (1000 sek);
var actBox = 0;
function swapTicker () {

	$('#ticker'+actBox+'').fadeOut(3000);
	if (document.getElementById("ticker" + (actBox + 1)) == null) {
		$('#ticker0').fadeIn('slow');
		actBox = 0;
	} else {
		$('#ticker'+(actBox + 1)+'').fadeIn(3000);
		actBox += 1;
	}
	//console.log(actBox);
}
var tickerTimer = window.setInterval(swapTicker, tickerTime);

function hideMainContent () {
	contentArray = new Array("content1", "content2", "content3", "content4", "content5", "content6", "impressum");
	if (subContent != "") { document.getElementById(subContent).style.display = "none"; document.getElementById(subContent + "link").style.background = "url(images/icon_" + subContent + ".gif) 0 0"; }
	for (var i = 0; i < contentArray.length; i++) {
		document.getElementById(contentArray[i]).style.height = "0px";
		document.getElementById(contentArray[i]).style.display = "none";
	}
	
}
function swapContent (obj, cHeight) {
	hideMainContent();
	subContent = "";
	document.getElementById("si1").style.display = "none";
	document.getElementById("si2").style.display = "none";
	if (document.getElementById(obj) != "") {
		if(cHeight != undefined) {
			document.getElementById(obj).style.height = cHeight + 'px';
		} else {
			document.getElementById(obj).style.height = "auto";
		}
		document.getElementById(obj).style.display = "block";
	}
	//alert(actContent);
}

function hideContent () { //(hObj, hObj2, hObj3) {
	
	//if (hObj != subContent) {
		if (subContent != "") {
			var linkObj = subContent + "link";
			document.getElementById(subContent).style.display = "none";
			document.getElementById(linkObj).style.background = "url(images/icon_" + subContent + ".gif) 0 0";
		}
	//}
	//if (hObj2 != subContent2) {
		if (subContent2 != "") {
			document.getElementById(subContent2).style.display = "none";
		}
	//}
	//if (hObj3 != subContent3) {
		if (subContent3 != "") {
			document.getElementById(subContent3).style.display = "none";
		}
	//}
}
function showContent (obj, obj2, obj3) {
	hideContent(); //(obj, obj2, obj3);
	document.getElementById("si1").style.display = "block";
	document.getElementById("si2").style.display = "block";
	var linkObj = obj + "link";
	//document.location.href = "#abgetaucht";
	//window.location.hash = "abgetaucht";
	document.getElementById(obj).style.display = "block";
	document.getElementById(linkObj).style.background = "url(images/icon_" + obj + ".gif) 160px 0";
	subContent = obj;
	if (obj2 != undefined) {
		document.getElementById(obj2).style.display = "block";
		subContent2 = obj2;
	}
	if (obj3 != undefined) {
		document.getElementById(obj3).style.display = "block";
		subContent3 = obj3;
	}
}

function resetLink() {
	if (prevLink != "") {
		document.getElementById(prevLink).style.color = "#CECECE";
		document.getElementById(prevLink).style.fontWeight = "normal";
	}
	if (prevLink2 != "") {
		document.getElementById(prevLink2).style.color = "#CECECE";
		document.getElementById(prevLink2).style.fontWeight = "normal";
	}
}
function setActive(link, link2) {
	resetLink();
	if ((link != undefined)&&(link != "")) {
		document.getElementById(link).style.color = txtLActiveColor;
		document.getElementById(link).style.fontWeight = txtLActiveWeight;
		prevLink = link;
	}
	if ((link2 != undefined)&&(link != "")) {
		document.getElementById(link2).style.color = txtLActiveColor;
		document.getElementById(link2).style.fontWeight = txtLActiveWeight;
		prevLink2 = link2;
	}
	
}

function winOpen(theURL,winName,breite,hoehe) {
  links = (screen.width/2)-(breite/2);
  oben = (screen.height/2)-(hoehe/2);
  window.open(theURL,winName,"height="+hoehe+",width="+breite+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars = yes,fullscreen = no,top ="+oben+",left ="+links);
}
