added javascript functionality