﻿$(document).ready(function () {
  mainmenu();
});

var widthLevel2Anchors = 0;
function mainmenu() {

//  $(".aLevel2").each(function () {
//    if ($($(this)[0].parentNode.parentNode).width() - 18 > widthLevel2Anchors) widthLevel2Anchors = $($(this)[0].parentNode.parentNode).width() - 18;
//  });
//  $(".aLevel2").each(function () {
//    var toSet = widthLevel2Anchors.toString() + "px";    
//    $(this).width(toSet);
//  });

  $(".nav ul.navLevel2").css({ display: "none" }); // Opera Fix
  $(".nav ul.navLevel3").css({ display: "none" }); // Opera Fix

  $(".nav li.subNav").hover(function () {
    $(this).find('ul.navLevel2:first').css({ visibility: "visible", display: "none" }).show(200);
  }, function () {
    $(this).find('ul.navLevel2:first').css({ visibility: "hidden" });
  });

  $("a.aLevel2").hover(
      function () {
        $(this.parentNode).find("ul.navLevel3:first").css({ visibility: "visible", display: "none" }).show();
      },
      function () { });

  $("li.liLevel2").hover(
      function () {
        //$(this).css({ width: "270px" });
      },
      function () {
        $(this).find("ul.navLevel3:first").css({ visibility: "hidden", display: "none" });
        //$(this).css({ width: "135px" });
      });

  $("ul.navLevel3").hover(
      function () { },
       function () {
         $(this).css({ visibility: "hidden", display: "none" });
       });
}


