$(function () {
    $('ul.sortable').sortable({ axis: "y", stop: saveStatusOrder, handle: '.handle', helper: "clone" });
});

function saveStatusOrder() {
    var ids = $('ul.sortable').sortable('toArray');
    $.getJSON(base + 'role.ivp/saveorder', { ids: ids, timestamp: new Date().toString() });
}

function openDialog() {
    $('#createRoleDialog').load('role.ivp/ShowDialog', function () {
        $('#createRoleDialog').dialog({
            autoOpen: true,
            position: [$(window).width() / 3, $(window).height() / 3],
            width: 'auto',
            modal: true,
            resizable: false,
            title: RoleResources.CreationDialogTitle
        });
    });
    return false;
}

function closeDialog() {
    $('#roleid').val(0);
    $('#createRoleDialog').dialog('close');
    return false;
}

