function Ajax()
{
	var self = this;
	this.result = function(j)
	{
		var debug = "";
		if(j.ok)
		{
			if(j.data)
			{
				$.each(j.data, function(e){
					debug += "Setting content: #" + e + "\n";
					$("#" + e).html(j.data[e]);
				});
			}
			if(j.callback)
			{
				if(typeof(eval("self." + j.callback)) == "function")
				{
					debug += "Running Callback: " + j.callback + "\n";
					eval("self." + j.callback + "(j);");
				}
			}
		}
	}

	this.post = function(loc, data)
	{
		if(!data) data = {};
		data.ajax = true;
		$.post(loc, data, self.result, "json");
	}
}

function serialize(box)
{
	var sel = "";
	$("#" + box + " li.ui-selected").each(function(){
		sel+= "[" + this.id + "]";
	});
	return sel;
}