jQuery(document).ready(function($) {
	$("#commentform").submit(function() {
		var $authorInput = $("#author");
		var $emailInput = $("#email");
		var emailExp = /.+@.+\.../;
		var $codeInput = $("#securitycode");
		var $commentInput = $("#comment");

		if ($authorInput && !$authorInput.val()) {
			alert("Bitte geben Sie Ihren Namen ein.");
			$authorInput.focus();
			
			return false;
		}

		if ($emailInput && (
			!$emailInput.val() || !emailExp.test($emailInput.val())
		)) {
			alert("Bitte geben Sie eine gültige E-Mail-Adresse ein.");
			$emailInput.focus();
			
			return false;
		}

		if ($codeInput && !$codeInput.val()) {
			alert("Bitte geben Sie den Zeichencode ein.");
			$codeInput.focus();
			
			return false;
		}
		
		if ($commentInput && !$commentInput.val()) {
			alert("Bitte geben Sie einen Kommentar ein.");
			$codeInput.focus();
			
			return false;
		}
	});
});