ww.form = {
	convert: function( form_id, success ) {
		var successFunc = function( responseText, statusText ) {
			$( '#' + form_id ).replaceWith( responseText );
			ww.form.convert( form_id, success );
			if( ! $( '#' + form_id + ' .error' ).length ) {
				eval( success + '()' );
			}
		}

		var options = {};
		if( success.length ) {
			options.success = successFunc;
		}
	
		$( '#' + form_id ).submit( function() {
	       	$( this ).ajaxSubmit( options );
	       	return false;
	    } );
	},
	
	empty: function() {
	},
	
	autocomplete: function( display_node_id, hidden_node_id, url ) {
		$( document ).ready( function() {
			$( '#' + display_node_id )
				.autocomplete( ww.buildPath( url ) )
				.result( function( event, data, formatted ) {
					if( data ) {
						$( '#' + hidden_node_id ).val( data[ 1 ] );
					}
				} )
		} );
	}
}

