/**
 * FormValidation
 */
var FormValidation = (function (document) {
    "use strict";
    /*jslint browser:true*/

    var module = {
        testmail : /^[a-zA-Z0-9][a-zA-Z0-9\._\-]+@([a-zA-Z0-9\._\-]+\.)[a-zA-Z-0-9]{2}/,
        _addError : function($el) {
            return $el.parentNode.classList.add('has-error');
        },
        removeError : function($el) {
            return $el.parentNode.classList.remove('has-error');
        },
        checkMail : function($input) {
            if (!module.testmail.test($input.value)) {
                module._addError($input);
                return false;
            }
            return true;
        },
        checkEmpty : function($input) {
            if ($input.value === '') {
                module._addError($input);
                return false;
            }
            return true;
        }
    };

    return {
        checkValidity : module.checkValidity,
        checkMail : module.checkMail,
        checkEmpty : module.checkEmpty,
        removeError: module.removeError
    };

}(document));


/**
 * @file contact-form-vanillajs.js
 */
(function (document) {
    "use strict";
    /*jslint browser:true, plusplus:true*/

    var $contactForm = document.querySelector("#contact-form"),
        $name        = document.querySelector("#name"),
        $mail        = document.querySelector("#email"),
        $assunto     = document.querySelector("#assunto"),
        $mensagem    = document.querySelector("#mensagem"),
        $required    = document.querySelectorAll(".required"),

        $requiredArray = Array.prototype.slice.call($required);



    if ($contactForm) {
        $contactForm.addEventListener("submit", function(e) {

            $requiredArray.forEach(function($element) {
                FormValidation.removeError($element);
            });


            if (!FormValidation.checkEmpty($name)) {
                e.preventDefault();
            }

            if (!FormValidation.checkMail($mail)) {
                e.preventDefault();
            }

            if (!FormValidation.checkEmpty($assunto)) {
                e.preventDefault();
            }

            if (!FormValidation.checkEmpty($mensagem)) {
                e.preventDefault();
            }

        });
    }
}(document));
@@ -1,12 +1,458 @@
+/*%0A--------------------------------%0ASimple PHP Contact Form%0A--------------------------------%0A+ https://github.com/pinceladasdaweb/Simple-PHP-Contact-Form%0A+ A Simple Contact Form developed in PHP with VanillaJS Form validation.%0A+ version 1.0%0A+ Copyright 2013 Pedro Rogerio%0A+ VanillaJS version developed by William Bruno %3Chttps://github.com/wbruno%3E%0A+ Licensed under the MIT license%0A%0A+ https://github.com/pinceladasdaweb/Simple-PHP-Contact-Form%0A*/%0A%0A
 /**%0A * FormV

Update banner