function MenuSub1 ( node )
	{
	images = new Array();

	images[0]="automobiles";
	images[1]="services";
	images[2]="about";



	this.node = node;
	this.menuItems = new Array();

	var imageName=this.node.id.substr((node.id.length-1), node.id.length)
	MenuSub1.prototype.add = function( menuItem )
		{
		this.menuItems[ this.menuItems.length ] = menuItem;}

	MenuSub1.prototype.additem = function( submenuItem ) {
		if ( this.menuItems.length > 0 ) {
				this.menuItems[ this.menuItems.length - 1 ].add( submenuItem );
			};

		};

	MenuSub1.prototype.create = function( )
		{
		var dNode = document.createElement( "div" );
		var str = "_" + this.node.id;
		var nodeid=this.node.id;
		dNode.setAttribute( "id", str );
		var w = this.node.offsetWidth;
		dNode.style.display = "none";
		dNode.style.position = "absolute";
		dNode.style.width = w > 150 ? w+"px" : "150px";
		addEvent( this.node, "mouseover", function() { showMenuInTime(str, 500) } );
		addEvent( this.node, "mouseout", function() { setInMenu(false) } );
		addEvent( dNode, "mouseover", function() {ChNodeSrc(nodeid, url_img+'face/main_menu/'+images[imageName]+'_active.gif');} );
		addEvent( dNode, "mouseout",  function() {ChNodeSrc(nodeid, url_img+'face/main_menu/'+images[imageName]+'_unactive.gif');} );
		dNode.setAttribute( "pItemID", this.node.id );
		dNode.setAttribute( "level", 1 );
		addEvent( dNode, "mouseover", function() { setInMenu(true) } );
		addEvent( dNode, "mouseout", function() { setInMenu(false) } );


	var	html =	'<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="170">';
		html+=	'<TR STYLE="background:#ffffff url('+url_img+'face/main_menu/l2/bg.gif) bottom repeat-x;">';
		html+=		'<TD WIDTH="100%">';
		html+=			'<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>';
		//html+=			'<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="10" ALT=""><BR></TD><TD WIDTH="100%"></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';

		top=0;
		var i=0;
		while(i+1<this.menuItems.length)
			{
			html += this.menuItems[i].getLinkHTML();
			top=1;
			i++;
			}

      		html += this.menuItems[i].getLinkHTML();

		html+=			'<TR><TD><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="10" ALT=""><BR></TD></TR>';
		html+=			'<TR><TD BGCOLOR="#B6B6B6"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR>';
		html+=			'</TABLE>';
		html+=		'</TD>';
		html+=	'</TR>';
		html+=	'<TR><TD BGCOLOR="#797979"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR>';
		html+=	'</TABLE>';

		body.appendChild( dNode );
		dNode.innerHTML = html;

        var i=0;
        while(i+1<this.menuItems.length)
		     {
		     this.menuItems[i].create(dNode);
		     i++;
		     }
        this.menuItems[i].create(dNode);

		}

	}

