making flexible list box code using javascript