// configuration and variables
	var str_topnavspeed = 'fast';
	
	var bool_nav_hover = new Array();
	var bool_anim_open = new Array();
	var bool_anim_close = new Array();
	
	jQuery('#topnavigation ul li[@id]').each(
		function(){ // mouseover
			bool_nav_hover[this.id]   = false;
			bool_anim_open[this.id]   = false;
			bool_anim_close[this.id]   = false;
		}
	);
	
// reuseable functions
	// check if a menu should open or close
	function checkmenustatus(id_topnav){
		if(!bool_nav_hover[id_topnav]){ // close menu
			if(bool_anim_close[id_topnav]){
				bool_anim_close[id_topnav] = false;
				jQuery('li#'+id_topnav+' ul:visible').slideUp(
					str_topnavspeed,
					function(){
						jQuery('#topnavigation li#'+id_topnav+' a.active').removeClass('active');
					}
				);
			}
		}else if(bool_nav_hover[id_topnav]){ // open menu
			var bool_currentsection = false;
			if(!bool_anim_open[id_topnav] && !bool_currentsection){
				jQuery('#topnavigation li#'+id_topnav+' a:first').addClass('active');
				jQuery('li#'+id_topnav+' ul:hidden').slideDown(
					str_topnavspeed,
					function(){
						bool_anim_open[id_topnav] = false;
						bool_anim_close[id_topnav] = true;
					}
				);
			}
		}
	};
	// evaluate what menus should be shown or hidden and run appropriate animations
	function checkmenus(){
		jQuery('#topnavigation ul li[@id]').each(
			function(){ // mouseover
				checkmenustatus(this.id);
			}
		);
	};
// jquery actions/page modifications
	jQuery(document).ready(function(){
		// adjust menu state variables based on tab hover state
		jQuery('#topnavigation ul li[@id]').each(function(){
			jQuery('a:first',this).hover(
				function(){ // mouseover
					bool_nav_hover[jQuery(this).parents('li[@id]').attr('id')] = true;
				},
				function(){ //mouseout
					bool_nav_hover[jQuery(this).parents('li[@id]').attr('id')] = false;
				}
			);
		});
		// adjust menu state variables based on sub-navigation hover state
		jQuery('#topnavigation ul li[@id] ul').hover(
			function(){ // mouseover
				bool_nav_hover[jQuery(this).parents('li[@id]').attr('id')] = true;
			},
			function(){ // mouseout
				bool_nav_hover[jQuery(this).parents('li[@id]').attr('id')] = false;
			}
		);
		// set a timer to call the menu manager function
		var interval_topnav = setInterval("checkmenus()", 100);
		// apply IE background flicker fix as appropriate
		// http://evil.che.lu/2006/9/25/no-more-ie6-background-flicker
		if(jQuery.browser.msie){
			document.execCommand('BackgroundImageCache', false, true);
		}
	});

