$(document).ready(function() {
	$("#questions_form").submit(function() {
		if( $("#contact_name").val() == "" || $("#contact_address").val() == "" || $("#contact_postal").val() == "" || $("#contact_phone").val() == "") {
			alert("Kontrollera att alla obligatoriska fält (*) är ifyllda");
			return false;
		}
	});
	
	$("#complaints_form").submit(function() {
		if( $("#complaint_name").val() == "" || $("#complaint_address").val() == "" || $("#complaint_postal").val() == "" || $("#complaint_phone").val() == "") {
			alert("Kontrollera att alla obligatoriska fält (*) är ifyllda");
			return false;
		}
	});
	
	$("#booking_form").submit(function() {
		if( $("#visit_name").val() == "" || $("#visit_address").val() == "" || $("#visit_postal").val() == "" || $("#visit_phone").val() == "") {
			alert("Kontrollera att alla obligatoriska fält (*) är ifyllda");
			return false;
		}
	});
	
	$("#booking-tabs a").click(function() {
		var target = $(this).parent().attr("id");
		var previous = (target == "questions") ? "complaints" : "questions";
		
		$("#booking-tabs li.active").removeClass("active");
		$(this).parent().addClass("active");
		$("#"+previous+"-form").fadeOut(100, function() {
			if(previous == "questions") {
				$("input#contact_name").val("");
			}
			else {
				$("input#complaint_name").val("");
			}
			$("#"+target+"-form").fadeIn(100);
		});
	});
	
	if($("body").attr("id") == "home") {
		//$.fn.colorbox({href:"annons.php", width: "650px", height: "430px", iframe:true});
		$.fn.colorbox({href:"boka.php", width: "680px", height: "500px", iframe:true});
	}
});
