/**
@file EXHR.js
@author Ivan De Marino
@created 2005-12-02
@updated 2005-12-02
@version 0.2
@description EXHR.utils */

/** Easy way "document.getElementById" 
 @param id DOM Element id attribute */
function getElementById(id) 
{
	return document.getElementById(id);
}

/** Easy way "document.getElementsByName"
 @param name DOM Elements name attribute */
function getElementsByName(name)
{
	document.getElementsByName(name);
}

/** Toggle checked attrivute for group of checkboxes.
 It' tipically invoced by the "onClick" 
 event of the element
 "supercheckboxId", passed as parameter.
 
 @param checkboxesName Name of the checkboxes of the group (with "[]" suffix)
 @param supercheckboxId ID of the "super checkbox" used 
 	to select/deselect the others of the group */
function supercheckboxToggleChecked (supercheckboxId, checkboxesName)
{
	var supercheckbox = getElementById(supercheckboxId);
	var checkboxes = getElementsByName(checkboxesName);
	var checkboxesNumber = checkboxes.length;
	
	if ( supercheckbox.checked == 'checked' )
	{
		supercheckbox.checked == ''
		for ( var i = 0; i < checkboxesNumber; i++ )
			checkboxes[i].checked = '';
	}
	else
	{
		supercheckbox.checked == 'checked'
		for ( var i = 0; i < checkboxesNumber; i++ )
			checkboxes[i].checked = 'checked';
	}	
}

/** Toggle disabled attrivute for a DOM element.

 @param elementId ID of the Element to enable/disable */
function toggleDisabled (elementId)
{
	var element = getElementById(elementId);

	if ( !element.disabled )
		elem.disabled = true;
	else
		elem.disabled = false;
}

/** Set the "innerHTML" property for the object "id" with value "data" */
function setInnerHTML(id, data)
{
	getElementById(id).innerHTML = data;
}
