var menuLineHeight = 29;
var menuLineHeightV = 17;

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);
   if (m.style == null) return;
   m.style.visibility = 'visible';
   m.style.left = x;
   m.style.top = y + menuLineHeight - 2;
}

function displayMenuV(n,x,y) {
   m = GEByID("menu"+n);
   if (m.style == null) return;
   m.style.visibility = 'visible';
   m.style.left = x;
   m.style.top = y + menuLineHeightV;
}

function showMenu(n) {
   m = GEByID("menu"+n);
   if (m.style == null) return;
   m.style.visibility = 'visible';
}

function hideMenu(n) {
   m = GEByID("menu"+n);
   if (m.style == null) return;
   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 cellspacing=0 cellpadding=3 style="border:1px solid #b5b5b5; background-image:url(img/bkg_07.jpg); background-repeat:no-repeat;">');
}

function endSubMenu() {
   d.write('<tr><td height="1" bgcolor="#EEEEEE"></td></tr>');
   d.write('</table></div>');
}

function newSubMenuItem(hrf, txt, subId, count, idM) {
      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';
      d.write('<tr><td style="cursor: hand; border-top:1px solid #EEEEEE; border-left:1px solid #EEEEEE; border-right:1px solid #EEEEEE" id="',classTd,'" bordercolor="#EEEEEE" bgcolor=\'#EEEEEE\' onMouseOver="this.style.backgroundColor=\'#FFFFFF\'" onMouseOut="this.style.backgroundColor=\'#EEEEEE\'" onClick="hideMenu(',idM,'); location.href=\'',hrf,'\';">&nbsp;&nbsp;<a href="',hrf,'" class="text_10_green_link2">',txt,'</a>&nbsp;&nbsp;</td></tr>');
}

newSubMenu(2);
newSubMenuItem("./catalog/bandsaws/vesto/","Vesto",0,23,1);
newSubMenuItem("./catalog/bandsaws/auce/","Tehnika (Auce)",0,23,1);
newSubMenuItem("./catalog/bandsaws/talsi/","Tehnika (Talsi)",0,23,1);
endSubMenu();
newSubMenu(3);
newSubMenuItem("./catalog/stanki/kromkoobreznye/","кромкообрезные",0,23,1);
newSubMenuItem("./catalog/stanki/rebrovye/","ребровые",0,23,1);
newSubMenuItem("./catalog/stanki/delitelnye/","делительные",0,23,1);
newSubMenuItem("./catalog/stanki/torcovochnye/","торцовочные",0,23,1);
newSubMenuItem("./catalog/stanki/mnogopilnye/","многопильные",0,23,1);
endSubMenu();
newSubMenu(4);
newSubMenuItem("./catalog/band-saws/32-40mm/","Пилы 32-40 мм, для ленточных пилорам",0,23,1);
newSubMenuItem("./catalog/band-saws/wide/","Широкие пилы",0,23,1);
newSubMenuItem("./catalog/band-saws/joiners/","Столярные пилы",0,23,1);
newSubMenuItem("./catalog/band-saws/mbp/","Пилы для мяса, хлеба, бумаги, поролона",0,23,1);
endSubMenu();


