
	function init()
	{
//		alert("init");
	}

	function getCookie(name)
	{
		var cookie_array = document.cookie.split("; ");
		 
	    for (var x = 0; x < cookie_array.length; x++) 
	    { 
	        cookieParts_array = cookie_array[x].split("=");
	         
	        if (cookieParts_array[0] == "hnp_" + name) 
	        { 
	            return cookieParts_array[1]; 
	        }
	    } 
		return null; 
	}

	function setCookie(name, value)
	{
		var expdate = new Date(); 
		expdate.setTime(expdate.getTime() + 90*24*60*60*1000); 
		document.cookie = "hnp_" + name + "=" + value + "; expires=" + expdate.toGMTString();
	}

	function removeCookie(name) 
	{
		if (getCookie(name)) 
		{
			setCookie(name, null);
			document.cookie = "hnp_" + name + "=" + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
		}
	}
	
	function login_init()
	{
		var username = getCookie('username');
		if (username != null)
		{
			document.loginform.username.value = username;
			document.loginform.remember.checked = true;
			document.loginform.password.focus();
		}
		else
		{
			document.loginform.remember.checked = false;
			document.loginform.username.focus();
		}
	}
	
	function login_submit()
	{
		if (document.loginform.remember.checked)
		{
			setCookie('username', document.loginform.username.value);
		}
		else
		{
			removeCookie('username');
		}
		
		document.loginform.submit();
	}
