Javascript codes for many purposes