function ajaxlogin() {
	var username = $("#username").val();	
	var password = $("#password").val();
    $.post("_action_login.php",{username:username, password:password},function(response) {
		if (response!="fail") {
			$("#login").html("You are logged in as <a href=\"#\">"+response+"</a><br/><br/><a href=\"javascript:logout();\">Sign Out</a>");
		} else {
			$("#login").html("NO DUDE");
		}
	})
}

function ajaxlogout() {
	$.post("_action_logout.php",{},function(response) {
		$("#login").html("Username<br/><input type=\"text\" name=\"username\" id=\"username\" class=\"text\" tabindex=\"1\" size=\"20\"/>Password<br/><input type=\"password\" name=\"password\" id=\"password\" class=\"text\" tabindex=\"2\" size=\"20\"/><input type=\"button\" tabindex=\"3\" value=\"Login\" class=\"buttons\" onclick=\"javascript:login();\" /><br/><a href=\"#\">Sign up</a><br/><a href=\"#\">Forgot Password?</a>");
	})
}

function login() {
	$("#login").submit();	
}