$(document).ready(function() {	
	
	
	
	clearity_menu();
	
	clearity_portfolio();

	$('a[rel="lightbox"]').colorbox({transition:'fade', speed:500});
 });

function clearity_menu(){
	
	$('#nav ul').css({display:"none"});
	
	$('#nav li').each(function(){
		var subNav = $(this).find('ul:first');
		
		$(this).hoverIntent(
				function(){
					$(this).addClass('hover');
					subNav.fadeIn('fast');
				},
				function(){
					$(this).removeClass('hover');
					subNav.fadeOut('fast')
				}
		);
		
		subNav.parent().addClass("parent");
	});
}

function clearity_portfolio(){
	$("#portfolio div.meta").hide();
	
	$("#portfolio div.item").hoverIntent(
		function(){
			$("div.meta", this).fadeIn();
		},
		function(){
			$("div.meta", this).fadeOut();
		});

		
}

function clearity_slider(){
	$('#slider').find('ul:first').cycle({
		fx: 'fade',
		speed:    300, 
		timeout:  10000,
		pagerAnchorBuilder: pagerAnchorBuilder, //see below
		pager: '#slider-pager',
		pause: true,
		height: 'auto',
		width: 960,
		cleartype: true,
	    cleartypeNoBg: true
	});
	
	var ctrl= $('#slider-control');
	$('#slider').hoverIntent(
			function(){
				ctrl.fadeIn('slow');
			},
			function(){
				ctrl.fadeOut('fast');
			}
	);
}
//builds a link for a slider element, will be shown in the pager element (default='#slider-pager')
function pagerAnchorBuilder(){
	return '<a href="#">&bull;</a>'
}


