/// <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;
    
    //For top-level menus with children clone the top level link as the first item in the sub-menu.
//    $("ul.level0 > li.parent").each(
//    function(i) {
//		$(this).children("div.level1 > ul")
//    );
    
	//Toggle the over / out state of the top level flyout items. 
    $("ul.level0 > li").hover(
      function () {
		//Hide any open menus.
		subMenuClose();
      }, 
      function () {
        return;
      }
    ); 
    
    //Toggle the over / out state of the top level flyout items. 
    $("ul.level0 > li.parent").hover(
      function () 
      {
		//CREATE IE.6 IFRAME FIX
		if (jQuery.browser.msie && (parseInt(jQuery.browser.version) < 7)) 
		{
			runIE6ZIndexFix(this, "SITE_MENU");
		}
        
		//Now open the currently requested menu.
        $(this).children("div.level1").show();
        
        clearTimeout(SITEMENUTIMEOUT);
      }, 
      function () {
		clearTimeout(SITEMENUTIMEOUT);
		SITEMENUTIMEOUT = setTimeout("subMenuClose();", SITEMENUTIMEOUTLENGTH);
        //return;
      }
    ); 
    
    //As a mouse out state happens on the parent we need to cancel the close action when we roll-over the child items.. 
    $("div.level1").hover(
      function () {
		clearTimeout(SITEMENUTIMEOUT);
        $(this).show();
      }, 
      function () {
		//SITEMENUTIMEOUT = setTimeout("subMenuClose();", SITEMENUTIMEOUTLENGTH);
		//$(this).hide();
		return;
      }
    );
}); 

function subMenuClose()
{
	$("ul.level0 > li.parent > div.level1").hide();
	
	//REMOVE ANY IE.6 IFRAME FIXES
	//if (jQuery.browser.msie && (parseInt(jQuery.browser.version) < 7)) 
	//{
		//$("ul.level0 > li.parent > div.level1 > iframe").remove();
	//}
} 
