If Variable Contains String Javascript Substring Method