$(document).ready(function() {
	
	$('html').addClass('js-on');  
	
	$("input").focus(function () {
	if ($(this).val() == $(this).attr("title")){
		$(this).val("");
	}
	});
	$("input").blur(function () {
		if ($(this).val() == ""){
			$(this).val($(this).attr("title"));
		}
	});

	$("a#open-login").fancybox();
	
	/* split menu */
	var lis = $("#pre-split li");
	for(var i = 0; i < lis.length; i+=4) {
		lis.slice(i, i+4)
		.wrapAll("<ul class='split-level'></ul>");
	}
	$(".split-level").appendTo(".main");
	$("#pre-split").remove();
	
	
	/* vertical spacing of home and contact button */
	var hVal = $(".main").height()/2-$("#vertical-left").height()/2;
	$("#vertical-left").css("padding-top", hVal).css("padding-bottom", hVal);
	$("#vertical-right").css("padding-top", hVal).css("padding-bottom", hVal);
	
	/* header height based on menu level 1 height */
	//var mainMenuOffset = $(".main").offset();
	//var menuHeight = $(".main").outerHeight();
	//$(".header .container").height(menuHeight + mainMenuOffset.top);
	

	$("#open-assesment-panel").click(function(){
		$("#login-panel-assesment-center").slideToggle(300);
		$(this).toggleClass("open");
	});
	
	/* fotoboek */
	$(".fancybox-view-01 ul a").fancybox();
	
	$(".fancybox-view-02 ul a").fancybox({
			titlePosition: 'over'
	});
	
	if($("table.maintenanceButtons").length > 0) {
		$("span.delete").css('display','block');
		$("span.edit").css('display','block');
		$("a.add-item").css('display','block');
	}

	$(".zie-ook li a").each(function() {
		$(this).html("<span>" + $(this).text() + "</span>");
	});
	
	$(".item-img img").each(function() {
		$(this).insertBefore($(this).parent().parent());
	});
	$(".item-img").remove()
	
	$(".nieuws-item img").each(function() {
		$(this).insertBefore($(this).parent());
	});
	
	/* scrollende items */
	$('.homepage-scroller').cycle({ 
		fx: 		'scrollLeft',
		slideExpr: 	'.scroll-item',
        speed:  	500,
		next: 		'.homepage-scroller .text-button',
		pause: 		1,
		timeout:   	8000
	});	
	
	/* smoelenboek */
	$(".smoelenboek a").fancybox();
	
	
	
	
	
	/* nieuws slide */
	$(".news .item h3").click(function () { 
		$(this).next('a').slideToggle("slow").next('div').slideToggle("slow");
	});
   
	$(".uitklappen").click(function () { 
		$(".item div").slideDown("slow");
		$(".item a").slideUp("slow");
	});
   
	$(".inklappen").click(function () { 
		$(".item div").slideUp("slow");
		$(".item a").slideDown("slow");
	});
	
	/* nieuws slide */
	$(".faq .item h3").click(function () { 
		$(this).next('div').slideToggle("slow");
	});

});
