//Creazione di un array per ogni menu;

arMenu1 = new Array(
"","",0,2,0,0,
"","",0,2,0,0,
"","",0,1,450,200
)
arMenu2 = new Array(
"Attachments","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/attach/attach.htm",0,2,0,0,
"Duraplant-Implantatsystem","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/dura/dura.htm",0,2,0,0,
"Jelenko-Legierungen","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/jelenko/jelenko.htm",0,2,0,0
)
arMenu3 = new Array(
"ZL-Vertriebspartner Inland","javascript:anzeigen('germ.htm?OpenDocument')",0,2,0,0,
"ZL-Vertriebspartner Ausland","javascript:anzeigen('world.htm?OpenDocument')",0,2,0,0

)
arMenu4 = new Array(
"Interview mit H. Pr. Dr. H.-L. Graf DGI-Preisträger (2003) ","javascript:anzeigen('presse.htm?OpenDocument') ",0,2,0,0,
"Nischen in der Implantologie mit H. Sven Grether ","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/presse/presse-ue.htm",0,2,0,0,
"Hilfsreiches Manual-Implantologie mit ZL-DURAPLANT","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/presse/presse-ue.htm",0,2,0,0,
"Prospektive Studie","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/presse/presse-ue.htm",0,2,0,0

)

arMenu5 = new Array(

"Kontaktformular","javascript:anzeigen('kontakt.htm?OpenDocument')",0,2,0,0,
"Geschäftszeit / Adresse","javascript:anzeigen('info.htm?OpenDocument')",0,2,0,0,
"Service  Gesprächspartner","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/service/service.htm",0,2,0,0,
"Das ZL-team  Gesprächspartner","javascript:anzeigen('team.htm?OpenDocument')",0,2,0,0,
"ZL-Wegbeschreibung","javascript:anzeigen('weg.htm?OpenDocument')",0,2,0,0,
"Trainingskurse-2004","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/kurse/labor.htm",0,2,0,0,
"Messe-Übersicht-2004","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/messe/messe.htm",0,2,0,0,

"Prothetik - Pass ","javascript:anzeigen('pass.htm?OpenDocument')",0,2,0,0,
"Videodent das Tele - Schulungssystem","javascript:anzeigen('video-1.htm?OpenDocument')",0,2,0,0,
"Liefer- und Zahlungsbedingungen ","javascript:anzeigen('liefer.htm?OpenDocument')",0,2,0,0,
"Preisliste ","file:///C:/Dokumente und Einstellungen/All Users/Dokumente/ZL-Web-Proto/ZL-WEb-neu/zl-web2-baustelle/deutsch/preisliste/preisliste.htm",0,2,0,0

)




function popUp(){return};
function popDown(){return};
areCreated=false;
if (!ver4) event=null;

//Impostazione parametri dei menu
if (ver4) {
if (NS4)
   LarghezzaMenu = 300;
else
   LarghezzaMenu = 145;
secondsVisible = 0.5;
ColoreLink = "0066cc";
LinkHover = "#ffffff";
if (NS4)
   DimensioneLink = "8pt";
else
   DimensioneLink = "8pt";
LinkWeight = "bold";
LinkStyle = "normal";
LinkFontFamily = "arial";
ColoreCella = "#ffffff";
if (NS4)
   ColoreCellaAttiva = "#0066cc";
else
   ColoreCellaAttiva = "#0066cc";
DistanzaLinee = "normal";
DimensioneBordoCella = 1;
ColoreBordoCella = "white"
StileBordoCella = "white";
imgSrc = "immagine.gif";
imgSiz = 30;
}

//Creazione dei menu
mSecsVis = secondsVisible*1000;

semi = ";";
styleStr = "<STYLE TYPE='text/css'>"
styleStr += ".items {"
styleStr += "width:" + LarghezzaMenu + semi
styleStr += "color:"+ ColoreLink + semi
styleStr += "font-size:"+ DimensioneLink + semi
styleStr += "font-weight:"+ LinkWeight + semi
styleStr += "font-style:"+ LinkStyle + semi
styleStr += "font-family:"+ LinkFontFamily + semi
styleStr += "border-width:" + DimensioneBordoCella + semi
styleStr += "border-color:" + ColoreBordoCella + semi
styleStr += "border-style:" + StileBordoCella + semi
styleStr += "line-height:" + DistanzaLinee + semi
styleStr += "}"
styleStr += "</STYLE>";
 
document.write(styleStr);


imgStr = "<IMG SRC=" + imgSrc + " WIDTH=" + imgSiz + " HEIGHT=" + imgSiz +" BORDER=0 VSPACE=2 ALIGN=RIGHT>"

