function CheckScrollAreaSize() {
  var objHeader = document.getElementById('objHeader');
  var objScrollArea = document.getElementById('objScrollArea');
  if (!window.innerWidth)
    objScrollArea.style.width = document.body.clientWidth;
  var intHeight = (window.innerHeight ? window.innerHeight : document.body.clientHeight) - objHeader.offsetHeight;
  objScrollArea.style.height = intHeight < objHeader.offsetHeight ? objHeader.offsetHeight : intHeight;
  objScrollArea.className = objScrollArea.className; // for stupid browsers
}

function PutMailLink(strMail) {
  document.write('<a href="mailto:' + strMail + '">' + strMail + '</a>');
}

function SearchData() {
  var strData = window.prompt('Строка поиска:', '');
  if (strData && (strData != '')) {
    var objWindow = window.open('http://www.google.com/custom?hl=ru&sitesearch=info.sotvorenie.kiev.ua&q=' + strData.replace('+', '%2B').replace('&', '%26'), 'GoogleSearch',
      'left=0,top=0,channelmode=0,directories=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=1,toolbar=0');
    try {
      objWindow.focus();
    } catch(e) {
    }
  }
}

function SetFullScreen() {
  if (window.opener == null)
    window.open(document.location.href, 'fullscreen_window', 'channelmode=0,menubar=0,location=0,directories=0,status=0,titlebar=0,toolbar=0,scrollbars=0,resizable=1,fullscreen=1');
  else
    try {
      window.opener.document.location.href = document.location.href;
      window.close();
    } catch(e) {}
}

function UpdateTables() {
  var arrTables = document.getElementsByTagName('TABLE');
  for (var i = 0; i < arrTables.length; i++)
    if (arrTables[i].className == 'clsTable') {
      var blnEvenRow = false;
      for (var j = 0; j < arrTables[i].rows.length; j++) {
        var objRow = arrTables[i].rows.item(j);
        var objCell = objRow.cells.item(0);
        if (objCell.tagName.toLowerCase() == 'td') {
          if (objCell.className == '')
            objCell.className = 'clsTableItem';
          if (blnEvenRow)
            objRow.className = 'clsTableEvenRow';
          blnEvenRow = !blnEvenRow;
        }
      }
    }
  CheckScrollAreaSize();
}

document.write('<style media=print>#objScrollArea{overflow:visible;width:100%!important} #objBody {padding:0px} ' +
  '.clsContent TD{padding-bottom: 20px} .clsContent,.clsDescription,.clsTable{width:100%} ' +
  '#objHeader{display:none}</style><div id=objHeader>');
