
var email_ok=false;
var username_ok=false;
var pass_ok=false;

function check()
{
if(email_ok && username_ok && pass_ok)
	{
	document.register.subit.disabled=false;
	return true;
	}
	else
	{
	document.register.subit.disabled=true;
	return false;
	};
};

function check_email()
{
if(document.register.email.value.indexOf('\@') == -1 || document.register.email.value.indexOf('\.') == -1)
	{
	
	document.all.ntf_email.innerHTML="<img src='../img/button_not_ok.gif' alt='Die Emailadresse scheint fehlerhaft zu sein!'>";
	email_ok=false;
		
	}
	else
		{
		document.all.ntf_email.innerHTML="<img src='../img/button_ok.gif'>";
		email_ok=true;
		}
	check();
};

function check_passwort()
{
if(document.register.passwort.value.length < 4)
	{
	
	document.all.ntf_password.innerHTML="<img src='../img/button_not_ok.gif' alt='Das Passwort muss mindestens 4 Zeichen enthalten!'>";
	pass_ok=false;
	
	}
	else
		{
		document.all.ntf_password.innerHTML="<img src='../img/button_ok.gif'>";
		pass_ok=true;
		}


if(document.register.passwort.value !=document.register.passwort1.value)
	{
	

	document.all.ntf_password1.innerHTML="<img src='../img/button_not_ok.gif' alt='Die Wiederholung stimmt nicht mit dem Passort überein!'>";
	pass_ok=false;
	
	}
	else
		{
		document.all.ntf_password1.innerHTML="<img src='../img/button_ok.gif'>";

		pass_ok=true;
		}
	check();
};

function check_email2()
{
if(document.register.email2.value!=document.register.email.value)
	{
	

	document.all.ntf_email2.innerHTML="<img src='../img/button_not_ok.gif' alt='Die Wiederholung deiner Emailadresse passt nicht!'>";
	email_ok=false;
	
	}
	else
		{
		document.all.ntf_email2.innerHTML="<img src='../img/button_ok.gif'>";
		email_ok=true;
		}
	check();
};

function check_username()
{
var user=document.register.username.value;

username_ok=true;

for (i=0; i<user.length && username_ok==true; i++) {

if (user.charCodeAt(i)!=43 && user.charCodeAt(i)!=45 && user.charCodeAt(i)!=95 && (user.charCodeAt(i)<48 || (user.charCodeAt(i)>57 && user.charCodeAt(i)<65) || (user.charCodeAt(i)>90 && user.charCodeAt(i)<97)) || user.charCodeAt(i)>122 )
	{

		if(user.substr(i,1)==" ")
			{
			
		var anzeige="Leerzeichen";
			}
			else
			{
		var anzeige=user.substr(i,1);
			};

	document.all.ntf_username.innerHTML="<img src='../img/button_not_ok.gif' alt='Der Username enthält mindestens ein ungültiges Zeichen: "+anzeige+"'>";
	username_ok=false;
	alert("Der Username enthält mindestens ein ungültiges Zeichen: "+anzeige);

   }
   else
	{

		document.all.ntf_username.innerHTML="<img src='../img/button_ok.gif'>";
		username_ok=true;
	};

}
check();
}


function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Caps Lock ist eingeschaltet!\n\nBitte schalte CAPS LOCK (dauerhafte Großschreibung) aus, bevor du dein Passwort eingibst.';

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		alert( myMsg );
		pass_ok=false;
		check();

	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		alert( myMsg );
		pass_ok=false;
		check();

	}
}