Form.prototype.response_parser = function( response ){
$("input").removeClass('error');
action = response.action;
var insert_errors = function(){
jQuery.each(action.args.errors, function(){
if ( this == '__all__' ) {
$("input").addClass('error');
} else {
$("[name="+this+"]").addClass('error');
}
})
}
var redirect = function(){
window.location = action.args.location;
}
eval(action.func + '()');
}
Form.prototype.ajax_form = function( selector ){
$(selector).ajaxForm({
data: {'selector': selector },
success: this.response_parser,
dataType: 'json'
});
}