// Javascript functions needed by the db page.
setTimeout("myBar.loaded('config.js')", 500); 
// Make this class of elements editable
function makeEditable(table, cellclass, imgclass, linkclass) {
	// Make all the cells editable
	//todo: figure out how to make the tab key commit the current cell and edit the next
	$(cellclass).editable('change.php?tab=' + table, {
		//indicator : " ",
		indicator : "updating...",
		type      : 'text',
		tooltip		: 'Click to edit...',
		style		: 'inherit',
		cssclass	: 'inherit',
		placeholder	: '',
		onblur		: 'submit'
	//	callback	: function(value,settings) { alert(dump(settings)); }
	});
	// Set up rollover and action for red x to delete row
	$(imgclass).hover(function() { $(this).attr('src','img/red-x2.gif'); },
		function() { $(this).attr('src','img/red-x2-light.gif'); }
	);
	$(linkclass).click(function() {
		var tr = $(this).parent().parent();
		var rowid = tr.attr('id');
		var match = rowid.match(/\d+/);
		$.get('change.php?tab=' + table + '&delrow=' + match[0]);
		tr.remove();
	});
	$('.editme').bind('keydown', function(event){
		if(event.keyCode==9) {
			$(this).find("input").blur();
			$(this).next(".editme").click();
			return false;
		}
	});
}
// Form a table row to add to the table
function formRow(linenum, numCells, ooe) {
var newrow = '
",
		indicator : "updating...",
		type      : 'text',
		tooltip		: 'Click to edit...',
		style		: 'inherit',
		cssclass	: 'inherit',
		placeholder	: '',
		onblur		: 'submit'
	//	callback	: function(value,settings) { alert(dump(settings)); }
	});
	// Set up rollover and action for red x to delete row
	$(imgclass).hover(function() { $(this).attr('src','img/red-x2.gif'); },
		function() { $(this).attr('src','img/red-x2-light.gif'); }
	);
	$(linkclass).click(function() {
		var tr = $(this).parent().parent();
		var rowid = tr.attr('id');
		var match = rowid.match(/\d+/);
		$.get('change.php?tab=' + table + '&delrow=' + match[0]);
		tr.remove();
	});
	$('.editme').bind('keydown', function(event){
		if(event.keyCode==9) {
			$(this).find("input").blur();
			$(this).next(".editme").click();
			return false;
		}
	});
}
// Form a table row to add to the table
function formRow(linenum, numCells, ooe) {
var newrow = '
