var am=new Array();
addLoadEvent(initMenu);
var def=-1;

function initMenu()
  {
  for( var i=0;i<9;i++)
    {
    if(document.getElementById('a'+i))
      {
      var a=document.getElementById('a'+i);
      a.i=i;
	  if (a.className=="sel")
	    {
		def=i;
		}
      a.onmouseover = function () {showsm(this.i); return false;}
      if (document.getElementById('a'+i+'h'))
        {
        var ah=document.getElementById('a'+i+'h');
        ah.i=i;
//		if (def==i) ah.style.display="block";
        ah.onmouseout = function () {hidesm(this.i); return false;}
        ah.onmouseover = function () {showsm(this.i); return false;}
        ah.style.top=a.offsetTop+'px';
        am.push(i);
        }
      }
    }
  }

function showsm(i)
  {
  zobr=false;
  for(j in am)
    {
    if (i==am[j])
	  {
	  zobr=true;
	  document.getElementById('a'+am[j]+'h').style.display="block";
	  document.getElementById('a'+am[j]).className="sel";
	  }
    else
	  {
	  document.getElementById('a'+am[j]+'h').style.display="none";
	  if (am[j]!=def) document.getElementById('a'+am[j]).className="";
	  }
    }
  if (!zobr && document.getElementById('a'+def+'h')) document.getElementById('a'+def+'h').style.display="block";
  }
function hidesm(i)
  {
  document.getElementById('a'+i+'h').style.display="none";
  if (i!=def) document.getElementById('a'+i).className="";
  if (document.getElementById('a'+def+'h'))
    {
	document.getElementById('a'+def+'h').style.display="block";
	}
  }



function addLoadEvent(func)
 { 
 var oldonload = window.onload;
 if (typeof window.onload != 'function')
   {
   window.onload = func;
   }
 else
   {
   window.onload = function(){oldonload();func();}
   }
 }
