$(document).ready(function() {
	// VALIDATOR
	$.validator.messages.required = "";
	$.validator.messages.email = "";
	
	$('#contactform').submit(function() {
		$("#contactform").validate();
		return $("#contactform").valid();
	});
				
	closeAntwoorden();
	
	$(".toongegevens").click(function(){
		removeClassesVraag();
		closeAntwoorden();
		var this_id = this.id.replace("toon","");
		
		if ($(this).hasClass("uitgeklapt")) {
			$("#informatie"+this_id).hide();
			$(this).removeClass("uitgeklapt");
			$(this).removeClass("active");			
		}
		else {
			$("#informatie"+this_id).show();
			$(this).addClass("uitgeklapt");		
			$(this).addClass("active");	
		} 
		return false;
	});
	
	$("#brochureLink").click(function() {
		$(".pdf_being_created").show();
		//stupid workaround to make the animated gif work on internet explorer
		$(".pdf_being_created").html($(".pdf_being_created").html());
	});
});

function removeClassesVraag(){
	$(".toongegevens").each(function(index) {
		$(this).removeClass("uitgeklapt");
		$(this).removeClass("active");
	});
}

function closeAntwoorden(){
	$(".moreinformation").each(function(index) {
		$(this).hide();
	});
}
