javascripts for the add rules functionality