various javascript snippet