// funzione per prendere un elemento con id univoco
function $(id_elemento) {
	var elemento;
	if(document.getElementById)
		elemento = document.getElementById(id_elemento);
	else
		elemento = document.all[id_elemento];
	return elemento;
};
	
function getClassName(obj) {
	if (typeof obj != "object" || obj === null)
		return false;
	objnamearr = obj.constructor.toString().split(' ');
	objname = objnamearr[1];
	objpos = objname.search(/\(/);
	objret = objname.substring(0, objpos);
	return objret;
}

function visualizza(id, action){
	// variabili assegnabili ad action --> 0: nascondi, 1: visualizza, -1: indifferente
	if (getClassName(document.getElementById(id)) == 'HTMLTableRowElement')
		viewtype = 'table-row';
	else
		viewtype = 'block';
	
	if (action == 1 || (action == -1 && document.getElementById(id).style.display == 'none')){
		document.getElementById(id).style.display = viewtype;
		return;
	}
	if (action == 0 || (action == -1 && document.getElementById(id).style.display == viewtype)){
		document.getElementById(id).style.display = 'none';
	}
}

function setStyle(objId, style, value) {
    document.getElementById(objId).style[style] = value;
}