topCount = 1;
areCreated = false;
isOverMenu = false;
currentMenu = null;
allTimer = null;

function menuSetup(hasParent,lastItem,openCont,openItem) {

	this.menuOver = menuOver;
	this.menuOut = menuOut;

	this.onmouseover = this.menuOver;
	this.onmouseout = this.menuOut;

	this.showIt = showIt;

	this.hideTree = hideTree
	this.hideParents = hideParents;
	this.hideChildren = hideChildren;
	this.hideTop = hideTop;
	
	this.hasChildVisible = false;
	this.isOn = false;
	
	this.hideTimer = null;

	if (hasParent) {
		this.hasParent = true;
		this.parentMenu = openCont;
		this.parentItem = openItem;
		this.parentItem.child = this;
	}
	else {
		this.hasParent = false;
		this.hideSelf = hideSelf;
	}

	if (NS4) {
		this.fullHeight = lastItem.top + lastItem.document.height;
		this.clip.bottom = this.fullHeight;
	}
	else {
	    this.fullHeight = lastItem.style.pixelTop + lastItem.offsetHeight;
		this.showIt(false);
		this.onselectstart = cancelSelect;
	}
}

function itemSetup(arrayPointer,whichArray) {

	this.itemOver = itemOver;
	this.itemOut = itemOut;
	this.onmouseover = this.itemOver;
	this.onmouseout = this.itemOut;

	this.dispText = whichArray[arrayPointer];
	this.linkText = whichArray[arrayPointer + 1];
	this.hasMore = whichArray[arrayPointer + 2];
  
	this.finestra = whichArray[arrayPointer + 3];
	this.finestraW = whichArray[arrayPointer + 4];
    this.finestraH = whichArray[arrayPointer + 5];
	
	if (this.linkText.length > 0) {
		this.linkIt = linkIt;
		if (NS4) {
			this.onfocus = this.linkIt;
		}
		else {
			this.onclick = this.linkIt;
			this.style.cursor = "hand";
		}
	}
      
	if (this.hasMore) {
		htmStr = imgStr + this.dispText;
	}
	else {
		htmStr = this.dispText;
	}

	if (NS4) {
		layStr = "<SPAN CLASS=items>" + htmStr+ "</SPAN>";
		this.document.write(layStr);
		this.document.close();

		this.bgColor = ColoreCella;
		this.clip.right = LarghezzaMenu;
		this.visibility = "inherit";
		this.container = this.parentLayer;

		if (arrayPointer == 0) {
			this.top = 0;
		}
		else {
			this.top = this.prevItem.top + this.prevItem.document.height - DimensioneBordoCella;
		}
		this.left = 0;
	}
	else {
		this.className = "items";
		this.style.padding = 3;
		this.innerHTML = htmStr;

		this.style.backgroundColor = ColoreCella; 
		this.container = this.offsetParent;

		if (arrayPointer == 0) {
			this.style.pixelTop = 0;
		}
		else {
			this.style.pixelTop = this.prevItem.style.pixelTop + this.prevItem.offsetHeight - DimensioneBordoCella;
		}
		this.style.pixelLeft = 0;
	}
}

function makeElement(whichEl,whichContainer) {
 if (arguments.length==1)
  whichContainer = (NS4) ? window: document.body;
if (NS4) {
  if (arguments.length==1){
   eval(whichEl + "= new Layer(LarghezzaMenu )");
  }
  else {
  eval(whichEl + "= new Layer(LarghezzaMenu, whichContainer )");
  }
 }
 else {
  elStr = "<DIV ID=" + whichEl + " STYLE='position:absolute;left:0;top:0'></DIV>";
  whichContainer.insertAdjacentHTML("BeforeEnd",elStr);
 }

 return eval(whichEl);
}


function makeTop() {
	while(eval("window.arMenu" + topCount)) {
		topArray = eval("arMenu" + topCount);
		topName = "elMenu" + topCount;

		topMenu = makeElement(topName);
    	topMenu.setup = menuSetup;

		topItemCount = 0;
		for (i=0; i<topArray.length; i+=6) {
			topItemCount++;
			topItemName = "item" + topCount + "_" + topItemCount;
			topItem = makeElement(topItemName,topMenu);

			if (topItemCount >1)
				topItem.prevItem = eval("item" + topCount + "_" + (topItemCount-1));
			topItem.setup = itemSetup;
			topItem.setup(i,topArray);
		}
		topMenu.setup(false,topItem);
		topCount++
	}
	areCreated = true;
}

