converted to nonobtrusive javascript