// Custom Java Script

$(document).ready(function(){
	
// Home page project slide show
	$('#slider').nivoSlider({
		  effect: 'fold',
		  animSpeed:1000,
		  pauseTime:8000,
		  startSlide:0,
		  //slices:15,
		  directionNav:false,
		  directionNavHide:false,
		  controlNav:true,
		  controlNavThumbs:false,
		  keyboardNav:true,
		  pauseOnHover:true,
		  afterLoad: function(){
		  jQuery(".nivo-caption").animate({top:"250px"}, {easing:"swing", duration: 500})
		  },
		  beforeChange: function(){
		  $(".nivo-caption").animate({top:"-600px"}, {easing:"swing", duration: 1000})
		  },
		  afterChange: function(){
		  $(".nivo-caption").animate({top:"250px"}, {easing:"swing", duration: 1000})
		}
	  });
	  
// Logo Animation	  
	  $('#logo a')
		.css({backgroundPosition: "0 0"})
		.hover(function () {
			$(this).stop().animate({backgroundPosition:"(0 -66px)"}, {duration:500});
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500});
		});

// Online Resume Animation		
		$('a#online')
		.css({backgroundPosition: "0 -146px"})
		.hover(function () {
			$(this).stop().animate({backgroundPosition:"(0 -171px)"}, {duration:500});
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(0 -146px)"}, {duration:500});
		});
		
// Download Resume Animation
		$('a#download')
		.css({backgroundPosition: "-111px -146px"})
		.hover(function () {
			$(this).stop().animate({backgroundPosition:"(-111px -171px)"}, {duration:500});
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(-111px -146px)"}, {duration:500});
		});
		
// Show Experience Animation
		$('div.experience')
		.css({backgroundPosition: "0 -77px"})
		.hover(function () {
			$(this).stop().animate({backgroundPosition:"(-69px -77px)"}, {duration:500});
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(0 -77px)"}, {duration:500});
		});
		
// Order Button Animation		
		$('.psdtoHTML a')
		.css({backgroundPosition: "0 -77px"})
		.hover(function () {
			$(this).stop().animate({backgroundPosition:"(-69px -77px)"}, {duration:500});
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(0 -77px)"}, {duration:500});
		});
		
// PSD to HTML Button Animation		
		$('#psdtohtml a')
		.css({backgroundPosition: "0 -616px"})
		.hover(function () {
			$(this).stop().animate({backgroundPosition:"(0 -673px)"}, {duration:500});
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(0 -616px)"}, {duration:500});
		});


// Portfolio Filter Button Animation		
		$('div#portfolio-filter a')
		.css({backgroundPosition: "0 -747px"})
		.hover(function () {
			$(this).stop().animate({backgroundPosition:"(0 -784px)"}, {duration:500});
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(0 -747px)"}, {duration:500});
		});
		
		
		$('div#portfolio-filter a').click(function () {
			$(this).addClass('');
		},

		function () {
			$(this).stop().animate({backgroundPosition:"(0 -747px)"}, {duration:500});
		});



/*// Show Design Animation		
		$('div#portfolio-filter a span').css({'opacity':'0','visibility':'visible'});
		$('div#portfolio-filter a').click(function(){
			$(this).find('span').stop(true, true).animate({opacity: 1},400);
		
			}, function(){
				$(this).find('span').stop(true, true).animate({opacity: 0},400);
			});
*/

		
// Show Project Details Animation
		$('ul#portfolio li').hover(function(){
			$("div.caption", this).stop().animate({bottom:'10px'},{queue:false,duration:1000});
		}, function() {
			$("div.caption", this).stop().animate({bottom:'-100px'},{queue:false,duration:1000});
		});

// Show Design Animation		
		$('a.zoom').css({'opacity':'0','visibility':'visible'});
		$('ul#portfolio li').hover(function(){
			$(this).find('a.zoom').stop(true, true).animate({opacity: 0.5, left: 10},400);
		
			}, function(){
				$(this).find('a.zoom').stop(true, true).animate({opacity: 0, left: 10},400);
			});
			
			
			

// Show Large image
		
		$("a.zoom").fancybox({
			titleShow    	: false,
			transitionIn	: 'elastic',
			transitionOut	: 'elastic',
			easingIn      	: 'easeOutBack',
			easingOut     	: 'easeInBack',
			autoScale 		: false,
			autoDimensions 	: true
			
	  });
	  
// Portfolio Filter		
	  $('#portfolio').filterable()
	  
// Resume tab
	  $("a.tab").click(function () {
		  $(".selected").removeClass("selected");
		  $(this).addClass("selected");
		  $(".resumeContent").slideUp();
		  var content_show = $(this).attr("title");
		  $("#"+content_show).slideDown();
	  });

	$('.resumeContent h4:first-child').css({'color':'#83bb0c'});
	
});
