Simplifying onclick jquery/JavaScript functions
<p>I am trying to simplify all .js functions on the site to improve page load speed and overall performance of my site. Managed to do most of it on my own, but got stack when started to minimize couple of functions that are mostly call backs and onclick functions called from the functions.js in the page head.</p>

<p>SO here is my question, how can I make one function out of the following 2 to make script shorter and without loosing any functionality, or if there any alternative way to make it all simpler than it currently is?</p>

<pre><code>function user_dialog(dialog_content, download_button) {
    if (typeof jQuery.ui != 'undefined') {
        $("#dialog").attr("title", "Lets share it").html(dialog_content);
        $("#dialog").dialog({
            modal: false,
            width: 400,
            buttons: {
                Cancel: function() {
                    $(this).dialog("close");
                },
                "Download": function () {
                    $(this).dialog("close");
                    window.location = download_button;
                }
            }
        });
    } else {
        window.location = download_button;
    }
}

function user_notice(link_source) {
    download_link = $(link_source).attr("href");
    $.ajax({
        type: "POST",
        url: "/includes/json.php",
        data: "action=reminder&amp;thepath=" + download_link,
        dataType: "json",
        error: function() {
            window.location = download_link;
        },
        success: function(resp_dialog) {
            if (resp_dialog.status == 1) {
                user_dialog(resp_dialog.html, download_link);
            }
        }
    });
}
</code></pre>

<p>Thanks for your help in advance!!!</p>
