//dipendenze sysinfo.js 
if (isNs()) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = mousecoords;

var Xcoords=0
var Ycoords=0

mnarray = new Array()

function menu(name) {
 this.cornice=name  //layer - div
 this.bgcolor=''
 this.border=0
 this.bdcolor=''
 this.head=''
 this.linkstyle=''
 this.size=''
 this.items=new Array(0)
 this.addit=addit
 this.setopt=setopt
 this.bullet=''
 this.testo=''
}
 

function drawmenu (mnobj){
 if (isNs4()){
  dw("<layer ID='l"+mnobj.cornice+"' name='l"+mnobj.cornice+"' width='"+mnobj.size+"' onMouseOver=\"javascript:mnshow('"+mnobj.cornice+"')\"  onMouseOut=\"javascript:mnhide('"+mnobj.cornice+"')\" visibility='hidden' Z-index=2>")
  dw("<Table cellpadding='"+mnobj.border+"' border='0' width='"+mnobj.size+"' ") //->
  dw("bgcolor='"+mnobj.bdcolor+"'><tr><td>")
  dw("<table cellpadding='2' width='100%' bgcolor='"+mnobj.bgcolor+"' border='0'><tr><td>")
  drawitems(mnobj)
  drawtesto(mnobj)
  dw("</td></tr></table></td></tr></table></layer>")
 } else {
  dw("<DIV ID='"+mnobj.cornice+"' name='"+mnobj.cornice+"' style=\"position:absolute; visibility:hidden; z-Index:2; width:"+mnobj.size+";\" ") //->
  dw(" onMouseOver=\"javascript: mnshow('"+mnobj.cornice+"');\"  onMouseOut=\"javascript: mnhideb('"+mnobj.cornice+"');\">")
  dw("<Table cellpadding='"+mnobj.border+"' border='0' width='"+mnobj.size+"'") //->
  dw("bgcolor='"+mnobj.bdcolor+"'><tr><td>")
  dw("<table cellpadding='2' width='100%' bgcolor='"+mnobj.bgcolor+"' border='0'><tr><td>")
  drawitems(mnobj)
  drawtesto(mnobj)
  dw("</td></tr></table></td></tr></table></DIV>")
 }  
 mnarray[mnarray.length]=mnobj.cornice 
}



function mnshow(mncornice){
 if (isIE4()) 
  return ""
 document.onmousemove=""
 for(i=0; i<mnarray.length; i++){
  if (mnarray[i]!=mncornice){  
	  mnhideb(mnarray[i])	
  } else {
    eval(layertype()+mncornice+"."+bstyle()+"visibility='visible'")	
  }
 }
}

function mnshowb(mncornice){
 if (isIE4()) 
  return ""
 mousecoords;
 document.onmousemove=mousecoords;
 for(i=0; i<mnarray.length; i++){
  if (mnarray[i]!=mncornice){  
	  mnhideb(mnarray[i])
	 } else {
   eval (layertype()+mncornice+"."+bstyle()+"top="+Ycoords+"-10")
   eval (layertype()+mncornice+"."+bstyle()+"left="+Xcoords+"+5")
   eval(layertype()+mncornice+"."+bstyle()+"visibility='visible'")
  }
 }
}

function txtshow(mncornice){
 mousecoords;
 for(i=0; i<mnarray.length; i++){
	if (mnarray[i]!=mncornice){  
		mnhideb(mnarray[i])
	  } else {
    eval (layertype()+mncornice+"."+bstyle()+"top="+Ycoords+"-200")
    eval (layertype()+mncornice+"."+bstyle()+"left="+Xcoords+"-340")
    eval(layertype()+mncornice+"."+bstyle()+"visibility='visible'")
	}
  }
}



function mnhide(mncornice){
 eval(layertype()+mncornice+"."+bstyle()+"visibility='hidden'")
 document.onmousemove = mousecoords; 
}

function mnhideb(mncornice){ 
  eval(layertype()+mncornice+"."+bstyle()+"visibility='hidden'")
}


function bstyle(){
 if (isNs()){
  return ""
 } else {
  return "style."
 }
}

function layertype() {
 if (isNs4()){
  return "document.layers.l"
 } else {
  if (isIE())
   return "document.all."
  else
   return "document."
 }
}

function dw(testo){
 document.write(testo)
}

function drawitems(mnobj){
 dw (mnobj.head)
 for (i=0; i<mnobj.items.length; i++){
  dw(mnobj.bullet)
  dw(mnobj.items[i][0]+"<font "+mnobj.linkstyle+">"+mnobj.items[i][1]+"</font></a><br>")
 }
}

function drawtesto(mnobj){
 dw(mnobj.testo)
}

function addit(link, nome){
 var i=this.items.length
 this.items[i]=new Array(2)
 this.items[i][0]=link
 this.items[i][1]=nome
}

function setopt (opt){
 this.bgcolor = opt.bgcolor
 this.size= opt.size
 this.linkstyle= opt.linkstyle
 this.border= opt.border
 this.bdcolor= opt.bdcolor
 this.bullet= opt.bullet
}

function mnoption() {
 this.bgcolor=''
 this.size=''
 this.border=''
 this.bdcolor=''
 this.linkstyle=''
 this.bullet=''
}


function mousecoords(e){
 if (isNs()){
  Xcoords=e.pageX
  Ycoords=e.pageY
 } else {
  Xcoords = event.clientX + document.body.scrollLeft
  Ycoords = event.clientY + document.body.scrollTop
 }
 if (Xcoords<0){Xcoords=0}
 if (Ycoords<0){Ycoords=0}
 return true 
}
 
