// see commonlib.js.doc for commented version of code
// (c) Concentric Network Corporation, 1999-2000.  All rights reserved.

document.write("<META http-equiv=expires content=0>");
document.write("<META http-equiv=Pragma content=no-cache>");
document.write("<META http-equiv=Cache-control content=no-cache>");


var NS4 = (document.layers) ? 1 : 0;	
var IE4 = (document.all) ? 1 : 0;

var gMenu = new Array;		
var gOverMenu = false;		
var gActiveMenu;		
var gActiveItem = null;	
var gChildMenu = null;		
var gParentMenu = null;		
var gLoaded = false;		

var gMenuTimer;
var gMenuCmd;

var gPopUpDelay = 500;	

var gInnerWidth,		
    gInnerHeight = 0;

var gChildMenuXOffset = -1;
var gChildMenuYOffset = 0;

var siteBuilderURL = "/sys-tmpl/pages/common/setup.nhtml";


if (NS4)
{
  window.onresize = handleResize;
}

function handleResize()
{
  if (gLoaded && 
      (gInnerWidth != window.innerWidth || 
       gInnerHeight != window.innerHeight))
    window.history.go(0);
}


function posLeft(ob)			
{
  if (!arguments.length)
    ob = this;

  if (IE4)
  {
    pos = ob.offsetLeft;

    parentElement = ob.offsetParent;

    while (parentElement != null)
    {
      pos += parentElement.offsetLeft;
      parentElement = parentElement.offsetParent;
    }
  }
  else
    pos = ob.pageX;

  return pos;
}


function posTop(ob)
{
  if (!arguments.length)
    ob = this;

  if (IE4)
  {
    pos = ob.offsetTop;

    parentElement = ob.offsetParent;

    while (parentElement != null)
    {
      pos += parentElement.offsetTop;
      parentElement = parentElement.offsetParent;
    }
  }
  else
    pos = ob.pageY;

  return pos;
}



function moveTo(x, y)
{
  this.style.pixelLeft = x - document.body.scrollLeft;
  this.style.pixelTop = y - document.body.scrollTop;
}


function show()
{
  (IE4) ? this.style.visibility = "visible" 
        : this.visibility = "show";
}

function hide()
{
  (IE4) ? this.style.visibility = "hidden"
        : this.visibility = "hide";
}

function menuOver(e)
{
  gOverMenu = true;
  gActiveMenu = this.id;
}

function menuOut(e)
{
  setTimeout("closeMenu('" + gActiveMenu + "')", 100);

  gOverMenu = false;
  gPrevMenu = gActiveMenu;

  if (gChildMenu)
    setTimeout("closeChildMenu('" + gChildMenu + "')", 100);
}

function itemClick(url)
{
  if (url)
    document.location = url;

  return true;
}

function itemOver(id, childMenu)
{
  gActiveItem = id;

  if (IE4)
  {
    ob = document.all[id];
    ob.className = "popUpMenuSelectedItem";

  }
  
  else
  {
    ob = document.layers[gActiveMenu].layers[id];
    selectStyle = document.layers["selectItem"];

    if (ob) 
    {
      ob.clip.width = document.layers[gActiveMenu].menuWidth - 2;
      ob.menuBaseColor = ob.bgColor;
      ob.bgColor = selectStyle.bgColor;
    }
  }

  if (childMenu)
  {
    gMenuCmd = "openPullRightMenu('" + childMenu + "', '" +
                gActiveMenu + "', '" + id + "')";

    gMenuTimer = setTimeout(gMenuCmd, gPopUpDelay);
  }

  window.status = '';
}

function itemOut()
{
  if (!gActiveItem)			// should not happen
    return;

  if (gMenuTimer)
    clearTimeout(gMenuTimer);

  if (IE4 && event.toElement && event.toElement.id == gActiveItem)
    return;

  activeMenu = gActiveMenu ? gActiveMenu : gPrevMenu;

  if (IE4) 
  {
    ob = document.all[gActiveItem];
    ob.className = "popUpMenuItem";
  }

  else
  {
    ob = document.layers[activeMenu].layers[gActiveItem];
    ob.bgColor = ob.menuBaseColor;
  }

  closeChildMenu(gChildMenu);
  gActiveItem = null;
  window.status = '';
}

function menuClick(name)
{
  clearTimeout(gMenuTimer);
  eval(gMenuCmd);
}


function fixNSMenu(menu)
{
  for (i = 1; i < menu.layers.length; i++)
    menu.layers[i].top += 1 + i;

  menu.isFixed = 1;
}

