var bwIE60 = (navigator.appVersion.indexOf("MSIE 6.0") != -1) ? "True" : "False";
var bwIE70 = (navigator.appVersion.indexOf("MSIE 7.0") != -1) ? "True" : "False";

$(document).ready(function () {
  // top menu
  $(".hlbMenuMain li").each(function () {
    // menu SHOW
    $(this).mouseenter(function () {
      $("a:first", this).toggleClass("hlbMenuMainSelected");
      var offset = $("a:first", this)[0].offsetLeft;
      if (bwIE60 == "True" || bwIE70 == "True") {
        offset = this.offsetLeft;
      }
      $("div:first", this).css("left", offset + "px");
      $("div:first", this).show();
    });
    // menu HIDE
    $(this).mouseleave(function () {
      $("div:first", this).hide();
      $("a:first", this).toggleClass("hlbMenuMainSelected");
    });
  });

  // model menu
  $(".mmMenuMain li", this).each(function () {
    // menu SHOW
    $(this).mouseenter(function () {
      $("a:first", this).toggleClass("mmMenuMainSelected");
      $("div:first", this).show();
      var offset = $("a:first", this)[0].offsetLeft;
      var width = $("div:first", this)[0].offsetWidth;
      if (bwIE60 == "True" || bwIE70 == "True") {
        offset = this.offsetLeft;
      }
      if (offset + width > 920) {
        var diff = 920 - (offset + width);
        offset = offset + diff;
      }
      $("div:first", this).css("left", offset + "px");
    });
    // menu HIDE
    $(this).mouseleave(function () {
      $("div:first", this).hide();
      $("a:first", this).toggleClass("mmMenuMainSelected");
    });
  });

  // Printing
  $("table.qlTable tbody").append("<tr><td><a href='#' class='print'>Print Page</a></td><td>&nbsp;</td></tr>");

  $("a.print").live("click", function () {
    window.print();
    return false;
  });


});

