$(document).ready(function(){$(".tab_content").hide();$("ul.tabs li:first").addClass("active").show();$(".tab_content:first").show();$("ul.tabs li").click(function(){$("ul.tabs li").removeClass("active");$(this).addClass("active");$(".tab_content").hide();var activeTab=$(this).attr("title");$(activeTab).fadeIn();return false;});$('.toggle').hide();$('.toggle-button').click(function(){var id=$(this).attr('id');$('form#'+id+' ,.toggle').toggle();});$.fn.clearForm=function(){return this.each(function(){var type=this.type,tag=this.tagName.toLowerCase();if(tag=='form')
return $(':input',this).clearForm();if(type=='text'||type=='password'||tag=='textarea')
this.value='';else if(type=='checkbox'||type=='radio')
this.checked=false;else if(tag=='select')
this.selectedIndex=-1;});};$("form#aanmelden").submit(function(){if($(this).valid()){$('div#msgbox').fadeIn().html('<p class="load round3">Aanmelden...</p>');var str=$(this).serialize();$.ajax({type:'POST',url:'../../../ajax_aanmelden.php',data:str,success:function(data){if(data=='error'){$('div#msgbox').empty().fadeIn().html('<p class="invalid round3">Beveiligingscode is onjuist.</p>');}
else{$('div#msgbox').empty().fadeIn().html(data);$("form#aanmelden").fadeOut();}}});}
return false;});$("form#appointment").submit(function(){if($(this).valid()){$('div.msgbox').fadeIn().html('<p class="load round3">Afspraak versturen...</p>');var str=$(this).serialize();$.ajax({type:'POST',url:'../../../ajax_afspraak.php',data:str,success:function(data){if(data=='error'){$('div.msgbox').empty().fadeIn().html('<p class="invalid round3">Beveiligingscode is onjuist.</p>');}
else{$('div.msgbox').empty().fadeIn().html(data);$("form#appointment").fadeOut();}}});}
return false;});$("form#contact").submit(function(){if($(this).valid()){$('div#msgbox').fadeIn().html('<p class="load round3">Versturen...</p>');var str=$(this).serialize();$.ajax({type:'POST',url:'../../../ajax_contact.php',data:str,success:function(data){if(data=='error'){$('div#msgbox').empty().fadeIn().html('<p class="invalid round3">Beveiligingscode is onjuist.</p>');}
else{$('div#msgbox').empty().fadeIn().html(data);$("form#contact").fadeOut();}}});}
return false;});

$("form#routeplanner").submit(function(){
	$('div#route_data').fadeIn().html('<p class="load round5 shadow-l">Route plannen...</p>');
	var str = $(this).serialize();
	//alert(str);
	$.ajax({
		type:'POST',
		url:'../../../routeplanner.php',
		data:str,
		success:function(data){
			$('div#route_data').empty().fadeIn().html(data);
			//$('div#route_data').empty().fadeIn().html('test');
			//alert(data);
		}
	});
	return false;
});

});
