// ################################################################################
// Abfragen etc. 
// ################################################################################

var loaded = 0;

// ##################################################
// Inhalte für Browser < 4 unsichtbar machen
// ##################################################

// NS4 = (document.layers)? true:false
// IE4 = (document.all)? true:false

// if (!NS4 && !IE4) { this.location.href = "index_old.htm"; }

// ##################################################
// Verzeichnisse auslesen
// ##################################################

var href = document.location.href;
var verzeichnis = href.split("/");

// ##################################################
// für Netscape: Flash vorhanden?
// ##################################################
// wenn ja: Variable "FlashMode" = 1, sonst 0
// ##################################################

FlashMode = 0;
if (navigator.appName == "Netscape" && navigator.plugins)
{
	numPlugins = navigator.plugins.length;
	if (numPlugins > 0) 
	{
		for (i = 0; i < numPlugins; i++)
		{
			plugin = navigator.plugins[i];
			if (plugin.description.indexOf("Flash 3") != -1 || plugin.description.indexOf("Flash 4") != -1)
			{
				numTypes = plugin.length;
				for (j = 0; j < numTypes; j++) 
				{
					mimetype = plugin[j];
					if (mimetype)
					{     
						if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf("swf") != -1)) FlashMode = 1;
						if (navigator.mimeTypes["application/x-shockwave-flash"] == null) FlashMode = 0;
					}
				}
			}
		}
	}
}

// ################################################################################
// Funktionen
// ################################################################################

// ##################################################
// Druckversion
// ##################################################

/* function Druckversion(id)
{
	druckversion_url = "index.php3?id=" + id + "&druckversion=1";
	var printWin = window.open( druckversion_url,'Print','width=620,height=400,scrollbars,menubar,toolbar=no,location=no,status,resizable');
}*/

function Druckversion(id)
{
// neue Funktion für die Druckversion: 
// Uebergabe der Datenbank-Parameter funktioniert jetzt auch
	handle = document.location.href;
	handle1 = handle.indexOf('?');

	if (handle1 == -1) { handle2 = "?id=main"; }
		else { handle2 = handle.substring(handle1,handle.length); }
		
	druckversion_url = "index.php3" + handle2 + "&druckversion=1";
	var printWin = window.open( druckversion_url,'Print','width=620,height=400,scrollbars,menubar,toolbar=no,location=no,status,resizable');
}


// ##################################################
// neues Fenster öffnen
// ##################################################

function neuesFenster( url, width, height, options, name )
{
	if (!width) width = 475;
	if (!height) height = 250;
	if (!options) options = "scrollbars=yes,menubar=yes,toolbar=no,location=no,status=yes,resizable=yes";
	if (!name) name = "BKK_Fenster";
	var newWin = window.open( url, name, "width=" + width + ",height=" + height + "," + options );
}

// ##################################################
// URL-Wechsler über SELECT-Feld
// ##################################################
// Formular muss "formular" und SELECT muss "url" heissen
// ##################################################

function changeURL(datei,formularname)
{
	if (!datei) datei = ''; // Dateinamen initialisieren
	if (!formularname) formularname = "formular"; // Standard-Formularnamen setzen
	nr = document[formularname].url.selectedIndex; // gewaehlten Index abfragen
	wohin = document[formularname].url.options[nr].value; // Value dieses Index abfragen
	
	if (wohin != "") // wenn eine URL im Value steht ...
	{
		this.location.href = datei + wohin; // ... dann zur gewählten URL wechseln
	}
}

// ##################################################
// RollOver 
// ##################################################

if (!high) { var high = 0; }
// Sollen die Bilder nach dem Anklicken aktiv bleiben?
// 0 = nein
// 1 = ja
// -> wird auf 0 gesetzt, wenn in HTML keine andere Angabe erfolgt ist

if (!aktiv_bleiben) { var aktiv_bleiben = 0; }
// Nummer des Bildes, das zuerst aktiv sein soll
// muss im HTML-Text auf ON stehen!
// 0 = kein Bild aktiv
// -> wird auf 0 gesetzt, wenn in HTML keine andere Angabe erfolgt ist

function rollover(name,welches,an)
{
	if ((document.layers) || (document.all))
	{	
		if (an) { document[name+welches].src = eval("on_" + name + welches + ".src"); }
		else { if (high != welches) { document[name+welches].src = eval("off_" + name + welches + ".src"); } }
	}
}

function rollover_merken(welches)
{
	if (aktiv_bleiben)
	{
		if ((high != welches) && (high != 0)) { document[name + high].src = eval("off_" + high + ".src"); }
		high = welches;
	}
}

// ##################################################
// Popup-Felder
// ##################################################
// Funktion generiert dynamische Layer, die in HTML
// engeblendet werden koennen
// ##################################################

dhtmlPopped = false;
var PopupTimer;
var lastPopup;

function Popup(PopupName) 
{
	if (loaded)
	{
		if (lastPopup) closePopup(lastPopup);
		if (document.layers) 
			{ thePopup = document.layers[PopupName]; } 
		else 
			{ thePopup = document.all.tags("DIV")[PopupName].style; }
	
		thePopup.visibility = 'visible';
		dhtmlPopped = true;
		lastPopup = PopupName;
	}
}

function closePopup(PopupName) 
{
	if (loaded) 
	{
		if (document.layers) 
			{ thePopup = document.layers[PopupName]; } 
		else 
			{ thePopup = document.all.tags("DIV")[PopupName].style; }
	
		thePopup.visibility = 'hidden';
		dhtmlPopped = false;
	}
}

function setPopupTimer(PopupName) 
{
	if (loaded) 
	{
		PopupTimer = setTimeout('closePopup("' + PopupName + '")',10);
	}
}

function makePopupLayer(layertop,layerleft,layername) 
{
	if (document.layers) 
		{ document.writeln('<LAYER NAME="' + layername + '" TOP=' + layertop + ' LEFT=' + layerleft + '  VISIBILITY="hidden" ONMOUSEOVER="clearTimeout(PopupTimer)" ONMOUSEOUT=setPopupTimer("' + layername + '");>'); } 
	else 
		{ document.writeln('<DIV ID="' + layername + '" STYLE="position:absolute; top:' + layertop + '; left: ' + layerleft + '; z-index:20; visibility:hidden;" ONMOUSEOVER="clearTimeout(PopupTimer);" ONMOUSEOUT=setPopupTimer("' + layername + '");>'); }
}

// ##################################################