	//Цвета
	var menuColorOver="black";
	var menuColorOut="#333333";
	var idImg=0;
		
	//Генерация меню
	var trCount=10;
		
	//Текущее меню
	var activeMenu=null;
	
	function onMenuClick(href){	
		window.location.href=href;
	}
	
	function onMenuOver(id, index){
		var ids=document.getElementById("img"+index);
		ids.src="images/triangle_orange.gif";
		if ((index==2)||(index==3)||(index==4))	ShowMenu(index);
	}

	function onMenuOut(index){	
		if (idImg==index) return;
		var id=document.getElementById("img"+index);
		id.src="images/triangle_white.gif";
	}
	
	function onMouseOverSub(id,img){
		id.cells[0].className="smRight_select";
	}

	function onMouseOutSub(id,img){
		id.cells[0].className="smRight_gray";
	}
	
	function smTR(nam, href){
		if (nam=="-"){
			document.write('<tr style="cursor:hand"><td valign=center class="smRight_gray" style="padding-left:4px;"><img src="images/folder_blue.gif" width=14 height=14 style="margin-right:3pt" align="absmiddle">'+href+'</td></tr>');
		} else {
			document.write('<tr id="sub'+(++trCount)+'" style="cursor:hand" onClick="onMenuClick(\''+href+'\')" onmouseover="onMouseOverSub(this)" onmouseout="onMouseOutSub(this)">');
			document.write('<td valign=center class="smRight_gray"><img src="images/triangle_black.gif"  style="margin-left:5pt;margin-right:3pt" align="absmiddle" width="5" height="9">'+nam+'</td></tr>');
		}
	}	
	
    function resizeMenu(){		
		var id=document.getElementById("menu2");
		var offset=document.getElementById("mainDiv").offsetLeft;
		id.style.left=offset+130;
		id=document.getElementById("menu3");
		id.style.left=offset+131*2-1;
		id=document.getElementById("menu4");
		id.style.left=offset+131*3-1;
	}

	function ShowMenu(index){
		var id = document.getElementById("menu"+index);
		if (activeMenu){
			activeMenu.style.visibility="hidden";
		}
		activeMenu=id;
		activeMenu.style.visibility="visible";
	}
	
	function myMove(e)
	{		
		if (!e) {
			x=event.clientX+this.scrollLeft;
			y=event.clientY+this.scrollTop;
		} else {
			x=e.pageX;
			y=e.pageY;
		}
		
		var offset=document.getElementById("mainDiv").offsetLeft;
		var offsetMenu=182;
		if (activeMenu) offsetMenu+=activeMenu.offsetHeight;
		
		if ((y>182-24)&&(y<offsetMenu))
		{
			if ((x>offset)&&(x<offset+130))
			{	
				if ((idImg!=0)&&(idImg!=1))document.getElementById("img"+idImg).src="images/triangle_white.gif";
				idImg=1;
			} else if ((x>offset+130)&&(x<offset+260)){
				if ((idImg!=0)&&(idImg!=2))document.getElementById("img"+idImg).src="images/triangle_white.gif";
				idImg=2;
			} else if ((x>offset+260)&&(x<offset+390)){
				if ((idImg!=0)&&(idImg!=3))document.getElementById("img"+idImg).src="images/triangle_white.gif";
				idImg=3;
			} else if ((x>offset+260+130)&&(x<offset+390+130)){
				if ((idImg!=0)&&(idImg!=4))document.getElementById("img"+idImg).src="images/triangle_white.gif";
				idImg=4;
			} else if ((x>offset+260+260)&&(x<offset+390+260)){
				if ((idImg!=0)&&(idImg!=5))document.getElementById("img"+idImg).src="images/triangle_white.gif";
				idImg=5;
			} else if ((x>offset+260+390)&&(x<offset+390+390)){
				if ((idImg!=0)&&(idImg!=6))document.getElementById("img"+idImg).src="images/triangle_white.gif";
				idImg=6;
			} else {
				if (idImg!=0)document.getElementById("img"+idImg).src="images/triangle_white.gif";
				idImg=0;
			}
		} else {
			if (idImg!=0)document.getElementById("img"+idImg).src="images/triangle_white.gif";
			idImg=0;
		}
		
		
		if (!activeMenu) return;	
		var left = activeMenu.offsetLeft;
		var right = activeMenu.offsetLeft+activeMenu.offsetWidth;
		if ((x<left)||(x>right)||(y<182-24)||(y>182+activeMenu.offsetHeight)) 
		{
			activeMenu.style.visibility="hidden";
			activeMenu=null;			
		}
	}
	
	function putSubMenu(){
		document.write('<table id="menu2" cellpadding=2 cellspacing=0  class="submenu">');
		
				
		document.write('</table><table id="menu3" cellspacing=0 class="submenu">');
	
		

		document.write('</table><table id="menu4"  class="submenu" cellpadding=2 cellspacing=0>');
	
		

		document.write('</table>');
	}
	

