$(function() {
	var arr = new Array();
	var error = true;
	var inputs = $('#registratie :input');
	
	$('input, textarea').focus(function() {
		if ($(this).hasClass('style'))
		{
			arr[$(this).name] = $(this).val();
			$(this).removeClass('style');
			$(this).val('');
		}
	});
	
	$('input, textarea').focusout(function() {
		if ($(this).val() == '' && $(this).attr('name') != 'submit')
		{
			$(this).addClass('style');
			$(this).val(arr[$(this).name]);
		}
	});
	
	// Slider
	$('#header_images').crossSlide({
	  sleep: 4,
	  fade: 1
	}, [
	  { src: '../images/header_2.png' },
	  { src: '../images/header_3.png'   },
	  { src: '../images/header_1.png'  }
	]);
		
	// Simpele validatie
	$('#registratie').submit(function() {
		error = true;

		inputs.each(function() {
			$(this).removeClass('redborder');
			console.log($(this).val().length);
			if (($(this).val() == '' || $(this).hasClass('style') || $(this).val().length > 250) && $(this).attr('name') != 'submit') {
				error = false;
				$(this).addClass('redborder');
			}
		});
		
		return error;
	});
});
