﻿//################################################
//代码功能：取得指定控件的getElementById
//编写时间：2008-12-13
//################################################

function $(id) {
    return document.getElementById(id);
}

//################################################
//代码功能：对全部select进行选择和反向选择
//编写时间：2008-12-13
//################################################

function skySelectCheckList() {
    var slist;
    slist = $("checkSelect");
    var t;
    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") {
            if (dom[i].disabled == "")
                dom[i].checked = t;
        }
    }
}

//################################################
//代码功能：系统功能提示
//编写时间：2008-12-13
//################################################

function skyDataGridList(id) {
    var info;
    if (id == 1) { info = "您确认要增加新数据吗？"; }
    if (id == 2) { info = "您确认要修改新数据吗？"; }
    if (id == 3) { info = "您确认要删除新数据吗？"; }
    return SkyShowConfirm("系统提示您：" + info);
}

function SkyShowConfirm(info) {
    return window.confirm(info);
}


//################################################
//代码功能：表格颜色控制
//编写时间：2008-12-13
//################################################
var highlightcolor = '#c1ebff';
var clickcolor = '#51b2f6';

function changeto() {
    source = event.srcElement;
    if (source.tagName == "TR" || source.tagName == "TABLE")
        return;
    while (source.tagName != "TD")
        source = source.parentElement;
    source = source.parentElement;
    cs = source.children;
    if (cs[1].style.backgroundColor != highlightcolor && source.id != "nc" && cs[1].style.backgroundColor != clickcolor)
        for (i = 0; i < cs.length; i++) {
        cs[i].style.backgroundColor = highlightcolor;
    }
}

function changeback() {
    if (event.fromElement.contains(event.toElement) || source.contains(event.toElement) || source.id == "nc")
        return
    if (event.toElement != source && cs[1].style.backgroundColor != clickcolor)
    //source.style.backgroundColor=originalcolor
        for (i = 0; i < cs.length; i++) {
        cs[i].style.backgroundColor = "";
    }
}

function clickto() {
    source = event.srcElement;
    if (source.tagName == "TR" || source.tagName == "TABLE")
        return;
    while (source.tagName != "TD")
        source = source.parentElement;
    source = source.parentElement;
    cs = source.children;
    //alert(cs.length);
    if (cs[1].style.backgroundColor != clickcolor && source.id != "nc")
        for (i = 0; i < cs.length; i++) {
        cs[i].style.backgroundColor = clickcolor;
    }
    else
        for (i = 0; i < cs.length; i++) {
        cs[i].style.backgroundColor = "";
    }
}
//#################################################################################################################
//################################################
//代码功能：取得文档信息
//编写时间：2008-12-13
//################################################
function SkyOpen(src) {
    var res;
    res = showModalDialog('/admin/document/documentindex.aspx', 'sky', 'dialogWidth: 900px; dialogHeight: 800px; center: yes; resizable: no; scroll: no; status: no;');
    //alert(res)
    if (res == undefined) {
        window.alert("系统提示您：您没有选择相关需要的信息！");
    }
    else {
        var m = $(src)

        m.value = res;
        try {

        }
        catch (e) { }
    }
}

function SkyView(src) {
    var m = $(src)
    if (m.value != "") {
        window.open(m.value);
    }
    else {
        alert("暂无数据，不能查看！");
    }
}
function openChildReturn(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 )$(txt).value = picname;
}




function editDetailArea(txt)
{
    var info=$(txt).value;
    var webURL="/admin/evaluation/evaluationdetailedit.aspx"; //?info="+escape(info);
    var obj =new Object();   
    obj.name=info;   
    var returninfo = window.showModalDialog( webURL, obj, "dialogWidth:750px;status:no;dialogHeight:450px" );
   if( returninfo != undefined )$(txt).value = returninfo;
}

function editDetailAreaView(txt,IID)
{
    if(IID!="")
    {
    
        var info=$(txt).value;
        var webURL="/admin/evaluation/evaluationdetaileditself.aspx?id="+IID; //?info="+escape(info);
        var obj =new Object();   
        obj.name=info;   
        //var returninfo = window.showModalDialog( webURL, obj, "dialogWidth:750px;status:no;dialogHeight:450px" );
        var win = window.open(webURL,'2011',"height=550, width=550, top=0, left=560,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no")   
        win.focus();
    }
    else
    {
        alert("对不起，用户暂时没有录入此项的完成情况。");
    }
}

