 		// настройки
		// размер колонок равный 90/iMaxColumn %
		var iMaxColumnTop = 6;
		var iMaxColumnBottom = 4;
		var isTop =0;
		var siteURL = "http://www.ved.ru/";
		var PathToImg = "http://www.ved.ru/images/";
		var Path ="";
		// Определяются файл и директория пути
			
			var iTopBand, iBottomBand;
			iTopBand=0;
			iBottomBand=0;
			var arPath,sPath;
			var levDir,levFile,levMainDir;
			var sFind="www.ved.ru/"; 
			sPath=document.location.href;
			var iPos = sPath.lastIndexOf(sFind);
			var sURL = sPath.substring(iPos+sFind.length,sPath.length);
			
			arPath=sURL.split("/");
			
			if (arPath.length==2) {
			levFile=arPath[1];
			levDir=arPath[0];
			levMainDir="";
			
			
			}
			else
			{
			
			
			levFile=arPath[2];
			levDir=arPath[1];
			levMainDir=arPath[0];
			}

	
			function replaceTemplate(source, template, text) {
				p = source.indexOf(template,0);
				while(p > 0)
				{
				source = source.substring(0,p) + text + source.substring(p+template.length,source.length);
				p = source.indexOf(template,0);
				}
				return source;
			}

			
			// началные тэги в блоках
			var sHTML ="<table width='100%' border='0' cellspacing='0' cellpadding='0' ID='tabmenu'>";
			var sHTMLend ="</table>";
			var sHTML2 = "<table width='100%' border='0' cellspacing='0' cellpadding='0' ID='Table2'>";
			
			// самый верх
			var sHTMLline1 ="<tr height='5'><td bgcolor='#d5d5d5' height='5'></td>";
			var sHTMLline1end ="<td bgcolor='#d5d5d5' height='5'></td></tr>";
			// вторая таба вверху (где картинка)
			var sHTMLline2 ="<tr><td bgcolor='#eeeeee'></td>";
			var sHTMLline2end = "<td bgcolor='#eeeeee'></td></tr>";
			// верхние меню 
			var sHTMLlineLevel1 ="<tr height='20'><td bgcolor='#eeeeee' height='20'>&nbsp;</td>";
			var sHTMLlineLevel1end ="<td bgcolor='#eeeeee' height='20'>&nbsp;</td></tr>";
			// ================================ 2 уровень меню ===
			var sHTML2line1 ="<tr height='6'><td bgcolor='#4a92b7' height='6'></td>";
			var sHTML2line1end ="<td bgcolor='#4a92b7' height='6'></td></tr>";
			// вторая таба вверху (где картинка)
			var sHTML2line2 ="<tr height='5'><td bgcolor='#6ea8c5' height='5'></td>";
			var sHTML2line2end = "<td bgcolor='#6ea8c5' height='5'></td></tr>";
			// нижние меню
			var sHTML2lineLevel1 ="<tr height='18'><td  bgcolor='#6ea8c5' height='18'>&nbsp;</td>";
			var sHTML2lineLevel1end ="<td  bgcolor='#6ea8c5' height='18'>&nbsp;</td></tr>";
			
			
			// шаблоны
			var menuHeader ="<table width='100%' border='0' cellspacing='0' cellpadding='0' ID='tabmenu'>";
			var menuTopLine ="<td bgcolor='#d5d5d5' height='5' width='@menu1@%'></td>";
			var menuTopLineSel ="<td bgcolor='#4a92b7' height='5' width='@menu1@%'></td>";
			var menuTopLine2 = "<td align='center' bgcolor='#eeeeee' width='@menu1@%'></td>";
			var menuTopLine2Sel = "<td align='center' bgcolor='#6ea8c5' width='@menu1@%'><img src='" + PathToImg + "arr_down.gif' alt='' height='4' width='7' border='0'></td>";
			var menuMainMenu1 ="<td align='center' bgcolor='#eeeeee' height='20' width='@menu1@%'><a class='mainOff' href='";
			var menuMainMenu2 ="'>";
			var menuMainMenu3 ="</a></td>";
			var menuMainMenu1Sel ="<td align='center' bgcolor='#6ea8c5' width='@menu1@%' height='20'><a class='mainOn' href='";
			var menuMainMenu2Sel ="'>";			
			var menuMainMenu3Sel ="</a></td>";
			
			var menu2Header ="<table width='100%' border='0' cellspacing='0' cellpadding='0' ID='tabmenu' align=center>";
			var menu2TopLine ="<td bgcolor='#4a92b7' height='6' width='@menu2@%'></td>";
			var menu2TopLineSel ="<td bgcolor='#cccccc' height='6' width='@menu2@%'></td>";
			var menu2TopLine2 = "<td align='center' bgcolor='#6ea8c5' height='5' width='@menu2@%'></td>";
			var menu2TopLine2Sel = "<td align='center' bgcolor='#6ea8c5' height='5' width='@menu2@%'><img src='"+PathToImg+"arr_up.gif' alt='' height='5' width='7' border='0'></td>";
			var menu2MainMenu1 ="<td align='center' valign='bottom' bgcolor='#6ea8c5' height='18' width='@menu2@%'><a class='subOff' href='";
			var menu2MainMenu2 ="'>";
			var menu2MainMenu3 ="</a></td>";
			var menu2MainMenu1Sel ="<td align='center' valign='bottom' bgcolor='#6ea8c5' height='18' width='@menu2@%'><a href='#' class='subOff'>";
			//var menu2MainMenu2Sel ="";
			var menu2MainMenu3Sel ="</a></td>";
