Using A Variable In A String Javascript Substring Until Character