/////////////////////////////////////////////////////
/* Multipler Formularcheck created by webdrache.ch */
/////////////////////////////////////////////////////

var Speicherfeldtext = "Benennen Sie hier Ihre Positionierung aller Ebenen";

Event.observe(window, "load", function start(){
	var formular = document.getElementById('EbenenPositionen');
	formular.konstellation.value = Speicherfeldtext;
	formular.konstellation.style.color = '#666666';
	LabelimInputElement();
});

function LabelimInputElement() {
	var formular = document.getElementById('EbenenPositionen');
	formular.konstellation.onfocus=function() {
		if(this.value == Speicherfeldtext && this.value != '') {
			this.value = '';
			this.style.color = '#333333';
		}
	}
	formular.konstellation.onblur=function() {
		if(this.value == '' || nur_Leerschlaege() == true) {
			this.value = Speicherfeldtext;
			this.style.color = '#666666';
		}
	}
}

function nur_Leerschlaege() {
	var ok = true;
	var nichtleer = 0;
	var formular = document.getElementById('EbenenPositionen');
	//alert(formular.konstellation.value.length);
	for (var i = 0 ; i < formular.konstellation.value.length; i++) {
		if(formular.konstellation.value.charAt(i) != " ") {
	 		nichtleer = i+1;
	 	}
	}
	//alert(nichtleer);
	if(nichtleer > 0) {
	 	ok = false;
	}	
 	return ok;	
}

function testeSpeicherung() {
	var alles_ok = true;
	var formular  = document.getElementById('EbenenPositionen');
	//if(formular.konstellation.value == "" || nur_Leerschlaege() == true) {
	if(formular.konstellation.value == Speicherfeldtext || nur_Leerschlaege() == true) {
 		alert("Bitte benennen Sie die Positionierung aller Ebenen, bevor Sie sie abspeichern!");
		formular.konstellation.focus();
 		alles_ok = false;
	}
 	return alles_ok;	
}

function testeLoeschung() {
	var alles_ok = true;
	var formular  = document.getElementById('EbenenLoeschen');
	if(formular.loeschliste.value == "nichts") {
 		alert("Bitte wählen Sie eine Positionierung im Auswahlmenu aus!");
 		alles_ok = false;
	}
	else {
		Check = confirm('Wollen Sie diese Positionierung aller Ebenen wirklich löschen?');
		if (Check == false) { alles_ok = false; }
	}
 	return alles_ok;	
}
//////////////////////////////////
/* Ende multipler Formularcheck */
//////////////////////////////////
