Randomizer fix, More JQuery calls, Testing, and Parenthesis cleanup

balances some parenthesis, changed the for loop and if-else, added
alerts for debugging. Also fixed the random number gen it was only
returning 0.