JS function to generate short title