var DataGrid = Class.create();

DataGrid.prototype = {
	initialize: function(data_grid_id){
		this.data_grid_id = data_grid_id;
		this.open_detail_pkey = null;
	},
	
	open_detail: function(pkey){
		if(pkey != this.open_detail_pkey && this.open_detail_pkey != null)
			$$('#DataGrid_'+ this.data_grid_id +' tr[pkey="'+this.open_detail_pkey+'"]')[0].hide();
		$$('#DataGrid_'+ this.data_grid_id +' tr[pkey="'+pkey+'"]')[0].show();
		this.open_detail_pkey = pkey;
	},
	
	close_detail: function(pkey){
		$$('#DataGrid_'+ this.data_grid_id +' tr[pkey="'+pkey+'"]')[0].hide();
		this.open_detail_pkey = null;
	},
	
	toggle_detail: function(pkey){
		if(this.open_detail_pkey == null){
			$$('#DataGrid_'+ this.data_grid_id +' tr[pkey="'+pkey+'"]')[0].show();
			this.open_detail_pkey = pkey;
		}else{
			if(pkey == this.open_detail_pkey)
				this.close_detail(pkey);
			else
				this.open_detail(pkey);
		}			
	}
}


