$(function() {
	
	$('#content').tabs({
			fxFade: true,
			fxSpeed: 100
		});
	});
	
	function initGallery() {
		$('#fullsize').cycle({ 
			fx:     'scrollHorz', 
			speedIn:  250, 
			speedOut: 250,
			timeout: 0,
			next:   '#next', 
			prev:   '#prev',
			after:	omschrijving
		});
	}
	
	function omschrijving() { 
		$('#omschrijving').html(this.alt); 
	}
	
	$(document).ready(function() {
	initGallery();
	submitPrijs();
});
	
function submitPrijs() {
	$("#contactform").validate({
		debug: true,
		rules: {
			Naam: "required",
			Woonplaats: "required",
			Telefoon: "required",
			Email: {
				required: true,
				email: true
			}
		},
		messages: {
			Naam: "Vul a.u.b. uw naam in",
			Woonplaats: "Vul a.u.b. uw woonplaats in",
			Telefoon: "Vul a.u.b. uw telefoon in",
			Email: {
				required: "Vul a.u.b. uw e-mailadres in",
				email: "Vul a.u.b. een geldig e-mailadres in"
			}
		},
		errorPlacement: function(error, element) {
			error.insertAfter(element.nextAll("span"));
			//error.remove();
		},
		submitHandler: function(form) {
			var options = {
				url: "sendmail.php",
				type: "POST",
				success: function(data) {	
					if(data == 'goed'){
						$('#contactFormDiv').hide();
						$('#contactFormDiv').fadeIn(100, function() {
							$(this).html('<p>Uw bericht is succesvol verzonden.</p>');
						});
						$('#contactForm').clearForm();
					} else {
						alert(data);	
					}
				}
			}
			$(form).ajaxSubmit(options);
			return false;
		}
	});
}