// массив
//sHTML = menuHeader;

// функции

	function getPath() {
		alert(document.location);
	}
	
	function makemenu(_level, _text, _url) {

		if (_level=="") {
			if(_url==levDir) {
			sHTMLline1+=menuTopLineSel;
			sHTMLline2+=menuTopLine2Sel;
			sHTMLlineLevel1 += menuMainMenu1Sel +"index.html" + menuMainMenu2Sel + _text  + menuMainMenu3Sel;
			 }
			 else
			 {
			 if (_url==levMainDir) {
				sHTMLline1+=menuTopLineSel;
				sHTMLline2+=menuTopLine2Sel;
				sHTMLlineLevel1 += menuMainMenu1Sel +"../index.html" + menuMainMenu2Sel + _text  + menuMainMenu3Sel;
			 }
			 else
			 {
			 sHTMLline1+=menuTopLine;
	 		 sHTMLline2+=menuTopLine2;
			if (_url.indexOf("://",-1)>0)
			 {
				sHTMLlineLevel1 += menuMainMenu1 + _url+ menuMainMenu2+_text+menuMainMenu3;
			}
			else
	 		 if (_url.indexOf(".",0)>0) {
				sHTMLlineLevel1 += menuMainMenu1 +siteURL + _url+ menuMainMenu2+_text+menuMainMenu3;	 		 
	 		 }
	 		 else {
				 sHTMLlineLevel1 += menuMainMenu1 +siteURL+ _url+ "/index.html"+menuMainMenu2+_text+menuMainMenu3;
				 }
				 }
			}
		}
		else
		{
		// 2 уровень - выбор в меню
		 if (_level==levDir)
		  {
			if (_url==levFile) {
			isTop=1;
			sHTML2line1+=menu2TopLineSel;
			sHTML2line2+=menu2TopLine2Sel;
			sHTML2lineLevel1 += menu2MainMenu1 + siteURL+_level+ "/" + _url+"/index.html" + menu2MainMenu2+_text+menu2MainMenu3;
			}
			else
			{
			isTop=1;
			sHTML2line1+=menu2TopLine;
			sHTML2line2+=menu2TopLine2;
			if (_url.indexOf("ttp:",-1)>0)  
				{
				sHTML2lineLevel1 += menu2MainMenu1 + _url + menu2MainMenu2+_text+menu2MainMenu3;
				}
				else
				{
				sHTML2lineLevel1 += menu2MainMenu1 + siteURL + _level+ "/" +_url+ "/index.html"+ menu2MainMenu2+_text+menu2MainMenu3;
				}
			
			}
		 }
		 else
			{
			// 2 уровень - подменю
			if (_level==levMainDir)
			{
				if(_url==levDir)
				{
					isTop=1;
					sHTML2line1+=menu2TopLineSel;
					sHTML2line2+=menu2TopLine2Sel;
					sHTML2lineLevel1 += menu2MainMenu1 + siteURL+_level+ "/" + _url +"/index.html"+ menu2MainMenu2+_text+menu2MainMenu3;
				}
				else
				{
					sHTML2line1+=menu2TopLine;
					sHTML2line2+=menu2TopLine2;
					isTop=1;
				if (_url.indexOf("ttp:",-1)>0)  
					{
						sHTML2lineLevel1 += menu2MainMenu1 + _url +"' target='_blank " + menu2MainMenu2+_text+menu2MainMenu3;
					}
					else
					{
						sHTML2lineLevel1 += menu2MainMenu1 + siteURL + _level+ "/" +_url+ "/index.html"+ menu2MainMenu2+_text+menu2MainMenu3;
					}
				}
			} 
			
			}
		}
	}
	
	
