$(function()
	{
		$("#form_callme").validate({
			errorLabelContainer: "#callme_error",
			messages: {
						callme_nr: "Vul uw nummer in aub."
			},
			submitHandler: function(form) {
				// prepare Options Object
				var options = {
								beforeSubmit:	function()	{
									$("#callme").html('<span id="callme_loading" class="loading">een moment geduld...</span>');
								},
								success:    function(responseText) {
									$("#callme").html(responseText);
								}
							};
				$(form).ajaxSubmit(options);
				return false;
			}
		}),

		$("#contact_form").validate({
			rules: {
				contact_name: "required",
				contact_email: {
					required: true,
					email: true
				},
				contact_remarks: "required"
			},
			messages: {
				contact_name: "Vul aub uw naam in.",
				contact_email: "Vul aub een geldig email adres in.",
				contact_remarks: "Vul aub uw opmerking in."
			}
,
			submitHandler: function(form) {
				// prepare Options Object
				var options = {
								beforeSubmit:	function()	{
									$("#inner_contact_form_div").html('<span class="loading">een moment geduld aub...</span>');
								},
								success:    function(responseText) {
									$("#inner_contact_form_div").html(responseText);
								},
								error:    function() {
									$("#inner_contact_form_div").html('Er is iets misgegaan.<br /><br />Probeer het a.u.b. later nogmaals of neem telefonisch contact met ons op.<br /><br />Onze excuses voor het ongemak.');
								}
							};
				$(form).ajaxSubmit(options);
				return false;
			}
		}),

		$(".toggle").click(function () {
		    $(this).next("div").slideToggle("fast");
	    });

		// determine the largest height of all content_item_divs and set
		// them all to that height, also set the content_scrollable_div to that height
		var theheight = 0;
		$( ".content_item_div" ).each(function() {
			if ($(this).height() > theheight) {
				theheight = $(this).height();
			}
		  });
		$( ".content_item_div" ).each(function() {
			$(this).height(theheight);
		  });
		$("#content_scrollable_div").height(theheight);

		$('#blog_menu li:first').addClass('active');
		$('#blog_nav').localScroll({
			target:'#content_scrollable_div',
			onBefore: function (e) {
				el = e.target.id;
				$('#' + el).parent().siblings().removeClass('active');
				$('#' + el).parent().addClass('active');
				$('#' + el).blur();
			}
		});
	}
);


