//Main Nav

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

function removeClassName(el, name) {

  var i, curList, newList;

  if (el.className == null)
    return;

  // Remove the given class name from the element's className property.

  newList = new Array();
  curList = el.className.split(" ");
  for (i = 0; i < curList.length; i++)
    if (curList[i] != name)
      newList.push(curList[i]);
  el.className = newList.join(" ");
}

// Submenu links

var submenu=new Array()

submenu[0]='<a href="osnovy.php?id=pob">&#1054;&#1089;&#1085;&#1086;&#1074;&#1080;</a> | <a href="cons.php">&#1054;&#1088;&#1075;&#1072;&#1085;&#1110;&#1079;&#1072;&#1094;&#1110;&#1103;</a> | <a href="history.php">&#1030;&#1089;&#1090;&#1086;&#1088;&#1110;&#1103;</a> | <a href="cons.php">&#1055;&#1088;&#1072;&#1094;&#1103;</a> | <a href="vatra.php">&#1053;&#1072; &#1042;&#1110;&#1095;&#1085;&#1091; &#1042;&#1072;&#1090;&#1088;&#1091; &#1055;&#1086;&#1073;&#1088;&#1072;&#1090;&#1080;&#1084;&#1110;&#1074;</a>'

submenu[1]='<a href="news.php?type=pob" style="">&#1055;&#1086;&#1073;&#1088;&#1072;&#1090;&#1080;&#1084;&#1080;</a> | <a href="news.php?type=usp" style="color:#215E21">&#1055;&#1041;-&#1059;&#1057;&#1055;</a> | <a href="news.php?type=ups" style="color:#5C3317">&#1055;&#1041;-&#1059;&#1055;&#1057;</a> | <a href="http://plastusa.org/plast_news.php">&#1055;&#1083;&#1072;&#1089;&#1090;</a> | <a href="news.php?type=svit" style="color:#191970">&#1059;&#1082;&#1088;. &#1057;&#1074;&#1110;&#1090;</a> | <a href="news.php" style="">&#1042;&#1089;&#1110; &#1053;&#1086;&#1074;&#1080;&#1085;&#1080;</a> | <a href="calendar.php?id=full">&#1050;&#1072;&#1083;&#1077;&#1085;&#1076;&#1072;&#1088;</a>'

submenu[2]='<a href="photo.php?type=new">&#1041;&#1083;&#1080;&#1078;&#1095;&#1077; &#1052;&#1080;&#1085;&#1091;&#1083;&#1077;</a> | <a href="photo.php?type=old">&#1044;&#1072;&#1083;&#1100;&#1096;&#1077; &#1052;&#1080;&#1085;&#1091;&#1083;&#1077;</a> | <a href="photo.php?type=archive">&#1040;&#1088;&#1093;&#1110;&#1074;</a>'

submenu[3]='<a href="cons.php">&#1053;&#1086;&#1074;&#1077; &#1063;&#1080;&#1089;&#1083;&#1086;</a> | <a href="cons.php">&#1040;&#1088;&#1093;&#1110;&#1074;</a>'

var menuobj=document.getElementById? document.getElementById("subs") : document.all


var activeButton = null;

function buttonClick(event, which) {

  var button;

  // Get the target button element.

  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;
	
  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Reset the currently active button, if any.

  if (activeButton != null)
    resetButton(activeButton);

  // Activate this button, unless it was the currently active one

  if (button != activeButton) {
    depressButton(button);
    activeButton = button;
	thecontent=(which==-1)? "" : submenu[which]
  }
  
  else {
    activeButton = null;
	thecontent = ""
  }
	
  menuobj.innerHTML=thecontent

  return false;
}

function depressButton(button) {
button.className += "active";
}

function resetButton(button) {
  removeClassName(button, "active");
}

function resetSub(button) {
  menuobj.innerHTML=""
}



