$(document).ready(function() {

	//fader
	$(function() {
		$("#header a").css("opacity","0");
		$("#header a").hover(function () {
			$(this).stop().animate({
				opacity: 1
			}, 50);
		},
		// on mouse out
		function () {
			$(this).stop().animate({
				opacity: 0
			}, 1200);
		});
		$("#header span").css("opacity","1");
		$("#header span").hover(function () {
			$(this).stop().animate({
				opacity: 1
			}, 50);
		},
		// on mouse out
		function () {
			$(this).stop().animate({
				opacity: 0.6
			}, 1200);
		});
		
		$(".fadelink").css("opacity","0.4");
		$(".fadelink").hover(function () {
			$(this).stop().animate({
				opacity: 1
			}, 50);
		},
		// on mouse out
		function () {
			// animate opacity to nill
			$(this).stop().animate({
				opacity: 0.5
			}, 1200);
		});
		
	});
	
	//smooth scroll
	$(function() {
		$('ul#nav a').bind('click',function(event){
			var $anchor = $(this);
	
			$('html, body').stop().animate({
				scrollTop: $($anchor.attr('href')).offset().top
			}, 1500,'easeInOutExpo');
			/*
			if you don't want to use the easing effects:
			$('html, body').stop().animate({
				scrollTop: $($anchor.attr('href')).offset().top
			}, 1000);
			*/
			event.preventDefault();
		});
	});

	// fancybox
	$("li.photo a").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'titlePosition' : 'inside',
		'overlayColor' : '#000',
		'overlayOpacity' : '0.8',
		'speedOut'		:	300
	});
	
	$("li.video a").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'titleShow'		: false,
			'overlayColor' : '#000',
			'overlayOpacity' : '0.8',
			'width'			: 640,
			'height'		: 390,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			'wmode'		: 'transparent',
			'allowfullscreen'	: 'true'
			}
		});
		return false;
	});
	
	// toggle work
	$('li.videoWork a').click(function() { 
		$('li.videoWork a').toggleClass('selected');
		$('li.video').toggleClass('hideWork');
	});
	$('li.photoWork a').click(function() { 
		$('li.photoWork a').toggleClass('selected');
		$('li.photo').toggleClass('hideWork');
	});
	$('li.weddingWork a').click(function() { 
		$('li.weddingWork a').toggleClass('selected');
		$('li.wedding').toggleClass('hideWork');
	});
	$('li.webWork a').click(function() { 
		$('li.webWork a').toggleClass('selected');
		$('li.web').toggleClass('hideWork');
	});
	$('li.otherWork a').click(function() { 
		$('li.otherWork a').toggleClass('selected');
		$('li.other').toggleClass('hideWork');
	});
		
});
