// JavaScript Document

var ie4 = document.all;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all; 



function findObj(theObj, theDoc)
{

  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];

	for (i=0; !foundObj && i < theDoc.forms.length; i++) 
     foundObj = theDoc.forms[i][theObj];

	for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
     foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;

}

function addText(){
	var newdiv=document.createElement("div");
	var newtext=document.createTextNode("testo testo");
	newdiv.appendChild(newtext); //append text to new div
	document.getElementById("PageCorpse").appendChild(newdiv);
	onPageLoaded();
}

function onPageLoaded(){
	var LeftMiddle = findObj("LeftMiddle");
	var RightMiddle = findObj("RightMiddle");
	var Corpse = findObj("PageCorpse");
	var LeftColumn = findObj("LeftColumn");
	var RightColumn = findObj("RightColumn");


	if(Corpse.offsetHeight < 500)
	{
		RightMiddle.style.visibility = "hidden";
		LeftMiddle.style.visibility = "hidden";
	}
	else
	{
		RightMiddle.style.visibility = "visible";
		LeftMiddle.style.visibility = "visible";	
	}
	
	LeftColumn.style.height = Corpse.offsetHeight + "px";
	RightColumn.style.height = Corpse.offsetHeight + "px";
};

function onMenuOver(e){
	var MenuCorpse = e;
	for (i=0; i<MenuCorpse.childNodes.length; i++)
	{
		if (MenuCorpse.childNodes[i].id=="CorpseMenu")
		{
			MenuCorpse.childNodes[i].style.visibility = "visible";
			//do something
		}
		
	}
};

function onMenuOut(e){
	var MenuCorpse = e;
	for (i=0; i<MenuCorpse.childNodes.length; i++)
	{
		if (MenuCorpse.childNodes[i].id=="CorpseMenu")
		{
			MenuCorpse.childNodes[i].style.visibility = "hidden";
			//do something
		}
		
	}
};








