<!--
// 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;
}



function oekolog_anmeldung(aktion, ziel) {
	
	var number = document.formular.elements.length;
	var uebergabe, feldname, feldwert, feldwert_definiert, schulart_definiert;
	//var schularten = ["VS", "HS", "PTS", "KMS", "NMS", "ASO", "AHS", "BS", "HAS", "BHAS", "BMS", "LFS", "HLFS", "HLA", "HBLA", "HLW", "HAK", "BHAK", "BAKIP", "HTL", "Schulzentrum", "Hochschule", "Sonstige"];
	var schularten = ["VS", "HS"];
	var id=document.formular.elements['id'].value;
	if (aktion == 1) {
		var logo = document.formular.elements['logo'].value;
		if (logo != "")	{
			alert("Sie haben ein Bild upgeloadet. Um dieses zu Speichern nutzen Sie bitte den Speicher-Button am unteren Ende der Seite");
			return;
		}
	}
	
	uebergabestring = "";
	if (aktion != 4) {
		schulart_definiert = 0;
		for (var i=0; i<number; i++) { 
			feldname=document.formular.elements[i].name;
			feldwert_definiert = 0;

			if (feldname == "k_anrede" || feldname == "d_anrede") {
				if (document.formular.elements[i].checked == true) {
					feldwert=document.formular.elements[i].value;
				}	
				feldwert_definiert = 1;
			}
			/*if (feldname == "d_anrede")	{
				if (document.formular.elements[i].checked == true) {
					feldwert=document.formular.elements[i].value;
				}	
				feldwert_definiert = 1;
			}*/

			//Schulstufen
			if (feldname == "1.-4. Schulstufe" || feldname == "5.-8. Schulstufe" || feldname == "ab 9. Schulstufe" || feldname == "StudentInnen") {
				if (document.formular.elements[i].checked == true) {
					feldwert = "1";
				}
				feldwert_definiert = 1;
			}
			if (feldname == "schulart")	{
				if (document.formular.elements[i].checked == true) {
					feldwert = document.formular.elements[i].value;
				}
				feldwert_definiert = 1;
			}
			if (feldname == "bundesland")	{
				feldwert = document.formular.elements[i].options[document.formular.elements[i].selectedIndex];
			}
			if (feldname == "logo") {
				feldwert = document.formular.elements[i].value;
				feldwert_definiert = 1;
			}
			if (feldname == "logo_loeschen") {
				if (document.formular.elements[i].checked ==true) {
					feldwert = 1;
				}
				feldwert_definiert = 1;
			}
			if (feldname == "schulerhalter" || feldname == "fahnenart") {
				if (document.formular.elements[i].checked == true) {
					feldwert = document.formular.elements[i].value;
				}
				feldwert_definiert = 1;
			}

			if (feldname == "schulprofil_vorhanden" || feldname == "schulprofil_nh" || feldname == "leitbild_vorhanden" || feldname == "leitbild_nh" || feldname == "schulprogramm_vorhanden" || feldname == "schulprogramm_nh") {
				if (document.formular.elements[i].checked == true) {
					feldwert = document.formular.elements[i].value;
				}
				feldwert_definiert = 1;
			}

			if (feldwert_definiert != 1) {
				feldwert=document.formular.elements[i].value;
			}
			
			var reg = /\n/;
			if (reg.exec(feldwert)) {
				feldwert = feldwert.replace(/\n/g,"<br>").replace(/\r/g,"");
			}

			if (feldwert != "") {
				uebergabestring += feldname + "=" + feldwert + "&";
			}
			feldwert = "";
		}
	}
	if (aktion == 1)	{
		aktion_alt = "datenblatt";
	}
	else if (aktion == 2)	{
		aktion_alt = "schulprofil";
	}
	else if (aktion == 3) {
		aktion_alt = "projekte_initiativen";
	}
	else if (aktion == 4) {
		aktion_alt = "anmeldung_kontrolle";
	}
	if (ziel == 1)	{
		ziel = "datenblatt";
	}
	else if (ziel == 2)	{
		ziel = "schulprofil";
	}
	else if (ziel == 3) {
		ziel = "projekte_initiativen";
	}
	else if (ziel == 4) {
		ziel = "anmeldung_kontrolle";
	}
	var url = "http://www.umweltbildung.at/cgi-bin/cms/oekolog/onlineverwaltung/schulen.pl?aktion=ergaenzen&aktion_alt=" + aktion_alt + "&ziel=" + ziel + "&id=" + id + "&" + uebergabestring;
	location.href= url;
}

