// self.focus();

function openWindow(fileName, windowName, theWidth, theHeight, theScrollbars,
		theResizable) {
	windowName = window.open(fileName, windowName,
			"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="
					+ theScrollbars + ",resizable=" + theResizable + ",width="
					+ theWidth + ",height=" + theHeight)
}

function closeWindow() {
	opener.location.reload();
	self.close()
}

function runClock(timeleft) {
	timeleft = timeleft - 1;
	if (timeleft > 0)
		theTime = window.setTimeout("runClock(" + timeleft + ")", 1000);
	minleft = Math.floor(timeleft / 60);
	secleft = timeleft % 60;
	if (secleft < 10)
		secleft = '0' + secleft;
	var display = 'ViLI: Ohne Aktivität endet Ihre Sitzung in ' + minleft + ':'
			+ secleft + ' Minuten';
	if (timeleft == 0) {
		display = 'ViLI: Ihre Sitzung ist abgelaufen.';
		window
				.setTimeout(
						"openWindow('sessionover.php','sessioninfo',500,500,0,1)",
						8000); // warten, damit auch die PHP-Session sicher
								// ablaufen kann.
	}
	status = display;
}


function toggleDisplay(ListID) {
	if (document.getElementById) {
		var stylenew = document.getElementById(ListID).style;
		if (stylenew.display == "none" || stylenew.display == "" || stylenew.display != "block") {
			stylenew.display = "block";
		} else
			stylenew.display = "none";

	} else if (document.all) {
		// old ms
		var stylenew = document.all[ListID].style;
		if (stylenew.display == "none")
			stylenew.display = "block";
		else
			stylenew.display = "none";
	} else if (document.layers) {
		// old netscape
		var stylenew = document.layers[ListID].style;
		if (stylenew.display == "none")
			stylenew.display = "block";
		else
			stylenew.display = "none";
	}
}


function show(ListID) {
	if (document.getElementById) {
		var stylenew = document.getElementById(ListID).style;
		stylenew.display = "block";
	} else if (document.all) {
		// old ms
		var stylenew = document.all[ListID].style;
		stylenew.display = "block";

	} else if (document.layers) {
		// old netscape
		var stylenew = document.layers[ListID].style;
		stylenew.display = "block";

	}
}

function addTag(tag) {
	if (document.forms[0].tags.value == "") {
		document.forms[0].tags.value = tag;
	} else {
		document.forms[0].tags.value += ", " + tag;
	}
}

function addTagtoField(tag, field) {
	if (document.getElementById(field).value == "") {
		document.getElementById(field).value = tag;
	} else {
		document.getElementById(field).value += ", " + tag;
	}
}
