
/* ----------------------------------------------------*/
/* General functions                                  */
/* ----------------------------------------------------*/

// sets value of hidden html element clicked_element
// and optional argument
// does submit of page
function do_postback(element, args) {
	document.forms[0].clicked_element.value = element.name;
	document.forms[0].clicked_element_args.value = args;
	document.forms[0].submit();
}

/* ----------------------------------------------------*/
/* Datagrid functions                                  */
/* ----------------------------------------------------*/

// do a 'postback', ie set window.location to new value
function datagrid_postback(datagrid_id, params) {
	var url = window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + params;
	window.location.href = url;
}

// set cells in selected row in edit mode
function datagrid_edit(row_id, params) {
	//alert(row_id + '\n' + params);
	var row = $(row_id);
	var cells = $A(row.cells);

	cells.each( function (cell) {
		if (cell.rawValue) {
			cell.innerHTML = "<input type='text' value='" + cell.rawValue + "'>";
		}
	});
}

/* ----------------------------------------------------*/
