function kontrola_odkazy() {
	if ( document.getElementById('bmeno').value=='' ) {
		alert("Musíš vyplniť meno!");
		document.getElementById('bmeno').focus();
		return false;
	}

	if ( document.getElementById('bodkaz').value=='' ) {
		alert("Musíš vyplniť odkaz!");
		document.getElementById('bodkaz').focus();
		return false;
	}

	if ( document.getElementById('banti2').value=='' ) {
		alert("Musíš zadať číslo");
		document.getElementById('banti2').focus();
		return false;
	}
}

function kontrola_akcie() {
	if ( document.getElementById('nick').value=='' ) {
		alert("Musíš vyplniť meno!");
		document.getElementById('nick').focus();
		return false;
	}

	if ( document.getElementById('komentar').value=='' ) {
		alert("Musíš vyplniť komentár!");
		document.getElementById('komentar').focus();
		return false;
	}

	if ( document.getElementById('buuk').value=='' ) {
		alert("Musíš zadať číslo");
		document.getElementById('buuk').focus();
		return false;
	}
}

		$(function() {
			$('#submitbutton').click(function(e) {
				
				var formData = $('form').serialize();
				
				$.ajax({
					type: "POST",
					url: "/include/send-comment.php",
					data: formData,
					success: function(d) {

					$('#message').html(d)
						.hide()
						.fadeIn(1500, function() {
					});
					
					$('#formular').html(e)
						.hide()
						.fadeIn(1500, function() {
					});
										
					}
				});
				e.preventDefault();
			});
		});

function databaza() { window.open('/include/databaza.php','','scrollbars=yes,width=460,height=540,resizable=1') }

function siteswap(s) { window.open('/scripts/siteswap.php?' + s,'','scrollbars=no,width=320,height=420,resizable=1') }

function testchk(){ document.getElementById("cudlik").disabled = !(document.getElementById("chk").checked) }

function vloz(myField, myValue) {
  //IE support
	if (document.selection) {
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	}
  //MOZILLA/NETSCAPE support
	else if (myField.selectionStart || myField.selectionStart == '0') {
		var startPos = myField.selectionStart;
			var endPos = myField.selectionEnd;
		    myField.value = myField.value.substring(0, startPos)
				+ myValue 
				+ myField.value.substring(endPos, myField.value.length);
	} else {
		myField.value += myValue;
	}
}