function changeBgColor(element, color){
	element.style.backgroundColor= color;
}

/*A method to hide or show a column of a table.
Param 1 - table id
Param 2 - column #
Param 3 - 1 or 0 for show or hide
*/
function show_hide_column(table_id, col_no, do_show) {
		var stl;
    	if (do_show) stl = 'block'
    	else         stl = 'none';
		
		var tbl  = document.getElementById(table_id);
    	var rows = tbl.getElementsByTagName('tr');
    	for (var row=0; row<rows.length;row++) {
      		var cels = rows[row].getElementsByTagName('td')		
			cels[col_no].style.display=stl;
    	}
}

function checkboxToggle(formName, fieldName, checked){
	if(!document.forms[formName])
		return;
	var objCheckBoxes = document.forms[formName].elements[fieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes){
		objCheckBoxes.checked = checked;
	}else{
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++){
			objCheckBoxes[i].checked = checked;
		}
	}
}
 
function radioSelected(radiobutton){
		for (var i=0; i<radiobutton.length; i++) {
   			if (radiobutton[i].checked) 
				return true;
		}
		return false;
}