var pfad = self.location.href;
	/* <![CDATA[ */
	LoginOptions = {
		width: "150px", // null or the width in px
		CSSclass: "errorbox", // null or a css class name
		toURL: 'index.php?site=loginoverview'
	};
	
	// End of Config
	
	// Loading the language vars
	language_array['checklogin_ajax'] = new Array();
	fetch('getlang.php?modul=checklogin_ajax&mode=array','none','execute','event');
	
	form = document.getElementById('login_form');
	form.onsubmit = function(e){
		$('#login_reg').html('<img align="middle" src="images/loader-bar.gif" style="margin:0 0 0 123px;">');
		fetch("checklogin_ajax.php?ws_user="+form.elements['ws_user'].value+
															"&pwd="+form.elements['pwd'].value+
															"&submit=true"
					,loginCallback,"callback","event");
		return false;
	}
	
	function writeLoginResponse(string){
		elem = document.getElementById('login_response');
		if (LoginOptions.width != null) {
			elem.style.width = LoginOptions.width;
		}
		if (LoginOptions.CSSclass != null) {
			elem.className = LoginOptions.CSSclass;
		}
		elem.innerHTML = string;
	}
	function go_to_private_page()
	{
	window.location = pfad; // Members Area
	
	}
	function Nix()
	{ /* gar nix weiter */ }
	function loginCallback(response){
		res = response.substr(0,1);
		switch(res){
			case "0":
				//writeLoginResponse(language_array['checklogin_ajax']['session_error']);
				$("#login_reg").html(language_array['checklogin_ajax']['session_error']);
				break;
			case "1":
				//fetch(LoginOptions.toURL,loginCallback2,"callback","event");
				setTimeout('go_to_private_page()', 1500);
				break;
			case "2":
				//writeLoginResponse(language_array['checklogin_ajax']['invalid_password']);
				$("#login_reg").html(language_array['checklogin_ajax']['invalid_password']);
				break;
			case "3":
				//writeLoginResponse(language_array['checklogin_ajax']['not_activated']);
				$("#login_reg").html(language_array['checklogin_ajax']['not_activated']);
				break;
			case "4":
				//writeLoginResponse(language_array['checklogin_ajax']['no_user'].replace(/%username%/g, form.elements['ws_user'].value));
				$("#login_reg").html(language_array['checklogin_ajax']['no_user'].replace(/%username%/g, form.elements['ws_user'].value));
				break;
			case "5":
				$("#login_reg").html(language_array['checklogin_ajax']['ip_banned'].replace(/%reason%/g, response.substr(1)));
				//writeLoginResponse(language_array['checklogin_ajax']['ip_banned'].replace(/%reason%/g, response.substr(1)));
				break;
			default:
				$("#login_reg").html(language_array['checklogin_ajax']['wronglogin']);
		}
  }
	
	function loginCallback2(response){
		document.open();
		document.write(response);
		document.close();
	}
	/* ]]> */
