$(document).ready(function(){
	
	$.fn.alignCenter = function() {
 var marginLeft = Math.max(0, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
 var marginTop = Math.max(20, parseInt($(window).height()/2 - $(this).height()/2)) + $(window).scrollTop() + 'px';
 return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop, 'top':0, 'left':0});
	};
	$(".address-link").click(function () {
	$("#popup-contact").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$(".call-link").click(function () {
	$("#popup-call").fadeIn(700);
	$('#opaco').height($(document).height());
	return false;
	});
	$(".seo-text").click(function () {
	$("#seo-popup").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$(".item1").click(function () {
	$("#info1").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$(".item2").click(function () {
	$("#info2").fadeIn(700).alignCenter();
	return false;
	});
	$(".item3").click(function () {
	$("#info3").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$(".item4").click(function () {
	$("#info4").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$("#item5").click(function () {
	$("#info5").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$(".price-apartament").click(function () {
	$("#price-apartament").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	
	
	$(".about_ip").click(function () {
	$("#about_ip").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	
	$(".open-price-table").click(function () {
	$("#price-apartament").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$(".apt11").click(function () {
	$("#apt11").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt12").click(function () {
	$("#apt12").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt13").click(function () {
	$("#apt13").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt14").click(function () {
	$("#apt14").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt15").click(function () {
	$("#apt15").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt16").click(function () {
	$("#apt16").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt17").click(function () {
	$("#apt17").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt18").click(function () {
	$("#apt18").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt31").click(function () {
	$("#apt31").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt32").click(function () {
	$("#apt32").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt33").click(function () {
	$("#apt33").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt34").click(function () {
	$("#apt34").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt35").click(function () {
	$("#apt35").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt36").click(function () {
	$("#apt36").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt37").click(function () {
	$("#apt37").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt38").click(function () {
	$("#apt38").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt39").click(function () {
	$("#apt39").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt310").click(function () {
	$("#apt310").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt311").click(function () {
	$("#apt311").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt312").click(function () {
	$("#apt312").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt41").click(function () {
	$("#apt41").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt42").click(function () {
	$("#apt42").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt43").click(function () {
	$("#apt43").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt44").click(function () {
	$("#apt44").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt45").click(function () {
	$("#apt45").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt46").click(function () {
	$("#apt46").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt47").click(function () {
	$("#apt47").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt48").click(function () {
	$("#apt48").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt49").click(function () {
	$("#apt49").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt410").click(function () {
	$("#apt410").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt411").click(function () {
	$("#apt411").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt412").click(function () {
	$("#apt412").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	
	
	
		$(".apt51").click(function () {
	$("#apt51").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt52").click(function () {
	$("#apt52").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt53").click(function () {
	$("#apt53").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt54").click(function () {
	$("#apt54").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt55").click(function () {
	$("#apt55").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt56").click(function () {
	$("#apt56").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt57").click(function () {
	$("#apt57").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt58").click(function () {
	$("#apt58").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt59").click(function () {
	$("#apt59").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt510").click(function () {
	$("#apt510").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt511").click(function () {
	$("#apt511").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	$(".apt512").click(function () {
	$("#apt512").fadeIn(700).alignCenter();
	$('#opaco2').height($(document).height());
	return false;
	});
	
	$(".close").click(function () {
		$(this).parent().fadeOut(500);
		$('#opaco').height(0);
		return false;
	}); 
	$(".popup-contact > .close").click(function () {
		$(this).parent().fadeOut(500);
		$('#opaco2').height(0);
		$('#opaco').height($(document).height());
		return false;
	}); 
	$("#popup-contact > .close").click(function () {
		$(this).parent().fadeOut(500);
		$('#opaco2').height(0);
		$('#opaco').height(0);
		return false;
	}); 
	$("#opaco").click(function () {
		$(".popup-contact").fadeOut(500);
		$(".popup-plan").fadeOut(500);
		$(".popup-call").fadeOut(500);
		$('#opaco').height(0);
		return false;
	}); 
	$("#opaco2").click(function () {
		$(".popup-contact").fadeOut(500);
		$('#opaco2').height(0);
		return false;
	}); 
    $(".gallery-nav a").click(function(){
        var largePath = $(this).attr("href");
        var largeAlt = $(this).attr("title");
        $(".largeImg").attr({ src: largePath, alt: largeAlt });
        $(".text-info").html( largeAlt );
		$(".gallery-nav li").removeClass("active");
		$(this).parent().toggleClass("active"); return false;
    });


})