function openPulldownMenu(name)
{
  if (!gLoaded)
    return;

  if (gActiveMenu != null)
    closeMenu(gActiveMenu);

  if (gActiveItem)
    itemOut();

  if (gParentMenu != null)
  {
    forceCloseMenu(gParentMenu);
    gParentMenu = null;
  }

  menuName = name + "Menu";  
  menu = gMenu[menuName];
  width = menu.menuWidth;

  if (IE4)
  {
    bar = document.all["menuBar"];
    option = document.all[name + "Bar"];

    x = posLeft(option) + document.body.scrollLeft -document.body.clientLeft;
    y = posTop(option) + document.body.scrollTop + option.offsetHeight + 1;

    docWidth = bar.offsetWidth +  document.body.clientLeft +
	(document.body.leftMargin / 2);
  }

  else
  {
    option = document.layers[name + "Bar"];

    x = posLeft(option);
    y = posTop(option) + option.clip.height + 1;

    docWidth = window.innerWidth;
  }

  if (x + width >= docWidth)
  {
    x = posLeft(option) - width;
    x += (NS4) ? option.clip.width : option.offsetWidth;
  }

  if (NS4 && !menu.isFixed)
    fixNSMenu(menu);

  menu.moveTo(x, y);
  menu.show();

  gActiveMenu = menuName;  
  gParentMenu = null;
  gParentItem = null;
  window.status = '';
}


function openPullRightMenu(name, parentMenuName, parentItemName)
{
  if (!gLoaded || !gActiveMenu)
    return;

  name += "Menu";

  if (gChildMenu)
    closeChildMenu();

  if (IE4)
  {
    bar = document.all["menuBar"];
    parentMenu = document.all[parentMenuName];
    parentItem = document.all[parentItemName];

    x = posLeft(parentMenu) + document.body.scrollLeft + 
        parentMenu.offsetWidth + gChildMenuXOffset;
    y = posTop(parentItem) + document.body.scrollTop + gChildMenuYOffset;

    docWidth = bar.offsetWidth + document.body.clientLeft +
	(document.body.leftMargin / 2);
  }

  else
  {
    parentMenu = document.layers[parentMenuName];
    parentItem = document.layers[parentMenuName].layers[parentItemName];

    x = posLeft(parentMenu) + parentMenu.clip.width + gChildMenuXOffset;
    y = posTop(parentItem) + gChildMenuYOffset;

    docWidth = window.innerWidth;
  }

  menuName = name;  
  menu = gMenu[menuName];
  width = menu.menuWidth;

  if (NS4 && !menu.isFixed)
    fixNSMenu(menu);

  if (x + width >= docWidth)
    x = docWidth - width;

  menu.moveTo(x, y);
  menu.show();

  gChildMenu = menuName;
  gParentMenu = parentMenuName;
  gParentItem = parentItemName;
  window.status = '';
}

function forceCloseMenu(menuName)
{
  if (!gMenu[menuName])
    return;

  gMenu[menuName].hide();
}


function closeMenu(menuName)
{
  if (!gMenu[menuName])
    return;

  if (!gOverMenu)
    gMenu[menuName].hide();
}


function closeChildMenu(menuName)
{
  if (!menuName)
    menuName = gChildMenu;

  if (!menuName)
    return;

  if (gParentItem && gParentItem == gActiveItem)
    return;

  if (menuName != gActiveMenu)
  {
    gMenu[menuName].hide();
    gChildMenu = null;
  }

  if (!gOverMenu)
  {
    if (NS4)
      setTimeout("closeMenu('" + gParentMenu + "');", 100);
    else
      closeMenu(gParentMenu);
  }
}


function closePulldownMenu(menuName)
{
  if (!gLoaded)
    return;

  if (gParentMenu && gParentMenu == menuName)
    return;

  if (gChildMenu)
    closeChildMenu();

  setTimeout("closeMenu('" + menuName + "Menu')", 100);
}


function addMenu(name)
{
  if (NS4)
    gMenu[name] = document.layers[name];
  else
    gMenu[name] = document.all[name];

  gMenu[name].show = show;
  gMenu[name].hide = hide;
  gMenu[name].onmouseout = menuOut;
  gMenu[name].onmouseover = menuOver;

  if (IE4)
  {
    gMenu[name].moveTo = moveTo;
    gMenu[name].menuWidth = gMenu[name].scrollWidth;
    gMenu[name].style.width = gMenu[name].menuWidth;
  }

  else
  {
    gMenu[name].menuWidth = gMenu[name].clip.width;
    gMenu[name].className = "popUpMenu";
  }
}


