modified javascript validation