$(document).ready(function() {
	
	//$("img").lazyload({ threshold : 200, effect : "fadeIn" });
	
	$('.galery .fotos a').lightBox();
	$('a[rel="lightbox"]').lightBox();
	
	DD_roundies.addRule('.waarom, .waaromphaz, .uniek', '10px', true);
	DD_roundies.addRule('.premies .sidenav', '10px', true);
	DD_roundies.addRule('.raamadvies', '6px', true);
	
	$('#portal-slider').nivoSlider({
		effect			: 'fade', 
		slices			: 1,
		animSpeed		: 200, 
		pauseTime		: 4000,
		startSlide		: 0, 
		directionNav	: false, 
		controlNav		: true, 
		keyboardNav		: false, 
		pauseOnHover	: true, 
		manualAdvance	: false, 
		beforeChange	: function(){},
		afterChange		: function(){},
		slideshowEnd	: function(){}
	});
	
	
	$('input[title], textarea[title]').each(function() {
		if($(this).val() === '') {
			$(this).val($(this).attr('title'));
		}
		
		$(this).focus(function() {
			if($(this).val() === $(this).attr('title')) {
				$(this).val('').addClass('focused'); 
			}
		});
		
		$(this).blur(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused'); 
			}
		});
	});
	
	$('#frm_contact').submit(function(e) {
		var i = 0;
		$('#frm_contact .txt, #frm_contact textarea').each(function(){
			if($(this).val() === $(this).attr('title') || $(this).val() === ''){
				$(this).removeClass('valid').addClass('error');
				i++;
			} else {
				$(this).removeClass('error').addClass('valid');
			}
		});
		
		if(i <= 0) {
			
		} else {
			e.preventDefault();
		}
		
	});
	
	$('.bookmark').each(function(){
		$(this).click(function(e){
			e.preventDefault();
			$.scrollTo($(this).attr('href'), 800);
		});
	});
	
});

