Javascript Model Restrictor