$(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
		$('.sf-menu').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 
        });  
	// }
	
	$("#highlightpanenav a").click(function () {
		var pane = $(this).attr('href');
		$("#highlightpanenav a, #highlightpanenav li, .highlightpane").removeClass('active');
		$(this).parent('li').addClass('active')
		$(pane).addClass('active');
		return false;
  });
	
	$('.newsblocks-tips a').cluetip({
    splitTitle: '::',
		tracking: true,
		positionBy: 'mouse',
		topOffset: -20
	});
	// END IF CSS

  if(document.location.href.match('/chv/')){
    var ipane = $("#hpchv");
    //$("#highlightpanenav a, #highlightpanenav li, .highlightpane").removeClass('active');
    document.getElementById('hpchvli').className='active';
    $(ipane).addClass('active'); // displays panel
    $("body").addClass('bodychv');
  }
  else if(document.location.href.match('/communities/')){
    var ipane = $("#hpcommunities");
    //$("#highlightpanenav a, #highlightpanenav li, .highlightpane").removeClass('active');
    document.getElementById('hpcommunitiesli').className='active';
    $(ipane).addClass('active'); // displays panel
  }
  else{
    var ipane = $("#hpsearch");
    //$("#highlightpanenav a, #highlightpanenav li, .highlightpane").removeClass('active');
    document.getElementById('hpsearchli').className='active';
    $(ipane).addClass('active'); // displays panel
  }

});