From javascript to ruby part 1.5