Javascript Substring Is Not A Function