function getMenu() {
	sHTML += sHTMLline1 +sHTMLline1end + sHTMLline2+sHTMLline2end + sHTMLlineLevel1+sHTMLlineLevel1end+sHTMLend;
	if (isTop) 
	sHTML += sHTML2+ sHTML2lineLevel1+sHTML2lineLevel1end +  sHTML2line2+sHTML2line2end + sHTML2line1 +sHTML2line1end+sHTMLend; 
	
	return sHTML
	
}

	function ShowMenu() {
	var iBottomWidth;
	var iTopWidth;
	iBottomWidth= 90 / iMaxColumnBottom; //iBottomBand;			
	iTopWidth = 90 / iMaxColumnTop; //iTopBand;
		
	var sMenu;
	sMenu =getMenu();
	sMenu = replaceTemplate(sMenu,"@menu2@",iBottomWidth);
	sMenu = replaceTemplate(sMenu,"@menu1@",iTopWidth);
	
	document.getElementById("mainmenu").innerHTML=sMenu;

	}
	
	function PrintMenu() {
	var iBottomWidth;
	var iTopWidth;
	iBottomWidth= 90 / iMaxColumnBottom;			
	iTopWidth = 90 / iMaxColumnTop;
		
	var sMenu;
	sMenu =getMenu();
	sMenu = replaceTemplate(sMenu,"@menu1@",iTopWidth);
	sMenu = replaceTemplate(sMenu,"@menu2@",iBottomWidth);
	
//	document.write("<INPUT id='Text1' type='text' value='11'>");
//	Text1.value=sMenu;
	
	document.write(sMenu);
	
	}