function MenuSub2( value, href, name, price )
	{
	this.value = ( value == null ) ? "" : value;
	this.href = ( href == "none" ) ? "none" : href;
	this.name = ( name == null ) ? "" : name;
	this.price = ( price == null ) ? "" : price;
	this.menuItems = new Array();
	MenuSub2.prototype.add = function( menuItem )
		{this.menuItems[ this.menuItems.length ] = menuItem; }


	if( this.href != "" && typeof useAbsPath != "undefined" )
		{
		if( useAbsPath && this.href.indexOf( "http://" ) == -1 && this.href.indexOf( "https://" ) == -1 )
			this.href = "http://www.deep.com.ua" + this.href;
		}

	MenuSub2.prototype.getLinkHTML = function ()
		{
		if( this.value != "")
			{
			var ret="";
			ret+= '<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="6" ALT=""><BR></TD><TD WIDTH="100%"></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';
			ret+= '<TR>';
			ret+=    '<TD ID="'+this.name+'">';
			if ( this.href == "none")
			   {ret+='<TABLE BORDER=0 BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%">';}
			else
			   {ret+='<TABLE BORDER=0 ONMOUSEOVER="ChNodeSrc(\'sel'+this.name+'\', \''+url_img+'face/main_menu/l2/left_active.gif\');ChNodeSrc(\'sel_right'+this.name+'\', \''+url_img+'face/main_menu/l2/right_active.gif\');" onmouseout="ChNodeSrc(\'sel'+this.name+'\', \''+url_img+'spacer.gif\');ChNodeSrc(\'sel_right'+this.name+'\', \''+url_img+'spacer.gif\');" border=0 cellpadding=0 cellspacing=0 width=100%>';}

			ret+=     '<TR>';
			ret+=         '<TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD>';
			ret+=         '<TD VALIGN="bottom"><IMG ID="sel'+this.name+'" src="'+url_img+'spacer.gif" WIDTH=17 HEIGHT=14><BR></TD>';
		   	ret+=         '<TD WIDTH="100%">';

		   	if ( this.href != "")
			   ret+= '<A STYLE="text-decoration:none;" onclick="setInMenu(false);hideMenu(); return true;" href="'+this.href+'"><font color="#000066">'+this.value+'</FONT></A>';
			else
			   ret+= '<FONT COLOR="#000066"><B><U>'+this.value+'</U></B></font>';

			ret+=            '</TD>';
			ret+=            '<TD VALIGN="bottom"><IMG ID="sel_right'+this.name+'" src="'+url_img+'spacer.gif" WIDTH="44" HEIGHT=14><BR></TD>';
			ret+=            '<TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD>';
			ret+=         '</TR>';
			ret+=         '</TABLE>';
			ret+=     '</TD>';
			ret+= '</TR>';
			return ret;
			}
		else if( this.value != "" && this.href == "" )
			{return "";}
		else
			{return "";}
		}


	MenuSub2.prototype.create = function( parrentdiv )
		{
		var node = getNode( this.name );
		var dNode = document.createElement( "div" );
		var str = "_" + node.id;
		var nodeid=node.id;
		var sql_id=str.substr(17, node.id.length)
		dNode.setAttribute( "id", str );
		dNode.style.display = "none";
		dNode.style.position = "absolute";

		dNode.style.top  = "100px";
		dNode.style.left = "100px";

// для того щоб всі баттьківські меню залишались активними
		images = new Array();
		images[0]="automobile";
		images[1]="services";
		images[2]="about";

	var imageName=parrentdiv.id.substr((parrentdiv.id.length-1), parrentdiv.id.length)
		addEvent( dNode, "mouseover", function() {ChNodeSrc(parrentdiv.id.substr(1, parrentdiv.id.length), url_img+'face/main_menu/'+images[imageName]+'_active.gif');} );
		addEvent( dNode, "mouseout",  function() {ChNodeSrc(parrentdiv.id.substr(1, parrentdiv.id.length), url_img+'face/main_menu/'+images[imageName]+'_unactive.gif');} );

	var tId=node.id;
		addEvent( dNode, "mouseover", function() {ChNodeSrc('sel'+tId, url_img+'face/main_menu/l2/left_active.gif');ChNodeSrc('sel_right'+tId, url_img+'face/main_menu/l2/right_active.gif');})
		addEvent( dNode, "mouseout",  function() {ChNodeSrc('sel'+tId, url_img+'spacer.gif');ChNodeSrc('sel_right'+tId, url_img+'spacer.gif');});



		addEvent( node, "mouseover", function() { showSubMenuInTime(str, 500, node.id) } );
		addEvent( node, "mouseout",	 function() { setInMenu(false) } );
		dNode.setAttribute( "pItemID", node.id );
		node.setAttribute(  "pItemID", parrentdiv.id );
		dNode.setAttribute( "level", 2 );
		addEvent( dNode, "mouseover",	function() {setInMenu(true) });
		addEvent( dNode, "mouseout",	function() {setInMenu(false)});

	var	html =	'<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=170>';
		html+=	'<TR STYLE="background:#ffffff url('+url_img+'face/main_menu/l2/bg_ext.gif) bottom repeat-x;">';
		html+=		'<TD WIDTH="100%">';
		html+=			'<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>';
		html+=			'<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="35" ALT=""><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD WIDTH="100%" background="'+url_img+'face/main_menu/l2/under_name.gif" ALIGN="center"><FONT COLOR="#ffffff" STYLE="font-size:12pt;">'+this.value+'</FONT><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';
		html+=			'<TR><TD ALIGN="center"><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="35" ALT=""><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD WIDTH="100%" ALIGN="CENTER"><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="1" BGCOLOR="#ebebeb"><TR><TD BGCOLOR="#ffffff" ALIGN="center"><A HREF="'+url_menu+'automobiles/'+idPath[sql_id]+'/main/index.html"><IMG SRC="'+url_img+'images/automobiles/menu/'+idPath[sql_id]+'.jpg" WIDTH="174" HEIGHT="82" ALT="" BORDER="0"><BR></A></TD></TR></TABLE></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';
		html+=			'<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="35" ALT=""><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD WIDTH="100%" ALIGN="center"><FONT COLOR="#000066" STYLE="font-size:10pt;">Ціна від:</FONT>&nbsp;&nbsp;</FONT><FONT COLOR="#AD0000" STYLE="font-size:12pt;"><B>'+this.price+'&nbsp;&#128;</B></FONT><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';

		top=0;
		var i=0;
		while(i+1<this.menuItems.length)
			{
			html += this.menuItems[i].getLinkHTML();
			top=1;
			i++;
			}

	       	html+= this.menuItems[i].getLinkHTML();

		html+=			'<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="10" ALT=""><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD WIDTH="100%"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="10" ALT=""><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';
		html+=			'<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1"  ALT=""><BR></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD WIDTH="100%" BGCOLOR="#b6b6b6"></TD><TD BGCOLOR="#DCDCDC"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';
		html+=             '</TABLE>';
		html+=         '</TD>';
		html+=    '</TR>';
		html+=	'<TR><TD BGCOLOR="#797979"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR>';
		html+= '</TABLE>';

		body.appendChild( dNode );
		dNode.innerHTML = html;

		}



	MenuSub2.prototype.getname = function ()
		{
		return 'sel'+this.name;
		}
	}


