Implemented some javascript functionality