$(document).ready(function() {
	
	$(".works").hide();
	$(".clients").hide();
	$(".about").hide();
	$(".contact").hide();


		if (window.location.pathname !== "/blog") {
			
		
if(window.location.hash) {


	$('#footer').fadeOut().empty();
	$('#content').fadeOut().empty();	
	
	var link = $('#navigation a[href=' + window.location.hash + ']').attr('alt');

	$.ajax({
  	type: "POST",
		url: link,
		data: "local=true",
  		success: function(data) {
    			$('#content').hide().html(data).fadeIn();
 		}
	});
}

}
	
$(".nav_point").click(function () {

	var isHidden = $('.works').is(':hidden');	
	
	$('.nav_content').hide(400);
			
	if($(this).hasClass('active')) {					
		$(this).removeClass('active');
	}
	else 
	{
		$('a').removeClass('active');
		$(this).addClass('active');

		if (isHidden === true)
		{
			$('.' + this.id).show(400);
			$(this).addClass('active');	
		}
		else
		{
			$('.' + this.id).hide(400);
			$(this).removeClass('active');
		}
	}		
});

	$("#contact").click(function () {
		
		if ($('.contact').is(':hidden') === true) {
			$('.contact').show(400);
			$(this).addClass('active');	
		}
		
		$('#content').fadeOut().empty();		
	});	
	
	$("#clients").click(function () {	
		
		if ($('.clients').is(':hidden') === true) {
			$('.clients').show(400);
			$(this).addClass('active');	
		}
		
		$('#content').fadeOut().empty();
	});
	
	$("#about").click(function () {
		if ($('.about').is(':hidden') === true	) {
			$('.about').show(400);
			$(this).addClass('active');	
		}			
		$('#content').fadeOut().empty();
	});

	$("#works").click(function() {
		var pathname = window.location.pathname;
		if (pathname === "/blog") {
			$('#content').fadeOut().empty();
		}
	});

$('#nav_full li a').click(function() {
	
	$('#footer').fadeOut().empty();

	if($(this).hasClass('active')) {					
		$(this).removeClass('active');
	}
	else 
	{
		$('a').removeClass('active');
		$(this).addClass('active');
	}	
  
	var link = $(this).attr('alt');

	$('#content').fadeOut().empty();

	$.ajax({
  		type: "POST",
		url: link,
		data: "local=true",
  		success: function(data) {
    			$('#content').hide().html(data).fadeIn();
			$('#footer').fadeIn();
 		}

	});	
    });	
});
