// DOM AANPASSINGEN
$(function() {
	// CSS3-fixes
	$("section#content div.#huisOverzicht .item:nth-child(4n)").css({ "margin-right": 0 });
});

$(function() {
	// CSS3-fixes
	$("header div#headerblock div.fotos div.fotoOverzicht .image:nth-child(3n)").css({ "margin-right": 0 });
});

//DATEPICKER
$(function() {
	$(".datepicker").datepicker({
		dateFormat: 'dd-mm-yy',
		firstDay: 1,
		nextText: 'volgende',
		prevText: 'vorige',
		dayNames: ['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'],
		dayNamesShort: ['Zon', 'Maa', 'Din', 'Woe', 'Don', 'Vrij', 'Zat'],
		dayNamesMin: ['Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'],
		monthNames: ['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December'],
		monthNamesShort: ['Jan','Feb','Maa','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec']
	}
	);
});

//ALERTS
$(function() {
	$.alerts.overlayOpacity = 0.75;
	$.alerts.overlayColor = "#000";
});

/* GALLERY
-------------------------*/
$(function() {
		$("div.scrollable").scrollable();
	});

  $(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
  });

	$(function() {
		$(".items img").click(function() {
			var url = $(this).attr("big").replace("_small", "");
			var wrap = $("#image_wrap");   //.fadeTo("medium", 0.5)
			var img = new Image();
			img.onload = function() {
				wrap.fadeTo("fast", 1);
				wrap.find("img").attr("src", url);
			};
			img.src = url;
			
			if($(".scrollable img.active").nextAll("img").length > 0){
				$("a.nextImg").css("display", "block");
			} else {
				$("a.nextImg").css("display", "none");
			}
			
			if($(".scrollable img.active").prevAll("img").length > 0){
				$("a.prevImg").css("display", "block");
			} else {
				$("a.prevImg").css("display", "none");
			}
		}).filter(":first").click();

		$("a.nextImg").click(function() {
			$(".scrollable img.active").nextAll("img:lt(1)").click();
		});

		$("a.prevImg").click(function() {
			$(".scrollable img.active").prevAll("img:lt(1)").click();
		});

		$("form#googlemaps input#saddr").each(function(){
			$(this).attr("data-placeholder", $(this).val());
			if($(this).attr("data-placeholder")){
				$(this).css("font-style", "italic").css("color", "#999");
			}
		});

		$("form#googlemaps input#saddr").focus(function(){
			if($(this).val() === $(this).attr("data-placeholder")){
				$(this).val("").css("font-style", "normal").css("color", "#000");
			}
		});

		$("form#googlemaps input#saddr").blur(function(){
			if($(this).val() === ""){
				$(this).val($(this).attr("data-placeholder")).css("font-style", "italic").css("color", "#999");
			}
		});

	});

