<!--
// Script bausteine.pl
var popupwindow = 0;

function open_popup(baustein, kategorie, detail, readonly, bausteinwert) {

//alert("baustein: "+baustein+"  kategorie: "+kategorie+"  detail: "+detail+"  readonly: "+readonly+"  bausteinwert: " + bausteinwert);
	var width = 500;
	if ((kategorie != '') || (detail != ''))
		width = 500;

	// window öffnen
	popupwindow = window.open("detail.pl?baustein="+baustein+"&kategorie="+kategorie+"&detail="+detail+"&readonly="+readonly+"&bausteinwert="+bausteinwert,baustein+kategorie+detail,"width="+width+",height=400, toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes");
}

function open_first_popup(baustein, kategorie, detail, readonly) {
	if (!check_consistency(baustein)) {
		alert("Innerhalb einer Liste kann nur ein Listenpunkt eingefügt werden!");
		return;
	}
	topwindow = opener;
	
	var width = 500;
	if ((kategorie != '') || (detail != ''))
		width = 500;
	//alert("open_popup: "+baustein+" kat: "+kategorie+" det: "+detail);
	// window öffnen
	window.open("detail.pl?baustein="+baustein+"&kategorie="+kategorie+"&detail="+detail+"&readonly="+readonly,baustein+kategorie+detail,"width="+width+",height=400, toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes");
}

function get_details(neu, typ) {
	if (typ == "publikation") {
		var result = neu + "::" + ((document.publikation_form.cover.checked) ? "1" : "0");
		result += "::" + document.publikation_form.alternativtext.value;
		return result;
	}
	if (typ == "zeitschrift") {
		var result = neu + "::" + ((document.zeitschrift_form.cover.checked) ? "1" : "0");
		result += "::" + document.zeitschrift_form.alternativtext.value;
		return result;
	}
	if (typ == "bild") {
		var result = neu + "::" + ((document.bild_form.rahmen.checked) ? "1" : "0");
		result += "::" + ((document.bild_form.alleine.checked) ? "1" : "0");
		result += "::" + document.bild_form.ausrichtung.options[document.bild_form.ausrichtung.selectedIndex].value;
		result += "::" + document.bild_form.size.value;
		result += "::" + document.bild_form.alternativtext.value;
		return result;
	}
	if (typ == "wwwlink") {
		return neu + "::" + document.wwwlink_form.alternativtext.value;
	}
	if (typ == "contentlink") {
		return neu + "::" + document.contentlink_form.alternativtext.value;
	}
	if (typ == "methode") {
		return neu + "::" + document.methode_form.alternativtext.value;
	}
	if (typ == "tatenbank") {
		return neu + "::" + document.tatenbank_form.alternativtext.value;
	}
	if (typ == "download") {
		return neu + "::" + document.download_form.alternativtext.value;
	}
	if (typ == "literatur") {
		return neu + "::" + document.literatur_form.alternativtext.value;
	}
	if (typ == "veranst") {
		return neu + "::" + document.veranst_form.alternativtext.value;
	}
	if (typ == "artikel") {
		return neu + "::" + document.artikel_form.alternativtext.value;
	}
}

function replace_baustein(alt, neu) {
	topwindow = opener;
//	alert("neu: " + neu);

	topwindow.top.inhalt.formular.aktion.value = "ersetzen";
	topwindow.top.inhalt.formular.baustein.value = neu;
	topwindow.top.inhalt.formular.replace.value = alt;
//	alert("alt: " + alt);
	topwindow.top.inhalt.formular.submit();
	
	window.close();
}

function close_popup(baustein, level, replacebaustein) {

	if (level == 1) {
		topwindow = opener;
	}
	if (level == 2) {
		topwindow = opener.opener;
		opener.close();
	}
	if (level == 3) {
		topwindow = opener.opener.opener;
		opener.opener.close();
		opener.close();
	}
	if (!replacebaustein) {
		topwindow.top.inhalt.formular.ausrichtung.value = (topwindow.top.rechts.formular.ausrichtung[0].checked) ? "darüber" : "darunter";
		topwindow.top.inhalt.formular.aktion.value = "speichern";
		topwindow.top.inhalt.formular.baustein.value = baustein;
	}
	else {
		topwindow.top.inhalt.formular.aktion.value = "ersetzen";
		topwindow.top.inhalt.formular.replace.value = replacebaustein;
		topwindow.top.inhalt.formular.baustein.value = baustein;
	}
	topwindow.top.inhalt.formular.submit();
	
	if (popupwindow != 0) {
		popupwindow.close();
	}

	window.close();
}

