function init(x)
{
	z=1;
	for (var i in menuID)
	{
		if((x&z)==0) document.getElementById("s-" + menuID[i]).style.display = "none";
			else  document.getElementById("s-" + menuID[i]).style.display = "block";
		z=z*2;
	}
}

function loadIframe(x,y)
{
	mostra(x);
	document.getElementById("s-"+x).innerHTML = "<iframe src='"+y+"' height='100%' width='100%' style='border:0px; margin:0px'></iframe>";
}

function mostra(id) {
	if (document.getElementById("s-"+id).style.display == "none")
	{
		document.getElementById("s-"+id).style.display = "block";
	} else {
		document.getElementById("s-"+id).style.display = "none";
	}
}

function setPointer(theRow, theCss)
{
	if (typeof(document.styleSheets[0].cssRules) != 'undefined')
	{
		var ruls = document.styleSheets[0].cssRules;
	} else {
		var ruls = document.styleSheets[0].rules;
	}
	
	function findcss(x,n)
	{
	    for (i = 0; i < x.length; i++) if(x[i].selectorText==n) return i;
	}

	function scambiaCss(oldcss,newcss)
	{
		oldcss.backgroundColor=newcss.backgroundColor;
		oldcss.borderBottomWidth=newcss.borderBottomWidth;
		oldcss.borderBottomStyle=newcss.borderBottomStyle;
		oldcss.borderBottomColor=newcss.borderBottomColor;
	}

	if (typeof(document.getElementsByTagName) != 'undefined')
	{
		theCells = theRow.getElementsByTagName('td');
	} else if (typeof(theRow.cells) != 'undefined') {
		theCells = theRow.cells;
	} else {
		return false;
	}

	for (c = 0; c < theCells.length; c++)
	{
		x=findcss(ruls,theCss);
		scambiaCss(theCells[c].style, ruls[x].style)
	}

    return true;
}

var myRequest= new Array(10);
function CreateXmlHttpReq2(handler) {
    var xmlhttp = null;
    try {
	  xmlhttp = new XMLHttpRequest();
    } catch(e) {
	  try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	  } catch(e) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  }
    }
    if(xmlhttp) xmlhttp.onreadystatechange = handler;
    return xmlhttp;
}

function move_box(an, box) {
  var cleft = 180;
  var ctop = 0;
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    obj = obj.offsetParent;
  }
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight + 8;
  if (document.body.currentStyle &&
    document.body.currentStyle['marginTop']) {
    ctop += parseInt(
      document.body.currentStyle['marginTop']);
  }
  box.style.top = ctop + 'px';
}

function apri(an, width, height, borderStyle) {
  var href = an.href;
  var boxdiv = document.getElementById(href);

  if (boxdiv != null) {
    if (boxdiv.style.display=='none') {
      move_box(an, boxdiv);
      boxdiv.style.display='block';
    } else
      boxdiv.style.display='none';
    return false;
  }

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', href);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = borderStyle;
  boxdiv.style.backgroundColor = '#fff';

  var contents = document.createElement('iframe');
  contents.scrolling = 'no';
  contents.frameBorder = '0';
  contents.style.width = width + 'px';
  contents.style.height = height + 'px';
  contents.src = href;

  boxdiv.appendChild(contents);
  document.body.appendChild(boxdiv);
  move_box(an, boxdiv);

  return false;
}