function showMenuBar(name)
{
  document.layers[name].visibility = "show";
}


function menuLink(name, id, url, childMenu)
{
  this.name = name;
  this.id = id;
  this.url = url;

  if (childMenu)
    this.childMenu = childMenu;

  return this;
}


function makeMenu(name, links)
{
  tagType = (NS4) ? "LAYER" : "SPAN";

  menu = "<DIV ID=\"" + name + "\" CLASS=\"popUpMenu\" ";
  menu += (NS4) ? "TOP=2>\n" : ">\n";

  for (i in links) 
  {
    isParent = links[i].childMenu;

    if (isParent)
      childStr = isParent;
    else
      childStr = "";

    menu += "<" + tagType + " ID=\"" + links[i].id + 
            "\" CLASS=\"popUpMenuItem\"\n";

    if (NS4)
    {
      menu += "LEFT=1\n";
      if (i == 0) menu += " TOP=1\n";
    }

    menu += "onMouseOver='itemOver(\"" + links[i].id + "\", \"" +
            childStr + "\");'\n" +
            "onMouseOut='itemOut();'\n";

    if (IE4)
    {
      if (isParent)
        menu += "\n onClick=\"menuClick('" + childStr + "');\"";
      else
        menu += "\n onClick=\"itemClick('" + links[i].url + "');\"";
    }

    menu += ">\n";

    if (NS4)
    {
      if (isParent)
        menu += "<A HREF=\"#\" onClick=\"menuClick('" + childStr + 
            "'); return false;\"\n" +
            "onMouseOver=\"window.status='';\">\n";

      else
        menu += "<A HREF=\"#\" onClick=\"itemClick('" + links[i].url + "'); " +
            "return false;\"\n" +
            "onMouseOver=\"window.status='';\">\n";
    }

    if (isParent)
      dots = "<B>...</B>";
    else
      dots = "";

    str1 = (NS4) ? "<FONT POINT-SIZE=10>" : "";
    str1 = "<NOBR>" + str1 + "&nbsp;" + links[i].name + dots + 
           "&nbsp;&nbsp;</NOBR>";

    str2 = (NS4) ? "</FONT>" : "";
    str2 = "<NOBR>&nbsp;" + links[i].name + dots + "&nbsp;" + str2 + "</NOBR>";
    
    menu += str1;
    if (NS4) menu += "</A>";
  
    menu += "</" + tagType + ">";

    if (NS4)
      menu += "<SPAN CLASS=\"fixNSSpan\">" +
              "<FONT COLOR=\"#EEEEEE\">" + str2 + "</FONT></SPAN>";

    if (i < links.length - 1)
      menu += "<BR>";
  }
         
  menu += "</DIV>";

  return menu;
}


function startSiteBuilder()
{ 
  siteBuilderURL = "/sys-tmpl/pages/common/setup.nhtml";

  window.open(siteBuilderURL, "templates", 
    "toolbar,scrollbars,resizable,width=640,height=480");

  closePulldownMenu("SiteBuilder");
}
  tm = new Array(1);
  tm[0] = new menuLink("dummy", "dummy", "dummy", "Dummy");
  document.write(makeMenu("DummyMenu", tm));

    tm = new Array(3);
  tm[0] = new menuLink("Account Settings", "AccountSettings", "/home/admin/domain/editdom.cgi", "");
  tm[1] = new menuLink("Billing Information", "BillingInformation", "/home/admin/domain/info_general.cgi", "");
  tm[2] = new menuLink("Add Resources", "AddResources", "/home/admin/domain/upgrade.cgi", "");
  document.write(makeMenu("ManageAccountMenu", tm));

  tm = new Array(2);
  tm[0] = new menuLink("Domain Information", "DomainInformation", "/home/admin/domain/lookup.cgi", "");
  tm[1] = new menuLink("Domain Aliasing", "DomainAliasing", "/home/admin/domain/remap/alias.cgi", "");
  document.write(makeMenu("ManageDomainMenu", tm));

  tm = new Array(5);
  tm[0] = new menuLink("Reports and Logs", "ReportsandLogs", "/home/admin/usage/", "");
  tm[1] = new menuLink("Protect Directories", "ProtectDirectories", "/home/admin/access/protect/", "");
  tm[2] = new menuLink("Search Engine Controls", "SearchEngineControls", "/home/admin/domain/search/", "");
  tm[3] = new menuLink("CGI Permissions", "CGIPermissions", "/home/admin/access/zones/", "");
  tm[4] = new menuLink("CGI Wizards", "CGIWizards", "/home/admin/domain/wizards.cgi", "");
  document.write(makeMenu("ManageSiteMenu", tm));


