/*

Main Javascript for jQuery Realistic Hover Effect
Created by Adrian Pelletier
http://www.adrianpelletier.com

*/

/* =Realistic Navigation
============================================================================== */

	// Begin jQuery
	
	$(document).ready(function() {

	/* =Reflection Nav
	-------------------------------------------------------------------------- */	
		
		// Append span to each LI to add reflection
		
		$("#nav-reflection li").append("<span></span>");	
		
		// Animate buttons, move reflection and fade
		
		$("#nav-reflection a").hover(function() {
		    $(this).stop().animate({ marginTop: "-10px" }, 200);
		    $(this).parent().find("span").stop().animate({ marginTop: "18px", opacity: 0.25 }, 200);
		},function(){
		    $(this).stop().animate({ marginTop: "0px" }, 300);
		    $(this).parent().find("span").stop().animate({ marginTop: "1px", opacity: 1 }, 300);
		});
				
	/* =Shadow Nav
	-------------------------------------------------------------------------- */
	
		// Append shadow image to each LI
		
		$("#nav-shadow li").append('<img class="shadow" src="/_img/social/icon-shadow.png" width="42" height="15" alt="" />');
	
		// Animate buttons, shrink and fade shadow
		
		$("#nav-shadow li").hover(function() {
			var e = this;
		    $(e).find("a").stop().animate({ marginTop: "-10px" }, 150, function() {
		    	$(e).find("a").animate({ marginTop: "4px" }, 250, function() {
		    	$(e).find("a").animate({ marginTop: "0" }, 250);
		    	});
		    });
		    $(e).find("img.shadow").stop().animate({ width: "54px", height: "15px", marginLeft: "-5px", marginBottom: "0", opacity: 0.25 }, 150, function() {
			    $(e).find("img.shadow").animate({ width: "34px", height: "15px", marginLeft: "5px", marginBottom: "-1px", opacity: 1 }, 250, function() {
			    $(e).find("img.shadow").animate({ width: "100%", height: "15px", marginLeft: "0", marginBottom: "0", opacity: 1 }, 250);
			    });
			});
		},function(){
			var e = this;
		    $(e).find("a").animate({ marginTop: "0" }, 250);
		});
	

	// End jQuery

	});


/* Begin custom jQuery
-----------------------*/
$(document).ready(function() {
	$.fn.pause = function(duration) {
		$(this).animate({ dummy: 1 }, duration);
		return this;
	};
	$('.hme a, h1 a').click(function(){
		$('#portfolio, #services, #contact').fadeOut(100);
		$('#home').pause(100).fadeIn(100);
	});
	$('.ptf a, a.portfolio, .view_rel a').click(function(){
		$('#home, #services, #contact').fadeOut(100);
		$('#portfolio').pause(100).fadeIn(100, function(){
		    $('#carousel').jCarouselLite({
		        circular: false,
		        start: 0,
		        visible: 3,
		        scroll: 1,
		        btnNext: '.next',
		        btnPrev: '.prev'
		    });
		});
	});
	$('.srv a, a.services').click(function(){
		$('#home, #portfolio, #contact').fadeOut(100);
		$('#services').pause(100).fadeIn(100, function(){
		    $('#services .copy').jCarouselLite({
		    	vertical: true,
		        circular: false,
		        start: 0,
		        scroll: 1,
		        visible: 1,
				btnGo:
					['.select .l01', '.select .l02',
					'.select .l03', '.select .l04']
		    });
		});
	});
	// Set active styles on navigation list
	$('.services, .l01').click(function(){
		$('.l01').removeClass('inactv').addClass('actv');
		$('.l02, .l03, .l04').removeClass('actv');
		$('.l02, .l03, .l04').addClass('inactv');
		Cufon.replace('.c', {
			hover: true
		});
	});
	$('.l02').click(function(){
		$('.l02').removeClass('inactv').addClass('actv');
		$('.l01, .l03, .l04').removeClass('actv');
		$('.l01, .l03, .l04').addClass('inactv');
		Cufon.replace('.c', {
			hover: true
		});
	});
	$('.l03').click(function(){
		$('.l03').removeClass('inactv').addClass('actv');
		$('.l01, .l02, .l04').removeClass('actv');
		$('.l01, .l02, .l04').addClass('inactv');
		Cufon.replace('.c', {
			hover: true
		});
	});
	$('.l04').click(function(){
		$('.l04').removeClass('inactv').addClass('actv');
		$('.l01, .l02, .l03').removeClass('actv');
		$('.l01, .l02, .l03').addClass('inactv');
		Cufon.replace('.c', {
			hover: true
		});
	});
	$('.con a').click(function(){
		$('#home, #portfolio, #services').fadeOut(100);
		$('#contact').pause(100).fadeIn(100);
	});
	// Fancybox
	$('.item a').attr('rel', 'gallery').fancybox({
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'easingIn' : 'easeOutBack',
		'easingOut' : 'easeInBack'
	});
	$('#photos a').fancybox({
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic',
		'easingIn' : 'easeOutBack',
		'easingOut' : 'easeInBack'
	});
});
/* End custom jQuery
-----------------------*/