function cutfile(type) {
    var txttype;
    if (type == "1")
    { txttype = "移动";  } else { txttype = "复制"; }
    var d = new dialog(); d.init();
    d.set('src', '');
    d.set('title', txttype + '到……');
    d.event('选择要' + txttype + '到的目标路径：<br><br><select name="vpath" id="vpath" class=kuan onchange="document.all.selpath.value=document.all.vpath.value;"><option>正在读取……</option></select><br><br><a href=\'#\' onclick=\"javascript:shareuser(\'search_user.aspx?sel=1\');\"><u>选择其它位置</u></a>', 'moveto()', '', '');
    var currpath;
    Webdisk.ContentPane.GetAllPath(get_Result_CallBack);
    document.all.selpath.value = "/";
}
function get_Result_CallBack(response) {
    if (response.value != null) {
        document.all("vpath").length = 0;
        var ds = response.value;
        if (ds != null && typeof (ds) == "object") {
            for (var i = 0; i < ds.Rows.length; i++) {
                var name = ds.Rows[i].path;
                var id = ds.Rows[i].path;
                document.all("vpath").options.add(new Option(name, id));
            }
        }
    }
    return
}
function shareuser(url) {
    window.open(url, '', 'scrollbars=yes,resizable=no,status=no,toolbar=no,menubar=no,location=no,width=700,height=500');
}
function newdir() {
    if (document.getElementById("txttmp").value != "") {
        Init();
        var currpath;
        if (getUrlParam('path') == "") currpath = "/"; else currpath = getUrlParam('path');
        Webdisk.ContentPane.newFolder(currpath, document.getElementById("txttmp").value, document.getElementById("txttmp1").value, Isnewdir_callback);
    }
}
function moveto() {
    var currpath;
    if (getFilePath(document.getElementById("txtfileid").value) == "") currpath = "/"; else currpath = getFilePath(document.getElementById("txtfileid").value);
    if (document.all.selpath.value != currpath.value) {
        Init();
        Webdisk.DownLoadFileMng.MoveTo(currpath.value, document.getElementById("HdnSelectedValues").value, document.all.selpath.value, "2", "", IsOprEnd_callback);
        Webdisk.DownLoadFileMng.WriteLog("分享文件", document.getElementById("filePath").value, document.getElementById("txtFileUser").value)
    }
}
function Isnewdir_callback(res) {
    document.all.loading.style.display = 'none';
    var bRet = res.value;
    if ((bRet != "0") && (bRet != "1")) {
        var d = new dialog(); d.init();
        d.set('src', 'pics/dlgico_excal.gif');
        d.set('title', '系统提示信息');
        d.event(bRet, 'window.close();', '', '');
    }
    else {
        var rowcount = document.getElementById("rowcount").value;
        var currpath;
        if (getUrlParam('path') == "") currpath = "/"; else currpath = getUrlParam('path');
        var txttmp = document.getElementById("txttmp").value;

        if (document.getElementById("nospace") != null) document.getElementById("nospace").style.display = 'none';
        AddRow(rowcount, currpath, txttmp, bRet, "0", "", "", "", document.getElementById("txttmp1").value);

        var info = document.getElementById("info").innerHTML;
        var first = info.indexOf("：")
        var second = info.indexOf("个")
        document.getElementById("info").innerHTML = info.substring(0, first) + "：" + parseInt(parseInt(info.substring(first + 1, second)) + 1) + info.substring(second, info.length);
        rowcount++;
        document.getElementById("rowcount").value = rowcount;
    }
    document.getElementById("txttmp").value = ""; document.getElementById("txttmp1").value = "";
}
function getFilePath(fileid) {
    return Webdisk.DownLoadFileMng.getFilePath(fileid);
}
function Init() {
     document.all.loading.style.top = Math.round((document.body.clientHeight - 100) / 2) + document.body.scrollTop - 50;
    document.all.loading.style.left = Math.round((document.body.clientWidth - 100) / 2) - 100;
    document.all.loading.style.display = '';
}
function IsOprEnd_callback(res) {
    var bRet = res.value;
    if ((bRet != "") && (bRet != "1") && (bRet != "2")) {
        var d = new dialog(); d.init();
        d.set('src', 'pics/dlgico_excal.gif');
        d.set('title', '系统提示信息');
        d.event(bRet, 'window.close();', '', '');
    }
    document.all.loading.innerHTML = document.all.loading.innerHTML.replace("正在处理，请稍候……", "操作已完成");
    window.setTimeout("document.all.loading.style.display='none';document.all.loading.innerHTML=document.all.loading.innerHTML.replace('操作已完成','正在处理，请稍候……');", 1000);
    Webdisk.DownLoadFileMng.updateDownloadCount(document.getElementById("txtfileid").value);
}