var menuLineHeight = 19;

var d = document;

function GEByID(id) { 
   return d.all ? d.all[id] : d.getElementById(id);
}

function relPosXX(e) { 
   return e.offsetLeft + (e.offsetParent != null && e.tagName != 'BODY' ? relPosXX(e.offsetParent) : 0);
}

function relPosYY(e) { 
   return e.offsetTop + (e.offsetParent != null && e.tagName != 'BODY' ? relPosYY(e.offsetParent) : 0);
}

function displayMenu(n,x,y) {
   m = GEByID("menu"+n);
   m.style.visibility = 'visible';
   m.style.left = x;
   m.style.top = y + menuLineHeight;
}

function showMenu(n) {
   m = GEByID("menu"+n);
   m.style.visibility = 'visible';
}

function hideMenu(n) {
   m = GEByID("menu"+n);
   m.style.visibility = 'hidden';
}

function newSubMenu(id) {
   d.write('<div id=menu',id,' style="z-index: 99; top:0; position:absolute; visibility:hidden;" onMouseOver="showMenu(',id,');" onMouseOut="hideMenu(',id,');">');
   d.write('<table border=0 cellspacing=0 cellpadding=3>');
}

function endSubMenu() {
   d.write('</table></div>');
}

function newSubMenuItem(hrf, txt, idM, nw) {
	if (nw==1) {
		link1='window.open(\''+hrf+'\',\'NewWindow\')';
		link2='onClick="window.open(\''+hrf+'\',\'NewWindow\'); return false;"';
	}else{
		link1='location.href=\''+hrf+'\'';
		link2='';
	}
	d.write('<tr><td id="menuJS" bgcolor=\'#DADADA\' onMouseOver="this.style.backgroundColor=\'#9cbbda\'" onMouseOut="this.style.backgroundColor=\'#DADADA\'" onClick="hideMenu(',idM,'); ',link1,';"><a href="',hrf,'" ',link2,' class="subMenu">',txt,'</a></td></tr>');
}
