Im trying to use ajax to post form contents and then use a callback function but im having a couple of problems.

here is the code. When the form is submitted login submitted is called. It then uses postpage to post the data and return the data to the function login returned.
Code:
function loginsubmitted(loginform){
	
	//hide loginmenu
	//changeOpac("loginmenu", 0)
	opacity("loginmenu", 100, 0, 40)
	
	var parms = "logout=false&username=" + document.getElementById("txtusername").value + "&password=" + document.getElementById("txtpassword").value
	postpage("includes/login.php", parms, function(){ loginreturned() })
	
	return false;
}

function postpage(page, parameters, callbk){
	
	var http = createrequest()
	
	if(http == false){
		return false;
	}
	
	http.open("POST", page, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", parameters.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function(){
	
		if(http.readyState == 4 && http.status == 200){
			var response = http.responseText
			callbk(response)
		}
	}
	http.send(parameters);


}

function loginreturned(content){

	alert(content)
	
}
http.responseText contains the right data in the postpage function but in the loginreturned function content it is undefined.