// Новости
  tm = new Array(6);
  tm[0] = new menuLink("Коммутируемое соединение", "x1", "/ru/price.html#dial", "");
  tm[1] = new menuLink("Выделенное соединение", "x2", "/ru/price.html#ll", "");
  tm[2] = new menuLink("Другие услуги", "x3", "/ru/price.html#other", "");
  document.write(makeMenu("ControlPanelMenu", tm));

// 
tm = new Array(3);
tm[0] = new menuLink("View/Edit Users", "ViewEditUsers", "/home/admin/users/", "");
tm[1] = new menuLink("User File Permissions", "UserFilePermissions", "/home/admin/access/users/", "");
tm[2] = new menuLink("Mailbox Usage", "MailboxUsage", "/home/admin/usage/user_mail.cgi", "");
document.write(makeMenu("ManageUsersMenu", tm));

  tm = new Array(3);
  tm[0] = new menuLink("Баланс", "z1", "/ru/time.html", "");
  tm[1] = new menuLink("Последние соединения", "z2", "/ru/last.html", "");
  tm[2] = new menuLink("Настройка соединения", "z3", "/ru/support.html#dial", "");

  document.write(makeMenu("SiteBuilderMenu", tm));

  tm = new Array(3);
  
  tm[0] = new menuLink("Галерея", "y1", "http://www.icq.kiev.ua/cgi-bin/icq/gallery/gallery.pl", "");
  tm[1] = new menuLink("Добавить новое фото", "y2", "http://www.icq.kiev.ua/cgi-bin/icq/gallery/up.pl", "");
  tm[2] = new menuLink("Добавить нового пользователя", "y3", "http://www.icq.kiev.ua/cgi-bin/icq/gallery/new.pl", "");
  document.write(makeMenu("BackOfficeMenu", tm));

  tm = new Array(1);
//  tm[0] = new menuLink("Клиент1", "k1", "/support/", "");
//  tm[1] = new menuLink("Search the Support Center", "SearchtheSupportCenter", "/home/search/search.cgi", "");
//  tm[2] = new menuLink("Contact Customer Support", "ContactCustomerSupport", "/home/home/contactCS.cgi", "");
//  tm[3] = new menuLink("Sitemap", "Sitemap", "/home/home/sitemap.cgi", "");
//  tm[4] = new menuLink("Take a Tour", "TakeaTour", "/home/tour/", "");
  document.write(makeMenu("SupportMenu", tm));

  tm = new Array(2);
  tm[0] = new menuLink("Как нас найти", "Addanewuser", "/ru/contact.html", "");
  tm[1] = new menuLink("Оставьте сообщение", "Changemypassword", "mailto:info@folgat.net?subject=from folgat.net", "");
  document.write(makeMenu("QuickTasksMenu", tm));




