function init(ttop) 
{
var MenuHeight=70; ItemHeight=32; ItemWidth=143; SubMenuHeight=28; SubItemHeight=23; SubItemWidth=140; MenuMargin=10; SubMargin=3;
var Items = new Array("about","news","insurance","order","contacts");
var NSubItems = new Array(2,0,2,0,0);
var SubItems0 = new Array("history","information");
var SubItems2 = new Array("compulsory","voluntary");

if (document.all) {		// MSIE4+
  layerRef="document.all[";
  styleSwitch="].style";
  }
else if (document.getElementById) {	// NS6+
  layerRef="document.getElementById(";
  styleSwitch=").style";
  };

document.writeln("<table style=\"margin-left:"+MenuMargin+";\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\""+MenuHeight+"\" width=\"98%\"><tr>");

for (i=0; i<Items.length; i++) {
  MakeImage ("button",Items[i]);
  document.write("<td height=\""+MenuHeight+"\" width=\""+ItemWidth+"\" valign=\"middle\">");
  if (NSubItems[i]>0) { 
    tmpLink="#null";
    tmpMouseOver="; "+layerRef+"'menu"+Items[i]+"'"+styleSwitch+".visibility='visible'";
    tmpMouseOut="; "+layerRef+"'menu"+Items[i]+"'"+styleSwitch+".visibility='hidden'";
    }
  else {
    if (Items[i] == "news") {
      tmpLink="../"+Items[i]+".php";
      }
    else {
      tmpLink="../"+Items[i]+".html";
      };
    tmpMouseOver="";
    tmpMouseOut="";
    };
  document.write("<a href=\""+tmpLink+"\" onClick=\"blur();\" onMouseOver=\"select('button"+Items[i]+"','button"+Items[i]+"on')"+tmpMouseOver+";\" onMouseOut=\"select('button"+Items[i]+"','button"+Items[i]+"off')"+tmpMouseOut+";\">");
  document.writeln("<img name=\"button"+Items[i]+"\" src=\"../images/"+Items[i]+"off.gif\" width=\""+ItemWidth+"\" height=\""+ItemHeight+"\" border=\"0\" alt=\"\"></a></td>");
  };
document.writeln("<td height=\""+MenuHeight+"\">&nbsp;</td>");
MakeImage ("button","mail");
document.write("<td height=\""+MenuHeight+"\" width=\"48\" valign=\"middle\">");
document.write("<a href=\"mailto:andrew@oradon.com?Subject=From%20www.oradon.com\" onClick=\"blur();\" onMouseOver=\"select('buttonmail','buttonmailon');\" onMouseOut=\"select('buttonmail','buttonmailoff');\">");
document.writeln("<img name=\"buttonmail\" src=\"../images/mailoff.gif\" width=\"48\" height=\"39\" border=\"0\" alt=\"Написать письмо\"></a></td>");
MakeImage ("button","home");
document.write("<td height=\""+MenuHeight+"\" width=\"48\" valign=\"middle\">");
document.write("<a href=\"../index.html\" target=\"_top\" onClick=\"blur();\" onMouseOver=\"select('buttonhome','buttonhomeon');\" onMouseOut=\"select('buttonhome','buttonhomeoff');\">");
document.writeln("<img name=\"buttonhome\" src=\"../images/homeoff.gif\" width=\"48\" height=\"39\" border=\"0\" alt=\"На главную\"></a></td>");
document.writeln("</tr></table>");

for (i=0; i<Items.length; i++) {
  if (NSubItems[i]>0) { 
    document.writeln("<div id=\"menu"+Items[i]+"\" style=\"position:absolute; visibility:hidden; z-index:1; width:"+SubItemWidth+"; height:"+eval(NSubItems[i]*SubMenuHeight)+"; left:"+eval(MenuMargin+SubMargin+i*ItemWidth)+"; top:"+ttop+";\" onMouseOver=\""+layerRef+"'menu"+Items[i]+"'"+styleSwitch+".visibility='visible'; select('button"+Items[i]+"','button"+Items[i]+"on');\" onMouseOut=\""+layerRef+"'menu"+Items[i]+"'"+styleSwitch+".visibility='hidden'; select('button"+Items[i]+"','button"+Items[i]+"off');\">");
    document.writeln("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\""+SubMenuHeight+"\" width=\""+SubItemWidth+"\">");
    for (j=0; j<NSubItems[i]; j++) {
      tmpSub=eval("SubItems"+i+"[j]");
      MakeImage("button",tmpSub);
      document.write("<tr><td height=\""+eval(SubItemHeight+3)+"\" valign=\"middle\"><a href=\"../"+tmpSub+".html\" onClick=\"blur()\">");
      document.writeln("<img name=\"button"+tmpSub+"\" class=\"off\" src=\"../images/"+tmpSub+"off.gif\" width=\""+SubItemWidth+"\" height=\""+SubItemHeight+"\" border=\"0\" alt=\"\" onMouseOver=\"this.className='on';\" onMouseOut=\"this.className='off';\"></a></td></tr>");
      };
    document.writeln("</table></div>");
    };
  };
};

function MakeImage(prefix, ImName)
{
eval(prefix+ImName+"off = new Image();");
eval(prefix+ImName+"off.src = \"../images/"+ImName+"off.gif\";");
eval(prefix+ImName+"on = new Image();");
eval(prefix+ImName+"on.src = \"../images/"+ImName+"on.gif\";");
};

function select(img1,img2)
{
 document.images[img1].src=eval(img2+".src");
};
