//################################################
//代码功能：打开模式窗口
//编写时间：2013-03-12
//################################################
function UsOpenDialogTree(paraurl, src, txtValue) {
    var url = paraurl;
    var res;
    res = showModalDialog(url, 'careff2013', 'dialogWidth: 300px; dialogHeight: 500px; center: yes; resizable: no; scroll: no; status: no;');
    if (res == undefined) {
        window.alert("系统提示您：您没有选择相关需要的信息！");
    }
    else {
        try {
            //alert(res);
            var strs = res.split("#")
            var m = $id(src)
            //m.title = strs[0];
            m.value = strs[1];
            var m1 = $id(txtValue)
            m1.value = strs[0];
        }
        catch (e) {
            alert(e);
        }
    }
}


function UsOpenDialogTreeBack(paraurl, src, txtValue, callback) {
    var url = paraurl;
    var res;
    res = showModalDialog(url, 'careff2013', 'dialogWidth: 300px; dialogHeight: 500px; center: yes; resizable: no; scroll: no; status: no;');
    if (res == undefined) {
        window.alert("系统提示您：您没有选择相关需要的信息！");
    }
    else {
        try {
            //alert(res);
            var strs = res.split("#")
            var m = $id(src)
            //m.title = strs[0];
            m.value = strs[1];
            var m1 = $id(txtValue)
            m1.value = strs[0];
            callback();
        }
        catch (e) {
            alert(e);
        }
    }
}


function UsOpenURLInfo(webURL) {
    //var webURL = "evaluationDetail.aspx?id=" + ID;
    var win = window.open(webURL, '2013', "height=500, width=750, top=0, left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no")
    win.focus();
}


function UsView(src) {
    var m = $id(src)
    if (m.value != "") {
        window.open(m.value);
    }
    else {
        alert("暂无数据，不能查看！");
    }
}
function UsOpenDialog(txt) {
    //alert(txt);
    var webURL = "/admin/document/documentuploadself.aspx"
    var picname = window.showModalDialog(webURL, window, "dialogWidth:550px;status:no;dialogHeight:150px");
    //alert(picname);
    if (picname != undefined) $id(txt).value = picname;
}

function UsClear(txt) {
    $id(txt).value = "";
}

function UsCopyRight() {
    var k = window.showModalDialog("/admin/ussoft.aspx", window, 'dialogWidth:500px;status:no;dialogHeight:320px');
}

//防止非法打开
function UsURLNoSrc() {

    //2015-01-07 关闭
    return;

    try {
        var srcURL = window.opener.location;
        var doURL = document.domain.toString();

        var strObj = new String(srcURL);
        if (strObj.indexOf(doURL) < 0) {
            //2015-01-22关闭
            //window.location.href = "/";
        }
    }
    catch (err) {
        //在此处理错误
        //window.close();
        //alert(err);

        //2015-01-22关闭
        //window.location.href = "/";
    }


}

function skySelectCheckList() {

    var slist;
    slist = $id("chkselect");
    var t;
   
    var nName;
    t = slist.checked;
    var dom = document.getElementsByTagName("*");
    var el = event.srcElement ? event.srcElement : event.target;
    for (i = 0; i < dom.length; i++) {
        if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
            nName = dom[i].id;
            //dom[i].checked = t;
            if (nName.indexOf("chkselect") != -1) {
                //alert(dom[i].disabled == false);
                if (dom[i].disabled == false) {
                    dom[i].checked = t;
                }
            }
            if (nName.indexOf("chkIsMakeup") != -1) {
                if (dom[i].disabled == false)
                    dom[i].checked = t;
            }

        }
    }
}


//careff.com
//2014-10-25  我的文档功能完善
function SkyOpen(txt) {
    if ($("#careff_mdiv").length <= 0) {
        $(document.body).append("<div id='careff_main'><iframe src='' id='selectfile' frameborder='0' width='100%' height='100%'></iframe></div><div id='careff_mdiv'></div>");
    }
    $('#careff_mdiv').show();
    $('#careff_main').show();
    $('#selectfile').attr("src", "../document/uploadone.aspx?id=" + txt);

    var left = ($(window).width() - $('#careff_main').outerWidth()) / 2;
    var top = ($(window).height() - $('#careff_main').outerHeight()) / 2 + $(document).scrollTop()
    $('#careff_main').css({
        position: 'absolute',
        left: left,
        top: top
    });

    $('#careff_mdiv').css({
        position: 'absolute',
        left: 0,
        top: 0,
        width: $(window).width(),
        height: $(window).height()
    });
}

function SkyOpenimg(txt,img) {
    if ($("#careff_mdiv").length <= 0) {
        $(document.body).append("<div id='careff_main'><iframe src='' id='selectfile' frameborder='0' width='100%' height='100%'></iframe></div><div id='careff_mdiv'></div>");
    }
    $('#careff_mdiv').show();
    $('#careff_main').show();
    $('#selectfile').attr("src", "../document/uploadone.aspx?id=" + txt + "&img=" + img);

    var left = ($(window).width() - $('#careff_main').outerWidth()) / 2;
    var top = ($(window).height() - $('#careff_main').outerHeight()) / 2 + $(document).scrollTop()
    $('#careff_main').css({
        position: 'absolute',
        left: left,
        top: top
    });

    $('#careff_mdiv').css({
        position: 'absolute',
        left: 0,
        top: 0,
        width: $(window).width(),
        height: $(window).height()
    });
}

function SkyOpenUploadMuti(txt) {
    //alert(txt);
    var path = document.getElementById(txt).value;
    if ($("#careff_mdiv").length <= 0) {
        $(document.body).append("<div id='careff_mainmul'><iframe src='' id='selectfile' frameborder='0' width='100%' height='100%'></iframe></div><div id='careff_mdiv'></div>");
    }
    $('#careff_mdiv').show();
    $('#careff_mainmul').show();
    $('#selectfile').attr("src", "../document/uploadmulti.aspx?path=" + path);

    var left = ($(window).width() - $('#careff_mainmul').outerWidth()) / 2;
    var top = ($(window).height() - $('#careff_mainmul').outerHeight()) / 2 + $(document).scrollTop()
    $('#careff_mainmul').css({
        position: 'absolute',
        left: left,
        top: top
    });

    $('#careff_mdiv').css({
        position: 'absolute',
        left: 0,
        top: 0,
        width: $(window).width(),
        height: $(window).height()
    });
    return false;
}


function UsOpenDialog2015(url) {
    //alert(txt);
    var webURL = url;
    var picname = window.showModalDialog(webURL, window, "dialogWidth:850px;status:no;dialogHeight:750px");
   
}