Runner.buttonEvents["nuevo_preventa"] = function( pageObj, proxy, pageid ) {
	//register a new button
	pageObj.buttonNames[ pageObj.buttonNames.length ] = 'nuevo_preventa';
	
	if ( !pageObj.buttonEventBefore['nuevo_preventa'] ) {
		pageObj.buttonEventBefore['nuevo_preventa'] = function( params, ctrl, pageObj, proxy, pageid, rowData, row, submit ) {		
			var ajax = ctrl;

		}
	}
	
	if ( !pageObj.buttonEventAfter['nuevo_preventa'] ) {
		pageObj.buttonEventAfter['nuevo_preventa'] = function( result, ctrl, pageObj, proxy, pageid, rowData, row, params ) {
			var ajax = ctrl;
// Put your code here.
var message = result["txt"] + " !!!";
ajax.setMessage(message);

		}
	}
	
	$('a[id="nuevo_preventa"]').each( function() {
		if ( $(this).closest('.gridRowAdd').length ) {
			return;
		}
		
		this.id = "nuevo_preventa" + "_" + Runner.genId();
		
		// create object
		var button_nuevo_preventa = new Runner.form.Button({
			id: this.id ,
			btnName: "nuevo_preventa"
		});
		
		// init
		button_nuevo_preventa.init( {args: [ pageObj, proxy, pageid ]} );
	});
};

