
function showHide(divId) {
  if (obj(divId))
    if (obj(divId).style.visibility == 'hidden') {
      obj(divId).style.visibility = 'visible';
      return true;
    } else {
      obj(divId).style.visibility = 'hidden';
      return false;
    }
}
function showHideSpan(spanId) {
  if (obj(spanId))
    if (obj(spanId).style.display == 'none') {
      obj(spanId).style.display = '';
    } else {
      obj(spanId).style.display = 'none';
    }
}

function centerPopup(url, nome, w, h, scroll, resiz) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  if(!resiz)
    resiz=true;
  winprops = 'height=' + h + ',width=' + w + ',top=' + wint + ',left=' + winl + ',scrollbars=' + scroll + ',resizable='+resiz+', toolbars=false, status=false, menubar=false';
  //alert (winprops);
  win = window.open(url, nome, winprops)
  if (parseInt(navigator.appVersion) >= 4) {
    win.window.focus();
  }
}

var changeEachNode=true;
var subMenuParentCounter;

function addEvent(obj,event_name,func_name){
	if (obj.attachEvent){
		obj.attachEvent("on"+event_name, func_name);
	}else if(obj.addEventListener){
		obj.addEventListener(event_name,func_name,true);
	}else{
		obj["on"+event_name] = func_name;
	}
}

function obj(objId) {
  return document.getElementById(objId);
}
