Add title counter javascript function.