$(document).ready(function() {
	// Check to see if the page is being viewed with css and prevent jquery from firing if not.
	if($("#header h1 a").css("position") == "absolute"){		
		// Set up the main menu
		$('#mainmenu').supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over     
        }).superfish({ 
            delay:       200,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed
			disableHI:    false              // set to true to disable hoverIntent detection 
        });  
		
		// Setup the Accordion (left sidebar)
		$('.submenu').accordion({
			active: false,
			header: '.head',
			navigation: true,
			event: 'click',
			autoHeight: false
		});
	
		$(".communitylist .head, .communitylist .subhead").next().hide();
		$(".communitylist .head, .communitylist .subhead").click(function() {
			if($(this).hasClass("head")){
				$(".communitylist .head, .communitylist .subhead").not($(this)).next().hide();
				$(this).next().toggle();
			}
			
			if($(this).hasClass("subhead")){
				$(".communitylist .subhead").not($(this)).next().hide();
				$(this).next().toggle();
			}			
			return false
		})
		
		// Make sure the Accordion regains focus (FF3 issue still exists)
		$('.submenu a').click(function () { 
			$("#header").focus();
    	});
		
		// Set up tabs
		$("#reacdifference > ul").tabs({fxAutoheight: true}).tabs('rotate', 15000);
		$("#reacvoh > ul").tabs({fxAutoheight: true}).tabs('rotate', 15000);
	}
	// END IF CSS
});