Completed the protoype functions to validate html5 forms and with a small polyfill for older browsers