(document.getElementById ? DOMCapable = true :  DOMCapable = false);

function hide(menuName)
{
	if  (DOMCapable)
	{
		var theMenuBut=document.getElementById(menuName+'but');
		if (theMenuBut != null) {
			theMenuBut.style.borderColor='#FFFFFF black black #FFFFFF';

			var theMenuItem=document.getElementById(menuName+'item');
			if (theMenuBut != null){
				theMenuBut.style.textDecoration='none';
			}
			if (theMenuItem != null){
				theMenuItem.style.visibility='hidden';
			}
		}       
	}
}


function show(menuName,topp,leftt)
{
	if (DOMCapable){
		var theMenuBut=document.getElementById(menuName+'but');
		var theMenuItem=document.getElementById(menuName+'item');
		if (topp == null) {
			topp='top';
		}
		if (leftt == null) {
			leftt='right';
		}
		if (theMenuBut != null) {
			theMenuBut.style.borderColor='black #FFFFFF #FFFFFF black';


//			alert(theMenuBut.style);
//			alert(theMenuBut.style.cssText);
			if (theMenuItem != null) {
				var x = 0;
				var y = 0;
				var xo = theMenuBut.offsetParent;
				var yo = theMenuBut.offsetParent;
				while (xo != null){
					x = x+xo.offsetTop;
					xo = xo.offsetParent;
				}
				while (yo != null){
					y = y+yo.offsetLeft;
					yo = yo.offsetParent;
				}
				if (topp == 'bottom') {
					theMenuItem.style.top=theMenuBut.clientHeight+theMenuBut.offsetTop+x+2;
				}
				if (topp == 'middle') {
					theMenuItem.style.top=(theMenuBut.clientHeight/2)+theMenuBut.offsetTop+x+1;
				}
				if (topp == 'top') {
					theMenuItem.style.top=theMenuBut.offsetTop+x-2;
				}

				if (leftt == 'left') {
					theMenuItem.style.left=theMenuBut.offsetLeft+y;
				}
				if (leftt == 'center') {
					theMenuItem.style.left=(theMenuBut.clientWidth/2)+theMenuBut.offsetLeft+y;
				}
				if (leftt == 'right') {
					theMenuItem.style.left=theMenuBut.clientWidth+theMenuBut.offsetLeft+y;
				}
				theMenuItem.style.visibility='visible';
			}
		}
	}
}

function clickk(loc)
{
	if  (DOMCapable)
	{		
//		alert(loc);
		top.location.href=loc;		
	}
}


function mainmenutextf(menuin) {
	
	var menutextin='<table id="'+menuin[1]+'item" class="mainmenutable">';
	menutextin=menutextin+'<tr>';
	var cl = '';
	for (i=4; i<menuin.length;i=i+1){
		cl = 'mainmenuitem';
		if (i == 4) {
			cl = 'mainmenuitemf';
		}
		if (i == (menuin.length-1)) {
			cl = 'mainmenuiteml';
		}
		menutextin=menutextin+'<td id="menu'+(i-3)+'but" class="'+cl+'" onmouseover="show(\'menu'+(i-3)+'\',\''+menuin[2]+'\',\''+menuin[3]+'\');" onmouseout="hide(\'menu'+(i-3)+'\')">'+menuin[i]+'</td>';
		if (menuin[0] == 'vertical') {
			menutextin=menutextin+'</tr><tr>';
		}
	}
	menutextin=menutextin+'</tr></table>';
	return menutextin;
}

function menutextf(menuin,menuhrefin) {
	
	var menutextin=''
	menutextin='<table id="'+menuin[1]+'item" class="menutable" style="visibility:hidden" onmouseover="show(\''+menuin[1]+'\',\''+menuin[2]+'\',\''+menuin[3]+'\');" onmouseout="hide(\''+menuin[1]+'\');">';
	menutextin=menutextin+'<tr>';
	var cl = '';
	for (i=4; i<menuin.length;i=i+1){
		cl = 'menuitem';
		if (i == 4) {
			cl = 'menuitemf';
		}
		if (i == (menuin.length-1)) {
			cl = 'menuiteml';
		}
		menutextin=menutextin+'<td id="'+menuin[1]+'_'+(i-3)+'but" class="'+cl+'" onmouseover="show(\''+menuin[1]+'_'+(i-3)+'\',\''+menuin[2]+'\',\''+menuin[3]+'\');" onmouseout="hide(\''+menuin[1]+'_'+(i-3)+'\')" onclick="clickk(\''+menuhrefin[i-4]+'\');">'+menuin[i]+'</td>';
		if ((menuin[0] == 'vertical') & (i != menuin.length-1)) {
			menutextin=menutextin+'</tr><tr>';
		}
	}
	menutextin=menutextin+'</tr></table>';
	return menutextin;
}

var mainmenutext = mainmenutextf(['','mainmenu','bottom','left','Публикации','Расписание семинара','Цели и задачи','Аудитория','Структура семинара','Визитная карточка']);
var menu1text = menutextf(['vertical','menu1','bottom','left','"Деловой Петербург"','Обсуждения'],['http://www.strategman.ru/delpeter.html','http://www.strategman.ru/gbook.php']);
var menu2text = menutextf(['vertical','menu2','bottom','left','Информация','Ближайшие даты','Архив'],['http://www.strategman.ru/index.html','http://www.strategman.ru/raspis.html','http://www.strategman.ru/arhiv.html']);
var menu3text = menutextf(['vertical','menu3','bottom','left','Задачи семинара','Описание семинара','Формат занятий'],['http://www.strategman.ru/about.html#top','http://www.strategman.ru/about.html#a2','http://www.strategman.ru/about.html#a3','','']);
var menu4text = menutextf(['vertical','menu4','bottom','left','Целевая аудитория','Ожидаемые выходы<br> для слушателей семинара','Регистрация','Гостевая книга'],['http://www.strategman.ru/audit.html#top','http://www.strategman.ru/audit.html#a5','http://www.strategman.ru/form.html','http://www.strategman.ru/gbook.php']);
var menu5text = menutextf(['vertical','menu5','bottom','left','Содержание семинара','Примерное расписание','Варианты длительности','Раздаточные материалы','Слайды'],['http://www.strategman.ru/content.html#top','http://www.strategman.ru/content.html#a7','http://www.strategman.ru/content.html#a8','http://www.strategman.ru/comments.html#top','http://www.strategman.ru/comments.html#a12']);
var menu6text = menutextf(['vertical','menu6','bottom','left','Автор и ведущий'],['http://www.strategman.ru/author.html']);
var textmenufull = mainmenutext+menu1text+menu2text+menu3text+menu4text+menu5text+menu6text;

