$(document).ready(function(){
	/* FANCYBOX */
	/* LIGHTBOX */
	$('.gallery a').fancybox();
	
	/* INVEST TOGGLE */
	$('.category.impact-investment-funds').hide();
	$('.toggle li:first-child').addClass('active');
	
	$('.toggle li:nth-child(1) a').click(function(){
		$('.category').hide();
		$('.category.responsible-investment-funds').show();
		
		$('.toggle li.active').removeClass('active');
		$('.toggle li:nth-child(1)').addClass('active');	
		
		return false;
	});
	
	$('.toggle li:nth-child(2) a').click(function(){
		$('.category').hide();
		$('.category.impact-investment-funds').show();
		
		$('.toggle li.active').removeClass('active');
		$('.toggle li:nth-child(2)').addClass('active');	

		return false;
	});
	
	/* IMAGEFADER */
	 $('#highlight ul').cycle({
		fx: 'fade',
		timeout: 5500
	});
	
	/* EVENTFORM */
	$("form.event-form").validate({
		messages: {
			name: "Dit veld is verplicht.",
			family_name: "Dit veld is verplicht.",
			address: "Dit veld is verplicht.",
			postalcode: "Dit veld is verplicht.",
			city: "Dit veld is verplicht.",
			phone: "Dit veld is verplicht.",
			conditions: "Dit veld is verplicht."
		}
	});
	
	/* INVESTMENT MANAGERS FORM */
	$("form.investment-managers").validate({
		messages: {
			name: "Dit veld is verplicht.",
			company: "Dit veld is verplicht.",
			email: "Dit veld is verplicht."
		}
	});
	
	/* CONTACTFORM */
	$("form.contact").validate({
		messages: {
			name: "Dit veld is verplicht.",
			email: "Dit veld is verplicht.",
			subject: "Dit veld is verplicht.",
			message: "Dit veld is verplicht."
		}
	});
		
	$('.event-information a.button').click(function(){

		if($(this).hasClass('active')) {
			$('.event-item').show();
			$('.event-item.signup').hide();
			
			$(this).removeClass('active').text('Aanmelden');
			
			return false;
		}
		else {
			$('.event-item').hide();
			$('.event-item.signup').show();
			
			$(this).addClass('active').text('Informatie');
			
			return false;
		}
		
	});
	
	$('.other-guests input').live('change', function(){

		var lastEnteredName = $('.other-guests div:last-child input').val();
		
		if(lastEnteredName != '') {
			$('.other-guests').append('<div class="row"><label>Naam gast</label><input type="text" name="other-guest[]" /></div>');		
		}

	});
});
