function navbar() {
var subNavTimer;
var open;

$("ul.subNav").mouseover(function() {
 $(this).show();
 open = $(this).parent();
});

$("li.navMainLink").mouseover(function() {
 if (open != null) open.children("ul").hide();
 clearTimeout(subNavTimer);
 if ($(this) != open) $(this).children("ul:hidden").show();
});

$("li.navMainLink").mouseout(function() {
  open = $(this);

subNavTimer = setTimeout(function() {
  open.children("ul:visible").fadeOut('fast', function() {
    open.children("ul:visible").hide();
  });
  }, 1000);
});
}

// note popup
function centrePopup()
   	{
      var windowWidth = document.documentElement.clientWidth;
      var windowHeight = document.documentElement.clientHeight;
      
      var popupHeight = $("#notePopup").height();
      var popupWidth = $("#notePopup").width();

      $("#notePopup").css(
      {
         "top": windowHeight/2-popupHeight/2,
         "left": windowWidth/2-popupWidth/2
      });
	  $("#notePopup").fadeIn('slow');
   	}


$(document).ready(function() {
 	navbar();
	// load popup note
 	centrePopup();
});