var inmenu=false;
var lastmenu=0;
function Menu(current) { 
if (!document.getElementById) return; 
inmenu=true; 
oldmenu=lastmenu; 
lastmenu=current; 
if (oldmenu) Erase(oldmenu); 
m=document.getElementById("menu-" + current); 
box=document.getElementById(current); 
box.style.left= posLib.getLeft(m) + posLib.getBorderLeftWidth(m) + 70; 
//box.style.left= m.offsetLeft + 70; 
box.style.top= posLib.getTop(m) - 7;
box.style.visibility="visible"; 
} 
/*
function Menu(current) {
   if (!document.getElementById) return;
   inmenu=true;
   oldmenu=lastmenu;
   lastmenu=current;
   if (oldmenu) Erase(oldmenu);
   m=document.getElementById("menu-" + current);
   box=document.getElementById(current);
   box.style.left= m.offsetLeft + 85;
   box.style.top= m.offsetTop + 102;//(m.offsetHeight/4);
   box.style.visibility="visible";
   //box.style.borderWidths="2";
   //box.style.borderColor="black";
   //m.style.backgroundColor="Aqua";
   //box.style.backgroundColor="Aqua";
   //box.style.width="108px";
}
*/
function Erase(current) {
   if (!document.getElementById) return;
   if (inmenu && lastmenu==current) {
	  return;
   }
   m=document.getElementById("menu-" + current);
   box=document.getElementById(current);
   box.style.visibility="hidden";
   //m.style.backgroundColor="#333333";
}
function Timeout(current) {
   inmenu=false;
   window.setTimeout("Erase('" + current + "');",300);
}

function Highlight(menu,item) {
   if (!document.getElementById) return;
   inmenu=true;
   lastmenu=menu;
   obj=document.getElementById(item);
   //obj.style.backgroundColor="#333333";
   //obj.style.color="green";
}
function UnHighlight(menu,item) {
   if (!document.getElementById) return;
   Timeout(menu);
   obj=document.getElementById(item);
   //obj.style.backgroundColor="#333333";
   //obj.style.color="yellow";
}

var posLib = { 

getIeBox: function (el) { 
return this.ie && el.document.compatMode != "CSS1Compat"; 
}, 

// relative client viewport (outer borders of viewport) 
getClientLeft: function (el) { 
var r = el.getBoundingClientRect(); 
return r.left - this.getBorderLeftWidth(this.getCanvasElement(el)); 
}, 

getClientTop: function (el) { 
var r = el.getBoundingClientRect(); 
return r.top - this.getBorderTopWidth(this.getCanvasElement(el)); 
}, 

// relative canvas/document (outer borders of canvas/document, 
// outside borders of element) 
getLeft: function (el) { 
return this.getClientLeft(el) + this.getCanvasElement(el).scrollLeft; 
}, 

getTop: function (el) { 
return this.getClientTop(el) + this.getCanvasElement(el).scrollTop; 
}, 

// relative canvas/document (outer borders of canvas/document, 
// inside borders of element) 
getInnerLeft: function (el) { 
return this.getLeft(el) + this.getBorderLeftWidth(el); 
}, 

getInnerTop: function (el) { 
return this.getTop(el) + this.getBorderTopWidth(el); 
}, 

// width and height (outer, border-box) 
getWidth: function (el) { 
return el.offsetWidth; 
}, 

getHeight: function (el) { 
return el.offsetHeight; 
}, 

getCanvasElement: function (el) { 
var doc = el.ownerDocument || el.document; // IE55 bug 
if (doc.compatMode == "CSS1Compat") 
return doc.documentElement; 
else 
return doc.body; 
}, 

getBorderLeftWidth: function (el) { 
return el.clientLeft; 
}, 

getBorderTopWidth: function (el) { 
return el.clientTop; 
}, 

getScreenLeft: function (el) { 
var doc = el.ownerDocument || el.document; // IE55 bug 
var w = doc.parentWindow; 
return w.screenLeft + this.getBorderLeftWidth(this.getCanvasElement(el)) + 
this.getClientLeft(el); 
}, 

getScreenTop: function (el) { 
var doc = el.ownerDocument || el.document; // IE55 bug 
var w = doc.parentWindow; 
return w.screenTop + this.getBorderTopWidth(this.getCanvasElement(el)) + 
this.getClientTop(el); 
} 
}; 

posLib.ua = navigator.userAgent; 
posLib.opera = /opera [56789]|opera\/[56789]/i.test(posLib.ua); 
posLib.ie = (!posLib.opera) && /MSIE/.test(posLib.ua); 
posLib.ie6 = posLib.ie && /MSIE [6789]/.test(posLib.ua); 
posLib.moz = !posLib.opera && /gecko/i.test(posLib.ua); 


