// Go to next image
function NextImage(active) {

	$('.portfolio_large_container').removeClass('block');
	$('.portfolio_large_container').addClass('invisible');
	$('#' + active).removeClass('invisible');
	$('#' + active).addClass('block');

}

// Show and hide Services
function ToggleService(current) {

	var display = $('#' + current).css('display');
	
	if (display == 'block') {
	
		$('#service_container').slideUp();
		$('#image_' + current).attr('src', 'img/arrow-down.png');
	
	} else {
	
		$('.service_container').slideUp();
		$('#' + current).slideDown();
		$('.service_header img').attr('src', 'img/arrow-right.png');
		$('#image_' + current).attr('src', 'img/arrow-down.png');
	
	}

}

// Een veld valideren
function ValidateField(element) {

	var value = $(element).val();
	
	if(value == '') {
	
		$(element).css('border','solid #ee7799 1px');
		return false;
	
	} else {
	
		$(element).css('border','solid #cccccc 1px');
		return true;
		
	}

}

// Hele formulier checken op lege velden
function CheckErrors() {

	error = 0;

	$("#contact_error").slideUp();
	$("#contact_error").removeClass('note')

	$('input[type=text]').add('textarea').each(function(index) {
		
		if($(this).val() == '') {
		
			if($(this).hasClass('dont_validate')) {
			
			} else {
			
				ValidateField(this);
			
				$("#contact_error").html('Een aantal velden zijn nog niet ingevuld.');
				$("#contact_error").addClass('note');
				$("#contact_error").slideDown();
				
				error++;
			
			}
		
		} else {
		
			if (!ValidateField(this)) {
			
				error++;
			
			}
			
		}
		
	});
	
	if (error > 0) {
	
		return false;
	
	} else {
	
		return true;
	
	}

}
