function txt_confirmDiscardContent(contentId)
{
    if (confirm("Delete text module?\n\nClick OK to delete, Cancel to abort"))
    {
        txt_discardContent(contentId);
    }
}

function txt_discardContent(contentId)
{
    showHorizontalAJAXLoader(true);

    var ajaxRequest = initialiseAJAXRequest();

    var contentType = "application/x-www-form-urlencoded; charset=UTF-8";

    var processURL = "./modules/text/AJAX/discardContent.jsp";

    var returnError = "";

    ajaxRequest.onreadystatechange = function()
    {
        if (ajaxRequest.readyState == 4)
        {
            if (ajaxRequest.status == 200)
            {
                returnError = ajaxRequest.responseText;

                // return header takes up 11 characters. If greater, then error message was returned.
                if (returnError.length > 11)
                {
                    alert("Discard ModuleContent Error : " + returnError);
                }
                else
                {
                    //txt_showContent(contentId, false);
                    txt_parseShowContent(contentId, false, true, "");
                }
            }
            else if (ajaxRequest.status == 204)
            {
                // Error;
                alert("Debug: error.");
            }
            showHorizontalAJAXLoader(false);
        }
    };

    ajaxRequest.open("POST", processURL, true);
    ajaxRequest.setRequestHeader("Content-Type", contentType);
    ajaxRequest.send("contentId=" + contentId);
}