//### util_forms.js -- General form processing functions

// Returns the selected radio button value.
function jzfRadioSel(group,iForm)
{
	if (!iForm) iForm=0;
	
	var g = document.forms[0][group];
	for (var i=0; i<g.length; i++) {
		if (g[i].checked) {
			return g[i].value;
         }
     }
	 return null;
} 

// Return the selected value of a select box
function jzfSelected(id)
{
	var o = document.getElementById(id);
	return o.options[o.selectedIndex].value;
}

// Disables the item plus its next sibling (the lable)
function jzfDisableCheck(id, f)
{
	var o = document.getElementById(id);
	o.disabled=f;
	o = o.nextSibling;

	if (o && o.tagName=="LABEL")
		o.style.color=f?"#aaa":"#000";
}

// Hilight a TR background color which contains the given field id.
function jzfHiErr(id, f)
{
	o = document.getElementById(id);
	if (f&2)
		o.focus();
		
	while (o && o.tagName!="TR")
		o=o.parentNode;
		
	if (o)
		o.className=(f&1)?"foE":"";
}