var AjaxFormValidator = Class.create();

AjaxFormValidator.prototype =
{
	form: '',
	url: '',
	errors: '',

	initialize: function(form,url)
	{
		this.form = $(form);
		this.url = url;
	},

	validate: function()
	{
		var params = Form.serialize(this.form);
		var myAjax = new Ajax.Request(this.url,{method:'post', parameters: params, onSuccess: this.processForm.bind(this), asynchronous: false});
		return this.errors;
	},

	processForm: function(req)
	{
		var response_txt = req.responseText;
		this.errors = response_txt.evalJSON();
	}
}