Javascript Uncaught Reference Error Variable Is A Factor