Missing "var" in javascript code