  function BrowserDetector() {
    this.dom = (document.getElementById)? true : false;
    this.nn4 = (document.layers)? true : false;
    this.ie4 = (document.all && !this.dom);
    this.netscape = (navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4);
    this.explorer = (document.all)? true : false;
  }
  var browser = new BrowserDetector();



function layerRef(id) {
	return (browser.dom) ? document.getElementById(id) : ((browser.ie4) ? document.all[id] : ((browser.nn4) ? document.layers[id] : null));
}

function Layer(id) {
	this.id = id;
	this.element = layerRef(id);
	this.style = (this.element) ? ((browser.nn4) ? this.element : this.element.style) : null;
	this.ok = (this.style) ? true : false;
	this.xpos = 0; this.ypos = 0;
	this.show = (this.ok) ? layerShow : stub;
	this.hide = (this.ok) ? layerHide : stub;
	this.move = (this.ok) ? layerMove : stub;
	this.get = (this.ok) ? layerGet : stub;
	this.set = (this.ok) ? layerSet : stub;
}

function layerShow() { this.style.visibility = (browser.nn4) ? 'show' : 'visible'; }
function layerHide() { this.style.visibility = (browser.nn4) ? 'hide' : 'hidden'; }
function layerMove(x,y) { this.style.left = x; this.style.top = y; this.xpos = x; this.ypos = y; }
function layerGet(property) { return this.style[property]; }
function layerSet(property, value) { this.style[property] = value; }
function stub(){ void(0) };


var color_on  = '#FFFFCC';
var color_off = '#FFFFFF';

var roll_supported = (document.images)? true : false;
var subnav_supported = (browser.dom || browser.nn4 || browser.ie4);
var timeout = 0;
var target;

var menu_counter = 0;
var item_counter = 0;
var active = null;
var menu_list = new Array;
var item_list = new Array;
var menu_over = false;

function Menu(xpos, ypos, width, items) {
	this.id = menu_list.length;
	this.xpos = xpos;
	this.ypos = ypos;
	this.width = width;
	this.height = items.length * 25;
	this.items = items;
	this.skin = menu_skin;
	menu_list[this.id] = this;
}

function Item(name, url) {
	this.id = item_list.length;
	this.name = name;
	this.url = url;
	this.skin = item_skin;
	item_list[this.id] = this;
}

// ======================================

function item_skin() {
	var div_start = (browser.nn4) ? '' : '<div id="item_div_' + this.id + '" style="background-color:white">';
	var div_end = (browser.nn4) ? '' : '</div>';
	var str =
		'<tr>' +
		'<td>' + div_start +
		'<table cellpadding="5" cellspacing="0" border="0"' + ((browser.nn4) ? 'width="100%" bgcolor="#FFFFFF"' : '') + '><tr>' +
		'<td><a onMouseOver="item_over(' + this.id + ');" onMouseOut="item_out(' + this.id + ');"' + 'href="' + this.url + '" class="menu">' + this.name + '</a></td>' +
		'</tr></table>' + div_end +
		'</td>' +
		'</tr>\n';
	return str;
}

function menu_skin() {
	var str = 
		'<div class="subnav" id="menu_' + this.id + '">' +
		'<table cellpadding="0" cellspacing="0" border="0" width="' + this.width + '">' +
		'<tr><td bgcolor="#663300">' +
		'<table cellspacing="1" cellpadding="0" border="0" width="' + this.width + '">\n';
	for (var i = 0; i < this.items.length; i++) str += this.items[i].skin();
	str +=
		'</table>' +
		'</td></tr>' +
		'</table>' +
		'</div>';
	return str;
}

// ======================================

function deactivate() {
	timeout = 0;
	if (active != null) {
		active.layer.hide();
		active = null;
	}
}

function over(item) {
	menu_over = true;
	if (subnav_supported) {
		if (timeout != 0) { clearTimeout(timeout); timeout = 0; }
		if (active == null || active.id != item) {
			if (active) active.layer.hide();
			if (menu_list[item]) {
				menu_list[item].layer.show();
				active = menu_list[item];
			} else {
				active = null;
			}
		}
	}
}