// Next ID = 149
var objMenu = Menu(['/images/home.gif', '/images/news.gif', '/images/updates.gif', '/images/links.gif', '/images/map.gif',
  '/images/insects.gif', '/images/trees.gif', '/images/flowers.gif', '/images/mammals.gif', '/images/water_plants.gif',
  '/images/health.gif', '/images/archive.gif', '/images/building.gif', '/images/poems.gif', '/images/soil.gif',
  '/images/food.gif', '/images/soap.gif', '/images/music.gif', '/images/video.gif', '/images/mushrooms.gif',
  '/images/family.gif', '/images/vermin.gif', '/images/child_education.gif', '/images/discoveries.gif',
  '/images/description.gif', '/images/light.gif', '/images/cultivation.gif', '/images/texts.gif', '/images/images.gif',
  '/images/medicine.gif', '/images/settlement_projects.gif', '/images/photos.gif', '/images/books.gif',
  '/images/beekeeping.gif', '/images/future_image.gif', '/images/fishes.gif', '/images/conferences.gif', '/images/birds.gif',
  '/images/home_power.gif', '/images/about_us.gif', '/images/lianas.gif', '/images/family_estate.gif', '/images/library.gif',
  '/images/who_are_we.gif', '/images/plants.gif', '/images/shrubs.gif', '/images/settlements.gif', '/images/contacts.gif',
  '/images/water.gif', '/images/organism.gif', '/images/animals.gif', '/images/knowledges.gif', '/images/stories.gif',
  '/images/fullscreen.gif', '/images/map_struc.gif', '/images/map_az.gif', '/images/photo_reports.gif',
  '/images/legislation.gif', '/images/back.gif', '/images/forward.gif', '/images/favorites.gif', '/images/questions.gif',
  '/images/settings.gif', '/images/tasks.gif', '/images/home_type.gif', '/images/home_heat.gif', '/images/opinions.gif',
  '/images/unie_bogi.gif', '/images/settlement_plans.gif', '/images/family_estate_images.gif', '/images/ukraine.gif',
  '/images/russia.gif', '/images/belarus.gif', '/images/mind_power.gif', '/images/search.gif'], false, [
  Item(130, '^Предыдущая страница', 'javascript:window.history.go(-1)', '', 58),
  Item(133, '^Следующая страница', 'javascript:window.history.go(1)', '', 59),
  Item(0, '-'),
  Item(1, 'Главная', '/index.html', '', 0, '', true, [
    Item(3, 'Новости', '/content/news/news.html', '', 1),
    Item(4, 'Новое на сайте', '/content/news/updates.html', '', 2),
    Item(0, '-'),
    Item(5, 'Архив новостей', '/content/news/news_archive/news_archive.html', '', 11),
    Item(7, 'Архив обновлений сайта', '/content/news/updates_archive/updates_archive.html', '', 11),
    Item(0, '-'),
    Item(137, 'Вопросы к знатокам', '/questions/questions.html', '', 61),
    Item(138, 'Текущие задачи сайта', '/tasks/tasks.html', '', 63)
  ]),
  Item(0, '-'),
  Item(13, 'Родовое Поместье', '/section.html?family_estate', '', 41, '', true, [
  Item(14, 'Почва', '/content/family_estate/soil/soil.html', '', 14, '', true, [
//  Item(14, 'Почва', '/section.html?soil', '', 14, '', true, [
//    Item(15, 'Сведения о структуре', ''),
//    Item(16, 'Восстановление почвы', ''),
//    Item(17, 'Типы почв', ''),
//    Item(18, 'Растения-индикаторы почв', ''),
//    Item(--, 'Обработка земли', '', '', 26)
    ]),
    Item(20, 'Растения', '/section.html?plants', '', 44, '', true, [
      Item(21, 'Описание видов', '/section.html?plant_kinds', '', 24, '', true, [
        Item(25, 'Деревья', '/content/family_estate/plants/kinds/trees/trees.html', '', 6),
        Item(23, 'Кустарники', '/content/family_estate/plants/kinds/shrubs/shrubs.html', '', 45),
        Item(121, 'Лианы', '/content/family_estate/plants/kinds/lianas/lianas.html', '', 40),
        Item(22, 'Травянистые растения', '/content/family_estate/plants/kinds/flowers/flowers.html', '', 7)
//        Item(27, 'Водные растения (Пока пусто)', '/content/family_estate/plants/kinds/water_plants/water_plants.html', '', 9)
      ]),
//    Item(29, 'Свойства растений', '/section.html?plant_props', '', -1, '', true, [
//      Item(30, 'Мыльные свойства', '', '', 16)
//    ]),
      Item(31, 'Выращивание растений', '/content/family_estate/plants/growing/plant_growing.html'),
//    Item(42, 'Человек и растения', ''),
      Item(0, '-'),
      Item(125, 'Статьи', '/content/family_estate/plants/articles/articles.html', '', 27)
    ]),
    Item(28, 'Грибы', '/section.html?mushrooms', '', 19, '', true, [
//    Item(129, 'Описание видов', '/section.html?mushroom_kinds', '', 24, '', true, [

//    ]),
//    Item(123, 'Выращивание грибов', '/section.html?mushroom_growing', '', -1, '', true, [

//    ]),
//    Item(0, '-'),
      Item(124, 'Статьи', '/content/family_estate/mushrooms/articles/articles.html', '', 27)
    ]),
    Item(43, 'Животный мир', '/section.html?animals', '', 50, '', true, [
//    Item(44, 'Описание видов', '/section.html?animal_kinds', '', 24, '', true, [
//      Item(45, 'Млекопитающие', '', '', 8),
//      Item(46, 'Птицы', '', '', 37),
//      Item(47, 'Рыбы', '', '', 35),
//      Item(48, 'Насекомые', '', '', 5)
//    ]),
      Item(49, 'Пчеловодство', '/content/family_estate/animals/beekeeping/beekeeping.html', '', 33),
//    Item(50, 'Борьба с "вредителями"', '', '', 21),
      Item(0, '-'),
      Item(134, 'Статьи', '/content/family_estate/animals/articles/articles.html', '', 27)
    ]),
    Item(51, 'Водные ресурсы', '/content/family_estate/water/water.html', '', 48),
    Item(145, 'Природные факторы', '/content/family_estate/natural_factors/natural_factors.html', '', 25),
    Item(61, 'Строительство', '/section.html?building', '', 64, '', true, [
      Item(67, 'Дом', '/content/family_estate/home_building/home_type/home_type.html', '', 12),
      Item(143, 'Баня', '/content/family_estate/home_building/bath/bath.html', '', 12),
      Item(72, 'Электроэнергия', '/content/family_estate/home_building/home_power/home_power.html', '', 38),
      Item(76, 'Отопление', '/content/family_estate/home_building/home_heat/home_heat.html', '', 65)
//    Item(80, 'Учёт освещённости', '', '', 25),
//    Item(0, '-'),
//    Item(81, 'Статьи', '', '', 27)
    ]),
    Item(0, '-'),
    Item(19, 'Сила мысли', '/content/family_estate/mind_power/mind_power.html', '', 73),
    Item(91, 'Здоровье', '/section.html?health', '', 10, '', true, [
      Item(92, 'Организм человека', '/content/family_estate/health/man_organism/man_organism.html', '', 49),
      Item(93, 'Питание', '/content/family_estate/health/food/food.html', '', 15),
//    Item(95, 'О "медицине"', '', '', 29),
      Item(96, 'Забытые знания предков', '/content/family_estate/health/znania_predkov/znania_predkov.html', '', 51)
    ]),
    Item(97, 'Семья', '/section.html?family', '', 20, '', true, [
      Item(98, 'Любовь', '/content/family_estate/family/love/love.html','', 20),
//    Item(??, 'Рождение детей', ''),
      Item(99, 'Воспитание детей', '/content/family_estate/family/child_education/child_education.html', '', 22)
    ]),
    Item(82, 'Поселения, группы', '/section.html?settlements', '', 46, '', true, [
      Item(89, 'Беларусь', '/section.html?poseleniya_belarus', '', 72, '', true, [
        Item(85, 'Минская область (Беларусь)', '/content/family_estate/settlements/minsk.html')
      ]),
      Item(88, 'Россия', '/section.html?poseleniya_rossia', '', 71, '', true, [
        Item(84, 'Башкортостан (Россия)', '/content/family_estate/settlements/ufa.html'),
        Item(86, 'Московская область (Россия)', '/content/family_estate/settlements/moscow.html')
      ]),
      Item(87, 'Украина', '/section.html?poseleniya_ukrain', '', 70, '', true, [
        Item(83, 'Киевская область (Украина)', '/content/family_estate/settlements/kiev.html'),
        Item(148, 'Крым (Украина)', '/content/family_estate/settlements/krim.html')
      ]),
//    Item(??, 'Ближнее зарубежье', ''),
//    Item(??, 'Дальнее зарубежье', ''),
      Item(0, '-'),
//    Item(??, 'Карта поселений', ''),
      Item(90, 'Проекты поселений', '/content/family_estate/settlements/projects/projects.html', '', 30)
    ]),
    Item(0, '-'),
    Item(146, 'Создание плана Родового Поместья', '/content/family_estate/pomestie/pomestie.html', '', 69),
    Item(147, 'Создание Родового поселения', '/content/family_estate/poselenie/poselenie.html', '',  64),
    Item(148, 'О жизни в Родовых Поселениях', '/content/family_estate/o_poseleniyah/o_poseleniyah.html', '', 27)
//    Item(122, 'Статьи', '/content/family_estate/articles/articles.html', '', 27)    
  ]),
  Item(0, '-'),
  Item(100, 'Библиотека', '/section.html?library', '', 42, '', true, [
    Item(101, 'Текстовая информация', '/section.html?texts', '', 27, '', true, [
      Item(102, 'Книги', '/content/library/texts/books/books.html', '', 32),
      Item(103, 'Интервью и конференции', '/content/library/texts/conferences/conferences.html', '', 36),
      Item(140, 'Мнения', '/content/library/texts/mneniya/mneniya.html', '', 66),
      Item(105, 'Научные открытия', '/content/library/texts/discoveries/discoveries.html', '', 23),
      Item(0, '-'),
      Item(142, 'Журнал "Юные Боги"', '/content/library/texts/unie_bogi/unie_bogi.html', '', 67),
      Item(107, 'Стихи', '/content/library/texts/poems.html', '', 13),
      Item(106, 'Образы будущего', '/content/library/texts/future_images/future_images.html', '', 34),
      Item(108, 'Притчи', '/content/library/texts/parables.html', '', 66),
      Item(131, 'Рассказы', '/content/library/texts/stories/stories.html', '', 52),
      Item(0, '-'),
      Item(141, 'Законодательство', '/content/library/texts/legislation/legislation.html', '', 57)
    ]),
    Item(109, 'Графические изображения', '/section.html?images', '', 28, '', true, [
      Item(128, 'Картинки из поместий', '/content/library/images/kartinki_iz_pomestiy/kartinki_iz_pomestiy.html', '', 69),
      Item(110, 'Планы Родовых Поместий', '/content/library/images/plani_pomestiy/plani_pomestiy.html', '', 30),
      Item(111, 'Планы Родовых Поселений', '/content/library/images/plani_poseleniy/plani_poseleniy.html', '', 68),
//    Item(??, 'Фотогалерея', '/content/library/images/photo_gallery/photo_gallery.html', '', 31),
      Item(0, '-'),
      Item(127, 'Фоторепортажи', '/content/library/images/photo_reports/photo_reports.html', '', 56)
    ]),
//  Item(112, 'Видео записи', '', '', 18),
    Item(113, 'Песни Бардов', '/content/library/bard_songs/bard_songs.html', '', 17),
    Item(0, '-'),
    Item(114, 'Полезные ссылки', '/content/library/links/links.html', '', 3)
  ]),
  Item(0, '-'),
  Item(115, 'О нас', '/section.html?about_us', '', 39, '', true, [
    Item(116, 'Кто мы?', '/content/about_us/who_are_we.html', '', 43),
    Item(117, 'Контактные данные', '/content/about_us/contacts.html', '', 47)
  ]),
  Item(0, '-'),
  Item(135, 'Избранное', '/section.html?favorites', '', 60, '', true, [
    Item(0, '-'),
    Item(136, 'Настройка', '/settings.html', '', 62)
  ]),
  Item(0, '-'),
  Item(118, 'Карта сайта', '/section.html?map', '', 4, '', true, [
    Item(119, 'В виде структуры', '/content/map/map1.html', '', 54),
    Item(120, 'В алфавитном порядке', '/content/map/map2.html', '', 55)
  ]),
  Item(0, '-'),
  Item(144, '^Поиск по сайту (Google-поиск)', 'javascript:SearchData()', '', 74),
  Item(132, '^На весь экран', 'javascript:SetFullScreen()', '', 53)
]);

