
/*
*	@author Marco Bortolin
*	@date 6/11/2006
*	standard functions
*/

/**
 * getObj
 */
function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
	this.text = document.getElementById(name).text;
	this.innerHTML = document.getElementById(name).innerHTML;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function print_description(descarray, descid, descbox)
{	
	var descboxelem = document.getElementById(descbox);
	if(!descboxelem) {
		alert("errore javascript");
		return;
	}

	descboxelem.innerHTML = descarray[descid];
}

/**
 * open_window
 */
 var aibpopup;
function open_window(src, title, width, height)
{
	//window.open(src, 'abi_popup', "statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height);
	if (aibpopup) {
		aibpopup.close();
	} 
	aibpopup = window.open(src, 'aibpopup', "statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height);

	if (window.focus) aibpopup.focus();
}

function close_aibpopup()
{
	if (aibpopup) {
		aibpopup.close();
	} 
}

/**
 * open_help_window
 */
 var aibhelppopup;
function open_help_window(src)
{
	if (aibhelppopup) {
		aibhelppopup.close();
	} 
	aibhelppopup = window.open(src, 'aibhelppopup', "statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400");
	if (window.focus) aibhelppopup.focus();
}


/**
 * checkUncheckAll
 */
function checkUncheckAll(theElement) 
{
	var theForm = theElement.form;
	var z = 0;
  while (theForm[z].type == 'checkbox' && theForm[z].name != 'checkall') 
  {
		theForm[z].checked = theElement.checked;
		z++;
	}
}

function selectDeselectAll (chkVal, idVal, frmid)
{
    var frm = document.forms[frmid];

    for (i=0; i<frm.length; i++)
    {
        if (idVal.indexOf ('CheckAll') != -1)
        {
            if(chkVal == true)
            {
                frm.elements[i].checked = true;
            }
            else
            {
                frm.elements[i].checked = false;
            }
        }
        else if (idVal.indexOf ('SelectThis') != -1)
        {
            if(frm.elements[i].checked == false)
            {
                frm.elements[0].checked = false;
            }
        }
    }
}


		



