function validateForm() {
	var authorInput = document.forms['commentForm']['author'];
		authorInput.style.border = '';
	var emailInput = document.forms['commentForm']['email'];
		emailInput.style.border = '';
	var contentInput = document.forms['commentForm']['commentContent'];
		contentInput.style.border = '';
	var spamInput = document.forms['commentForm']['spam'];
		spamInput.style.border = '';
	var akm = document.forms['commentForm']['akm'].value;

	var super_tajny_szyfr = (spamInput.value*3)+2; // lol
	var errorBox = document.getElementById('errorBox');
		errorBox.innerHTML = '';
	var errorId = 0;
	var errorMsg = [];
		errorMsg[0] = 'Nieznany błąd!';
		errorMsg[1] = 'Błędna suma kontrolna!';
		errorMsg[2] = 'Musisz się przedstawić!';
		errorMsg[3] = 'Musisz podać swój e-mail!';
		errorMsg[4] = 'Musisz wpisać treść komentarza!';
	
	if(super_tajny_szyfr != akm) {
		spamInput.style.border = '1px solid red';
		spamInput.focus();
		errorId = 1;
	}
	else if(authorInput.value == '') {
		authorInput.style.border = '1px solid red';
		authorInput.focus();
		errorId = 2;
	}
	else if(emailInput.value == '') {
		emailInput.style.border = '1px solid red';
		emailInput.focus();
		errorId = 3;
	}
	else if(contentInput.value == '') {
		contentInput.style.border = '1px solid red';
		contentInput.focus();
		errorId = 4;
	}
	else {
		errorId = 0;
	}

	if(errorId) {
		errorBox.innerHTML = errorMsg[errorId];
		return false;
	}
	else {
		errorBox.innerHTML = '<span>Dodaj komentarz:</span>';
		return true;
	}
};
