Proposed fix for #84

JavaScript tested standalone in Firefox, Chromium. Wicket integration is not yet tested.