function close_popup_bild(baustein, level, replacebaustein) {
	
	if (replacebaustein) {
		baustein = get_details(baustein, "bild");
	}
	else {
		baustein = "bild|"+baustein;
		baustein += "::"+((document.bild_form.rahmen.checked) ? "1" : "0");
		baustein += "::"+((document.bild_form.alleine.checked) ? "1" : "0");
		baustein += "::"+document.bild_form.ausrichtung.value;
		baustein += "::"+document.bild_form.size.value;
		baustein += "::"+document.bild_form.alternativtext.value;
	}
	
	close_popup(baustein, level, replacebaustein);
}

function close_popup_publikation(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "publikation");
	}
	else {
		baustein = "publikation|"+baustein;
		baustein += "::"+((document.publikation_form.cover.checked) ? "1" : "0");
		baustein += "::"+document.publikation_form.alternativtext.value;
	}
	
	close_popup(baustein, level, replacebaustein);
}

function close_popup_zeitschrift(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "zeitschrift");
	}
	else {
		baustein = "zeitschrift|"+baustein;
		baustein += "::"+((document.zeitschrift_form.cover.checked) ? "1" : "0");
		baustein += "::"+document.zeitschrift_form.alternativtext.value;
	}
	
	close_popup(baustein, level, replacebaustein);
}

function close_popup_wwwlink(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "wwwlink");
	}
	else {
		baustein = "wwwlink|"+baustein;
		baustein += "::"+document.wwwlink_form.alternativtext.value;
	}
	
	close_popup(baustein, level, replacebaustein);
}


function close_popup_artikel(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "artikel");
	}
	else {
		baustein = "artikel|"+baustein;
		baustein += "::"+document.artikel_form.alternativtext.value;
	}
	
	close_popup(baustein, level, replacebaustein);
}

function close_popup_contentlink(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "contentlink");
	}
	else {
		baustein = "contentlink|"+baustein;
		baustein += "::"+document.contentlink_form.alternativtext.value;
	}

	close_popup(baustein, level, replacebaustein);
}

function close_popup_methode(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "methode");
	}
	else {
		baustein = "methode|"+baustein;
		baustein += "::"+document.methode_form.alternativtext.value;
	}

	close_popup(baustein, level, replacebaustein);
}

function close_popup_tatenbank(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "tatenbank");
	}
	else {
		baustein = "tatenbank|"+baustein;
		baustein += "::"+document.tatenbank_form.alternativtext.value;
	}

	close_popup(baustein, level, replacebaustein);
}


function close_popup_download(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "download");
	}
	else {
		baustein = "download|"+baustein;
		baustein += "::"+document.download_form.alternativtext.value;
	}

	close_popup(baustein, level, replacebaustein);
}

function close_popup_literatur(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "literatur");
	}
	else {
		baustein = "literatur|"+baustein;
		baustein += "::"+document.literatur_form.alternativtext.value;
	}

	close_popup(baustein, level, replacebaustein);
}

function close_popup_veranst(baustein, level, replacebaustein) {

	if (replacebaustein) {
		baustein = get_details(baustein, "veranst");
	}
	else {
		baustein = "veranst|"+baustein;
		baustein += "::"+document.veranst_form.alternativtext.value;
	}

	close_popup(baustein, level, replacebaustein);
}



function close_popup_autofill_normal(liste, kategorie, linksnav_id) {
	topwindow = opener;
	
	topwindow.top.inhalt.formular.aktion.value = "topergaenzen";
	topwindow.top.inhalt.formular.liste.value = liste;
//	alert("linksnav_id: " + linksnav_id);

	topwindow.top.inhalt.formular.elements[linksnav_id].value = liste + "|" + kategorie;
	topwindow.top.inhalt.formular.submit();
	
	if (popupwindow != 0) {
		popupwindow.close();
	}

	window.close();
}

