Function 1 - Inserted Code into java scripts

Inserted the code into both game won and game over java scripts, to make
the function work.