var lbMenuLarge  = 0;
var liInMenuItem = 0;
var tmpovers     = 0;
var tmpouts      = 0;

function pMenuClick()
{  var targ;
  if (!e) { var e=window.event;   }
if (e.target)
  {    targ=e.target;   }
else if (e.srcElement)
  {   targ=e.srcElement;   }
if (targ.nodeType==3) // defeat Safari bug
  {  targ = targ.parentNode;
  }
var tname;
tname=targ.tagName;
//document.getElementById('MuisOver').value = "clicked on " + tname + " element with id " + e.srcElement.Id ;

   if ( lbMenuLarge == 0 )
    {      var li1=0;    }
   else     {       pMenuMouseOut();    }
//    window.setTimeout( "OptionsVisible()" , 1500); 
  }

function pMenuMouseOver()
{ 
  liInMenuItem = 1;
  if ( lbMenuLarge == 0 )
    {
      document.getElementById("p2").style.visibility="visible";
      document.getElementById("p3").style.visibility="visible";
      document.getElementById("p4").style.visibility="visible";
      document.getElementById("p5").style.visibility="visible";
      lbMenuLarge = 1;
      var li1=0;
      while (li1 < 14 ) {
           var li = 0;
	   li  = li1 * 10 + 31;  
           li1++;       }
      window.setTimeout( "OptionsVisible()" , 2000); 
    }
}

function pMenuMouseOut()  
{ 
  liInMenuItem = 0;
//  window.setTimeout( "AvoidFlicker()" , 200); 
}

function pMenuItemMouseOver(liIn)
{
  liIn > 20?liIn = 'DivPause':liIn = 'p' + liIn;

liBgColor = document.getElementById(liIn).style.backgroundColor;
liColor   = document.getElementById(liIn).style.color;
//document.getElementById(liIn).style.borderColor='white';
document.getElementById(liIn).style.color='black';
//document.getElementById(liIn).style.backgroundColor=liColor;
liInMenuItem = 1;
}

function pMenuItemMouseOut(liOut)
{ 
liBgColor = document.getElementById("p" + liOut).style.backgroundColor;
liColor   = document.getElementById("p" + liOut).style.color;
//document.getElementById("p" + liOut).style.borderColor='white';
document.getElementById("p" + liOut).style.color='white';
//document.getElementById("p" + liOut).style.backgroundColor=liColor;
liInMenuItem = 0;
// window.setTimeout( "AvoidFlicker()" , 100); 
}

function LowerWindow(li) {  document.getElementById('divall').style.top=li+'px';}

function AvoidFlicker()
{
  if ( liInMenuItem == 0 && lbMenuLarge == 2 )        {
    document.getElementById("p3").style.visibility="hidden";
    lbMenuLarge = 0;
    document.getElementById('divall').style.top=43+'px';   }
}

function OptionsVisible()
{ lbMenuLarge = 2;
if ( 1 == 0 )                                {
    lbMenuLarge = 0;
    document.getElementById('divall').style.top=43+'px';   }
  else {    lbMenuLarge = 2;
    document.getElementById("p4").style.visibility="visible";
       }
}

function isMouseLeaveOrEnter(Evt, handler)
{	
  if (Evt.type != 'mouseout' && Evt.type != 'mouseover') return false;
 
lsone = Evt.type;
// document.getElementById('ParentNode').value=Evt.type + ' From ' + Evt.toElement.id + ' X ' + event.clientX;

  var Related = Evt.relatedTarget ? Evt.relatedTarget : Evt.type == 'mouseout' ? Evt.toElement : Evt.fromElement;
  while (Related && Related != handler)
    { Related = Related.parentNode;
    }
  return (Related != handler);
}