
 
 $(document).ready(function(){
 		
 		$(".title_div").find("img").css("opacity","0");
 		$(".title_div").find("img:first").animate({opacity: 1}, 1000);
 		
 		$(".helper1").each(function(){
 			var size = $(this).find("img").size();
 			var i = 1;
 			setInterval(function () {
				$(".helper1").find("img").animate({opacity: 0}, 1000);
				$(".helper1").find("img:eq("+i+")").animate({opacity: 1}, 700);
				i++;
				if (i == size) {
					i = 0;
				}
			}, 3500);
 		});
 		
 		$(".helper2").each(function(){
 			var size = $(this).find("img").size();
 			var i = 1;
 			setInterval(function () {
				$(".helper2").find("img").animate({opacity: 0}, 900);
				$(".helper2").find("img:eq("+i+")").animate({opacity: 1}, 900);
				i++;
				if (i == size) {
					i = 0;
				}
			}, 4000);
 		});
 		
 		$(".helper3").each(function(){
 			var size = $(this).find("img").size();
 			var i = 1;
 			setInterval(function () {
				$(".helper3").find("img").animate({opacity: 0}, 600);
				$(".helper3").find("img:eq("+i+")").animate({opacity: 1}, 600);
				i++;
				if (i == size) {
					i = 0;
				}
			}, 3100);
 		});
 		
 		$(".helper4").each(function(){
 			var size = $(this).find("img").size();
 			var i = 1;
 			setInterval(function () {
				$(".helper4").find("img").animate({opacity: 0}, 800);
				$(".helper4").find("img:eq("+i+")").animate({opacity: 1}, 800);
				i++;
				if (i == size) {
					i = 0;
				}
			}, 4300);
 		});
 		
 		
 		
 		var speed = 1500;
 		
 		setTimeout(function(){ 
		
			$('#primary').masonry({
			    singleMode: true, 
			    // only apply masonry layout to visible elements
			    itemSelector: '.box:not(.invis)',
			    animate: true,
			    animationOptions: {
			        duration: speed,
			        queue: false
			    }
			});
		}, 10);
 		
 		
 		$('.predpo_helper').hover(function(){
			$(this).stop().animate({opacity: 0}, 500);
		},function(){
			$(this).stop().animate({opacity: 1}, 500);
		});
 		
 		$('#filtering-nav a').click(function(){
		    var colorClass = '.' + $(this).attr('class');
		    
		    var helper = $(this).attr('class');
		    
		    if (helper.match(/active/)) { 
		    	
		    } else {
			    $('#filtering-nav a').removeClass("active");
			    $(this).addClass("active");
			    
			    if(colorClass=='.all') {
			        // show all hidden boxes
			        $('#primary').children('.invis')
			            .toggleClass('invis').css("display","block").animate({opacity: 1},{ duration: speed });
			    } else {    
			        // hide visible boxes 
			        $('#primary').children().not(colorClass).not('.invis').toggleClass('invis').animate({ opacity: 0}, 500, function() { 
			        														$('.invis').css("display","none"); 
			        														});
												
			        // show hidden boxes
			        $('#primary').children(colorClass+'.invis')
			            .toggleClass('invis').css("display","block").animate({opacity: 1},{ duration: speed });
			    }
			    $('#primary').masonry();
			
			    return false;
		    }
		});
 		
 		
 		$(".kontakt tr:nth-child(odd)").find("td").css("backgroundColor","#e4ead3");
 		$(".fullwidth tr:nth-child(odd)").find("td").css("backgroundColor","#e4ead3");
 		$(".kontakt tr").find("td:nth-child(even)").css("fontWeight","bold");
 		$(".kontakt tr").find("td:nth-child(odd)").css("color","#939393");
 		
		$("img[title]").tooltip({ 
			delay: 0,
			position: "top left", 
			offset: [39, 1]
		});
		
		$(".doors").hover(function(){
			$(".doors").not(this).stop().animate({opacity: 0.5}, 500);
		},function(){
			$(".doors").stop().animate({opacity: 1}, 500);
		});
		
		$(".doors1").hover(function(){
			$(".doors1").not(this).stop().animate({opacity: 0.5}, 500);
		},function(){
			$(".doors1").stop().animate({opacity: 1}, 500);
		});
		
		$(".podlahy").hover(function(){
			$(".podlahy").not(this).stop().animate({opacity: 0.5}, 500);
		},function(){
			$(".podlahy").stop().animate({opacity: 1}, 500);
		});
		
		$(".box").hover(function(){
			$(".box").not(this).stop().animate({opacity: 0.5}, 500);
		},function(){
			$(".box").stop().animate({opacity: 1}, 500);
		});
		
		$(function() {
        	$("#primary a").lightBox();
   		 });
	
	 	
		
		$(".tabs a").click(function(){
			var helper = $(this).index();
			//alert(helper);
			$(".tabs a").removeClass("active");
			$(this).addClass("active");
			
			$(".tabs_slider").stop().scrollTo( $('.tab_content:eq(' + helper + ')'), 800 );
		});


 		
 		$('.button').click(function(){
		    $("body").scrollTo($(".title"), 500,  { axis: 'y' });
		 });
		
		
		$('#main_content').find("p:first").css("fontSize","16px").css("lineHeight","22px");
		

		
		$('#menu h2').hover(function(){
			if ($(this).parent().attr("class") != "active_div" ) {
				$(this).css("color","#0092c8");
			}
		},function(){
			if ($(this).parent().attr("class") != "active_div" ) {
				$(this).css("color","#17435B");
			}
		});
		
		$('.active_div').find("ul").css("display","block");
		var height = $(".active_div").height();
	    height = height + 50;
	    $('#menu').css("paddingTop",height+"px");
		
		
 		$('#menu h2').click(function(){
		    
		    
		    if ($(this).parent().attr("class") != "active_div" ) {
		    	
		    	$('#menu h2').css("color","#17435B");
			    $('#menu h2').parent().removeClass("active_div");
			    $('#menu ul').css("opacity","0");
			    $('#menu ul').stop(true,true).slideUp(0);
			    
			    $(this).parent().addClass("active_div");
			    $(this).siblings("ul").css("display","block");
			    var height = $(this).siblings("ul").height();
			    height = height + 110;
			    $('#menu').css("paddingTop",height+"px");
			    $(this).siblings("ul").css("display","none");
			    $(this).siblings("ul").css("opacity","1").stop(true,true).slideDown(1000);
			    $(this).css("color","#ffffff");
		    }
		    
		 });

});




