jQuery.validator.addMethod('phoneNL', function(phone_number, element) {
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(\(?(0|\+31)[1-9]{1}\d{1,4}?\)?\s?\d{3,4}\s?\d{3,4})$/);
}, 'Voer een correct telefoonnummer in.');


jQuery.validator.addMethod("dateNL", function(value, element) {
		return this.optional(element) || /^\d\d?[\.\/-]\d\d?[\.\/-]\d\d\d?\d?$/.test(value);
	}, "Vul hier een geldige datum in."
);
jQuery.validator.messages.required = '<img src="' + source + 'images/form/error.gif" alt="Error..." />';
jQuery(function() {
	// show a simple loading indicator
	jQuery().ajaxStart(function() {
		$(".submit").html('<img src="' + source + 'images/form/loader.gif" alt="loading..." /> Uw formulier wordt verwerkt. Een ogenblik geduld...');
	}).ajaxStop(function() {
		//loader.hide();
	}).ajaxError(function(a, b, e) {
		throw e;
	});
	
	var v = jQuery("#form").validate({
		submitHandler: function(form) {
			jQuery(form).ajaxSubmit({
				target: "#form_container"
			});
		}
	});
	
	jQuery("#reset").click(function() {
		v.resetForm();
	});
});

$(document).ready(function(){	
	// homepage slider
	$('#slide_ul').innerfade({ speed: 2000, timeout: 4000, type: 'sequence', containerheight: '248px' }); 

	/* toggle navigation slide buttons */
	$("a img").hover(function(){
		var src = $(this).attr('src');
		$(this).attr("src", src.replace(".gif", "_hover.gif"));
	}, function(){
		var src = $(this).attr('src');
		$(this).attr("src", src.replace("_hover.gif", ".gif"));
	});
	
	$("#get_to_us_check").validate();

});
