var listGridId;
var listGridNewRowId;

function editNewListGridRow() {

	var listGrid = bb.document.getElementById( listGridId );
	
	listGrid.setAttribute( 'selectedIndexes', listGridNewRowId );
	listGrid.setProperty( 'focusedRow', listGridNewRowId );
	
	listGrid.removeEventListener('pageRefreshed', editNewListGridRow, false);
	
	window.setTimeout(function(){
		listGrid.focus();
		listGrid.initEditMode();
	}, 300);
	
}

function rowAction( listGridId, baseUrl ) {
	var listGrid = bb.document.getElementById( listGridId );
	var rowId = listGrid.getProperty( 'focusedRow' );
	bb.command.load( baseUrl + rowId, 'GET', '', null, bb.document.getElementById('divContent'), 'replaceChildren' );
	listGrid.refresh();
}

function rowActionElement( listGridId, baseUrl, element ) {
	var listGrid = bb.document.getElementById( listGridId );
	var rowId = listGrid.getProperty( 'focusedRow' );
	bb.command.load( baseUrl + rowId, 'GET', '', null, bb.document.getElementById(element), 'replaceChildren' );
	listGrid.refresh();
}

function rowActionRedirect( listGridId, baseUrl ) {
	var listGrid = bb.document.getElementById( listGridId );
	var rowId = listGrid.getProperty( 'focusedRow' );
	document.location.href = baseUrl + 'id/' + rowId;
}

function rowActionLoad( listGridId, baseUrl ) {
	var lg = bb.document.getElementById(listGridId);
  var iIndex = lg.getProperty('selectedIndex');
	var aboid = btl.dataSource.getValue(lg.getDataSource(), iIndex , 'aboid');
					
	document.location.href = baseUrl + aboid;
}