function close_popup_autofill_spezial() {
	topwindow = opener;
	
	topwindow.top.inhalt.formular.aktion.value = "topergaenzen";

	var liste=document.form_spezial.elements['liste'].value;
	var stichworte=document.form_spezial.elements['stichworte'].value;
	var linksnav_id=document.form_spezial.elements['linksnav_id'].value;
	
	topwindow.top.inhalt.formular.elements[linksnav_id].value = liste + "|" + stichworte;
	topwindow.top.inhalt.formular.submit();
	
	if (popupwindow != 0) {
		popupwindow.close();
	}

	window.close();
}

// Popupfenster für Thema aktuell, Schwerpunkte
function open_popup_sonderseiten(kategorie) {

//alert("baustein: "+baustein+"  kategorie: "+kategorie+"  detail: "+detail+"  readonly: "+readonly+"  bausteinwert: " + bausteinwert);
	var width = 500;
	if ((kategorie != '') || (detail != ''))
		width = 500;

	// window öffnen
	popupwindow = window.open("detail.pl?baustein="+baustein+"&kategorie="+kategorie+"&detail="+detail+"&readonly="+readonly+"&bausteinwert="+bausteinwert,baustein+kategorie+detail,"width="+width+",height=400, toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes");
}

function open_first_popup_sonderseiten(kategorie) {
	topwindow = opener;
	
	var width = 500;
	if ((kategorie != '') || (detail != ''))
		width = 500;
	//alert("open_popup: "+baustein+" kat: "+kategorie+" det: "+detail);
	// window öffnen
	window.open("detail.pl?baustein="+baustein+"&kategorie="+kategorie+"&detail="+detail+"&readonly="+readonly,baustein+kategorie+detail,"width="+width+",height=400, toolbar=no,status=yes,location=no,menubar=no,scrollbars=yes");
}


function send_form(neu) {
	if (neu != "speichern" && neu != "beenden") {
		if (!check_consistency(neu)) {
			alert("Innerhalb einer Liste kann nur ein Listenpunkt eingefügt werden!");
		return;
		}
	}
	if (neu == "speichern")	{
		parent.inhalt.document.formular.speichern.value = "1";
	}
	else {
		parent.inhalt.document.formular.speichern.value = "0";
	}

	if (neu == "titel") {
		neu = (parent.rechts.document.formular.titel_art[0].checked) ? "titel" : "titel2";
	}
	//alert("send_form "+neu+" --- "+parent.inhalt.formular.contentid.value);
	parent.inhalt.document.formular.ausrichtung.value = (parent.rechts.document.formular.ausrichtung[0].checked) ? "darüber" : "darunter";
	parent.inhalt.document.formular.aktion.value = "speichern";
	parent.inhalt.document.formular.baustein.value = neu;
	if (neu == "beenden") {
		var beenden = 1;
		if (parent.inhalt.document.formular.titel_1.value == "") {
			var entscheidung = confirm('\nACHTUNG!\n\nSolange kein Titel angegeben wird, wird der Eintrag nicht akzeptiert.\n\nBereits gespeicherte Einträge werden gelöscht!');
			var auswahl = parent.inhalt.document.formular.auswahl.value;
			if (entscheidung == true) {
				var url = "http://www.umweltbildung.at/cgi-bin/cms/text.pl?aktion=speichern&beenden=1&titel_1=&auswahl=" + auswahl;
				parent.inhalt.location.href=url;
			}
			else {
				return;
			}
		}
	}
	else {
		var beenden = 0;
	}

	parent.inhalt.document.formular.beenden.value = beenden;
	parent.inhalt.document.formular.submit();
}



function liste_check(liste_name) {
	var check = 0; 
	var reg = "lizp";
	
	for (var i=0; i<parent.inhalt.document.formular.elements.length; i++) {
		if (parent.inhalt.document.formular.elements[i].name == liste_name.name) {
			if (parent.inhalt.document.formular.elements[i].checked == true) {
				check = 1;
			}
			
			for (var j=i+1; j<parent.inhalt.document.formular.elements.length; j+=2) {
				if (parent.inhalt.document.formular.elements[j].name.substring(0,4) == reg) {
					if (check == 1) {
						parent.inhalt.document.formular.elements[j].checked = true;
					}
					else {
						parent.inhalt.document.formular.elements[j].checked = false;
					}
				}
				else {
					break;
				}
			}
			break;
		}
	}
}




