	function Is()
	{
		var appName = navigator.appName;
		var version = navigator.appVersion;
	
		this.ns = ( appName == "Netscape" );
		this.ns4 = this.ns && version.indexOf("4.")!=-1;
		this.ns5 = this.ns && version.indexOf("5.")!=-1;
		this.ns6 = ( this.ns5 || (this.ns && version.indexOf("6.")!=-1) );

		this.ie = ( appName == "Microsoft Internet Explorer" );
		this.ie4 = this.ie && version.indexOf("MSIE 4.")!=-1;
		this.ie5 = this.ie && version.indexOf("MSIE 5.")!=-1;
		this.ie6 = this.ie && version.indexOf("MSIE 6.")!=-1;
	
		var userAgent = navigator.userAgent.toLowerCase();
		this.mac = ( userAgent.indexOf( "mac" ) != -1 );
		this.win = ( userAgent.indexOf( "windows" ) != -1 );
		this.linux = ( userAgent.indexOf( "linux" ) != -1 );
	}
	Is.prototype.toString = function()
	{
		var s = '';
		for( var i in this )
		{
			s += i + ': ' + this[i] + '\n';
		}
		return s;
	}
	var is = new Is();
	function objectMenu( div )
	{
		this.id = div.id;
		this.name = div.id.replace(/Div/, "");

		this.div = div;
		this.style = ( is.ns4 ) ? this.div : this.div.style;

		//this.position = this.getPosition();
		//this.size = this.getSize();
	}
	objectMenu.all = new Array();
	objectMenu.add = function( div )
	{
		var name = div.id.slice(0, -3);
		if( div.id == name + "Div")
		{
			objectMenu.all[ name ] = new objectMenu( div );
			eval( name + " = objectMenu.all." + name );
		}
	}
	objectMenu.init = function( doc )
	{
		this.isLoaded = true;
		if( document.layers )
		{
			if( doc == null ) doc = document;
			for( var i=0; i<doc.layers.length; i++ )
			{
				objectMenu.add( doc.layers[i] );
				objectMenu.init( doc.layers[i].document );
			}
			return true;
		} 
		var allD = false;
		if( is.ie4 ) 
			allD = document.all.tags("DIV");
			
		else 
			if( is.ie5 || is.ie6 ) 
				allD = document.getElementsByTagName("DIV");
			else 
				if( is.ns6 ) 
					allD = document.getElementsByTagName("DIV");
		if( allD )
		{
			for( var i=0; i<allD.length; i++ )
				objectMenu.add( allD[i] );
			return true;
		}
		return false;
	}
	objectMenu.prototype.show = function()
	{
		this.style.visibility = "visible";
	}
	objectMenu.prototype.hide = function()
	{
		this.style.visibility = "hidden";
	}
	function show(obj)
	{
		
		if(objectMenu.all[obj])
		{
			objectMenu.all[obj].show();
		}
	}
	function hide(obj)
	{
		if(objectMenu.all[obj])
			objectMenu.all[obj].hide();
	}

// Установка переменных
window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS4 = (bName == "Netscape" && bVer == 4);
 var NS4 = (bName == "Netscape" && bVer >= 4);
 var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
 var IE4 = ((bName == "Microsoft Internet Explorer" && bVer >= 4) || (bName == "Netscape" && bVer == 5));
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
 var menuActive = 0;
 var menuOn = 0;
 var onLayer;
 var timeOn = null;
 var loaded = 0;
 var onLayerSize = 0;

 
// УстанавливАем цвет меню
var menuColor = "yellow";
var menuBorderColor = "#000000";

if (NS4 || IE4) {
 if (navigator.appName == "Netscape") {
  layerStyleRef="layer.";
  layerRef="document.layers";
  styleSwitch="";
  }else{
  layerStyleRef="layer.style.";
  layerRef="document.all";
  styleSwitch=".style";
 }
}


// Показываем слои
function showLayer(layerName)
{
	if (NS4 || IE4) 
	{
		if (timeOn != null) 
		{
  			clearTimeout(timeOn);
  			hideLayer(onLayer);
  			
  		}
  		onLayer = layerName;
		if (NS4 || IE4) 
		{
			if(navigator.appName != "Netscape")
			{
				eval(layerRef+'["'+layerName+'Div"]'+styleSwitch+'.display=""');
			}
  			show(layerName);
		}
 		
	}
}

// Прячем слои
function hideLayer(layerName)
{
	if (menuActive == 0)
	{
		 if (NS4 || IE4) 
		 {
		 hide(layerName);
		 }
	}
}

// Счетчик для пряталки слоев
function btnTimer(opt) 
{
 	timeOn = setTimeout("btnOut()",250);
}

// Если время вышло
function btnOut(layerName) 
{
	if (menuActive == 0) 
	{
  		hideLayer(onLayer);
  	}
}

// Бедная мышка:)
// Мышка на слое
function menuOver(itemName) 
{
	clearTimeout(timeOn);
 	menuActive = 1;
}

// мышка вне слоя
function menuOut(itemName) 
{
 	menuActive = 0;
	timeOn = setTimeout("hideLayer(onLayer)", 400);
}


// Создаем меню
function menuLink(title, url) 
{
	this.title = title;
	this.url = url;
}

// Создание меню
function menuMaker(menuArray, LayerSize) 
{
	onLayerSize = LayerSize;
 	n = "";
 	j = eval(menuArray + ".length") - 1;
 	nameOfLayer = eval(menuArray + ".id.slice(0, -3)");
 	topTable = "<div ID='" + eval(menuArray + ".id") + "'><table border=1 style='border-collapse: collapse;' cellpadding=0 cellspacing=0 bgcolor='" + menuColor +"' bordercolor='" + menuBorderColor +"'>";
 	cell = "<tr height=15><td class=vmenu onmouseover=\"showLayer('" + nameOfLayer + "'); this.className='vmenul';\" onmouseout=\"btnTimer(); this.className='vmenu';\" style='padding-top: 1px; padding-bottom: 2px; padding-left: 0px; padding-right: 7px'>&nbsp;"; 
 	cellend = "</td></tr>";
 	btmTable = "</table></div>";
	n += topTable;
 	for( var i = 1; i <=j; i++)
 	{
   		n += cell+"<a class=vmenufont href='" + eval(menuArray + "[" + i + "].url") + "' target='_top' >" + eval(menuArray + "[" + i + "].title") + "</a><br>"+cellend;
 	}
 	n += btmTable;
 	return n;
}

function CallThisMenu() 
{
	for(i=0; i<menuSize.length;i++)
	{
                	document.write(menuMaker(menuSize[i],31));
		nameMenu=eval(menuSize[i]+".id");
		//.slice(0, -3)
		if(navigator.appName != "Netscape")
		{
			eval(layerRef+'["'+nameMenu+'"]'+styleSwitch+'.display="none"');
		}
	}
}

onload=objectMenu.init;