JavaScript router system