function login (caller)
{
	var args = [];

	args[0] = JSON.stringify ({username: caller.username.value, pass: caller.pass.value});
	sajax_do_call ("login", args, afterLogin);
}

function afterLogin (httpRequest)
{
	if (httpRequest.status == 200)
	{
		var args = {status: false};
		try	{ args = JSON.parse (httpRequest.responseText);	}
		catch (ex) {}
		if (args.status)
			location = "index.php";
		else
			alert (args.error ? args.error :
			 "There was an error logging in.\nPlease try again later.");
	}
}