Added javascript functionality