make the javascript as a separated one so that other client code could reuse it