added some javascript from trumpet