var objCookie = {PanelStates: [], FavSectionIDs: []};
var i, arrCookieParts = document.cookie.split(';');
for (i = 0; i < arrCookieParts.length; i++)
  if (arrCookieParts[i].split('=')[0].indexOf('params') > -1) {
    var arrParams = arrCookieParts[i].split('=')[1].split('.');
    objCookie.PanelStates = arrParams[0].split(',');
    if (arrParams[1] != '')
      objCookie.FavSectionIDs = arrParams[1].split(',');
    break;
  }
if (objCookie.PanelStates.length < 5) {
  objCookie.PanelStates = [1, 1, 1, 1, 1];
  objCookie.FavSectionIDs = [3, 4, 20, 100];
}

var arrItems = [];
for (i = 0; i < objCookie.FavSectionIDs.length; i++) {
  var objItem = objMenu.ItemByID(objCookie.FavSectionIDs[i]);
  if (objItem != null)
    arrItems[arrItems.length] = Item(objItem.ID + '_',
      objItem.Caption + (objItem.Parent.Caption ? ' (' + objItem.Parent.Caption + ')' : ''), objItem.URL + ' ',
      objItem.Target, objItem.ImageIndex, objItem.ClassName, objItem.VerticalItems);
}
if (arrItems.length == 0)
  arrItems[0] = Item('_', 'Разделы не выбраны', '', '', -1, 'clsMenuDisabledItem');
