﻿function CheckAndSend() {

        // Get elements
        var txtName = document.getElementById("txtName");
        var txtMail = document.getElementById("txtMail");
        var txtAbout = document.getElementById("txtAbout");
        var txtMsg = document.getElementById("txtMsg");

        var lblName = document.getElementById("lblName");
        var lblMail = document.getElementById("lblMail");
        var lblAbout = document.getElementById("lblAbout");
        var lblMsg = document.getElementById("lblMsg");


        var isValid = true;

        if (txtName.value == "") {
            lblName.style.display = "inline";
			txtName.className="errorInp";
            isValid = false;
        }
        else {
            lblName.style.display = "none";
        }
        
        if (txtMail.value == "") {
            isValid = false;
            lblMail.style.display = "inline";
			txtMail.className="errorInp";
        }
        else {
            lblMail.style.display = "none";
        }
        
        if (txtAbout.value == "") {
            isValid = false;
            lblAbout.style.display = "inline";
			txtAbout.className="errorInp";
        }
        else {
            lblAbout.style.display = "none";
        }

        if (txtMsg.value == "") {
            isValid = false;
            lblMsg.style.display = "inline";
			txtMsg.className="errorInp";
        }
        else {
            lblMsg.style.display = "none";
        }

        if (isValid) {
            document.getElementById("mainform").submit();
        }
    }


