
var _navigation = function() {
  var removeSelected = false;
  $("#top-nav li.level1").hover(function() {
    if ($(this).find("ul")) {
      if (!$(this).find("a").hasClass("selected")) {
        removeSelected = true;
        $(this).find("a").addClass("selected");
      }
      $(this).find("ul").show();
      /*if ($.browser.msie && $.browser.version.substr(0,1)<8) {
        // check if iframe already exists if not add. (div containing iframe with absolute position)
        if ($(this).find('.hover_node_iframe').length <= 0) {
          $(this).prepend('<div class="hover_node_iframe"><iframe width="' + $(this).outerWidth() + 'px" height="' + $(this).outerHeight() + 'px" src="ping.html" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no">IFrame not supported by your browser version...</iframe></div>');
        }
      }*/
    }
  }, function () {
    if ($(this).find("ul")) {
      if (removeSelected) {
        $(this).find("a").removeClass("selected");
        removeSelected = false;
      }
      $(this).find("ul").hide();
    }
  });
};

var _equalHeight = function() {
  var leftNav = $("#contentleft");
  var contentRight = $("#contentright");
  var leftNavHeight = 0;
  var contentRightHeight = 0;
  if (leftNav != null && contentRight != null) {
    leftNavHeight = leftNav.height();
    contentRightHeight = contentRight.height();
    if (leftNavHeight < contentRightHeight) leftNav.height(contentRightHeight + "px");
  }
};

// start the navigation script
$(document).ready(function() {
  _navigation();
  _equalHeight();
});
