/*v 1.0 2004-02-20
menujava for www.ovdiy.kiev.ua
Developed by Bekeshev Aleksandr,Nikolaev Alexey
alex@topworld.com.ua,Omni_khm@mail.ru
Kiev, Ukraine 2003, http://www.topworld.com.ua
*/

var d = document;
var br;
var countMenu = 2;
var dom = 'http://ovdiy.kiev.ua/ua';
var heightElMenu = 16;
var padElMenu = 2;
var bgColor = "#0061CE";//1051B5
var upColor = "#1051B5";//F7F794
var sepColor = "#B8F6B8";
var topMenu = 16;
var topCap = 112;
var fontElMenu = 'tahoma';
var sizeElMenu = '12';
var colorElMenu = '#ffffff';
var weightElMenu = 'normal';
var border = "#000000";
var cursorElMenu = 'hand';
var timeShow = 500;
var flagShow = 0;
var curID;
var toID;

var filter = '';
filter = "filter: Alpha(opacity=100)";

var AMenu = new Array('imn1','imn2');
var widthElMenu = new Array(150,100);

var nameElMenu = new Array();
nameElMenu[0] = new Array('Села предків','Архівні дослідження','Прізвища роду','Поколiння роду');
nameElMenu[1] = new Array('Моє місто','Моя родина','Мої друзi');



var linkElMenu = new Array();
linkElMenu[0] = new Array('selo.htm','ar.htm','fam.htm','pok.htm');
linkElMenu[1] = new Array('city.htm','family.htm','friend.htm');



function initMenu()
{
if (d.all) {br = 'IE';} else if (d.getElementById) {br = 'DOM';}
createMenu(br);
}

function createMenu(br)
{
for (i=0;i<=countMenu-1;i++)
{
if (br == 'IE'){divMenu(i);} else if (br == 'DOM') {domMenu(i);}
}
}

function divMenu(i)
{
id = AMenu[i];
id_ = id+"_";

t = '<div id="'+id_+'" style="z-index:100;position:absolute;visibility:hidden;width:'+widthElMenu[i]+';height:'+heightElMenu+';margin-top:'+topMenu+';border-style:solid;border-width:1;border-color:#00000;'+filter+'">';
t += '';
for (j=0;j<=nameElMenu[i].length-1;j++){
if (linkElMenu[i][j] != '') {bgmn = bgColor;} else {bgmn = sepColor;}
t += '<div style="z-index:100;width:'+widthElMenu[i]+';font-family:'+fontElMenu+';font-size:'+sizeElMenu+'; background-color:'+bgmn+';color:'+colorElMenu+';font-weight:'+weightElMenu+';padding:'+padElMenu+';cursor:'+cursorElMenu+';"'
t += '';
if (linkElMenu[i][j] != '') {t += ' onMouseOver="this.style.backgroundColor = \''+upColor+'\';flagShow=1;status=\'http://'+dom+'/'+linkElMenu[i][j]+'\'" onMouseOut="this.style.backgroundColor = \''+bgColor+'\';hideMenu(\''+AMenu[i]+'\');status=\'\'" onClick="location.href=\'http://'+dom+'/'+linkElMenu[i][j]+'\';event.cancelBubble=true"';}
t += '>'+nameElMenu[i][j]+'</div>';
}
t = t+'</div>';
d.all.item(id).insertAdjacentHTML("BeforeBegin",t);
}

function domMenu(i)
{
id = AMenu[i];
id_ = id+"_";
newl = document.createElement('div');
newl.setAttribute('id',id_);
newl.style.position = 'absolute';
newl.style.visibility = 'hidden';
newl.style.borderStyle = 'solid';
newl.style.borderColor = border;
newl.style.borderWidth = 1;
newl.addEventListener("click", stclick, true);

t = '';
for (j=0;j<=nameElMenu[i].length-1;j++){
if (linkElMenu[i][j] != '') {bgmn = bgColor;} else {bgmn = sepColor;}
t += '<div style="z-index:100;width:'+widthElMenu[i]+';font-family:'+fontElMenu+';font-size:'+sizeElMenu+'; background-color:'+bgmn+';color:'+colorElMenu+';font-weight:'+weightElMenu+';padding:'+padElMenu+';cursor:'+cursorElMenu+';"';
if (linkElMenu[i][j] != '') {t += ' onMouseOver="this.style.backgroundColor = \''+upColor+'\';flagShow=1;" onMouseOut="this.style.backgroundColor = \''+bgColor+'\';hideMenu(\''+AMenu[i]+'\');" onClick="location.href=\'http://'+dom+'/'+linkElMenu[i][j]+'\';"';}
t += '>'+nameElMenu[i][j]+'</div>';
}
newl.innerHTML = t;
pid = d.getElementById(id);
pid.appendChild(newl);
}

function stclick(e)
{
event.stopPropagation();
}

function showMenu(id)
{
flagShow = 1;
hideAllMenu();
if (br == 'IE'){
d.all.item(id+'_').style.visibility = "visible";
} else if (br == 'DOM'){
pid = d.getElementById(id+'_');
pid.style.visibility = "visible";
}
}

function hideMenu(id)
{
flagShow = 0;menuOut(id);
}

function hideAllMenu()
{
if (br == 'IE'){for (i=0;i<=countMenu-1;i++){d.all.item(AMenu[i]+'_').style.visibility = "hidden";}
} else if (br == 'DOM') {
for (i=0;i<=countMenu-1;i++){pid = d.getElementById(AMenu[i]+'_');pid.style.visibility = "hidden";}
}
}

function menuOut(id)
{
curID = id;
if (toID) {clearTimeout(toID);toID = null;}
toID = setTimeout("hideMenuid()",timeShow);
}

function hideMenuid(id)
{
if (!flagShow){
if (br == 'IE'){d.all.item(curID+'_').style.visibility = "hidden";} else if (br == 'DOM') {pid = d.getElementById(curID+'_');pid.style.visibility = "hidden";}
}
}

function openWnd(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
