/* 
Überprüfung der Eingabefelder auf leere Eingaben 
!!! ACHTUNG: Alle Felder werden zusätzlich mittels PHP geprüft !!!
Version 1.0 - Stand: 27.06.2007 - Letzte Änderung: MO
*/

function formvalidate($formname) {
	$check_fields = true;
	
	if(typeof($errorcode) != "undefined" && $errorcode == 2) {
		$invalid = $invalid.split(' ');
		for($each in $invalid) {
			document.getElementById($invalid[$each]).style.border  = '2px solid #B70000';
		}

		$check_fields = false;
		document.getElementById("errorbox").innerHTML = '<strong style="color: #B70000;">Die rot umrandete Email-Adresse ist ung&uuml;ltig!</strong>';
	}
	else {
		// Border Style zurück setzen
		for($i in $formfields){
			document.getElementById($formfields[$i]).style.border  = '1px solid #000000';
		}
		// Felder prüfen
		for($i in $formfields){
			if(document.getElementById($formfields[$i]).value == "") {
				document.getElementById($formfields[$i]).style.border  = '2px solid #B70000';
				$check_fields = false;
			}
		}
		if ($check_fields != true){
			document.getElementById("errorbox").innerHTML = '<strong style="color: #B70000;">Bitte f&uuml;llen sie alle rot umrandeten Felder aus!</strong>';
		}
	}
	return $check_fields;
}

function newword(){
	$addstr = "";
	if($global_sessid) {
		$addstr = "&PHPSESSID="+$global_sessid;
	}
	document.getElementById("captcha").src = "/images/captcha/genimage.php?randid=" + (Math.random()*100000) + $addstr;
}
function question($what){
	switch($what){
		case "open":
			var x,y;
			if (self.innerHeight){ // all except Explorer
				x = self.innerWidth;
				y = self.innerHeight;
			}
			else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				x = document.documentElement.clientWidth;
				y = document.documentElement.clientHeight;
			}
			else if (document.body){ // other Explorers
				x = document.body.clientWidth;
				y = document.body.clientHeight;
			}
			
			nleft = (x/2) - 200;
			ntop = (y/2) - 75;
			document.getElementById("question").style.left = nleft + 'px';
			document.getElementById("question").style.top = ntop + 'px';
		break;
		case "close":
			document.getElementById("question").style.left = "-500px";
			document.getElementById("question").style.top = "-500px";
		break;
	}
}

