var listItem = null;
var callbackFun = null;

function windowInit(arguments)
{
    var params = arguments[0];
    document.title = params["title"];
    listItem = params["item"];
    $e("box_value").setAttribute("value", listItem.firstChild.getAttribute("label"));
    callbackFun = arguments[1];
}

function windowClose()
{
    
}

function btn_ok()
{
    var e = $e("box_value");
    var newTitle = e.value;
    var oldPath = listItem.getAttribute("value");
    if(newTitle.length)
    {
        listItem.setAttribute("value", getFileDir(oldPath) + "\\" + newTitle + ".xml");
        listItem.firstChild.setAttribute("label", newTitle);
        var oFile = Io.getFileFrom(oldPath);
        oFile.moveTo(oFile.parent, newTitle+ ".xml");
       // alert(oFile.path);
        callbackFun(oldPath, oFile.path);
    }
    window.close();    
}

function btn_cancel()
{
    window.close();
}
