// JavaScript Document
$(document).ready(function() {



	$("#onderhoud__frm").click(function(){
		showMatchingProjects();
  });

	$("#renovatie__frm").click(function(){ 
		showMatchingProjects();
  });

	$("#restauratie__frm").click(function(){ 
		showMatchingProjects();
  });

//	showMatchingProjects();

initHover();
fixForthProjectOnRow();

});

function initHover(){
			$('div.hover_block').find('img:last').css({opacity:0, display:"none"});

			$('div.hover_block').hover(function(){
				$(this).find('img:last').css({opacity:1, display:"none"}).fadeIn(400);
			}, function(){

				
				$(this).find('img:last').fadeOut(350);
			});

}

function showMatchingProjects(){
//	alert('ShowMatchingProjects');

		$("#projectFilter input").each(function(i){
			mymatch = $(this).attr('value');
			if($(this).attr('checked')){
				$("#projectoverview div[@class*="+mymatch+"]").show().attr('lang', 'nl');
			}
		});
		
		fixForthProjectOnRow();
		$("#projectoverview div").attr('lang', '');
		
}


function fixForthProjectOnRow(){
	var ii = 0
																														
	$("#projectoverview div.projectcontainer").each(function(i){	
		ii++;

		if(ii == 4){//if forth div apply fix
			ii = 0;			
			$(this).css("padding-right","0px");
		};																				 
	});
}
