  _opacity = new Array();
  _layer = new Array();
  var _stepOpacity=10;
  var _stepTimeOut=0.1;
  var _stepInterval=300;
  var _v = new Array();
  var _h = new Array();
  var _t = new Array();
  var _s = new Array();
  var stop_play;



  function hiddenImgList(_stopKey) {
           if (_layer) {
              for (var id in _layer) {
                  if (_stopKey != _layer[id]) hiddenImage(_layer[id]);
              }
           }
  }


  function hiddenPopupList(_stopKey) {
           stop_play = 1;
           if (_layer) {
              for (var id in _layer) {
                  if (_stopKey != _layer[id]) unSetOpacity(_layer[id]);
              }
           }
  }


  function viewImgList() {
           if (_layer) {
              for (var id in _layer) {
                   popupOver(_layer[id]);
              }
           }
  }

  function hiddenImage(key) {
           _opacity[key]=0;
           _this=document.getElementById(key);
           _this.style.filter ="alpha(opacity="+_opacity[key]+");";
           _this.style.opacity  =  _opacity[key]/100;
           _this.style.visibility = "hidden";

  }

  function showImage(key) {
           _opacity[key]=100;
           _this=document.getElementById(key);
           _this.style.visibility = "visible";
           _this.style.filter ="alpha(opacity="+_opacity[key]+");";

  }


  function popupOver(key) {
           _this=document.getElementById(key);
           _this.style.visibility = "visible";
           clearInterval(_t[key]);
           if (_opacity[key] != 100) setOpacity(key);
  }

  function popupOut(key) {
           _this=document.getElementById(key);
           clearTimeout(_v[key]);
           clearTimeout(_h[key]);
           clearInterval(_t[key]);
           _t[key]=setInterval("unSetOpacity(\""+key+"\")", _stepInterval);
  }


  function popupOverS(key) {
           if (!stop_play) {
              _this=document.getElementById(key);
              _this.style.visibility = "visible";
              clearInterval(_t[key]);
              if (_opacity[key] != 100) setOpacity(key);
           }
  }

  function popupOutS(key) {
           if (!stop_play) {
              _this=document.getElementById(key);
              clearTimeout(_v[key]);
              clearTimeout(_h[key]);
              clearInterval(_t[key]);
              _t[key]=setInterval("unSetOpacity(\""+key+"\")", _stepInterval);
           }
  }




  function setOpacity(key) {
           _this=document.getElementById(key);
           clearTimeout(_h[key]);
           if (!_opacity[key]) _opacity[key] = 0;

           if (_opacity[key] < 100) {
              _opacity[key]+=_stepOpacity;
              _this.style.filter ="alpha(opacity="+_opacity[key]+");";
              _this.style.opacity  =  _opacity[key]/100;
              _v[key]=setTimeout("setOpacity(\""+key+"\")", _stepTimeOut);
           } else {
              clearTimeout(_v[key]);
           }
  }

  function unSetOpacity(key) {
           _this=document.getElementById(key);
           clearTimeout(_v[key]);
           if (!_opacity[key]) _opacity[key] = 100;

           if (_opacity[key] > 10) {
              _opacity[key]-=_stepOpacity;
              _this.style.filter ="alpha(opacity="+_opacity[key]+");";
              _this.style.opacity  =  _opacity[key]/100;
              _h[key]=setTimeout("unSetOpacity(\""+key+"\")", _stepTimeOut);
           } else {
              clearTimeout(_t[key]);
              clearTimeout(_h[key]);
              _this.style.visibility = "hidden";
              _this.style.filter="";
           } 
  }




  function displayShow(key) {
           _this=document.getElementById(key);
           _this.style.display = "";
  }

  function displayHidden(key) {
           _this=document.getElementById(key);
           _this.style.display = "none";
  }


  function showOtherPage(_showPage) {
//         _s[key]=setInterval("hidDisplayAndShow(\""+_hidPage+"\",\""+_showPage+"\")", 1000);

           hidDisplayAndShow(_hidPage, _showPage);
           _hidPage=_showPage;
  }




  function hidDisplayAndShow(_hidPageKey, _showPageKey) {

//           alert("спрятать "+_hidPageKey+" "+_opacity[_hidPageKey]+", пRказать "+_showPageKey+" "+_opacity[_showPageKey]+" ");

//           clearInterval(_s[key]);
             popupOut(_hidPageKey);
             displayHidden(_hidPageKey);
             displayShow(_showPageKey);
             hiddenImage(_showPageKey);
             popupOver(_showPageKey);
  }

 function showOtherYear(_showYear) {
          hidDisplayAndShow(_hidYear, _showYear);
         _hidYear=_showYear;
 }



