pure Javascript Validation function meant to work well with cakePHP and Ruby on Rails