// ---------------------------------------------------
// Löschen Bestätigen
// ------------------
// Beschreibung:
// Funktion zum Bestätigen von Löschenoperationen
// Erwartet: id (Integer), typ (String)
// Letzte Änderung:
// Erstellt: 05.11.2007 Bernd Hertel
// Geändert: 	

function check_del(id, typ){
	switch (typ) {
		case "user":
			check = confirm("Benutzer wirklich löschen?");
			if(check == true) document.location.href = "benutzer_liste.php?a=del&id=" + id;
			break;
		case "inhalte":
			check = confirm("Inhalt wirklich löschen?");
			if (check == true) document.location.href = "inhalte_liste.php?a=del&id=" + id;
			break;
		case "infos":
			check = confirm("Infobox wirklich löschen?");
			if(check == true) document.location.href = "infos_liste.php?a=del&id=" + id;
			break;
		case "news":
			check = confirm("News wirklich löschen?");
			if(check == true) document.location.href = "news_liste.php?a=del&id=" + id;
			break;			
	}	
}


// ---------------------------------------------------
// Formularfelder auf Inhalt überprüfen
// ------------------------------------
// Beschreibung:
// Überprüft Felder, ob diese ausgefüllt sind. Sollten alle Felder ausgefüllt sein, wird das Formular abgeschickt
// Erwartet: feldliste (String), formname (String), msgtext (String)
// Letzte Änderung:
// Dritter Parameter optional
// Erstellt: 26.01.2007 Bernd Hertel
// Geändert: 13.11.2007 Bernd Hertel

function check_fields(feldliste, formname, msgtext){

	var error = 0;
	var felder = feldliste.split(",");
	
	if (msgtext == "") msgtext = "Bitte überprüfen Sie Ihre Eingabe!";

	for(i = 0; i < felder.length; i++) {
		eval ("if((document." + formname + "." + felder[i] + ".value == '' || document." + formname + "." + felder[i] + ".value == 'http://') && error != 1) { alert ('" + msgtext + "'); error=1; document." + formname + "." + felder[i] + ".focus(); }");
	}

	if(error == 0) eval("document." + formname + ".submit();");
}


// ---------------------------------------------------
// Bild wechseln
// -------------
// Beschreibung:
// Tauscht Image-Source aus
// Erwartet: imgID (String), imgSrc (String)
// Letzte Änderung:
// Erstellt: 19.11.2007 Bernd Hertel
// Geändert: 

function chg_image(imgID, imgSrc){
  document.getElementById(imgID).src = imgSrc;
}


// ---------------------------------------------------
// Bild in PopUp öffnen
// --------------------
// Beschreibung:
// Öffnet ein Bild in einem PopUp-Fenster
// Erwartet: bildname (String)
// Letzte Änderung:
// Erstellt: 19.11.2007 Bernd Hertel
// Geändert: -

function open_Image(bildname){
	window.open("show_image.php?file=" + bildname, "Bild_Detail", "width=500, height=500, left=100, top=100, scrollbars=no, toolbar=no, status=no");
}

// ---------------------------------------------------
// zeitgesteuerte Weiterleitung
// --------------------
// Beschreibung:
// Leitet nach 2 Sekunden auf die Startseite um
// Erwartet: -
// Letzte Änderung:
// Erstellt: 28.05.2008 Claudia Wannenmacher
// Geändert: -

function go_start(){
	document.location.href = "index.php";
}
