JQuery

Fixes for migration from prototype to jquery