function MenuSub3( value, href, name)
	{
	this.value = ( value == null ) ? "" : value;
	this.href = ( href == "none" ) ? "none" : href;
	this.name = ( name == null ) ? "" : name;

	if( this.href != "" && typeof useAbsPath != "undefined" )
		{
		if( useAbsPath && this.href.indexOf( "http://" ) == -1 && this.href.indexOf( "https://" ) == -1 )
			this.href = "http://www.deep.com.ua" + this.href;
		}

	MenuSub3.prototype.getLinkHTML = function ()
		{
		if( this.value != "")
			{
			var ret="";
			ret+= '<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="6" ALT=""><BR></TD><TD WIDTH="100%"></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';
			ret+= '<TR>';
			ret+=    '<TD ID="'+this.name+'">';
			if ( this.href == "none")
			   {ret+='<TABLE BORDER=0 BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%">';}
			else
			   {ret+='<TABLE BORDER=0 ONMOUSEOVER="ChNodeSrc(\'sel'+this.name+'\', \''+url_img+'face/main_menu/l2/left_active.gif\');ChNodeSrc(\'sel_right'+this.name+'\', \''+url_img+'face/main_menu/l2/right_active.gif\');" onmouseout="ChNodeSrc(\'sel'+this.name+'\', \''+url_img+'spacer.gif\');ChNodeSrc(\'sel_right'+this.name+'\', \''+url_img+'spacer.gif\');" border=0 cellpadding=0 cellspacing=0 width=100%>';}

			ret+=     '<TR>';
			ret+=         '<TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD>';
			ret+=         '<TD VALIGN="bottom"><IMG ID="sel'+this.name+'" src="'+url_img+'spacer.gif" WIDTH=17 HEIGHT=14><BR></TD>';
		   	ret+=         '<TD WIDTH="100%">';

		   	if ( this.href != "")
			   ret+= '<A STYLE="text-decoration:none;" onclick="setInMenu(false);hideMenu(); return true;" href="'+this.href+'"><font color="#000066">'+this.value+'</FONT></A>';
			else
			   ret+= '<FONT COLOR="#000066"><B><U>'+this.value+'</U></B></font>';

			ret+=            '</TD>';
			ret+=            '<TD VALIGN="bottom"><IMG ID="sel_right'+this.name+'" src="'+url_img+'spacer.gif" WIDTH="44" HEIGHT=14><BR></TD>';
			ret+=            '<TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD>';
			ret+=         '</TR>';
			ret+=         '</TABLE>';
			ret+=     '</TD>';
			ret+= '</TR>';
			return ret;
			}
		else if( this.value != "" && this.href == "" )
			{return "";}
		else
			{return "";}
		}

	MenuSub3.prototype.getname = function ()
		{
		return 'sel'+this.name;
		}
	}


