Java Script client code