$(document).ready(function(){
	
//Navigation
	$('#menu a').click( function () {
	$('#menu a').removeClass("active");
	$(this).addClass("active");
	}); 

	$('#logo').click( function () {
	$('#menu a').removeClass("active");
	}); 
	
	
	
//Portfolio Image Hover
$(".recent-work li, .portfolio li").hover(function () {						 
	$(this).find("img").stop(true, true).animate({ opacity: 0.5 }, 500);
	$(this).find(".view-image, .view-video").fadeIn(500);
}, function() {
	$(this).find("img").stop(true, true).animate({ opacity: 1.0 }, 300);
	$(this).find(".view-image, .view-video").fadeOut(300);
});


//Initializate fancybox
$("a[data-id^='fancybox']").fancybox({
				'overlayShow'	: true,
				'overlayColor'		: '#000',
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'				
}); 

$("a[data-id^='fancybox-portfolio']").fancybox({
				'overlayShow'	: true,
				'overlayColor'		: '#000',
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'height' : 800,
				'width'	: 850		
}); 


//Scrol
$('#menu a, #logo, .scrol').click(function() {
	var elementClicked = $(this).attr("href");
	var destination = $(elementClicked).offset().top;
	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-0}, 1000 );		   
	return false;
});	



var options = { 
	target: '#progress', 
	success:  showResponse
	}
	$("#contact-form").validate({
		submitHandler: function(form) {
			$(form).ajaxSubmit(options); 
		}
	});


	function showResponse() {
		$('#progress').fadeIn(500).delay(3000).fadeOut(500);
	}


	
});


$(window).load(function() {
        //Image Hover Efect
		$(".loading").fadeOut(1000); 	
});