function linkIt() {
    var w
    
	if (this.finestra==1){
		w=window.open(this.linkText,'nuova','toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,screenX=0,screenY=0,left=0,top=0');
        w.resizeTo(this.finestraW,this.finestraH);
    }
	else{
	    if (this.finestra==2)
          //nuovo documento nella stessa finestra
   		   window.document.location=this.linkText;
	    else
  	       if (this.finestra==3)
              //finestra normale senza barraindirizzi ecc.
   		       window.open(this.linkText,'nuova','toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=1,scrollbars=1,screenX=0,screenY=0,left=0,top=0');
	       else
		      //finestra normale
               window.open(this.linkText,'nuovafinestra');
    }
}

function showIt(on) {
	if (NS4) {this.visibility = (on) ? "show" : "hide"}
		else {this.style.visibility = (on) ? "visible" : "hidden"}
}

function popUp(menuName,e,xPos,yPos){
	if (!areCreated) return;
	hideAll();
	currentMenu = eval(menuName);
   //Posizionamento menu
	if (NS4)
		{screen_w = window.innerWidth;}
	else
		{screen_w = document.body.clientWidth;}
	if (screen_w > 596)
		{left_offset = (screen_w - 596)/2;}
	else
		{
		left_offset = 0;
		}
    if (NS4)
	    {
	    currentMenu.left = xPos + left_offset;
	    currentMenu.top = yPos;
		}
	else
	    { 
	    currentMenu.style.pixelLeft = xPos + left_offset;
	    currentMenu.style.pixelTop = yPos;
		}
    currentMenu.isOn = true;
	currentMenu.showIt(true);
}

function popDown(menuName){ 
	if (!areCreated) return;
	whichEl = eval(menuName);
	whichEl.isOn = false;
	whichEl.hideTop();
}

function menuOver() {
	this.isOn = true;
	isOverMenu = true;
	currentMenu = this;
	if (this.hideTimer) clearTimeout(this.hideTimer);
}

function menuOut() {
	if (IE4 && event.srcElement.contains(event.toElement)) return;
	this.isOn = false;
	isOverMenu = false;
	if (IE4) allTimer = setTimeout("currentMenu.hideTree()",10); 
}

function itemOver(){
	if (IE4 && event.srcElement.tagName == "IMG") return;

	if (NS4) {
		this.bgColor = ColoreCellaAttiva;
	}
	else {
		this.style.backgroundColor = ColoreCellaAttiva;
		this.style.color = LinkHover;
	}
	
	if (this.container.hasChildVisible) {
		this.container.hideChildren(this);
	}            

	if(this.hasMore) {
		this.container.hasChildVisible = true;
		this.container.visibleChild = this.child;
		this.child.showIt(true);
	}
}


function itemOut() {
    if (IE4 && (event.srcElement.contains(event.toElement)
     || (event.fromElement.tagName=="IMG" && event.toElement.contains(event.fromElement))))
        return;

	if (NS4) {
		this.bgColor = ColoreCella;
		if (!isOverMenu) {
			allTimer = setTimeout("currentMenu.hideTree()",10);
		}
	}
	else {
		this.style.backgroundColor = ColoreCella;
		this.style.color = ColoreLink;
	}
}

function hideAll() {
	for(i=1; i<topCount; i++) {
		temp = eval("elMenu" + i);
		temp.isOn = false;
		if (temp.hasChildVisible) temp.hideChildren();
		temp.showIt(false);
	}	
}

function hideTree() { 
	allTimer = null;
	if (isOverMenu) return;
	if (this.hasChildVisible) {
		this.hideChildren();
	}
	this.hideParents();
}

function hideChildren(item) {
	if (this.visibleChild.hasChildVisible) {
		this.visibleChild.visibleChild.showIt(false);
		this.visibleChild.hasChildVisible = false;
	}

	if (!this.isOn || !item.hasMore || this.visibleChild != this.child) {
		this.visibleChild.showIt(false);
		this.hasChildVisible = false;
	}
}

function hideParents() {     

	if (this.hasParent) {
		this.showIt(false);
		if (this.parentMenu.hasParent) {
			this.parentMenu.isOn = false;		
			this.parentMenu.showIt(false);
			this.parentMenu.parentMenu.isOn = false;
			whichEl = this.parentMenu.parentMenu
		}
		else {
			this.parentMenu.isOn = false;
			whichEl = this.parentMenu;
		}
	}
	else {
		whichEl = this;
	}

	whichEl.hideTop();
}

function hideTop() {
	whichEl = this;
	this.hideTimer = setTimeout("whichEl.hideSelf()",mSecsVis);
}

function hideSelf() {
	this.hideTimer = null;
	if (!this.isOn && !isOverMenu) { 
		this.showIt(false);
	}
}

function cancelSelect(){return false}

window.onload = makeTop;