function ViewPjInfo(ID)
{
    var webURL="evaluationDetail.aspx?id="+ID;
    var win = window.open(webURL,'2010',"height=550, width=550, top=0, left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no")   
    win.focus();
}



function setOpenFunction(info)
{
     alert(info);
     $("txtInfo").value=info;
}

function closeReturn(txt)
{
    var returnInfo=$(txt).value;
    returnValue = returnInfo;
    window.close();
}

function clearReturn(txt)
{
    $(txt).value = "";
}

function viewChildReturn(txt)
{
     var url = $(txt).value;
     if(url!="")
     {
        window.open(url,"")
     }
     else
     {
        alert("对不起,您暂时没有上传文件,不能预览!");
     }
}

function nchangeImg() {
    var img = document.getElementById("imgVerify");
    img.src = "/admin/skyRandomImages.aspx?" + Math.random();
    //var ctrl = document.getElementById("verifycode");
    //if (ctrl != null) {	ctrl.focus(); ctrl.select();}
}

function openwebinfo(url) {
    //var k = window.showModalDialog(url, window, 'dialogWidth:900px;status:no;dialogHeight:600px');
    windowopen(url);
}

function openuserinfo(url) {
    //var k = window.showModalDialog(url, window, 'dialogWidth:800px;status:no;dialogHeight:700px');
    windowopen(url);
}

function windowopen(url)
{
    var width = screen.width;
    var height = screen.height;
    if (height == 768) height -= 75;
    if (height == 600) height -= 60;
    var szFeatures = "top=0,";
    szFeatures += "left=0,";
    szFeatures += "width=" + width/2 + ",";
    szFeatures += "height=" + height/2 + ",";
    szFeatures += "directories=no,";
    szFeatures += "status=yes,";
    szFeatures += "menubar=no,";
    if (height <= 600) szFeatures += "scrollbars=yes,";
    else szFeatures += "scrollbars=yes,";
    szFeatures += "resizable=yes"; //channelmode
    //window.alert(szFeatures);
    window.open(url,"",szFeatures)
}

//################################################
//代码功能：后台登录功能
//编写时间：2009-03-15
//################################################

function SkyShowInfoURL(info, url) {
    window.alert(info);
    SkyOprnUrl(url);
}
function SkyOprnUrl(url) {
    var redirectUrl = url;
    var width = screen.width;
    var height = screen.height;
    if (height == 768) height -= 75;
    if (height == 600) height -= 60;
    var szFeatures = "top=0,";
    szFeatures += "left=0,";
    szFeatures += "width=" + width + ",";
    szFeatures += "height=" + height + ",";
    szFeatures += "directories=no,";
    szFeatures += "status=yes,";
    szFeatures += "menubar=no,";
    if (height <= 600) szFeatures += "scrollbars=yes,";
    else szFeatures += "scrollbars=yes,";
    szFeatures += "resizable=yes"; //channelmode
    var open_flag = window.open(redirectUrl, "", szFeatures);
    //alert(open_flag);
    //return false;
    if (open_flag == null) {
        window.location.href = url;
    }
    else {
        window.opener = "绩效考核评估系统";
        window.close();
    }
    //不提示的关闭窗口
    window.opener = "绩效考核评估系统";
    // window.close();
}
function SkyShowDetail(id) {
    var url;
    url = "evaluationDetail.aspx?id=" + id
    var k = window.showModalDialog(url, window, 'dialogWidth:700px;status:no;dialogHeight:500px');
}

//################################################
//代码功能：页面加载调整大小
//编写时间：2009-07-14
//################################################
function win_onLoad() {
    if (self == top) {
        var width = document.all["tbMain"].offsetWidth;
        var height = document.all["tbMain"].offsetHeight;
        width = eval(width + 30);
        height = eval(height + 30);
        window.resizeTo(width, height);
    }
}
//################################################
//代码功能：文本框设置
//编写时间：2010-07-24
//################################################
function skyTxtDefault(txt,info)
{
    if(txt.value==info)
    {
        txt.value="";
    }
}


function SkyGo()
{
    return window.confirm("您确实要保存可以评价的指标吗？");
}


function killerrors() {
    return true;
}
window.onerror = killerrors;
//启用了关闭错误后AJAX就可以使用了，但是不能导出数据路，后期在弄吧；
