/// <summary>The SiteMenu class adds the javascript logic for creating our nested flyout menus.
$(document).ready(function() { 
	//Set our global timout to catch mouse out events that fire the menu close.
	var SITEMENUTIMEOUT;
    var SITEMENUTIMEOUTLENGTH = 500;
    
    subSiteMenuClose();
    
	//Toggle the over / out state of the top level flyout items. 
    $("ul.menu.top.level1 > li").hover(
      function () {
		//Hide any open menus.
		subSiteMenuClose();
      }, 
      function () {
        return;
      }
    ); 
    
    //Toggle the over / out state of the top level flyout items. 
    $("ul.menu.top.level1 > li.parent").hover(
      function () {
		//Now open the currently requested menu.
        $(this).children("div.menu.top.level2").show();
        clearTimeout(SITEMENUTIMEOUT);
      }, 
      function () {
		SITEMENUTIMEOUT = setTimeout("subSiteMenuClose();", SITEMENUTIMEOUTLENGTH);
      }
    ); 
    
    //As a mouse out state happens on the parent we need to cancel the close action when we roll-over the child items.. 
    $("div.menu.top.level2").hover(
      function () {
		clearTimeout(SITEMENUTIMEOUT);
        $(this).show();
      }, 
      function () {
		return;
      }
    );
}); 

function subSiteMenuClose()
{
	$("ul.menu.top.level1 > li.parent > div.menu.top.level2").hide();
} 