
function setupMediaPreview() {
        
	if(jQuery().prettyPhoto) {
		
		$(".video_player a, .images_wrapper a").addClass('gallery').prettyPhoto({
			social_tools: false,
			slideshow: 2500,
			overlay_gallery: false,
			deeplinking: true,
			theme:'dark_rounded',
			skin: "http://content2.longtailvideo.com/skins/glow/glow.zip"
		});
		
		
	} 
	
}


$(document).ready(function() {
	
	initCarousel();
        setupMediaPreview();
	
	
        $(".featured_items > li").equalizeCols();
	
	
	$('a[rel*=external]').click( function() {
		window.open(this.href);
		return false;
	});
        
        
	$('.featured_items > li, .categories > li').hover(
		function() {$(this).addClass('hover');},
		function() {$(this).removeClass('hover');}
	);
	
	$('.featured_items > li, .categories > li').live('click', function() {
		  window.location = $(this).find("a").attr("href");
		  return false;
	});
        
        
        // was moved in the php
        //$('.featured_items li:last').addClass('last');
        
        
	function megaHoverOver(){
		$(this).find("ul").stop().fadeTo(100, 1).show();
	}

	function megaHoverOut(){
		$(this).find("ul").stop().fadeTo('fast', 0, function() {
			$(this).hide();
		});
	}

	var config = {
			sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
			interval: 30, // number = milliseconds for onMouseOver polling interval
			over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
			timeout: 500, // number = milliseconds delay before onMouseOut
			out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};

	$("#nav ul").css({'opacity':'0'});
	$("#nav li").hoverIntent(config);
	
});


function initCarousel() {
	
	if(typeof(carousel) === 'undefined') return;
		
	var flashvars = {
		source: carousel.xml_source
	};
	var params = {};
	params.wmode = "transparent";
	params.bgcolor = "#f5f1eb";
	params.allowscriptaccess = "always";
	params.allownetworking = "all";
	var attributes = {};
	swfobject.embedSWF(carousel.flash_path + "flash/banner.swf", "flash_banner", "740", "248", "9.0.0", carousel.flash_path + "flash/expressInstall.swf", flashvars, params, attributes);
}

