
function getMaintenanceEntryForm(taskId, entryTypeId) {

    var p = {};
    for (var i = 0, j = arguments.length; i < j; i++){
        p[i] = arguments[i];
    }

    var actionUrl = getContextPath()+"/entryDetailed/ajaxCreate/";
    var container = jQuery('#maintenanceEntryContainer');
    var button = jQuery('#maintenanceEntryButton');
    var params = {taskId: taskId, entryTypeId: entryTypeId};

    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
    });
}