function check_consistency(neu) {
	var focuswert = getfocus();
	var reg = /lizp/;
	if (!reg.exec(focuswert) || neu.substring(0,4) == "lizp") {
		return true;
	}
	var newpos = (parent.rechts.document.formular.ausrichtung[0].checked) ? -2 : 2;
	
	for (var i=0; i<parent.inhalt.document.formular.elements.length; i+=2) {
		//alert(i + ": " +parent.inhalt.formular.elements[i].name);
		if (parent.inhalt.document.formular.elements[i].name == focuswert) {
			if (i<parent.inhalt.document.formular.elements.length-1 && 
				parent.inhalt.document.formular.elements[i+newpos].name.substring(0,4) == "lizp") {
				return false;
			}
			if (parent.rechts.document.formular.ausrichtung[0].checked) {
				setfocus(parent.inhalt.document.formular.elements[i-3].name);
				parent.rechts.document.formular.ausrichtung[0].checked = false;
			}
		}
	}
	return true;
}

function loeschen() {
	var bestaetigung = confirm("\n              Achtung!\n\n" + "Nicht gespeicherte Daten gehen verloren!\n\n" + "Zum Speichern den Button 'Speichern' drücken!");
	if (bestaetigung == true) {
		var number = parent.inhalt.document.formular.elements.length;
		var uebergabe, feldname;
		var contentid=parent.inhalt.document.formular.elements['contentid'].value;
		var auswahl=parent.inhalt.document.formular.elements['auswahl'].value;
		var uebergabe = "";
		for (var i=0; i<number; i++) { 
			feldname=parent.inhalt.document.formular.elements[i].name;
			var reg = /loeschen/;
			if (reg.exec(feldname)) {
				if (parent.inhalt.document.formular.elements[i].checked) {
					uebergabe += feldname + "=1" + "&";
				}
			}
		}
		var x, uebergabestring;
		x = uebergabe.length;
		x = x - 1;
		uebergabestring = uebergabe.substring(0,x);
		var url = "http://www.umweltbildung.at/cgi-bin/cms/text.pl?aktion=loeschen&contentid=" + contentid + "&auswahl=" + auswahl + "&" + uebergabestring;
		parent.inhalt.location.href= url;
	}
}