function PrintQuickMenu() {
	document.write("<select name='jumper' size='1'  style='font-size:7pt; color: #069; margin-left:5px; margin-right:5px' onchange='window.location.href=this.options[this.selectedIndex].value'>");
	document.write("<option  value='http://www.ved.ru/company/index.html' selected>О КОМПАНИИ</option>");
	document.write("<option  value='http://www.ved.ru/company/sertificates/index.html'>- сертификаты и лицензии</option>");
	document.write("<option  value='http://www.ved.ru/company/press/index.html'>- пресс-релизы</option>");
	document.write("<option  value='http://www.ved.ru/company/vacancy/index.html'>- вакансии</option>");
	document.write("<option  value='http://www.ved.ru/company/contacts/index.html'>- контакты</option>");
	document.write("<option  value='http://www.ved.ru/telecom/index.html'>ОБОРУДОВАНИЕ И ПРОЕКТЫ</option>");
	document.write("<option  value='http://www.ved.ru/telecom/equipment/index.html'>- оборудование</option>");
	document.write("<option  value='http://www.ved.ru/telecom/services/index.html'>- техническое обслуживание</option>");
	document.write("<option  value='http://www.ved.ru/telecom/info/index.html'>- полезная информация</option>");
	document.write("<option  value='http://www.ved.ru/telecom/order/index.html'>- задать вопрос</option>");
	document.write("<option  value='http://www.ved.ru/distribution/index.html'>ДИСТРИБУЦИЯ</option>");
	document.write("<option  value='http://www.ved.ru/distribution/bedealers/index.html'>- стать дилером</option>");
	document.write("<option  value='http://techzone.ved.ru/dealer'>- для дилеров</option>");
	document.write("<option  value='http://www.ved.ru/distribution/marketing/index.html'>- маркетинговые программы</option>");
	document.write("<option  value='http://catalog.ved.ru/index.aspx'>ЦЕНЫ</option>");
	document.write("<option  value='http://www.ved.ru/service/index.html'>СЕРВИС ЦЕНТР</option>");
	document.write("<option  value='http://www.ved.ru/service/sertificates/index.html'>- сертификаты и лицензии</option>");
	document.write("<option  value='http://www.ved.ru/service/prices/index.html'>- услуги </option>");
	document.write("<option  value='http://www.ved.ru/service/rules/index.html'>- правила работы</option>");
	document.write("<option  value='http://www.ved.ru/service/order/index.html'>- задать вопрос</option>");
	document.write("<option  value='http://techzone.ved.ru/biblio/'>ТЕХНИЧЕСКАЯ ЗОНА</option>");
	document.write("<option  value='http://www.ved.ru/softlab/index.html'>SOFTLAB</option>");
	document.write("<option  value='http://www.ved.ru/softlab/for_small/index.html'>- для малого бизнеса</option>");
	document.write("<option  value='http://www.ved.ru/softlab/systems/index.html'>- корпоративные решения</option>");
	document.write("<option  value='http://www.ved.ru/softlab/web/index.html'>- web-решения</option>");
	document.write("<option  value='http://www.ved.ru/softlab/download/index.html'>- download</option>");
	document.write("<option  value='http://www.ved.ru/softlab/contacts/index.html'>- контакты</option>");
	document.write("</select>");
}


// *** МЕНЮ	***
// *** МЕНЮ	***
makemenu("","О компании","company");
	makemenu("company","сертификаты и лицензии","sertificates");
	makemenu("company","пресс-релизы","press");
	makemenu("company","вакансии","vacancy");
	makemenu("company","контакты","contacts");
	
makemenu("","Оборудование&nbsp;и&nbsp;проекты","telecom");
	makemenu("telecom","оборудование","equipment")
	makemenu("telecom","техническое обслуживание","services")
	makemenu("telecom","полезная информация","info")
	makemenu("telecom","задать вопрос","order")	
	
makemenu("","Дистрибуция","distribution");
	makemenu("distribution","маркетинговые программы","marketing");
	makemenu("distribution","стать дилером","bedealers");
	makemenu("distribution","для дилеров","http://techzone.ved.ru/dealer");

makemenu("","Цены","http://catalog.ved.ru/index.aspx");
   
   
makemenu(""," Сервис центр ","service");
	makemenu("service","сертификаты и лицензии","sertificates");
	makemenu("service","услуги","prices");
	makemenu("service","правила работы","rules");
	makemenu("service","задать вопрос","order");

makemenu("","Техническая зона","http://techzone.ved.ru/biblio");      

makemenu("","SoftLab","softlab");
	makemenu("softlab","для малого бизнеса","for_small");
	makemenu("softlab","корпоративные решения","systems");
	makemenu("softlab","web-решения","web");
	makemenu("softlab","download","download");
	makemenu("softlab","контакты","contacts");
	