function MenuSub2not3( value, href, name)
	{
	this.value = ( value == null ) ? "" : value;
	this.href = ( href == "none" ) ? "none" : href;
	this.name = ( name == null ) ? "" : name;
	this.menuItems = new Array();
	MenuSub2not3.prototype.add = function( menuItem )
		{this.menuItems[ this.menuItems.length ] = menuItem; }


	if( this.href != "" && typeof useAbsPath != "undefined" )
		{
		if( useAbsPath && this.href.indexOf( "http://" ) == -1 && this.href.indexOf( "https://" ) == -1 )
			this.href = "http://www.deep.com.ua" + this.href;
		}

	MenuSub2not3.prototype.getLinkHTML = function ()
		{
		if( this.value != "")
			{
			var ret="";
			ret+= '<TR><TD><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="6" ALT=""><BR></TD><TD WIDTH="100%"></TD><TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD></TR></TABLE></TD></TR>';
			ret+= '<TR>';
			ret+=    '<TD>';
			if ( this.href == "none")
			   {ret+='<TABLE BORDER=0 BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH="100%">';}
			else
			   {ret+='<TABLE BORDER=0 ONMOUSEOVER="ChNodeSrc(\'sel'+this.name+'\', \''+url_img+'face/main_menu/l2/left_active.gif\');" onmouseout="ChNodeSrc(\'sel'+this.name+'\', \''+url_img+'spacer.gif\');" border=0 cellpadding=0 cellspacing=0 width=100%>';}

			ret+=     '<TR>';
			ret+=         '<TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD>';
			ret+=         '<TD VALIGN="bottom"><IMG ID="sel'+this.name+'" src="'+url_img+'spacer.gif" WIDTH=17 HEIGHT=14><BR></TD>';
		   	ret+=         '<TD WIDTH="100%">';

		   	if ( this.href != "")
			   ret+= '<A STYLE="text-decoration:none;" onclick="setInMenu(false);hideMenu(); return true;" href="'+this.href+'"><font color="#000066">'+this.value+'</FONT></A>';
			else
			   ret+= '<FONT COLOR="#000066"><B><U>'+this.value+'</U></B></font>';

			ret+=           '</TD>';
			ret+=           '<TD><IMG SRC="'+url_img+'spacer.gif" WIDTH=12 HEIGHT=1><BR></TD>';
			ret+=            '<TD BGCOLOR="#646464"><IMG SRC="'+url_img+'spacer.gif" WIDTH="1" HEIGHT="1" ALT=""><BR></TD>';
			ret+=         '</TR>';
			ret+=         '</TABLE>';
			ret+=     '</TD>';
			ret+= '</TR>';
			return ret;
			}
		else if( this.value != "" && this.href == "" )
			{return "";}
		else
			{return "";}
		}


	MenuSub2not3.prototype.create = function( parrentnode )	{};

	MenuSub2.prototype.getname = function ()
		{
		return 'sel'+this.name;
		}
	}








