function contraiespandi(divid) {
currdisp=document.getElementById(divid).style.display;
if (currdisp != "none") {
	document.getElementById(divid).style.display="none"; 
} else {
	if (currdisp=='none') {
		document.getElementById(divid).style.display='block'; 
	}	
}
}

// setta allo stesso stato di CHECKED / UNCHECKED un serie di checkobox aventi lo stesso NOME
// ESEMPIO di utilizzo su un bottone:
//<input onclick="SetAllCheckBoxes('myForm', 'myCheckbox', true);" value="I like them all!" type="button">
function setallcheckboxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++) {
			if(CheckValue=='INVERT') {
				if(objCheckBoxes[0].checked==true) {
					objCheckBoxes[i].checked = true;
				}
				else {
					objCheckBoxes[i].checked = false;
				} 
			}
			else objCheckBoxes[i].checked = CheckValue;
		}
}


