Added offset for text positioning in Javascript