document.write("<BODY bgColor=#FFF7EF>");
document.write("<TABLE cellSpacing=0 cellPadding=0 width=85% align=center border=0>");
document.write("  <TBODY>");
document.write("  <TR vAlign=top alig=left>");
document.write("    <TD><a href=/index.html><img  src=/images/logo_st.gif border=0></a><br></TD><td align=right alig=right>");
user = "3097";
page = "2";
pid = Math.round((Math.random() * (10000000 - 1)));
//document.write("<iframe src='http://banner.kiev.ua/cgi-bin/bi.cgi?h" +
// user + "&"+ pid + "&" + page + "' frameborder=0 vspace=0 hspace=0 " +
// " width=468 height=60 marginwidth=0 marginheight=0 scrolling=no>");
//document.write("<a href='http://banner.kiev.ua/cgi-bin/bg.cgi?" +
// user + "&"+ pid + "&" + page + "' target=_top>");
//document.write("<img border=0 src='http://banner.kiev.ua/" +
// "cgi-bin/bi.cgi?i" + user + "&" + pid + "&" + page +
// "' width=468 height=60 alt='&#8992;&#9561;Н&#9552;&#9559;&#9564;є&#9561;&#9552;\Ж &#9553;&#9552;&#9564;&#9564;&#9556;Н&#9564;&#9552;\Ж є&#9556;Хѕ'></a>");
document.write("</iframe></td></tr>");
document.write("  <TR vAlign=top>");
document.write("    <TD colspan=2 width=100% rowSpan=0><IMG height=8 src=/images/dot.gif></TD></TR>");
document.write("  <TR vAlign=top>");
document.write("    <TD colspan=2 class=menuBackground width=100% bgColor=#003366 rowSpan=0><IMG height=1 src=/images/dot.gif width=100% border=0></TD></TR>");
document.write("  <TR vAlign=top bgColor=#EEEEEE>");
document.write("    <TD colspan=2 width=100% rowSpan=0><IMG height=2 src=/images/dot.gif></TD></TR>");
document.write("  <TR vAlign=top bgColor=#EEEEEE>");
document.write("    <TD colspan=2 vAlign=top align=left><DIV class=menuBar id=menuBar>");
document.write("      <TABLE cellSpacing=0 cellPadding=0 width=100% border=0>");
document.write("        <TBODY><TR bgColor=#EEEEEE>");
document.write("          <TD align=left>");
document.write("<SPAN class=menuBarItem><A href=/ru/news/news.html#><NOBR>&nbsp;&nbsp;Новости</NOBR></A></SPAN>&nbsp;&nbsp;|&nbsp;&nbsp;");
document.write("<SPAN class=menuBarItem id=ControlPanelBar><A onmouseover=openPulldownMenu('ControlPanel'); onmouseout=closePulldownMenu('ControlPanel'); href=/ru/price.html><NOBR>Цены</NOBR></A></SPAN>&nbsp;&nbsp;|&nbsp;&nbsp;");
document.write("<SPAN class=menuBarItem id=SiteBuilderBar><A onmouseover=openPulldownMenu('SiteBuilder'); onmouseout=closePulldownMenu('SiteBuilder'); href=/ru/support.html><NOBR>Поддержка</NOBR></A></SPAN>&nbsp;&nbsp;|&nbsp;&nbsp;");
// document.write("<SPAN class=menuBarItem><A href=http://www.icq.kiev.ua/icqlist/main.html><NOBR>ICQlist</NOBR></A></SPAN>&nbsp;&nbsp;|&nbsp;&nbsp;");
// document.write("<SPAN class=menuBarItem id=BackOfficeBar><A onmouseover=openPulldownMenu('BackOffice'); onmouseout=closePulldownMenu('BackOffice'); href=http://www.icq.kiev.ua/cgi-bin/icq/gallery/gallery.pl><NOBR>Галерея</NOBR></A></SPAN>&nbsp;&nbsp;|&nbsp;&nbsp;");
document.write("<SPAN class=menuBarItem><A href=http://mail.folgat.net><NOBR>&nbsp;&nbsp;Почта</NOBR></A></SPAN>&nbsp;&nbsp;|&nbsp;&nbsp;");
document.write("<SPAN class=menuBarItem><A href=/ru/client.html><NOBR>Клиенты</NOBR></A></SPAN>");
document.write("</FONT></TD><TD align=right>");
document.write("<SPAN class=menuBarItem id=QuickTasksBar><A onmouseover=openPulldownMenu('QuickTasks'); onmouseout=closePulldownMenu('QuickTasks'); href=/ru/contact.html><NOBR>Контакты&nbsp;&nbsp;</NOBR></A></SPAN>");
document.write("</FONT></TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY>");
document.write("<TR vAlign=top>");
document.write("<TD colspan=2 bgColor=#EEEEEE width=100% rowSpan=0><IMG height=2 src=/images/dot.gif></TD></TR>");
document.write(" <TR vAlign=top>");
document.write("<TD colspan=2 class=menuBackground width=100% bgColor=#003366 rowSpan=0><IMG height=1 src=/images/dot.gif border=0></TD></TR>");
document.write("</TABLE>");
document.write("  <script>");
document.write("  addMenu('DummyMenu');");
document.write("  addMenu('ManageUsersMenu');");
document.write("  addMenu('ManageAccountMenu');");
document.write("  addMenu('ManageDomainMenu');");
document.write("  addMenu('ManageSiteMenu');");
document.write("  addMenu('ControlPanelMenu');");
document.write("  addMenu('SiteBuilderMenu');");
document.write("  addMenu('BackOfficeMenu');");
document.write("  addMenu('SupportMenu');");
document.write("  addMenu('QuickTasksMenu');");
document.write("  if (NS4)");
document.write("  {");
document.write("    gInnerWidth = new Number(window.innerWidth);");
document.write("    gInnerHeight = new Number(window.innerHeight);");
document.write("  }");
document.write(" gLoaded = true;");
document.write("  </script>");
document.write("<br><table align=center BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=1 WIDTH=85%>");
document.write("<tr><td bgcolor=#003366><table border=0 width=100% cellspacing=1 cellpadding=3>");
document.write("<tr bgcolor=#EEEEEE><td width=100%>");