function out(item) {
	menu_over = false;
	if (subnav_supported && (timeout == 0)) timeout = setTimeout("deactivate()", 500);
}

function item_over(item) {
	var id = item_list[item].id;
	if (browser.dom || browser.ie4) {
		layerRef('item_div_' + id).style.backgroundColor = color_on;
	}
}

function item_out(item) {
	var id = item_list[item].id;
	if (browser.dom || browser.ie4) {
		layerRef('item_div_' + id).style.backgroundColor = color_off;
	}
}

function inArea(checkX, checkY, areaX, areaY, areaW, areaH) {
	return ((checkX >= areaX) && (checkY >= areaY) && (checkX < areaX + areaW) && (checkY < areaY + areaH));
}

function mouseMove(e) {
	var x = (browser.netscape)? e.pageX : event.clientX;
	var y = (browser.netscape)? e.pageY : event.clientY;
	if ((browser.explorer) && (document.body.scrollTop)) y += document.body.scrollTop;
	if ((browser.explorer) && (document.body.scrollLeft)) x += document.body.scrollLeft;
	if (active) {
		if (inArea(x, y, active.xpos, active.ypos, active.width, active.height)) {
			if (timeout != 0) { clearTimeout(timeout); timeout = 0; }
		} else {
			if ((!menu_over) && (timeout == 0)) { timeout = setTimeout("deactivate()", 500); }
		}
	}
	return true;
}

function init() {
	for (var i = 0; i < menu_list.length; i++) document.writeln(menu_list[i].skin());
}

function activate() {
	for (var i = 0; i < menu_list.length; i++) {
		menu_list[i].layer = new Layer('menu_' + menu_list[i].id);
		menu_list[i].layer.move(menu_list[i].xpos, menu_list[i].ypos);
	}
	if (browser.netscape) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = mouseMove;
}

<!--
  navbar = new Array(
    // X, Y, Width
    new Menu(216, 170, 269,
      new Array(
        new Item('финские сауны', '/catalog/stroy/fin/'),
        new Item('турецкие бани, велнесс-центры &quot;под ключ&quot; ', '/catalog/stroy/tyr/'),
        new Item('камины, печи и дымоходы', '/catalog/stroy/others/')
      )
    ),

    new Menu(487, 170, 267,
      new Array(
        new Item('сборные сауны', '/catalog/equipment/sbor_sauna/'),
        new Item('инфракрасные кабины', '/catalog/equipment/inf_cab/'),
        new Item('электрокаменки', '/catalog/equipment/electrokamenki/'),
        new Item('дровяные каменки', '/catalog/equipment/drovkamenki/'),
        new Item('камины, печи и дымоходы', '/catalog/equipment/kamini/'),
        new Item('водонагревательное оборудование', '/catalog/equipment/vodonagrev/'),
        new Item('массажные души и души впечатлений', '/catalog/equipment/dush/'),
	    new Item('арома- и солетерапия', '/catalog/equipment/aroma/'),
        new Item('оптоволоконное освещение', '/catalog/equipment/svet/'),
        new Item('цветотерапия', '/catalog/equipment/cvetoterapija/')
      )
    ),

    new Menu(756, 170, 245,
      new Array(
        new Item('двери', '/catalog/accessories/doors/'),
        new Item('купели и обливные устройства', '/catalog/accessories/kupeli/'),
        new Item('бондарные изделия', '/catalog/accessories/bond/'),
        new Item('измерительные приборы', '/catalog/accessories/mesure/'),
        new Item('дополнительные принадлежности', '/catalog/accessories/sub/'),
        new Item('изделия из войлока и фетра', '/catalog/accessories/fetra/'),
        new Item('ароматизаторы и масла', '/catalog/accessories/aroma/')
      )
    )

   

   

  );