var objFavItem = objMenu.ItemByID(135);
objFavItem.Items = arrItems.concat(objFavItem.Items);
objFavItem.InitItems(objMenu);
objMenu.Render();

var objSelItem = null, strSectionPath = '';
var blnPredefinedURL = strSectionURL ? true : false;
// объявление переменных если они не объявлены ранее
if (!blnPredefinedURL)
  var strSectionURL = '';
var objParent = null, arrSections = [];
var strURL = (blnPredefinedURL ? strSectionURL : document.location.pathname + document.location.search).toLowerCase();
var blnHomePage = strURL.replace('/', '').replace('index.html', '') == '';
if (!blnHomePage) {
  objSelItem = objMenu.ItemByURL(strURL);
  if (objSelItem != null)
    objParent = blnPredefinedURL ? objSelItem : objSelItem.Parent;
  while ((objParent != null) && objParent.Parent) {
    arrSections[arrSections.length] = '<a href="' + objParent.URL + '"><nobr>' + (objParent.ImageIndex == -1 ? '' :
      '<img src="' + objParent.Menu.ItemImages[objParent.ImageIndex] + '" align=absmiddle class=clsSectionImage>') + objParent.Caption + '</nobr></a>';
    objParent = objParent.Parent;
  }
  strSectionPath = arrSections.reverse().join(' > ');
}
document.write('<table cellspacing=0 cellpadding=0 class=clsMenuFooter><tr><td class=clsSectionPath>' +
  (strSectionPath != '' ? strSectionPath : '<marquee direction=left behavior=scroll scrollamount=2 scrolldelay=50>' +
  '<img src="/images/anim_bird.gif" width=21 height=13 align=absmiddle> ' +
  'Дорогие посетители сайта! Творцы! Если Вы имеете интересную, важную, полезную информацию, соответствующую ' +
  'тематике сайта, и хотите дополнить сайт данной информацией, то, пожалуйста, присылайте её на любой из ' +
  'электронных адресов, указанных на странице <a href="/content/about_us/contacts.html">Контактные данные</a>. ' +
  '<img src="/images/anim_bird.gif" width=21 height=13 align=absmiddle></marquee>') +
  '</td><td class=clsCounter><a href="http://top.mail.ru/jump?from=933191" target=_blank>' +
  '<img src="http://top.list.ru/counter?id=933191;t=87" height=18 width=88></a></td></tr></table></div>' +
  '<div id=objScrollArea><table cellspacing=0 cellpadding=0 width=100% height=100%><tr><td id=objBody align=center><br>' +
  (!blnPredefinedURL && (objSelItem != null) ? '<div id=objPageTitle>' + (objSelItem.ImageIndex != -1 ?
  '<img src="' + objMenu.ItemImages[objSelItem.ImageIndex] + '" class=clsMenuItemImage align=absmiddle> ' : '') +
  objSelItem.Caption + (objSelItem.Caption == 'Статьи' ? ' (' + objSelItem.Parent.Caption + ')' : '') + '</div>' : ''));
window.onresize = CheckScrollAreaSize;
if (window.attachEvent)
  window.attachEvent('onload', UpdateTables);
else if (window.addEventListener)
  window.addEventListener('load', UpdateTables, true);
else
  window.onload = UpdateTables;
CheckScrollAreaSize();