function oekolog_jahresbericht(aktion, ziel) {
	
	if (aktion == 0)  {
		aktion_alt = "jb_start";
	}
	if (aktion == 1)	{
		aktion_alt = "jb_rueckschau";
	}
	else if (aktion == 2)	{
		aktion_alt = "jb_projekt";
	}
	else if (aktion == "2a") {
		aktion_alt = "jb_bilder";
	}
	else if (aktion == 3) {
		aktion_alt = "jb_vorschau";
	}
	else if (aktion == 4) {
		aktion_alt = "jb_netzwerke";
	}
	else if (aktion == 5) {
		aktion_alt = "jb_kontrolle";
	}
	else if (aktion == 6) {
		aktion_alt = "jb_abschluss";
	}
	if (ziel == 0)	{
		ziel = "jb_start";
	}
	else if (ziel == 1)	{
		ziel = "jb_rueckschau";
	}
	else if (ziel == 2)	{
		ziel = "jb_projekt";
	}
	else if (ziel == "2a")	{
		ziel = "jb_bilder";
	}
	else if (ziel == 3)	{
		ziel = "jb_vorschau";
	}
	else if (ziel == 4)	{
		ziel = "jb_netzwerke";
	}
	else if (ziel == 5)	{
		ziel = "jb_kontrolle";
	}
	else if (ziel == 6)	{
		ziel = "jb_abschluss";
	}
	
	var number = document.formular.elements.length;

	//Startseite
	if (aktion == "0") {
		var jb_id=document.formular.elements['jb_id'].value;
		var url = "http://www.umweltbildung.at/cgi-bin/cms/oekolog/onlineverwaltung/schulen.pl?aktion=" + ziel + "&jb_id=" + jb_id;
		location.href= url;
	}

	//Wenn Entscheidung für Projektart noch nicht gefallen ist
	if (aktion == "2")	{
		if (number == 1) {
			var jb_id=document.formular.elements['jb_id'].value;
			var url = "http://www.umweltbildung.at/cgi-bin/cms/oekolog/onlineverwaltung/schulen.pl?aktion=" + ziel + "&jb_id=" + jb_id;
			location.href= url;
		}
	}
	
	//Abschluss-Seite
	if (aktion == "6")	{
		var jb_id=document.formular.elements['jb_id'].value;
		var url = "http://www.umweltbildung.at/cgi-bin/cms/oekolog/onlineverwaltung/schulen.pl?aktion=" + ziel + "&jb_id=" + jb_id;
		location.href= url;
	}

	var uebergabe, feldname, feldwert, feldwert_definiert;

	var handlungsbereiche = ["Energie", "Abfall", "Wasser", "Schulgestaltung/Raumgestaltung", "Klima/Klimaschutz", "Ernährung", "Gesundheitsförderung", "Bewegung, Mobilität und Verkehr", "Natur", "Artenvielfalt", "Kultur des Lehrens und des Lernens", "ökologische Beschaffung", "Lebensstil und Fair Trade", "Schulentwicklung - ökologisches Schulprogramm", "Öffnung der Schule/Einfluss auf Umfeld und Gemeinde wie z.B. lokale oder regionale Agenda"];

	var jb_id=document.formular.elements['jb_id'].value;
	//alert("jb_id: " + jb_id);
	
	if (aktion == "2a") {
		var bild1 = document.formular.elements['bild1'].value;
		var bild2 = document.formular.elements['bild2'].value;
		var bild3 = document.formular.elements['bild3'].value;
		var bild4 = document.formular.elements['bild4'].value;
		var bild5 = document.formular.elements['bild5'].value;

		if (bild1 != "" || bild2 != "" || bild3 != "" || bild4 != "" || bild5 != "")	{
			alert("Sie haben zumindest ein Bild upgeloadet. Um dieses zu Speichern nutzen Sie bitte den Speicher-Button am unteren Ende der Seite");
			return;
		}
	}
	
	uebergabestring = "";

	for (var i=0; i<number; i++) { 
		feldname=document.formular.elements[i].name;
		feldwert_definiert = 0;


		for (var j=0; j<handlungsbereiche.length; j++) {
			if (handlungsbereiche[j] == feldname) {
				if (document.formular.elements[i].checked == true) {
					feldwert = "1";
				}
				feldwert_definiert = 1;
			}
		}

		if (feldname == "bild_loeschen1" || feldname == "bild_loeschen2" || feldname == "bild_loeschen3" || feldname == "bild_loeschen4" || feldname == "bild_loeschen5") {
			if (document.formular.elements[i].checked ==true) {
				feldwert = 1;
			}
			feldwert_definiert = 1;
		}

		if (feldname == "netzwerk_uzs" || feldname == "netzwerk_who" || feldname== "netzwerk_kkik" || feldname == "netzwerk_keins" || feldname == "fonds" || feldname == "abgeschlossen" || feldname == "feedback") {
			if (document.formular.elements[i].checked ==true) {
				feldwert = 1;
			}
			feldwert_definiert = 1;
		}

		if (feldwert_definiert != 1) {
			feldwert=document.formular.elements[i].value;
		}
		
		var reg = /\n/;
		if (reg.exec(feldwert)) {
			feldwert = feldwert.replace(/\n/g,"<br>").replace(/\r/g,"");
		}

		if (feldwert != "") {
			uebergabestring += feldname + "=" + feldwert + "&";
		}
		feldwert = "";
	}

	var url = "http://www.umweltbildung.at/cgi-bin/cms/oekolog/onlineverwaltung/schulen.pl?aktion=jb_ergaenzen&aktion_alt=" + aktion_alt + "&ziel=" + ziel + "&jb_id=" + jb_id + "&" + uebergabestring;
	//alert ("url: " + url);//
	location.href= url;
}


-->
