/**************************************
/kindly taken from http://www.alistapart.com/articles/dropdowns
/adds over class to appropriate classe, as IE doesnt support li:hover
/**************************************/
IEhoverBug = function() {
  if(!browserIsIE())  //if not Internet explorer which is the only browser where the problem occurs
    return false;

  if (document.all&&document.getElementById) {
	  navRoot = document.getElementById("functionbar");
	  if (navRoot == null)
	    return false;
	  addHoverClassToLIs(navRoot,1);
	}

  function addHoverClassToLIs(navRoot, level)
  {
    if (navRoot.childNodes.length == 0)
      return false;

	  var i;  //must be declared because it is called recursive (javascript..!)
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI" || node.nodeName=="li") {
        node.onmouseover=function() {
	        this.className+=" over"+level;
        }
        node.onmouseout=function() {
	        this.className=this.className.replace(" over"+level, "");
        }
      }

      if (node.childNodes.length > 0)
      {
        var j;
        for (j=0; j<node.childNodes.length; j++) {

          // traverse subtree
          subTree = node.childNodes[j];

          if (subTree != null)
            if (subTree.nodeName=="UL" || subTree.nodeName=="ul") {
              addHoverClassToLIs(subTree,level+1);
            }

        }
      
      }
    }
  }
}
if (window.attachEvent) window.attachEvent('onload', IEhoverBug);

// *************************
/** IE script to cover <select> elements with <iframe>s **/
selectHide = function()
{
  if(!browserIsIE())  //if not Internet explorer which is the only browser where the problem occurs
    return false;     //then do nothing
    
  var ieULs = document.getElementById('functionbar').getElementsByTagName('ul');

  for (j=0; j<ieULs.length; j++)
  {
    //insert iframe to hide select dropdowns
    ieULs[j].innerHTML = (ieULs[j].innerHTML + '<div></div><iframe style="filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" class="iFrameHider" src="about:blank" scrolling="no" frameborder="0"></iframe>');
    var ieMat = ieULs[j].lastChild; //select iFrame in each UL
    ieMat.style.height = ieULs[j].offsetHeight + "px";
  }
}
if (window.attachEvent) window.attachEvent('onload', selectHide);

/*--------------------------------------------------*/
//Internet explorer detect
function browserIsIE()
{
  var detect = navigator.userAgent.toLowerCase();
  if (checkIt('msie'))
    return true;  
  return false;
  
  function checkIt(string)
  {
	  if ((detect.indexOf(string) + 1) && !(detect.indexOf('opera') + 1)) //hvis msie og ikke opera!!! :-)
	    return true;
	  return false;
  }
}
