Multi-use javascript widgets