function AjaxForm()
{
	Actionable.call(this);
	
	this.getActionQuery = function()
	{
		var data = "";
		this.scopeBlock.find('*[@send]').each
		(
			function()
			{
				if ($(this).attr('type') == "checkbox" && !this.checked)
					return;
				var value = $(this).attr('value');
				if (value != undefined && value != $(this).attr('prompt'))
					data += '&'+$(this).attr('name')+'='+URLEncode(value);
			}
		);
		return data;
	}
	
	this.getValue = function(name)
	{
		var elem = $("[@name='"+name+"']");
		if (elem.attr('type') == "checkbox")
			return elem.get(0).checked;
		else
			return elem.val();
	}
	
	this.setValue = function(name, val)
	{
		$("[@name='"+name+"']").attr('value', val);
	}
	
	this.onEditSuccess = function()
	{
	}
}

function EditForm()
{
	AjaxForm.call(this);
	EventDispatcher.call(this);
	
	this.changed = false;
	var self = this;
	
	$(document).ready(function()
	{
		$('input[@type="text"][@send]').change(function()
		{
			if (self.changed != true)
			{
				self.changed = true;
				self.fireEvent('formchanged');
			}
		});
	});
	
	
	this.onEditSuccess = function(data)
	{
		this.entity = data;
		this.onItemSaved.call(this, data);
	};
	
	this.onItemSaved = function(entity)
	{
		window.callback(entity);
	}
}
