// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Piero Bellomo                                     |
// +----------------------------------------------------------------------+
// | Licence: LPLG <>																											|
// +----------------------------------------------------------------------+
// | Author: Piero Bellomo <piero.bellomo@fastwebnet.it>                  |
// +----------------------------------------------------------------------+
function showProps(obj,objName) {
	var result = ""
	for (var i in obj) result += objName + "." + i + " = " + obj[i] + "<br/>"
	
	monitor=window.open();
	monitor.document.write(result)
}/*alert(result)*/
				//showProps(e, e.name)


function get_value(f_name, e_name)	{
	e = document.forms[f_name][e_name+'[]'];	/*showProps(e, 'textbox')*/
	if(e != null)	{
		if(e.length != null)	{
			val_arr = new Array()
			for(i=0; i<e.length; i++)	if(e[i].checked) val_arr[val_arr.length] = e[i].value;
			return val_arr;
		} else if(e.checked) return e.value;
	} else {
		e = document.forms[f_name][e_name]
		if(e != null)	{
			if(e.value != null) {
				return e.value
			}	else if(e.length != null)	{
				for(i=0; i<e.length; i++)	if(e[i].checked) {
					return e[i].value;
				}
			}
		}
	}
	return '';
}


function showel(e_name)	{
	if(document.getElementById(e_name)) e = document.getElementById(e_name)
	else {
		e = document.getElementById(e_name+'_el')
		if(e.parentNode.className == 'regroup') e = e.parentNode
	}
	// if(e.parentNode.tagName.toLowerCase() == 'label') e = e.parentNode
	// alert(e.id)
	e_s = e.style
	e_s.display = 'block';
	// alert('showing: '+e.innerHTML)
}
function hideel(e_name)	{
	if(document.getElementById(e_name)) e = document.getElementById(e_name)
	else {
		e = document.getElementById(e_name+'_el')
		if(e.parentNode.className == 'regroup') e = e.parentNode
	}
	// if(e.parentNode.tagName.toLowerCase() == 'label') e = e.parentNode
	// alert(e.id)
	e_s = e.style
	e_s.display = 'none';
	// alert('hiding: '+e.innerHTML)
}

function ableel(e_name)	{
	e = document.getElementById(e_name+'_el')
	e.style.color = '#151';
	e_i = e.all ? e.all : e.getElementsByTagName("*"); 	
	for(i=0, n = e_i.length; i < n; i++) {
		e_i[i].style.color = '#151';
		if(e_i[i].tagName.toLowerCase() == 'input' || e_i[i].tagName.toLowerCase() == 'textarea')	{
			e_i[i].disabled = ''
			e_i[i].style.backgroundColor = '#FFB'
			if(e_i[i].type == 'text' || e_i[i].tagName.toLowerCase() == 'textarea') {
				e_i[i].style.borderStyle = 'inset'
				e_i[i].style.backgroundColor = '#FFB'
			}
			if(e_i[i].type == 'radio' || e_i[i].type == 'checkbox') {
				e_i[i].style.backgroundColor = '#FFF'
			}
		}
	}
}
function dsblel(e_name)	{
	e = document.getElementById(e_name+'_el')
	e.style.color = '#BDC';
	e_i = e.all ? e.all : e.getElementsByTagName("*"); 	
	for(i=0, n = e_i.length; i < n; i++) {
		e_i[i].style.color = '#BDC';
		if(e_i[i].tagName.toLowerCase() == 'input' || e_i[i].tagName.toLowerCase() == 'textarea')	{
			e_i[i].disabled = 'true'
			if(e_i[i].type == 'text' || e_i[i].tagName.toLowerCase() == 'textarea') {
				e_i[i].style.borderStyle = 'outset'
				e_i[i].style.backgroundColor = '#FFF'
			}
		} 
	}
}
