updated javascript to pass collapsed sized to javascript