var errors = 0;
function Validate(is_form){

  $(".req").each ( function (){

    var block = this.parentNode.parentNode;
    if ("" == this.value) {
      block.className += " error";
      this.focus();
      errors++;
    }

  })

  if (errors) {
    alert("Please fill all required fields");
    return false;
  } else {
    if (is_form) {
        //form submited, just return true;
        return true;
    } else {
        $('#contact').submit();
    }
  }

}
/*
Init =  function() {

    //Colorize block on hover and decolorize on blur
    $('#contact :input').each(function() {
        var block = this.parentNode.parentNode;
        this.onfocus = function () {
            block.className += " active";
        }
        this.onblur = function () {
            block.className = block.className.replace(/\ active/g, "");
        }
    });

  }

$(document).ready(
  Init
);

*/