Update controller.php

Removed a lot of javascript and placed in a jquery plugin