// Load Tabs
$j(function () { /* -  Most Read box tabs - */
				var tabContainers = $j('div.tabs > div');
				tabContainers.hide().filter(':first').show();				
				$j('div.tabs ul.tabNavigation a').mouseover(function () {
					tabContainers.hide();
					tabContainers.filter('#' + this.rel).show();
					//alert(this.rel);
					$j('div.tabs ul.tabNavigation a').removeClass('selected');
					$j(this).addClass('selected');
					return false;
				}).filter(':first').mouseover();				
				/* - Weather/Traffic/Lottery tabs - */
				var tabContainers2 = $j('div.tabs2 > div');
				tabContainers2.hide().filter(':first').show();				
				$j('div.tabs2 ul.tabNavigation a').mouseover(function () {
					tabContainers2.hide();
					tabContainers2.filter('#' + this.rel).show();
					$j('div.tabs2 ul.tabNavigation a').removeClass('selected');
					$j(this).addClass('selected');
					return false;
				}).filter(':first').mouseover();				
				/* - Leaderbox tabs - */
				var tabContainers3 = $j('div.tabs3 > div');
				tabContainers3.hide().filter(':first').show();				
				$j('div.tabs3 ul.tabNavigation a').mouseover(function () {
					tabContainers3.hide();
					tabContainers3.filter('#' + this.rel).show();
					$j('div.tabs3 ul.tabNavigation a').removeClass('selected');
					$j(this).addClass('selected');
					return false;
				}).filter(':first').mouseover();				
			});
// Toolbox
$j(function(){
	$j('#drop_down>li>ul').hide();
	setupToolboxEvents();										 
});

function setupToolboxEvents() {
	this.toolBoxTimeoutID = 0;	
	// setup events on the toolbox:
	$j('#drop_down>li').hover(function() {
		if ($j('#drop_down ul:animated').length > 0) return;		
		// clear the timeout:
		clearTimeout(this.toolBoxTimeoutID);		
		// get the li that the user is hovered over:
		var hoveredLI = $j(this);		
		// method for sliding the element down:
		var slideDownFn = function() {
			hoveredLI.find('ul').slideDown(200);
		};		
		// collapse currently expanded siblings:
        var expandedSiblings = hoveredLI.siblings().find('ul:visible');
		if (expandedSiblings.length > 0)
		{
			expandedSiblings.slideUp(200, slideDownFn);
		}
		else
		{
			slideDownFn();
		}		
	}, function() {
		var hoveredLI = $j(this);
		this.toolBoxTimeoutID = setTimeout(function() {
			$j(hoveredLI).find('ul').slideUp(200);
		}, 500);
	});	
};
/* Accordion Load */
$j(document).ready(function(){
    $j("#accordion").accordion({ 
	header: 'h3',
	event: 'mouseover',
	active: 3,
	autoHeight: false	
	});
  });
/* - carousel - */
jQuery(document).ready(function() {
    jQuery('#showcasecarousel').jcarousel({
        scroll: 3
    });
    jQuery('#carousel').jcarousel({
        scroll: 4
    });
    jQuery('#ent_carousel').jcarousel({
        scroll: 2
    });
	jQuery('#score_carousel').jcarousel({
    scroll: 1
    });
});
//Showcase
// Initially set opacity on thumbs and add
			// additional styling for hover effect on thumbs
			var onMouseOutOpacity = 0.67;
			$j('#thumbs-adv ul.thumbs li').css('opacity', onMouseOutOpacity)
				.hover(
					function () {
						$j(this).not('.selected').fadeTo('fast', 1.0);
					}, 
					function () {
						$j(this).not('.selected').fadeTo('fast', onMouseOutOpacity);
					}
				);
			$j(document).ready(function() {
				// Initialize Advanced Galleriffic Gallery
				var galleryAdv = $j('#gallery-adv').galleriffic('#thumbs-adv', {
					delay:                  10000,
					numThumbs:              24,
					preloadAhead:           0,
					enableTopPager:         false,
					enableBottomPager:      false,
					imageContainerSel:      '#slideshow-adv',
					controlsContainerSel:   '#controls-adv',
					captionContainerSel:    '#caption-adv',
					loadingContainerSel:    '#loading-adv',
					renderSSControls:       false,
					renderNavControls:      false,
					playLinkText:           'Play Slideshow',
					pauseLinkText:          'Pause Slideshow',
					prevLinkText:           '&lsaquo; Previous Photo',
					nextLinkText:           'Next Photo &rsaquo;',
					nextPageLinkText:       'Next &rsaquo;',
					prevPageLinkText:       '&lsaquo; Prev',
					enableHistory:          true,
					autoStart:              false,
					onChange:               function(prevIndex, nextIndex) {
						$j('#thumbs-adv ul.thumbs').children()
							.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
							.eq(nextIndex).fadeTo('fast', 1.0);
					},
					onTransitionOut:        function(callback) {
						$j('#slideshow-adv, #caption-adv').fadeOut('fast', callback);
					},
					onTransitionIn:         function() {
						$j('#slideshow-adv, #caption-adv').fadeIn('fast');
					},
					onPageTransitionOut:    function(callback) {
						$j('#thumbs-adv ul.thumbs').fadeOut('fast', callback);
					},
					onPageTransitionIn:     function() {
						$j('#thumbs-adv ul.thumbs').fadeIn('fast');
					}
				});				
				// Initialize Minimal Galleriffic Gallery
				var galleryMin = $j('#gallery-min').galleriffic('#thumbs-min', {
					imageContainerSel:      '#slideshow-min',
					controlsContainerSel:   '#controls-min'
				});
			});