Javascript code for Fight Code