function showMenuInTime( node, time )
		{popID = setTimeout( "showMenu('" + node + "')", time );}

function showSubMenuInTime( node, time )
		{popID = setTimeout( "showSubMenu('" + node + "')", time );}

function showMenu( node )
		{
		clearTimeout( popID );
		if( typeof node == "string" )
			node = getNode( node );

		if( last != null && last != node )
			hideMenu( last );
		else if( last == node )
			{
			setInMenu( true );
			return;
			}

		var pItem = getNode( node.getAttribute( "pItemID" ) );
		var menuLeft = 0;
		var menuTop = pItem.offsetHeight;
		var tmp = pItem;
		while(tmp!=null && tmp.tagName!="BODY")
			{
			if( tmp.tagName == "html:body" ) break;
			menuLeft += tmp.offsetLeft;
			menuTop  += tmp.offsetTop;
			tmp = tmp.offsetParent;
			}
		node.style.left = menuLeft + "px";
		node.style.top = menuTop + "px";
		var w = pItem.offsetWidth;
		node.style.width = w > 150 ? w+"px" : "150px";
		node.style.display = "block";
		setInMenu( true );
		last = node;
		tID = setTimeout( "hideMenu( last )", 500 );
		}



function showSubMenu( node )
			{
			clearTimeout( popID );

			if( typeof node == "string" )
				node = getNode( node );

			if( lastsub != null && lastsub != node)
				{
				hideMenu( lastsub );
				}
			else if( lastsub == node )
				{
				setInMenu( true );
				return;
				}

			var pItem = getNode( node.getAttribute( "pItemID" ) );
			var menuLeft = pItem.offsetWidth;
			var menuTop = 0;
			var tmp = getNode( pItem.getAttribute( "pItemID" ) );
			while(tmp!=null && tmp.tagName!="BODY")
				{
				if( tmp.tagName == "html:body" ) break;
				menuLeft += tmp.offsetLeft;
				menuTop  += tmp.offsetTop;
				tmp = tmp.offsetParent;
				}
			node.style.left = menuLeft + "px";
			node.style.top = menuTop + "px";
			node.style.width = "150px";
			node.style.display = "block";
			setInMenu( true );
			lastsub = node;
			clearTimeout(tID);
			tID = setTimeout( "hideMenu( last )", 500 );
		}

function hideMenu( node )
		{
		if( node == null )
			{
			setInMenu( false );
			if (last != null) { hideMenu( last ); };
			return;
			}

		if( typeof node == "string" )
			node = getNode( node );

		if( node.getAttribute("level") == 2 )
			{
				//підменю завжди викликається з lastsub=node
			if( !inMenu )
				{
				node.style.display = "none"; // цей шмат коду по-ідеї не виконується ніколи
				last.style.display="none";
				last = null;
				lastsub=null;
				clearTimeout( tID );
				}
			else
				{
				node.style.display = "none";
				lastsub = null;
				tID = setTimeout( "hideMenu( last )", 100 );
				}

			}
		else
			{
				//меню
				if( !inMenu )
					{
					if (lastsub) {lastsub.style.display = "none";lastsub=null;};
					node.style.display = "none";
					//var pItem = getNode( node.getAttribute( "pItemID" ) );
					if (last) {last.style.display = "none";last=null;};
					clearTimeout( tID );
					}
				else
					tID = setTimeout( "hideMenu( last )", 100 );
			};
		}

function setInMenu( value )
		{
		inMenu = value;
		if( !value ) clearTimeout( popID );
		}

function addEvent( node, evtType, func )
		{
		if( node.addEventListener )
			{
			node.addEventListener( evtType, func, false );
			return true;
			}
		else if( node.attachEvent )
			return node.attachEvent( "on" + evtType, func );
		else
			return false;
		}

function getNode( nodeId )
		{
		if( document.getElementById )
			return document.getElementById( nodeId );
		else if( document.all && document.all( nodeId ) )
			return document.all( nodeId );
		else if( document.layers && document.layers[ nodeId ] )
			return document.layers[ nodeId ];
		else
			return false;
		}

