var main = {
    providerURL : "/resources/provider/",
    remove:function(id) {
        if (confirm("Are you sure, that you want remove your account ?\nThis action can't be undone!")) {
            $.ajax({
                type: "DELETE",
                url: main.providerURL + id,
                dataType:"json",
                success: function(json) {
                    $("#mainDialog").dialog('option', 'title', json.title);
                    $("#mainDialog").text(json.message);
                    $("#mainDialog").dialog('open');
                }
            });
        } else {
            return;
        }
    }
};

google.setOnLoadCallback(function() {
    $("#deleteLink").click(function() {
       main.remove("todo");
    });
    $("#mainDialog").dialog({
        autoOpen:false,
        autoResize:true,
        resizable:false,
        modal:true,
        buttons: {
            "Ok": function() {
                $(this).dialog("close");
                window.location = "http://www.plupper.com";
            }
        }
    });
});
