$(document).ready(function(){
	var height = $('#container').height() - 193;
	$("#hoofdcontent").css("min-height",height);
	$("#ziektebeeldenrechts").css("min-height",height);
	$("#menulinks").css("min-height",height);
	$(".current").prepend("<img src='img/right.png' class='hoverpijlfixed' />");
	$(".homemenuhover ul li").hover(function(){
		$(this).prepend("<img src='img/right.png' class='hoverpijlfixed' />");
	}, function(){
		$(this).find('.hoverpijlfixed').remove();
	})
	var aantalSlides = $("#slider").children().size();
	if(aantalSlides != 1){
		var timer = setInterval('slide()', 3000); 
	}
	$("#agendaup").click(function(){
		$("#agenda ul").animate({'top' : '-=75'});
	});
	$("#agendadown").click(function(){
		$("#agenda ul").animate({'top' : '+=75'});
	});
	$(".medewerker:first").show();
	$(".medewerkeropsomming img").click(function(){
		var id = $(this).attr("rel");
		var id = "." + id;
		$(".medewerker:visible").fadeOut(function(){
			$(id).fadeIn();
		});
	});
	$(function() {
		$('#contactsubmit').click(function() {
			  var naam = $("#naam").val();
			  var email = $("#email").val();
			  var telefoon = $("#telefoon").val();
			  var bericht = $("#bericht").val();
			  $.ajax({
				url: '?p=contact&submit=true',
				type: 'POST',
				data: 'naam=' + naam + '&email=' + email + '&telefoon=' + telefoon + '&bericht=' + bericht,
				
				success: function(result) {
				$('#response').append('' + result + '');
				$('#response').appendTo("#wrap");
				$('#response').hide();
				$('#contentdiv').fadeThenSlideToggle('normal', function() {
					$('#contentdiv').hide();
					$('#response').fadeIn('normal', function() {
						   this.style.removeAttribute('filter');
					});
				});
				
				}
			});
			return false;
		});
	});
});

jQuery.fn.fadeThenSlideToggle = function(speed, easing, callback){
		return this.fadeTo(speed, 0, easing).slideUp(speed, easing, callback);
	};

function slide(){   
    $('#slider:not(:animated)').animate({'top' : -193},3000,function(){      
    		$('#slider li:last').after($('#slider li:first'));
    		$('#slider').css('top',0);
    });  
}  