// Script allgsubs.pl
function MM_reloadPage(init) {
//reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

// Script diverse
function fenster(URL, breite, hoehe) {
	topwindow = opener;
	F1 = window.open(URL, "Popup", "width=" + breite + ",height=" + hoehe + ",menubar=no,status=no,resizable=no,scrollbars=yes,locationbar=no,dependent=yes");
	F1.focus();
}

function fenster1(URL, breite, hoehe) {
	topwindow = opener;
	F1 = window.open(URL, "Popup", "width=" + breite + ",height=" + hoehe + ",menubar=no,status=no,resizable=no,scrollbars=yes,locationbar=no,dependent=yes");
	F1.focus();
}

function fenster_ohne_scroll(URL, breite, hoehe) {
	topwindow = opener;
	F1 = window.open(URL, "Popup", "width=" + breite + ",height=" + hoehe + ",menubar=no,status=no,resizable=no,scrollbars=no,locationbar=no,dependent=yes");
	F1.focus();
}


function fenster_vorschau() {
	topwindow = opener;
	var contentid=parent.inhalt.document.formular.elements['contentid'].value;
	var url = "http://www.umweltbildung.at/cgi-bin/cms/vorschau.pl?contentid=" + contentid;
	F1 = window.open(url, "Popup", "width=700,height=600,menubar=no,status=yes,resizable=no,scrollbars=yes,locationbar=no,dependent=yes");
	F1.focus();
}


//Script content.pl
function setfocus(which) {
	var x = which;
	var wert = holeCookie('cms');
	var wertneu = wert;
	var reg = /focus/;
	if (reg.exec(wert)) {
		var pos = wert.indexOf("~focus");
		wertneu = wert.substring(0, pos);
	}
	wertneu += "~focus_" + x;
	var exp = new Date();
	exp.setTime(exp.getTime() + (1 * 2 * 60 * 60 * 1000));
	document.cookie = "cms=" + wertneu + "; expires=" + exp.toGMTString();
}

function getfocus() {
	var wert = holeCookie('cms');
	var reg = /focus/;
	if (reg.exec(wert)) {
		var pos = wert.indexOf("~focus");
		return wert.substring(pos+7);
	}
}


// Script content.pl
function holeCookie(name) {
	name += "=";
	var laenge = name.length;
	var cookie_laenge = document.cookie.length;
	var i=0;
	while (i < cookie_laenge) {
		var j = i + laenge;
		if (document.cookie.substring(i, j) == name) 
			return holeCookieWert(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) 
			break;
	}
}

// Script content.pl
function holeCookieWert(position) {
	var ende = document.cookie.indexOf(";", position);
	if (ende == -1) 
		ende = document.cookie.length;
	return unescape(document.cookie.substring(position,ende));
}

// Script administration.pl
function Go(auswahl,ziel) {
	if (auswahl == "") {
	   return;
	}
	if (ziel == "text") {
		if (auswahl == "alle") {
			var url = "http://www.umweltbildung.at/cgi-bin/cms/text.pl?aktion=liste&auswahl=alle&liste=alle&art=alle";
		}
		else {
			var url = "http://www.umweltbildung.at/cgi-bin/cms/text.pl?aktion=liste&liste=kategorie&auswahl=" + auswahl;
		}
	}
	if (ziel == "linksnav") {
		if (auswahl == "alle") {
			var url = "http://www.umweltbildung.at/cgi-bin/cms/linksnav.pl?aktion=liste&auswahl=alle";
		}
		else {
			var url = "http://www.umweltbildung.at/cgi-bin/cms/linksnav.pl?aktion=liste&auswahl=kat&topkategorie=" + auswahl;
		}
	}
	if (ziel == "content") {
		var url = "http://www.umweltbildung.at/cgi-bin/cms/frame.pl?seite=http://www.umweltbildung.at/cgi-bin/cms/content.pl&aktion=neu&kategorie=" + auswahl;
	}
	if (ziel == "kat4sub") {
		var url = "http://www.umweltbildung.at/cgi-bin/cms/subkat.pl?aktion=liste&topkategorie=" + auswahl;
	}
	if (ziel == "einleitung") {
		var url = "http://www.umweltbildung.at/cgi-bin/cms/einleitung.pl?aktion=neu&art=fortsetzung&topnav=" + auswahl;
	}
	if (ziel == "seitenbau") {
		var url = "http://www.umweltbildung.at/cgi-bin/cms/seitenbau.pl?aktion=content&topkategorie=" + auswahl;
	}
	if (ziel == "statistik") {
		var url = "http://www.umweltbildung.at/cgi-bin/cms/statistik.pl?aktion=liste_kategorie&kategorie=" + auswahl;
	}

	parent.inhalt.location.href=url;
}


// Script packages.pl
function katauswahl(wert) {
	parent.inhalt.document.formular.art.value="kategorie";
	parent.inhalt.document.formular.kategorie.value=wert;
	parent.inhalt.document.formular.submit();
}



// Script bausteine.pl
function bbcode(v)
 {
 if (document.selection) // für IE
   {
    var str = document.selection.createRange().text;
    document.formular.elements[x].focus();
    var sel = document.selection.createRange();
    sel.text = "[" + v + "]" + str + "[/" + v + "]";
    return;
   }
  else insert('[' + v + '][/' + v + '] ');
 }

// Script bausteine.pl
function insert(what)
 {
  if (parent.inhalt.document.formular.elements[x].createTextRange)
   {
    parent.inhalt.document.formular.elements[x].focus();
    parent.inhalt.document.selection.createRange().duplicate().text = what;
   }
  else
   {
    parent.inhalt.document.formular.elements[x].value += what;
   }
 }

// Script text.pl
function loeschbestaetigung(url, text) {
	var entscheidung = confirm(text);
	if (entscheidung == true) {
		if (window == top) {
			location.href=url;
		}
		else {
			parent.inhalt.location.href=url;
		}
	}
}

function ersatzbestaetigung(url, text) {
	var entscheidung = confirm(text);
	if (entscheidung == true) {
		var contentid = parent.inhalt.document.formular.contentid.value;
		var weiterleitung = url + "?aktion=speicherversion&contentid=" + contentid;
		if (window == top) {
			location.href=weiterleitung;
		}
		else {
			parent.inhalt.location.href=weiterleitung;
		}
	}
}


function framewechsel(URL1, URL2) {
	parent.inhalt.location.href=URL1;
	parent.nav.location.href=URL2;
}


function openPopupFilm(url) {
   window.open(url, "popup","width=456,height=400,location=no,scrollbars=no,toolbars=no,resizable=no,status=0,titlebar=no");
   return;
}




-->