a transplantation from flash to js for LTP front end