var menuLineHeight = 16;
var menuLineHeightV = 27;

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 displayMenuV(n,x,y) {
   m = GEByID("menu"+n);
   m.style.visibility = 'visible';
   m.style.left = x;
   m.style.top = y + menuLineHeightV;
}

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=1 cellpadding=5>');
}

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

function newSubMenuItem(hrf, txt, subId, count) {
   if (count > 20) {
      if (subId < (count / 2)) classTd = 'menuJS';
      if (subId >= (count / 2)) classTd = 'menuJSNLeft';
      if (subId == 0) classTd = 'menuJSTop';
      if (subId == Math.ceil(count / 2)) classTd = 'menuJSTopNLeft';
      if (subId < (count / 2)) d.write('<tr>');
      d.write('<td id="',classTd,'" onMouseOver="this.style.backgroundColor=\'#dddddd\'" onMouseOut="this.style.backgroundColor=\'#A7AD25\'" onClick="location.href=\'',hrf,'\'"><a href="',hrf,'" class="t_menu">',txt,'</a></td>');
      if (subId >= (count / 2)) d.write('</tr>');
   }
   else {
      if (subId == 0) classTd = 'menuJSTop';
      else classTd = 'menuJS';
      d.write('<tr height="25"><td id="',classTd,'" onMouseOver="this.style.backgroundColor=\'#F4CA5A\'" onMouseOut="this.style.backgroundColor=\'#4A8227\'" onClick="location.href=\'',hrf,'\'"><span class="t_menu">&raquo; </span><a href="',hrf,'" class="t_menu">',txt,'</a></td></tr>');
   }
}



newSubMenu(1);
endSubMenu();
newSubMenu(2);
endSubMenu();
newSubMenu(3);
endSubMenu();
newSubMenu(4);
endSubMenu();

