function checkLoginForm() {
  var error = false;
  var errorMessage = new String();
  var thisForm = window.document.getElementById("cmsLoginForm")
  //thisForm.submitButton.disabled = true;
  
  if(thisForm.uid.value == "") {
    error = true;
    errorMessage += "\n* Nezadali ste prihlasovacie meno.";
  }
  
  if(thisForm.userPassword.value == "") {
    error = true;
    errorMessage += "\n* Nezadali ste prihlasovacie heslo.";
  }
  
  if(error == true) {
    alert("Pri vypĺňaní formulára pre prihlásenie došlo k chybe: " + errorMessage);
    //thisForm.submitButton.disabled = false;
    return false;
  } else {
    	(new AJAX()).RPC(BASE + "/cms/loginHandlerRPC.php", "checkLoginCredencials", [thisForm.uid.value, thisForm.userPassword.value], function(jsonObject) {
    	var error = false;
  		var errorMessage = new String();
  		var thisForm = window.document.getElementById("cmsLoginForm")
  		
  		//alert(jsonObject.result);
  		if(jsonObject.result == "n") {
  			alert("Prihlasovacie meno alebo heslo nie je správne.");
  			//thisForm.submitButton.disabled = false;
  		} else {
  			//thisForm.submitButton.disabled = false;
  			openMailboxWindow();
  			thisForm.submit();
  		}
    });
    return false;
  }
}