	
	var login = {
				
		submitEnter: function(myfield,e)
		{
			var keycode;
			if (window.event)
				keycode = window.event.keyCode;
			else if (e)
				keycode = e.which;
			else
				return true;
			if (keycode == 13)
			{
				login.start(myfield.form);
				return false;
			}
			else
				return true;
		},	
			
		start: function(form_obj)
		{
			//this.buttonObj = document.getElementById("loginbutton");
			//this.buttonObj.value = message;
			//this.buttonObj.disabled = true;
			
			if(window.XMLHttpRequest)
				xmlhttp = new XMLHttpRequest();
			else if(window.ActiveXObject)
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			else
				return false;
			xmlhttp.open("GET", document.location.pathname + "?ajaxWEBsysLogin=getHash", true);
			xmlhttp.onreadystatechange=function()
			{
				if (xmlhttp.readyState == 4)
					if (xmlhttp.readyState)
						login.logging(xmlhttp.responseText, form_obj);
			};
			xmlhttp.send(null);
		},
		logging: function(hash,form_obj)
		{
			if(window.XMLHttpRequest)
				xmlhttp = new XMLHttpRequest();
			else if(window.ActiveXObject)
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			else
				return false;
			xmlhttp.open("POST", document.location.pathname + "?ajaxWEBsysLogin=auth", true);
			xmlhttp.onreadystatechange=function()
			{
				if (xmlhttp.readyState == 4)
					if (xmlhttp.readyState)
					{
						if (xmlhttp.responseText)
						{
							if (xmlhttp.responseText == 'failed')
							{
								alert(dict['loginFailed']);
								location.reload();
							}
							else if (xmlhttp.responseText == 'duplicated')
							{
								location.reload();
							}
						}
						else
						{
							location.reload();
						}
					}
			};
			
			var fields=form_obj.getElementsByTagName	('input');
			xmlhttp.send(hex_md5(hash + hex_md5(fields[1].value))+fields[0].value);
		},
		reload: function()
		{
			/*if(window.XMLHttpRequest)
				xmlhttp = new XMLHttpRequest();
			else if(window.ActiveXObject)
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			else
				return false;
			xmlhttp.open("GET", document.location.pathname + "?ajaxWEBsysLogin=reload", true);
			xmlhttp.onreadystatechange=function()
			{
			}
			xmlhttp.send(null);
			*/
		},
		logout: function()
		{
			if(window.XMLHttpRequest)
				xmlhttp = new XMLHttpRequest();
			else if(window.ActiveXObject)
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			else
				return false;
			xmlhttp.open("POST", document.location.pathname + "?logout=1", true);
			xmlhttp.onreadystatechange=function()
			{
				if (xmlhttp.readyState == 4)
					if (xmlhttp.readyState)
					{
						location.reload();
					}
			};
			
			xmlhttp.send(null);
		}
	};
	
