$(function () {
var move_right = '<span class="glyphicon glyphicon-minus pull-left dual-list-move-right" title="Remove Selected"></span>';
var move_left = '<span class="glyphicon glyphicon-plus pull-right dual-list-move-left " title="Add Selected"></span>';
$(".dual-list.list-left .list-group").sortable({
stop: function( event, ui ) {
updateSelectedOptions();
}
});
$('body').on('click', '.list-group .list-group-item', function () {
$(this).toggleClass('active');
});
$('body').on('click', '.dual-list-move-right', function (e) {
e.preventDefault();
actives = $(this).parent();
$(this).parent().find("span").remove();
$(move_left).clone().appendTo(actives);
actives.clone().appendTo('.list-right ul').removeClass("active");
actives.remove();
sortUnorderedList("dual-list-right");
updateSelectedOptions();
});
$('body').on('click', '.dual-list-move-left', function (e) {
e.preventDefault();
actives = $(this).parent();
$(this).parent().find("span").remove();
$(move_right).clone().appendTo(actives);