$(document).ready(function(){

/*
	$("#nav li").hover(function(){
		$(this).children("ul").slideDown("slow");
	}, function(){
		$(this).parent().find("ul").slideUp();
	});
*/
	
	$("#nav li").hoverIntent({
			sensitivity: 3, 
			interval: 100, 
			over: showSubMenu, 
			timeout: 50, 
			out: hideSubMenu
		});

	$("#banner").show();		
	$("#banner").cycle({
		fx:'fade',
		delay:1000,
		speed:1000,     
		timeout:3000,
		// cleartype corrections for IE 
		cleartypeNoBg:true
	});
	
	$("#quotes").show();		
	$("#quotes").cycle({
		fx:'fade',
		delay:10000,
		speed:1000,     
		timeout:10000,
		random:1, 
		// cleartype corrections for IE 
		cleartypeNoBg:true
	});

	$("#downarrow").click(function(){
		$(this).next("ul").slideDown();
	});
	$("#uparrow").click(function(){
		$(this).parent("ul").slideUp();
	});
	
	$("a.popup").fancybox({
			'titleShow'		: false,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic'
	});
		
	$("a.gallery").fancybox({
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>';
			}
	});
	
	$("a.inline").fancybox({
			'titleShow'		: false,
			'padding'			: 0,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic'
	});
	
	$("a.iframe").fancybox({
			'width'				: 1100,
			'height'			: '75%',
			'padding'			: 5,
			'autoScale'     	: false,
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'type'				: 'iframe'
	});
	
	$("a.flash").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: true,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'overlayColor'	: '#000',
				'overlayOpacity': .8,
				'titleShow'		: false,
				'title'			: this.title,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
						'wmode'				: 'transparent',
						'allowfullscreen'	: 'true'
				}
			});
		return false;
	});
	
});

function showSubMenu(){$(this).children("ul").slideDown(150);}
function hideSubMenu(){$(this).parent().find("ul").slideUp(100);}

