function dirInlineEdit(id, value)
{
    submit = "dirInlineSubmit('" + id + "', '" + value + "'); return false;";

    text = "<form action='javascript:void();' onsubmit=\"" + submit + "\">";
    text += "<table><tr><td><input id='" + id + "_text' type='text' value='" + value + "' title='Enter new file name'></td>";
    text += "<td><button onclick=\"" + submit + "\">Rename</button></td>";
    text += "<td><button onclick=\"dirInlineCancel('" + id + "', '" + value + "'); return false;\" title='Cancel rename'>Cancel</button></td></tr></table>";
    text += "</form>";
    
    document.getElementById(id).innerHTML = text;

    document.getElementById(id + "_text").focus();
}

function dirInlineCancel(id, value)
{
    text = "<span class='inline' title='Click to rename file' onclick=\"dirInlineEdit('" + id + "', '" + value + "'); return false;\">" + value + "</span>";
    document.getElementById(id).innerHTML = text;
}

function dirInlineSubmit(id, value)
{
    new_value = document.getElementById(id + "_text").value;
    
    dirInlineCancel(id, new_value);
    
    xajax_dirRenameFile(value, new_value);
}

