function attachToPickListButtons(id, fn) {
$$("input[onclick^='pickListMove'][type='button']").each(function(field) {
if (!(typeof(field.onclick) == 'undefined')) {
var fieldOnclick = "" + field.onclick;
if (null != fieldOnclick.toLowerCase().match(id.toLowerCase())) {
Event.observe(field, 'click', function(event) {
var element = Event.element(event);
element.forid = id;
fn(element);
});
}
}
});
}
function pickListHelper(id) {
var _selectedList = $(id);
var _unselectedList = $(id+ "_unselected");
var _hiddenList = $(id+ "_hidden");
this.getSelectedList = function() {
return _selectedList;
}
this.getUnSelectedList = function() {
return _unselectedList;
}
this.getHiddenList = function() {
return _hiddenList;
}
this.moveAll = function(toSelected) {
var fromList = toSelected ? _unselectedList : _selectedList;
var toList = toSelected ? _selectedList : _unselectedList;
pickListMoveAll(fromList, toList, _hiddenList, toSelected);
}
}