Javascript Bug fixed

included { } for the ifs.