var buttonOn = "";

function highlight(MyS)
{
  var temph = document.getElementById(MyS).src;
  if (temph.substring(temph.length-14,temph.length) == "_highlight.png")
  {
    temph = temph.substring(0, (temph.length -14)) + ".png";
    buttonOn="";
 //   document.getElementById("Menu").style.backgroundColor = "#fff";
  }
  else
  {
    temph = temph.substring(0, (temph.length -4)) + "_highlight.png";
    buttonOn=MyS;
  }
  document.getElementById(MyS).src = temph;
  
  
  temph = "PNL" + MyS.substring(4, (temph.length));
  
  if (document.getElementById(temph))
  {
    if (buttonOn.length>0)
      document.getElementById(temph).style.display="block";
    else
      document.getElementById(temph).style.display="none";
  }
  
  
 // document.getElementById("MenuOption").innerHTML = buttonOn;  
  return;
}

function highlightTax()
{
  if (buttonOn.length > 0)
    highlight(buttonOn);
  highlight("BTN_Tax");
 // document.getElementById("Menu").style.backgroundColor = "#fa2";  
}
function highlightBusiness()
{
  if (buttonOn.length > 0)
    highlight(buttonOn);
  highlight("BTN_Business");
 // document.getElementById("Menu").style.backgroundColor = "#2c4";  
}
function highlightSuper()
{
  if (buttonOn.length > 0)
    highlight(buttonOn);
  highlight("BTN_Super");
 // document.getElementById("Menu").style.backgroundColor = "#24c";  
}
function highlightAudit()
{
  if (buttonOn.length > 0)
    highlight(buttonOn);
  highlight("BTN_Audit");
 // document.getElementById("Menu").style.backgroundColor = "#f30";  
}
function highlightWealth()
{
  if (buttonOn.length > 0)
    highlight(buttonOn);
  highlight("BTN_Wealth");
 // document.getElementById("Menu").style.backgroundColor = "#73b";  
}


function highlightOff()
{
  if (buttonOn.length > 0)
    highlight(buttonOn);
}

var addEvents=false; //addEventlistener

function pageLoaded()
{

  //var mode=document.compatMode,m;
  //if(mode)
  //{
  //  if(mode=='BackCompat')
  //    m='Quirks';
  //  else if(mode=='CSS1Compat')
  //    m='Standards Compliance';
  //  else m='Almost Standards Compliance';
    
    //document.getElementById("messagePost").innerHTML ='The document is being rendered in '+m+' Mode.';
  //}
  
  if (window.addEventListener)  
    addEvents = true;
  
  if (addEvents)
  {
    if (document.getElementById("BTN_Tax"))
    {
      document.getElementById("BTN_Tax").addEventListener("mouseover",highlightTax,false);
      document.getElementById("BTN_Tax").addEventListener("mouseout",highlightOff,false);    
    }
    if (document.getElementById("BTN_Business"))    
    {
      document.getElementById("BTN_Business").addEventListener("mouseover",highlightBusiness,false);
      document.getElementById("BTN_Business").addEventListener("mouseout",highlightOff,false);    
    }
    if (document.getElementById("BTN_Super"))    
    {
      document.getElementById("BTN_Super").addEventListener("mouseover",highlightSuper,false);
      document.getElementById("BTN_Super").addEventListener("mouseout",highlightOff,false);
    }
    if (document.getElementById("BTN_Audit"))    
    {
      document.getElementById("BTN_Audit").addEventListener("mouseover",highlightAudit,false);
      document.getElementById("BTN_Audit").addEventListener("mouseout",highlightOff,false);
    }
    if (document.getElementById("BTN_Wealth"))    
    {
      document.getElementById("BTN_Wealth").addEventListener("mouseover",highlightWealth,false);
      document.getElementById("BTN_Wealth").addEventListener("mouseout",highlightOff,false);
    }
  }
  else
  {
    if (document.getElementById("BTN_Tax"))    
    {
      document.getElementById("BTN_Tax").attachEvent("onmouseover",highlightTax);
      document.getElementById("BTN_Tax").attachEvent("onmouseout",highlightOff);
    }
    if (document.getElementById("BTN_Business"))    
    {  
      document.getElementById("BTN_Business").attachEvent("onmouseover",highlightBusiness);
      document.getElementById("BTN_Business").attachEvent("onmouseout",highlightOff);
    }
    if (document.getElementById("BTN_Super"))    
    {  
      document.getElementById("BTN_Super").attachEvent("onmouseover",highlightSuper);  
      document.getElementById("BTN_Super").attachEvent("onmouseout",highlightOff);  
    }
    if (document.getElementById("BTN_Audit"))    
    {  
      document.getElementById("BTN_Audit").attachEvent("onmouseover",highlightAudit);
      document.getElementById("BTN_Audit").attachEvent("onmouseout",highlightOff);
    }
    if (document.getElementById("BTN_Wealth"))    
    {    
      document.getElementById("BTN_Wealth").attachEvent("onmouseover",highlightWealth);
      document.getElementById("BTN_Wealth").attachEvent("onmouseout",highlightOff);  
    }
  }
  
} //pageLoaded
  
window.onload=pageLoaded;
  
  
  
  
  
  
