
// Load an Entry from via AJAX.
// @container Container object to load response into.
// @button Button object used to trigger this function.
// @args Params map to pass to actionUrl.
function loadEntryForm(container, button, params) {

    var actionUrl = getContextPath()+"/entryDetailed/ajaxCreate/";

    function success(data, textStatus, jqXHR){
        container.html(data);
        jQuery('html,body').animate({scrollTop: container.offset().top}, 800, function() {
            container.css("border", "1px solid #006DBA");
            container.find(':input[name="comment"]').focus();
        });
    }

    function error(jqXHR, textStatus, errorThrown){
        container.html(errorIndication().slideDown(600));
        button.show(600);
    }

    // Start.
    button.hide(600);
    container.html(loadingIndication().slideDown(600));

    jQuery.ajax({
        url: actionUrl,
        data: params,
        success: success,
        error: error
    });
}
