﻿// JScript 文件
var queryValue_Id = "";
var orgTarName = "";
var valueList = "";
var borderColor = "#009ace";
var pointTag = -5;
var frmSelectTag;
//获取坐标点
function getAbsolute(tag){
    var oTmp = tag;
	var x = 0;
	var y = 0;
	var value = new Array();
	do {
		x += oTmp.offsetLeft;
		y += oTmp.offsetTop + 0.5;
		oTmp = oTmp.offsetParent;
	} while(oTmp.tagName!="BODY" && oTmp != undefined);
	value[0] = x;
	value[1] = y + tag.offsetHeight;
	return value;
}
function getWebRoot() {
    if (WEBROOT == null || WEBROOT == undefined) {
        var pathName = window.location.pathname;
        var virtualPath = "";
        var temp = pathName.substring(1, pathName.length).split("/");
        // 如果数组大于等于2，说明是虚拟目录，否则是网站目录
        if (temp.length >= 2) {
            virtualPath = ("/" + temp[0] + "/");
        } else {
            virtualPath = "/";
        }
        return virtualPath;
        //return "$!{WebRoot}";
    }
    else {
        return WEBROOT;
    }
}

//
//
//
function setLangSwitch(url,lang) {
    var pars = "lang=" + lang;
    var t = new AjaxUtils(url, pars, function(e) { window.location = window.location; }, errorHandle, "GET", null);
    t.sendURL();
    t = null;
}
function getPublicCodeList(valuelist, codeType){
	valueList = valuelist;
	queryValue_Id = codeType;
	var lookupList = $("lookup" + codeType);
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenPanel(codeType);
		} else {
			showPanel(codeType);
		}
	} else {
		createPanel(codeType);
	}	
}

function createPanel(queryId){
	var point = getPoint();
    //var el = document.activeElement;
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookup" + queryId + "' style='position:absolute;top=" + (point[1] + pointTag) + ";"
        + " left=" + point[0] + ";BACKGROUND-COLOR:#f4f4f4; border:solid 1px " + borderColor + ";display:\"\";z-index:9999;width=240px;height:230px;overflow:auto' onblur=\"hiddenPanel('" + queryId + "');\">"
		+ "</div>";
	//document.body.innerHTML += lookupPanel;
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	loadValueData(queryId);
}

function loadValueData(queryId){
    var pars = "CodeTypeId=" + queryId + "&keyWhere=";
    var url = getWebRoot() + "public_list/PublicCodeRequest.ashx";
    var t = new AjaxUtils(url, pars, showValueData, errorHandle, "GET", null);
    t.sendURL();
}
// Modify By xqwu 2008-10-06
function loadValueDataWhere(queryId, queryKey){
    var pars = "CodeTypeId=" + queryId + "&keyWhere=" + queryKey + "&act=" + new Date();
    var url = getWebRoot() + "public_list/PublicCodeRequest.ashx";
    var t = new AjaxUtils(url, pars, showValueData, errorHandle, "POST", null);
    t.sendURL();
}
function showValueData(responseText){
    var obj = $("lookup" + queryValue_Id);
    if (obj != null && obj != undefined){
        obj.innerHTML = responseText;
    }
}

function hiddenPanel(queryId){
	var lookupList = $("lookup" + queryId);
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showPanel(queryId){
	var point = getPoint();
	var el = document.activeElement;
        var lookupList = $("lookup" + queryId);
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (point[1] + pointTag);
			left = value[0];
		}
	}
}

function getPoint(){
	var listBoxes = valueList.split(",");
	var point = new Array();
	for(var i = 0; i < listBoxes.length; i ++){
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (listBox.tagName == "INPUT" && listBox.type == "text"){
			point = getAbsolute(listBox);
			break;
		}
	}
	return point;
}
	
function setValues(_values){
	var values;
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	if (_values == undefined || _values == null){
		values = getValues();
	} else {
	    values = _values.split(",");
	}
	var listBoxes = valueList.split(",");
	
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		
		var _val = values[i];
		if (_val != null){
			listBox.value = _val;
		} else {
			listBox.value = "";
		}
	}
	hiddenPanel(queryValue_Id);
}

function getValues(){
	var values = new Array();
	var element = document.activeElement;
	var obj;
	if (element.tagName == "TD"){
		obj = element.parentElement;
	} else if (e.tagName == "TR"){
		obj = e;
	}
	for(var i = 0; i < obj.children.length; i ++){
		values[i] = obj.children[i].innerText;
	}
	return values;
}
//==========================================================
//
// 获取行政区划编码
// 
//==========================================================
function getRegionList(valuelist){
    valueList = valuelist;
    queryValue_Id = "Region"; // Modify By xqwu 2008-10-06 增加选择行政区后自动关闭
	var lookupList = $("lookupRegion");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenRegion();
		} else {
			dispayRegion();
		}
	} else {
		createRegion();
	}
}

function hiddenRegion(){
	var lookupList = $("lookupRegion");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function dispayRegion(){
	var lookupList = $("lookupRegion");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createRegion(){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupRegion' style='overflow:auto;position:absolute;top:" + (point[1] + pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=230px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	load_RegionData();
}
function load_RegionData(){
    var t = new AjaxUtils(getWebRoot() + "public_list/regionRequest.ashx", null, showRegionData, errorHandle, "GET", null);
    t.sendURL();
}
function showRegionData(s){
   var obj = $("lookupRegion");
   obj.innerHTML = s;
}
function regionNodeClick(id, o){
    var obj = $("__region_" + id);
    loadRegionChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadRegionChild(id){
    var obj = $("__region_" + id);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "parent_id="  + id;
   	    var t = new AjaxUtils(getWebRoot() + "public_list/regionRequest.ashx", pars, function(s) { obj.innerHTML = s; }, errorHandle, "GET", null);
        t.sendURL();
    }
}


//==========================================================
//
// 获取功能树 Modify By xqwu
// 
//==========================================================
var funWhere = "";
function getFunctionList(valuelist, structureId){
    valueList = valuelist;
    queryValue_Id = "Function";        
    if (structureId == null || structureId == undefined){
	    funWhere = "";
	} else if (structureId == ""){
	    funWhere = "";
	} else {
	    funWhere = "structure_id=" + structureId + "";
	}
	var lookupList = $("lookupFunction");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenFunction();
		} else {
			dispayFunction();
		}
	} else {
		createFunction();
	}
}

function hiddenFunction(){
	var lookupList = $("lookupFunction");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function dispayFunction(){
	var lookupList = $("lookupFunction");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createFunction(){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupFunction' style='overflow:auto;position:absolute;top:" + (point[1] + pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4; border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=230px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	load_FunctionData();
}
function load_FunctionData(){
    var t = new AjaxUtils(getWebRoot() + "public_list/functionRequest.ashx", funWhere, showFunctionData, errorHandle, "GET", null);
    t.sendURL();
}
function showFunctionData(s){
   var obj = $("lookupFunction");
   obj.innerHTML = s;
}
function functionNodeClick(id, o){
    var obj = $("__function_" + id);
    loadFunctionChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadFunctionChild(id){
    var obj = $("__function_" + id);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "parent_id="  + id + "&" + funWhere; //
   	    var t = new AjaxUtils(getWebRoot() + "public_list/FunctionRequest.ashx", pars, function(s) { obj.innerHTML = s; }, errorHandle, "GET", null);
        t.sendURL();
    }
}

//==========================================================
//
// 代码类别树 Modify By xqwu
// 
//==========================================================
var codeTypeWhere = "";
function getCodeTypeList(valuelist, structureId){
    valueList = valuelist;
    queryValue_Id = "CodeType";     
    if (structureId == null || structureId == undefined){
	    codeTypeWhere = "";
	} else if (structureId == ""){
	    codeTypeWhere = "";
	} else {
	    codeTypeWhere = "structure_id=" + structureId + "";
	}
	var lookupList = $("lookupCodeType");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenCodeType();
		} else {
			dispayCodeType();
		}
	} else {
		createCodeType();
	}
}

function hiddenCodeType(){
	var lookupList = $("lookupCodeType");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function dispayCodeType(){
	var lookupList = $("lookupCodeType");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createCodeType(){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupCodeType' style='overflow:auto;position:absolute;top:" + (point[1] + pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=230px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	load_CodeTypeData();
}
function load_CodeTypeData(){
    var t = new AjaxUtils(getWebRoot() + "public_list/codeTypeRequest.ashx", codeTypeWhere, showCodeTypeData, errorHandle, "GET", null);
    t.sendURL();
}
function showCodeTypeData(s){
   var obj = $("lookupCodeType");
   obj.innerHTML = s;
}
function codeTypeNodeClick(id, o){
    var obj = $("__codeType_" + id);
    loadCodeTypeChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadCodeTypeChild(id){
    var obj = $("__codeType_" + id);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "parent_id="  + id + "&" + codeTypeWhere; //
   	    var t = new AjaxUtils(getWebRoot() + "public_list/codeTypeRequest.ashx", pars, function(s) { obj.innerHTML = s; }, errorHandle, "GET", null);
        t.sendURL();
    }
}

//==========================================================
//
// 培训,考试场地选择 Modify By xqwu 2008-09-18 10:55
// 例:onclick='getLocusList("ctl00_Contentplaceholder2_firstLocusId,ctl00_Contentplaceholder2_firstLocusName", $("ctl00_Contentplaceholder2_structureId").value,$("ctl00_Contentplaceholder2_secondLocusId").value,"03");'
//    $("ctl00_Contentplaceholder2_structureId").value   取当前页面上的单位
//    $("ctl00_Contentplaceholder2_secondLocusId").value   排除已经选择的产地
//    03  代表场地类型(01-等级考试   03-教育培训)
//==========================================================
var locusWhere = "";
function getLocusList(valuelist, structureId, prvlocusid, typeid){
    valueList = valuelist;     
    if (structureId == null || structureId == undefined){
	    locusWhere = "";
	} else if (structureId == ""){
	    locusWhere = "";
	} else {
	    locusWhere = "structure_id=" + structureId + "";
	}
	// 上一场地
	if (prvlocusid == null || prvlocusid == undefined){
	    locusWhere += "";
	} else if (prvlocusid == ""){
	    locusWhere += "";
	} else {
	    locusWhere += "&prv_id=" + prvlocusid + "";
	}
	// 场地类别
	if (typeid == null || typeid == undefined){
	    locusWhere += "";
	} else if (typeid == ""){
	    locusWhere += "";
	} else {
	    locusWhere += "&type_id=" + typeid + "";
	}
	
	var lookupList = $("lookupLocus");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenLocus();
		} else {
			dispayLocus(); 
		}
	} else {
		createLocus();
	} 
}

function hiddenLocus(){
	var lookupList = $("lookupLocus");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function dispayLocus(){
	var lookupList = $("lookupLocus");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createLocus(){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupLocus' style='overflow:auto;position:absolute;top:" + (point[1] + pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=230px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	load_LocusData();
}
function load_LocusData(){
    var t = new AjaxUtils(getWebRoot() + "public_list/locusRequest.aspx", locusWhere, showLocusData, errorHandle, "GET", null);
    t.sendURL();
}
function showLocusData(s){
   var obj = $("lookupLocus");
   obj.innerHTML = s;
}
function locusNodeClick(id, o){
    var obj = $("__locus_" + id);
    loadLocusChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadLocusChild(id){
    var obj = $("__locus_" + id);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "parent_id="  + id + "&" + locusWhere; //
   	    var t = new AjaxUtils(getWebRoot() + "public_list/locusRequest.aspx", pars, function(s) { obj.innerHTML = s; }, errorHandle, "GET", null);
        t.sendURL();
    }
}



/***********************************************************
*
*    获取机构编码列表，使用树形模式展示
*    parms:valuelist 将返回值填充到哪些控件
*    return:StructureId,StructureName
*    如TextBoxStructureId,TextBoxStructureName表示将返回值按
*    0,1,0,1......顺序分别填充到TextBoxStructureId,TextBoxStructureName
*
***********************************************************/
var struWhere = "";
function getStructureList(valuelist, structureId){
	valueList = valuelist;
	
	if (structureId == null || structureId == undefined){
	    struWhere = "";
	} else if (structureId == ""){
	    struWhere = "";
	} else {
	    struWhere = "parent_id=" + structureId + "";
	}
	
	var lookupList = $("lookupStructure");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenStructure();
		} else {
			showStructure();
		}
	} else {
		createStructure();
	}
}
function hiddenStructure(){
	var lookupList = $("lookupStructure");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showStructure(){
	var lookupList = $("lookupStructure");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1]+pointTag);
			left = value[0];
		}
	}
}
function createStructure(){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupStructure' style='overflow:auto;position:absolute;top:" + (point[1]+pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4; border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=260px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	loadStructure();
}
function loadStructure(){
    var url = getWebRoot() + "public_list/structureRequest.ashx";
    var t = new AjaxUtils(url, struWhere, function(s){var obj = $("lookupStructure");obj.innerHTML = s;}, errorHandle, "GET", null); // // Modify By xqwu 2008-09-18 16:14 增加 struWhere
    t.sendURL();
}

function structureNodeClick(id, o){
    var obj = $("__structure_" + id);
    loadStructureChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadStructureChild(id){
    var obj = $("__structure_" + id);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "parent_id="  + id + "&showchild=0"; // Modify By xqwu 2008-09-18 16:14 增加 "&showchild=0"
   	    var t = new AjaxUtils(getWebRoot() + "public_list/structureRequest.ashx", pars, function(s) { obj.innerHTML = s }, errorHandle, "GET", null);
        t.sendURL();
    }
}

function doSelectStructure(org_code, org_cname){
    var values;
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	values = getValues();
	var listBoxes = valueList.split(",");
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (i == 0){
			listBox.value = org_code;
		} else {
			listBox.value = org_cname;
		}
	}
	hiddenStructure();
}
/***********************************************************
*
*    获取机构编码列表，使用树形模式展示
*    parms:valuelist 将返回值填充到哪些控件
*    return:StructureId,StructureName
*    如TextBoxStructureId,TextBoxStructureName表示将返回值按
*    0,1,0,1......顺序分别填充到TextBoxStructureId,TextBoxStructureName
*
***********************************************************/
// 定义变量用来存放初始化时的StructureId，如果StructureId发生变化
// 则需要重载整个控件
var courseID = "";
function getChapterList(valuelist, courseId){
	valueList = valuelist;
	var lookupList = $("lookupChapter");
	if (courseID != courseId){
	    courseID = courseId;
	    if (lookupList != null && lookupList != undefined){
	        loadChapter(courseId);
	        showChapter();
	    } else {
	        createChapter(courseId);
	    }
	} else if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenChapter();
		} else {
			showChapter();
		}
	} else {
		createChapter(courseId);
	}
}
function hiddenChapter(){
	var lookupList = $("lookupChapter");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showChapter(){
	var lookupList = $("lookupChapter");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createChapter(courseId){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupChapter' style='overflow:auto;position:absolute;top:" + (point[1]+pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=260px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	loadChapter(courseId);
}
function loadChapter(courseId){
    var url = getWebRoot() + "chapterRequest.aspx";
    var t = new AjaxUtils(url, "course_id=" + courseId, function(s){var obj = $("lookupChapter");obj.innerHTML = s;}, errorHandle, "GET", null);
    t.sendURL();
}

function chapterNodeClick(course_id, chapter_id, o){
    var obj = $("__chapter_" + course_id + "_" + chapter_id);
    loadChapterChild(course_id, chapter_id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadChapterChild(course_id, chapter_id){
    var obj = $("__chapter_" + course_id + "_" + chapter_id);
    if (obj.innerText == "正在读取数据......"){
        var pars = "course_id="  + course_id + "&chapter_id=" + chapter_id;
        var t = new AjaxUtils(getWebRoot() + "public_list/chapterRequest.aspx", pars, function(s) { obj.innerHTML = s }, errorHandle, "GET", null);
        t.sendURL();
    }
}

function doSelectChapter(courseId, chapterId, chapterName){
    var values;
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	values = getValues();
	var listBoxes = valueList.split(",");
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (i == 0){
			listBox.value = courseId;
		} else if (i == 1){
			listBox.value = chapterId;
		} else if (i == 2){
			listBox.value = chapterName;
		} else {
		    listBox.value = chapterName;
		}
	}
	hiddenChapter();
}

/***********************************************************
*
*    获取机构编码列表，使用树形模式展示
*    parms:valuelist 将返回值填充到哪些控件
*    return:StructureId,StructureName
*    如TextBoxStructureId,TextBoxStructureName表示将返回值按
*    0,1,0,1......顺序分别填充到TextBoxStructureId,TextBoxStructureName
*
***********************************************************/
// 定义变量用来存放初始化时的StructureId，如果StructureId发生变化
// 则需要重载整个控件
var StructureID = "";
function getCourseList(valuelist, structureId){
	valueList = valuelist;
	var lookupList = $("lookupCourse");
	if (StructureID != structureId){
	    StructureID = structureId;
	    if (lookupList != null && lookupList != undefined){
	        loadCourse(structureId);
	        showCourse();
	    } else {
	        createCourse(structureId);
	    }
	} else if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenCourse();
		} else {
			showCourse();
		}
	} else {
		createCourse(structureId);
	}
}
function hiddenCourse(){
	var lookupList = $("lookupCourse");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showCourse(){
    var el = document.activeElement;
	var lookupList = $("lookupCourse");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createCourse(structureId){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupCourse' style='overflow:auto;position:absolute;top:" + (point[1]+pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=350px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	loadCourse(structureId);
}
function loadCourse(structureId){
    var url = getWebRoot() + "courseRequest.aspx";
    var t = new AjaxUtils(url, "structure_id=" + structureId, function(s){var obj = $("lookupCourse");obj.innerHTML = s;}, errorHandle, "GET", null);
    t.sendURL();
}

function courseNodeClick(id, o){
    var obj = $("__course_" + id);
    loadCourseChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadCourseChild(id){
    var obj = $("__course_" + id);
    if (id.indexOf("_") > 0){
        var tmp = id.split('_');
        if (obj.innerText == "正在读取数据......"){
   	        var pars = "train_exam_sid="  + tmp[1];
   	        var t = new AjaxUtils(getWebRoot() + "public_list/courseRequest.aspx", pars, function(s) { obj.innerHTML = s }, errorHandle, "GET", null);
            t.sendURL();
        }
    }
}

function doSelectCourse(courseId, courseName){
    var values;
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	values = getValues();
	var listBoxes = valueList.split(",");
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (i == 0){
			listBox.value = courseId;
		} else {
			listBox.value = courseName;
		}
	}
	hiddenCourse();
}
//=======================================================
var deptTarName = "";
var deptWhere = "";
function getDeptartmentList(valuelist, deptartmentId, selectTag) {
    frmSelectTag = selectTag; // 
	valueList = valuelist;
        if (deptartmentId == null || deptartmentId == undefined){
	    deptWhere = "";
	} else if (deptartmentId == ""){
	    deptWhere = "";
	} else {
	    deptWhere = "parent_id=" + deptartmentId + "";
	}
	var lookupList = $("lookupDepartment");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenDeptPanel();
		} else {
			showDeptPanel();
		}
	} else {
		createDeptPanel();
	}
}
function hiddenDeptPanel(){
	var lookupList = $("lookupDepartment");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showDeptPanel(){
    var el = document.activeElement;
	var lookupList = $("lookupDepartment");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1]+pointTag);
			left = value[0];
		}
	}
}
function createDeptPanel(){
    var point = getPoint();
    
	var tag = $(frmSelectTag);
	if (tag == null || tag == undefined)
	{
	    tag = document.createElement("DIV");
	}	
	tag.innerHTML = 
	  "<div id='lookupDepartment' style='overflow:auto;position:absolute;top:" + (point[1]+pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4; border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=260px;height:230px'>"
		+ "</div>";
	//document.body.innerHTML += lookupPanel;   
	//div.innerHTML = lookupPanel;
	//document.body.appendChild(div);
	//var tag = $(frmSelectTag);
	//if (tag != null && tag != undefined) {
	//    tag.innerHTML = lookupPanel;
	//}
	//else {
	//    document.body.appendChild(div);
	//}
	load_DeptData();
}
function load_DeptData(){
    var url = getWebRoot() + "public_list/departmentRequest.ashx";    
    //var t = new AjaxUtils(url, deptWhere, function(s){var obj = $("lookupDepartment");obj.innerHTML = s;}, errorHandle, "GET", null);
    //t.sendURL();
    var sprySelect = new Spry.Data.JSONDataSet(url);
    if (sprySelect != null)
        $("lookupDepartment").innerHTML = sprySelect.doc;
}

function departmentNodeClick(id, o){
    var obj = $("__department_" + id);
    loadDeptChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadDeptChild(id){
    var obj = $("__department_"+id);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "parent_id="  + id + "&showchild=0";
   	    var t = new AjaxUtils(getWebRoot() + "public_list/departmentRequest.ashx", pars, function(s) { obj.innerHTML = s; }, errorHandle, "GET", null);
        t.sendURL();
    }
}

function doSelectDepartment(structureId, departmentId, departmentName){
    var values;
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	values = getValues();
	var listBoxes = valueList.split(",");
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (i == 0){
			listBox.value = structureId;
		} else if (i == 1){
			listBox.value = departmentId;
		} else {
			listBox.value = departmentName;
		}
	}
	hiddenDeptPanel();
}
var userWhere = "";
//==================================================
function getUserList(valuelist, departmentId){
    valueList = valuelist;
    if (departmentId == null || departmentId == undefined){
	    userWhere = "";
	} else if (departmentId == ""){
	    userWhere = "";
	} else {
	    userWhere = "parent_id=" + departmentId;
	}
    var lookupList = $("lookupUser");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenUser();
		} else {
			showUser();
		}
	} else {
		createUser();
	}
}
function hiddenUser(){
	var lookupList = $("lookupUser");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showUser(){
	var lookupList = $("lookupUser");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createUser(){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupUser' style='overflow:auto;position:absolute;top:" + (point[1] + pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=260px;height:230px'>"
		+ "</div>";
	div.innerHTML = lookupPanel;
    document.body.appendChild(div); 
	loadUser();
}
function loadUser(){
    var t = new AjaxUtils(getWebRoot() + "public_list/userRequest.aspx?mode=0", userWhere, function(s) {
        var obj = $("lookupUser");obj.innerHTML = s;
    }, errorHandle, "GET", null);
    t.sendURL();
}
function departmentUserNodeClick(departmentId, o){
    var obj = $("__department_user_" + departmentId);
    loadUserChild(departmentId);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "images/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "images/right.gif";
       }
    }
}
function loadUserChild(departmentId){
    var obj = $("__department_user_" + departmentId);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "parent_id="  + departmentId;
   	    var t = new AjaxUtils(getWebRoot() + "public_list/userRequest.aspx?mode=1", pars, function(s) { obj.innerHTML = s; }, errorHandle, "GET", null);
        t.sendURL();
    }
}

function doSelectUser(returnValue)
{
    var values;
	if (valueList == null || valueList == undefined){
		hiddenUser();
		return;
	} else if (valueList == ""){
		hiddenUser();
		return;
	}
	if (returnValue == undefined || returnValue == null || returnValue == "") {
	    hiddenUser();
	    return;
	}
	values = returnValue.split(",");
	var listBoxes = valueList.split(",");
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (i == 0){
			listBox.value = values[0];
		} else if (i == 1){
			listBox.value = values[1];
		} else if (i == 2){
			listBox.value = values[2];
		} else if (i == 3){
			listBox.value = values[3];
		} else {
			listBox.value = values[3];
		}
	}
	hiddenUser();
}
//==================================================
function getEmployeeList(valuelist, departmentId){
	valueList = valuelist;
	if (dept_Code == null || dept_Code == undefined){
	    userWhere = "";
	} else if (dept_Code == ""){
	    userWhere = "";
	} else {
	    userWhere = "dept_code=" + dept_Code + "";
	}
	var lookupList = $("lookupUserCode");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenUserPanel();
		} else {
			showUserPanel();
		}
	} else {
		createUserPanel();
	}
}
function hiddenUserPanel(){
	var lookupList = $("lookupUserCode");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showUserPanel(){
        var el = document.activeElement;
	var lookupList = $("lookupUserCode");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1]+pointTag);
			left = value[0];
		}
	}
}
function createUserPanel(){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupUserCode' style='overflow:auto;position:absolute;top:" + (point[1]+pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=260px;height:230px'>"
		+ "</div>";
	//document.body.innerHTML += lookupPanel;
	div.innerHTML = lookupPanel;
    document.body.appendChild(div); 
	load_UserData();
}
function load_UserData(){
    var t = new AjaxUtils(getWebRoot() + "/common/valuelist/user_list.jsp", userWhere, show_User_Data, errorHandle, "GET", null);
    t.sendURL();
}
function show_User_Data(responseText){
   var obj = $("lookupUserCode");
   obj.innerHTML = responseText;
}
function userViewClick(org_code, dept_code, o){
    var obj = $("ur" + dept_code);
    deptTarName = "du" + dept_code;
    loadUserChild(org_code, dept_code);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "/images/default/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "/images/default/right.gif";
       }
    }
}

function showDeptChild(responseText){
    var obj = $(deptTarName);
    obj.innerText = '';
    obj.innerHTML = responseText;
}
function loadUserList(org_code, dept_code){
    var pars = "org_code=" + org_code + "&dept_code="  + dept_code;
   	var t = new AjaxUtils(getWebRoot() + "/common/valuelist/user.jsp", pars, showUserList, errorHandle, "GET", null);
    t.sendURL();
}
function showUserList(responseText){
    var obj = $(deptTarName);
    obj.innerHTML += responseText;
}
function doSelectUserCode(user_id, user_name){
    var values;
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	values = getValues();
	var listBoxes = valueList.split(",");
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (i == 0){
			listBox.value = user_id;
		} else {
			listBox.value = user_name;
		}
	}
	hiddenUserPanel();
}

//==========================================================
var standardsTarName = "";
var assetstype = "";
function doStandardsLookup(valuelist, assetstypecode, assetsname){
	var __assetstype = assetstypecode;
	var __assetsname = assetsname;
	if (__assetsname == null || __assetsname == undefined)
	{
		__assetsname = "";
	}
	var returnValue = OpenModalWindow(getWebRoot() + "/common/valuelist/standards_select.jsp?assetstype=" + __assetstype + "&assetsname=" + __assetsname, 500, 400);
	if (returnValue != null && returnValue != undefined)
	{
		var listBoxes = valuelist.split(",");
		for(var i = 0; i < listBoxes.length; i ++){
			if (listBoxes[i] == null || listBoxes[i] == ""){
				continue;
			}
			var listBox = $(listBoxes[i]);
			if (listBox == null){
				continue;
			}
			listBox.value = returnValue[i];
		}
	}
}
function hiddenStandardsPanel(){
	var lookupList = $("lookupStandards");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function showStandardsPanel(){
	var lookupList = $("lookupStandards");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = value[1];
			left = value[0];
		}
	}
}
function createStandardsPanel(){
	var point = getPoint();
	var lookupPanel = 
	  "<div id='lookupStandards' style='overflow:auto;position:absolute;top:" + point[1] + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4; display:\"\";z-index:9999;width=260px;height:230px'>"
		+ "</div>";
	document.body.innerHTML += lookupPanel;
	load_StandardsData();
}
function load_StandardsData(){
    var pars = "";
    if (assetstype == ""){
        pars = "";
    } else {
        pars = "assetstype=" + assetstype;
    }
    //alert(pars);
    var t = new AjaxUtils(getWebRoot() + "/common/valuelist/standards_list.jsp", pars, show_Standards_Data, errorHandle, "GET", null);
    t.sendURL();
}
function show_Standards_Data(responseText){
   var obj = $("lookupStandards");
   obj.innerHTML = responseText;
}
function StandardsViewClick(id, o){
    var obj = $("sc" + id);
    standardsTarName = "sm" + id;
    loadStandardsChild(id);
    if (obj != null){
       if (obj.style.display == "none"){
           obj.style.display = "";
           o.src = getWebRoot() + "/images/default/down.gif";
       } else {
           obj.style.display = "none";
           o.src = getWebRoot() + "/images/default/right.gif";
       }
    }
}
function loadStandardsChild(id){
    var obj = $(standardsTarName);
    if (obj.innerText == "正在读取数据......"){
   	    var pars = "standard_id="  + id;
   	    var t = new AjaxUtils(getWebRoot() + "/common/valuelist/standards_list.jsp", pars, showStandardsChild, errorHandle, "GET", null);
        t.sendURL();
    }
}
function showStandardsChild(responseText){
    var obj = $(standardsTarName);
    obj.innerText = '';
    obj.innerHTML = responseText;
}
function doSelectStandardsCode(org_code, org_cname, assetstype, assetsmeasure){
    var values;
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	values = getValues();
	var listBoxes = valueList.split(",");
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		if (i == 0){
			listBox.value = org_code;
		} else if (i == 1){
			listBox.value = org_cname;
		} else if (i == 2){
		    listBox.value = assetstype;
		} else if (i == 3){
		    listBox.value = assetsmeasure;
		}
	}
	hiddenStandardsPanel();
}

//===================================================================
// 参数value为要检索的Standard_Id
// 参数valuelist为检索到的Standard_Name,Assetstype,Assetsmeasure回传控件名
var lookupValuelist = "";
function doLookupStandardsById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=standards&code_value="  + value;
   	doLookupByValue(pars);
}
function doLookupCountryById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=country&code_value="  + value;
   	doLookupByValue(pars);
}
function doLookupPurchaseById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=purchase&code_value="  + value;
   	doLookupByValue(pars);
}
function doLookupUserById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=user&code_value="  + value;
   	doLookupByValue(pars);
}
function doLookupItemNameById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=item&code_value="  + value;
   	doLookupByValue(pars);
}
function doLookupDeptById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=dept&code_value="  + value;
   	doLookupByValue(pars);
}
function doLookupOrgById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=org&code_value="  + value;
   	doLookupByValue(pars);
}
function doLookupAssetsTypeById(value, valuelist){
    if (value == null || value ==undefined || value == ""){
        return;
    }
    lookupValuelist = valuelist;
    var pars = "code_type=assetstype&code_value="  + value;
   	doLookupByValue(pars);
}

function doLookupByValue(pars){
    var t = new AjaxUtils(getWebRoot() + "/DataLookup", pars, showLookupValues, errorHandle, "GET", null);
    t.sendURL();
}
function showLookupValues(s){
    if (s == ""){
        alert('没有检索到符合要求的记录。');
    } else {
        if (lookupValuelist == null || lookupValuelist == undefined || lookupValuelist == ""){
            return;
        } else {
            var values = s.split(",");
            var listBoxes = lookupValuelist.split(",");
            for(var i = 0; i < listBoxes.length; i++){
                var listBox = $(listBoxes[i]);
                if (listBox == null || listBox == undefined){
                    continue;
                }
                listBox.value = values[i];
            }
        }
    }
}

// 显示设备分布信息
function getAssetsDeployInfo(assetsName, dept_Code, devName){
    createAssetsDeployInfo();
    var pars = "";
    pars = "assetsname=" + assetsName + "&dept_code=" + dept_Code + "&dev_name=" + devName;
    var t = new AjaxUtils(getWebRoot() + "/query/assets_deploy.jsp", pars, showAssetsDeployInfo, errorHandle, "GET", null);
    t.sendURL();
}

function showAssetsDeployInfo(s){
    //alert(s);
    var o = $('assetsdeployinfo');
    if (o != null && o != undefined){
        o.innerHTML = s;
    }
}

function createAssetsDeployInfo(){
    if ($('assetsdeployinfo') == null || $('assetsdeployinfo') == undefined){
        var lookupPanel = 
	      "<div id='assetsdeployinfo' style='overflow:auto;position:absolute;top:" + (document.body.scrollTop+event.clientY) + ";"
          + " left:" + (document.body.scrollLeft+event.clientX) + ";BACKGROUND-COLOR:#f4f4f4; display:\"\";z-index:9999'>"
		  + "</div>";
	    document.body.innerHTML += lookupPanel;
	} else {
	    with($('assetsdeployinfo').style){
			top = (document.body.scrollTop+event.clientY);
			left = (document.body.scrollLeft+event.clientX);
			display = "";
		}
	}
}

function hiddenAssetsDeployInfo(){
   var o = $('assetsdeployinfo');
    if (o != null && o != undefined){
        o.style.display = "none";
    }
}
//==========================================================
//
// 知识点选择列表
// 
//==========================================================
function getKnowledgeList(valuelist, courseId, chapterId){
    valueList = valuelist;     
	var lookupList = $("lookupKnowledgeList");
	if (lookupList != null && lookupList != undefined){
		if (lookupList.style.display == "" && valueList == valuelist){
			hiddenKnowledge();
		} else {
		    loadKnowledge(courseId, chapterId);
			dispayKnowledge();
		}
	} else {
		createKnowledge(courseId, chapterId);
	}
}

function hiddenKnowledge(){
	var lookupList = $("lookupKnowledgeList");
	if (lookupList != null && lookupList != undefined){
		lookupList.style.display = "none";
	}
}

function dispayKnowledge(){
	var lookupList = $("lookupKnowledgeList");
	if (lookupList != null && lookupList != undefined){
		with(lookupList.style){
			var value = new Array();
			value = getPoint();
			display = "";
			top = (value[1] + pointTag);
			left = value[0];
		}
	}
}
function createKnowledge(courseId, chapterId){
	var point = getPoint();
    var div = document.createElement("DIV");
	var lookupPanel = 
	  "<div id='lookupKnowledgeList' style='overflow:auto;position:absolute;top:" + (point[1] + pointTag) + ";"
        + " left:" + point[0] + ";BACKGROUND-COLOR:#f4f4f4;border:solid 1px " + borderColor + "; display:\"\";z-index:9999;width=230px;height:260px'>"
		+ "</div>";
    div.innerHTML = lookupPanel;
    document.body.appendChild(div);
	loadKnowledge(courseId, chapterId);
}
function loadKnowledge(courseId, chapterId){
    var pars = "course_id="+courseId+"&chapter_id="+chapterId; 
    var t = new AjaxUtils(getWebRoot() + "KnowledgeHandler.ashx", pars, function(s){var obj = $("lookupKnowledgeList");obj.innerHTML = s;}, errorHandle, "GET", null);
    t.sendURL();
}

function setKnowledgeSelection(_values){
    var values = "";
	if (valueList == null || valueList == undefined){
		return;
	} else if (valueList == ""){
		return;
	}
	if (_values == undefined || _values == null){
		return;
	} else {
	    values = _values.split(",");
	}
	var listBoxes = valueList.split(",");
	
	for(var i = 0; i < listBoxes.length; i ++){
		if (listBoxes[i] == null || listBoxes[i] == ""){
			continue;
		}
		var listBox = $(listBoxes[i]);
		if (listBox == null){
			continue;
		}
		
		var _val = values[i];
		if (_val != null){
			listBox.value = _val;
		} else {
			listBox.value = "";
		}
	}
	hiddenKnowledge();
}
function getExpenseValue(valueList, structureId, year, workId, gradeId, propertyId){
    var pars = "structure_id="+structureId+"&year="+year+"&work_id="+workId+"&grade_id="+gradeId+"&property_id="+propertyId;
    var t = new AjaxUtils(getWebRoot() + "GetExpenseValue.ashx", pars, function(s){var obj = $(valueList);obj.value = s;}, errorHandle, "GET", null);
    t.sendURL();
}


/********************************/
var HB = {
    vlist: "",
    tag: null,
    dataList: null,
    vabsolute: null,
    tagName: null, //目标容器
    tagOpt: null, // 扩展参数,可变
    tagReadId: null, // 扩展参数,不可变
    tagReadKey: null,
    x: 100,
    y: 100,
    w: 300,
    h: 160,
    open: function() {
        alert('a');
    },
    doCheck: function(obj) {
        if (!obj)
            return false;
        if (obj == null || obj == undefined)
            return false;
        return true;
    },
    errorHandle: function(msg) {
        alert(msg);
    },
    showOpen: function(title, url, returnfields, key, _x, _y, _width, _height) {
        if (!this.doCheck(url))
            return false;
        if (!this.doCheck(returnfields))
            return false;
        if (!this.doCheck(key))
            return false;
        if (!this.doCheck(_x)) { _x = this.x; }
        if (!this.doCheck(_y)) { _y = this.y; }
        if (!this.doCheck(_width)) { _width = this.w; }
        if (!this.doCheck(_height)) { _height = this.h; }
        var _sid = "sid=" + key;
        if (this.doCheck(this.tagOpt)) {
            // 扩展参数Create By xqwu 2009-01-07
            _sid += "&opt=" + this.tagOpt;
        }
        if (this.doCheck(this.tagReadKey)) {
            // 扩展参数,不变值
            _sid += "&readid=" + this.tagReadId + "&readkey=" + this.tagReadKey;
        }
        var _returnfields = "&returnfields=" + returnfields;
        var _url = "<iframe id='popFrame' name='popFrame' src='" + url + _sid + _returnfields + "' frameborder='no' border='0' scrolling='auto' width=100% height=100%></iframe>";
        if (!this.doCheck(this.tagName))
            MessageBox._tagName = this.tagName;
        MessageBox.show(title, _url, _x, _y, _width, _height);
    },
    getPublicCodeList: function(valuelistselect, codeType, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 350;
        if (!this.doCheck(_height))
            _height = 260;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("请选择(双击选定内容)", getWebRoot() + "public_list/public_code_select.aspx?", this.vlist, codeType, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getRegionList: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("行政区域选择(双击选定内容)", getWebRoot() + "public_list/public_region_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);

    },
    getRegionListSave: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("行政区域选择(双击选定内容)", getWebRoot() + "public_list/public_regionsave_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);

    },
    getStructureList: function(valuelistselect, parentId, _width, _height, _tagName) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("机构选择(双击选定内容)", getWebRoot() + "public_list/public_structure_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getStructureListPage: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 450;
        if (!this.doCheck(_height))
            _height = 380;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_structurepage_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getStructureListActivePage: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 450;
        if (!this.doCheck(_height))
            _height = 380;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_structureactivepage_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getStructureListQuery: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 520;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 200;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }

        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_structurelist_query.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getStructureListActiveQuery: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 670;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 100;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        this.vabsolute.X = document.body.clientWidth / 2 - (_width / 2);
        this.vabsolute.Y = document.body.clientHeight / 2 - (_height / 2);
        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_structurelistactive_query.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getDepartmentList: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var deptid = ls[1].trim();
        var name = ls[2].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(deptid);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_department_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getDepartmentListPage: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 450;
        if (!this.doCheck(_height))
            _height = 380;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var deptid = ls[1].trim();
        var name = ls[2].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(deptid);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }

        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_departmentpage_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getDepartmentListActivePage: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 450;
        if (!this.doCheck(_height))
            _height = 380;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var deptid = ls[1].trim();
        var name = ls[2].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(deptid);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_departmentactivepage_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getDepartmentListQuery: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 520;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 200;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var deptid = ls[1].trim();
        var name = ls[2].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(deptid);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_departmentlist_query.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getDepartmentListActiveQuery: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 520;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 200;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var deptid = ls[1].trim();
        var name = ls[2].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(deptid);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("单位选择(双击选定内容)", getWebRoot() + "public_list/public_departmentlistactive_query.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getDepartmentListRegister: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = document.body.clientWidth - 10;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 10;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var deptid = ls[1].trim();
        var name = ls[2].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(deptid);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.vabsolute.X = document.body.offsetTop + 2;
        this.vabsolute.Y = document.body.offsetLeft + 2;
        //
        this.showOpen("单位注册", getWebRoot() + "portal/register/structure_register.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y, _width, _height);
    },
    getEmployeeListQuery: function(valuelistselect, parentId, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 520;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 200;
        if (!this.doCheck(parentId))
            parentId = "0";

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var deptid = ls[1].trim();
        var name = ls[2].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(deptid);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            //this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("人员选择(双击选定内容)", getWebRoot() + "public_list/public_employee_select.aspx?", this.vlist, parentId, this.vabsolute.X - 300, this.vabsolute.Y + tag.offsetHeight - 37, _width, _height);
    },
    getResourceList: function(valuelistselect, codeType, _width, _height) {
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 420;
        if (!this.doCheck(_height))
            _height = 300;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("资源选择(双击选定内容)", getWebRoot() + "public_list/public_resource_select.aspx?", this.vlist, codeType, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getSpecialtyList: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 330;
        if (!this.doCheck(_height))
            _height = 280;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("专业选择(双击选定内容)", getWebRoot() + "public_list/public_specialty_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getSpecialtyListSave: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 330;
        if (!this.doCheck(_height))
            _height = 280;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("专业选择(双击选定内容)", getWebRoot() + "public_list/public_specialtysave_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getReportSpecialtyListSave: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 330;
        if (!this.doCheck(_height))
            _height = 280;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("打印专业选择(双击选定内容)", getWebRoot() + "public_list/public_reportspecialtysave_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getTradeList: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("行业选择(双击选定内容)", getWebRoot() + "public_list/public_trade_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getTradeListSave: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("行业选择(双击选定内容)", getWebRoot() + "public_list/public_tradesave_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getCodeTypeList: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("代码类型选择(双击选定内容)", getWebRoot() + "public_list/public_codetype_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getFunctionList: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("功能选择(双击选定内容)", getWebRoot() + "public_list/public_function_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getRoleList: function(valuelistselect, parentId, _width, _height, _tagName) {
        // 
        if (!this.doCheck(valuelistselect))
            return false;
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (!this.doCheck(parentId))
            parentId = "0";
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);
        this.vabsolute = DOM.getPosition(tag);
        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        //
        this.showOpen("角色选择(双击选定内容)", getWebRoot() + "public_list/public_role_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getCourseList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 550;
        if (!this.doCheck(_height))
            _height = 350;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("课程选择(双击选定内容)", getWebRoot() + "public_list/public_course_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getCoursewareList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 550;
        if (!this.doCheck(_height))
            _height = 380;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("课件选择(双击选定内容)", getWebRoot() + "public_list/public_courseware_choose.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getReportResultDetail: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        //if (!this.doCheck(valuelistselect))
        //    return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 550;
        if (!this.doCheck(_height))
            _height = 380;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        //var ls = this.vlist.split(",");
        //var id = ls[0].trim();
        //var name = ls[1].trim();

        //var tag = DOM.$(name);
        //if (tag == null || tag == undefined)
        //    tag = DOM.$(id);

        //this.vabsolute = DOM.getPosition(tag);

        //
        //if ((this.vabsolute.X + _width) > document.body.clientWidth) {
        //    this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        //}
        //if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
        //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        //}

        //
        this.showOpen("专业课程选择(双击选定内容)", getWebRoot() + "portal/report/report_userdetail_select.aspx?", this.vlist, parentId, document.body.clientWidth / 2 - (_width / 2), document.body.clientHeight / 2 - (_height / 2), _width, _height);
    },
    getChapterList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 230;
        if (!this.doCheck(_height))
            _height = 260;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("章节选择(双击选定内容)", getWebRoot() + "public_list/public_chapter_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getCourseChapterList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 550;
        if (!this.doCheck(_height))
            _height = 380;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("章节选择(双击选定内容)", getWebRoot() + "public_list/public_coursechaptertree_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getCourseLocusList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 550;
        if (!this.doCheck(_height))
            _height = 350;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("课程场地选择", getWebRoot() + "public_list/public_course_locus_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getExamList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 550;
        if (!this.doCheck(_height))
            _height = 350;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("考试选择", getWebRoot() + "public_list/public_exam_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setUserRestorePassword: function(valuelistselect, parentId, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        if (arrId.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 350;
        if (!this.doCheck(_height))
            _height = 220;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        var url = getWebRoot() + "portal/system/user_restore_password.aspx?";
        //
        this.showOpen("重置密码", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setCourseCourseware: function(valuelistselect, parentId, parentUrl, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        var arrUrl = [parentUrl];
        if (arrId.length <= 0 || arrUrl.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 530;
        if (!this.doCheck(_height))
            _height = 380;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        var url = getWebRoot() + parentUrl;
        //
        this.showOpen("课程课件配置", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setCoursewareSpecialty: function(valuelistselect, parentId, parentUrl, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        var arrUrl = [parentUrl];
        if (arrId.length <= 0 || arrUrl.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 530;
        if (!this.doCheck(_height))
            _height = 450;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        var url = getWebRoot() + parentUrl;
        //
        this.showOpen("课件专业配置", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setCourseLocus: function(valuelistselect, parentId, parentUrl, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        var arrUrl = [parentUrl];
        if (arrId.length <= 0 || arrUrl.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 350;
        if (!this.doCheck(_height))
            _height = 320;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        var url = getWebRoot() + parentUrl;
        //
        this.showOpen("课程场地配置", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setExamPaper: function(valuelistselect, parentId, parentUrl, _width, _height) {
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        var arrUrl = [parentUrl];
        if (arrId.length <= 0 || arrUrl.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 350;
        if (!this.doCheck(_height))
            _height = 320;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        parentUrl += parentUrl.indexOf("?") == -1 ? "?" : "";
        var url = getWebRoot() + parentUrl;
        //
        this.showOpen("考试试卷配置", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setExamRule: function(valuelistselect, parentId, parentUrl, _width, _height) {
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        var arrUrl = [parentUrl];
        if (arrId.length <= 0 || arrUrl.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 350;
        if (!this.doCheck(_height))
            _height = 320;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        parentUrl += parentUrl.indexOf("?") == -1 ? "?" : "";
        var url = getWebRoot() + parentUrl;
        //
        this.showOpen("考试组卷规则配置", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setExamLocus: function(valuelistselect, parentId, parentUrl, _width, _height) {
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        var arrUrl = [parentUrl];
        if (arrId.length <= 0 || arrUrl.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 350;
        if (!this.doCheck(_height))
            _height = 320;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        parentUrl += parentUrl.indexOf("?") == -1 ? "?" : "";
        var url = getWebRoot() + parentUrl;
        //
        this.showOpen("考试场地配置", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setExamSchedule: function(valuelistselect, parentId, parentUrl, _width, _height) {
        if (!this.doCheck(valuelistselect))
            return false;
        var arrId = [parentId];
        var arrUrl = [parentUrl];
        if (arrId.length <= 0 || arrUrl.length <= 0) {
            alert("参数配置不正确，请检查。");
            return false;
        }

        if (!this.doCheck(_width))
            _width = 350;
        if (!this.doCheck(_height))
            _height = 320;

        this.vlist = valuelistselect;

        var tag = this.vlist;
        if (tag == null || tag == undefined)
            return false;

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        parentUrl += parentUrl.indexOf("?") == -1 ? "?" : "";
        var url = getWebRoot() + parentUrl;
        //
        this.showOpen("考试安排配置", url, this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getAdvertiserList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 550;
        if (!this.doCheck(_height))
            _height = 350;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("广告客户选择", getWebRoot() + "public_list/public_advertiser_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getAdvertiseList: function(valuelistselect, parentId, parentKey, readId, readKey, _width, _height) {
        //
        this.tagOpt = null;
        this.tagReadId = null;
        this.tagReadKey = null;
        //
        if (!this.doCheck(valuelistselect))
            return false;
        if (this.doCheck(parentId) && this.doCheck(parentKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrId = [parentId];
            var arrKey = [parentKey];
            if (arrId.length != arrKey.length) {
                return false;
            }
        }
        if (this.doCheck(readId) && this.doCheck(readKey)) {
            // 判断两个参数传递值数量不对应,则退出
            var arrReadId = [readId];
            var arrReadKey = [readKey];
            if (arrReadId.length != arrReadKey.length) {
                return false;
            }
        }
        if (!this.doCheck(_width))
            _width = 580;
        if (!this.doCheck(_height))
            _height = 350;
        if (this.doCheck(parentKey))
            this.tagOpt = parentKey;
        if (!this.doCheck(parentId))
            parentId = "0";
        // 不变参数值
        if (this.doCheck(readId))
            this.tagReadId = readId;
        if (this.doCheck(readKey))
            this.tagReadKey = readKey;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        var tag = DOM.$(name);
        if (tag == null || tag == undefined)
            tag = DOM.$(id);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        //
        this.showOpen("广告位选择", getWebRoot() + "public_list/public_advertise_select.aspx?", this.vlist, parentId, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    getUploadManage: function(valuelistselect, accessoryid, resourceid, resourcetype, path, content, _width, _height) {

        if (!this.doCheck(valuelistselect))
            return false;
        var _sid = accessoryid;
        if (accessoryid != null && accessoryid != undefined && accessoryid != "") {
            _sid = accessoryid;
        }
        else {
            _sid = resourceid;
        }

        if (_sid == null || _sid == undefined || _sid == "") {
            alert("数据输入不完整，请检查。");
            return false;
        }
        if (resourceid == null || resourceid == undefined || resourceid == "") {
            resourceid = _sid;
        }
        if (resourcetype == null || resourcetype == undefined || resourcetype == "") {
            alert("类别不能为空，请检查。");
            return false;
        }
        if (!this.doCheck(_width))
            _width = 380;
        if (!this.doCheck(_height))
            _height = 150;

        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        if (ls.length > 1)
            var name = ls[1].trim();

        var tag = DOM.$(id);
        if (tag == null || tag == undefined)
            tag = DOM.$(name);

        this.vabsolute = DOM.getPosition(tag);

        //
        if ((this.vabsolute.X + _width) > document.body.clientWidth) {
            this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
        }
        if ((this.vabsolute.Y + _height) > document.body.clientHeight) {
            //this.vabsolute.Y = this.vabsolute.Y - _height - tag.offsetHeight;
        }
        var arr = new Array();
        arr.push("accessoryid=" + _sid);
        arr.push("resourceid=" + ((resourceid == null || resourceid == undefined || resourceid == "") ? "" : resourceid));
        arr.push("resourcetype=" + ((resourcetype == null || resourcetype == undefined || resourcetype == "") ? "" : resourcetype));
        arr.push("path=" + ((path == null || path == undefined || path == "") ? "" : path));
        arr.push("content=" + ((content == null || content == undefined || content == "") ? "" : content));
        var _returnfields = "returnfields=" + this.vlist;
        var url = getWebRoot() + "FileManager.aspx?" + _returnfields + "&" + arr.join("&");

        var _url = "<iframe id='popFrame' name='popFrame' src='" + url + "' frameborder='no' border='0' scrolling='auto' width=100% height=100%></iframe>";
        if (!this.doCheck(this.tagName))
            MessageBox._tagName = this.tagName;
        MessageBox.show("附件上传", _url, this.vabsolute.X, this.vabsolute.Y + tag.offsetHeight, _width, _height);
    },
    setOpenUrl: function(valuelistselect, url, _width, _height, _tagName) {

        //
        if (url == null || url == undefined || url == "")
            return false;
        if (!this.doCheck(_width))
            _width = document.body.clientWidth - 2;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 2;
        //        
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //
        // 定义
        this.vabsolute = {};
        this.vabsolute.X = document.body.clientWidth / 2;
        this.vabsolute.Y = document.body.clientHeight / 2;
        //
        if (valuelistselect != null && valuelistselect != undefined && valuelistselect != "") {
            this.vlist = valuelistselect;
            var ls = this.vlist.split(",");
            var id = ls[0].trim();
            var name;
            var tag;
            if (ls.length > 1)
                name = ls[1].trim();
            if (name)
                tag = DOM.$(name);
            if (tag == null || tag == undefined)
                tag = DOM.$(id);
            this.vabsolute = DOM.getPosition(tag);

            //
            _width = 550;
            _height = 350;
            this.vabsolute = DOM.getPosition(tag);
            if ((this.vabsolute.X + _width) > document.body.clientWidth) {
                this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
            }
            this.vabsolute.Y = this.vabsolute.Y + tag.offsetHeight;
        }
        else {
            this.vabsolute.X = 0.1;
            this.vabsolute.Y = 0.1;
        }
        var ourl = getWebRoot() + url;
        var _url = "<iframe id='popFrame' name='popFrame' src='" + ourl + "' frameborder='no' border='0' scrolling='auto' width=100% height=100%></iframe>";
        if (document.body.style) {

            //document.body.style.overflow = "hidden";
            //document.body.style.marginRight = "0";
            //document.getElementsByTagName('body')[0].style.overflow = 'hidden';
            //document.getElementsByTagName('body')[0].scroll = "no";
        }
        if (!this.doCheck(this.tagName))
            MessageBox._tagName = this.tagName;
        MessageBox.show("", _url, this.vabsolute.X, this.vabsolute.Y, _width, _height);
    },
    setOpenUrlCenter: function(valuelistselect, url, _width, _height, _tagName) {

        //
        if (url == null || url == undefined || url == "")
            return false;
        if (!this.doCheck(_width))
            _width = document.body.clientWidth - 2;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 10;
        //        
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //
        // 定义
        this.vabsolute = {};

        //
        if (valuelistselect != null && valuelistselect != undefined && valuelistselect != "") {
            this.vlist = valuelistselect;
            var ls = this.vlist.split(",");
            var id = ls[0].trim();
            var name;
            var tag;
            if (ls.length > 1)
                name = ls[1].trim();
            if (name)
                tag = DOM.$(name);
            if (tag == null || tag == undefined)
                tag = DOM.$(id);
            this.vabsolute = DOM.getPosition(tag);

            //
            _width = 550;
            _height = 350;
            this.vabsolute = DOM.getPosition(tag);
            if ((this.vabsolute.X + _width) > document.body.clientWidth) {
                this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
            }
            this.vabsolute.Y = this.vabsolute.Y + tag.offsetHeight;
        }
        else {
            this.vabsolute.X = document.body.clientWidth / 2 - (_width / 2);
            this.vabsolute.Y = document.body.clientHeight / 2 - (_height / 2);
        }
        var ourl = getWebRoot() + url;
        var _url = "<iframe id='popFrame' name='popFrame' src='" + ourl + "' frameborder='no' border='0' scrolling='auto' width=100% height=100%></iframe>";

        if (!this.doCheck(this.tagName))
            MessageBox._tagName = this.tagName;
        MessageBox.show("", _url, this.vabsolute.X, this.vabsolute.Y, _width, _height);
    },
    setOpenUrlCenterText: function(valuelistselect, url, _width, _height, _tagName) {
        //
         
        if (url == null || url == undefined || url == "")
            return false;
        if (!this.doCheck(_width))
            _width = document.body.clientWidth - 2;
        if (!this.doCheck(_height))
            _height = document.body.clientHeight - 10;
        //        
        if (!this.doCheck(_tagName))
            this.tagName = _tagName; //
        // 定义
        this.vabsolute = {};

        //
        if (valuelistselect != null && valuelistselect != undefined && valuelistselect != "") {
            this.vlist = valuelistselect;
            var ls = this.vlist.split(",");
            var id = ls[0].trim();
            var name;
            var tag;
            if (ls.length > 1)
                name = ls[1].trim();
            if (name)
                tag = DOM.$(name);
            if (tag == null || tag == undefined)
                tag = DOM.$(id);
            this.vabsolute = DOM.getPosition(tag);

            //
            _width = 550;
            _height = 350;
            this.vabsolute = DOM.getPosition(tag);
            if ((this.vabsolute.X + _width) > document.body.clientWidth) {
                this.vabsolute.X = this.vabsolute.X - _width + tag.offsetWidth;
            }
            this.vabsolute.Y = this.vabsolute.Y + tag.offsetHeight;
        }
        else {
            this.vabsolute.X = document.body.clientWidth / 2 - (_width / 2);
            this.vabsolute.Y = document.body.clientHeight / 2 - (_height / 2);
        }
        var ourl = getWebRoot() + url;
        var _url = "<div id='popFrame' name='popFrame' width=100% height=100%>" + url + "</div>";

        if (!this.doCheck(this.tagName))
            MessageBox._tagName = this.tagName;
        MessageBox.show("", _url, this.vabsolute.X, this.vabsolute.Y, _width, _height);
    },
    getWdatePicker: function(valuelistselect) {
        // 引用WdatePicker
        if (typeof (WdatePicker) == 'function') {
            WdatePicker({ el: DOM.$(valuelistselect), dateFmt: 'yyyy-MM-dd', alwaysUseStartDate: true });
        }
    },
    getWdataPickerMaxDate: function(valuelistselect) {
        if (!this.doCheck(valuelistselect))
            return;
        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        if (typeof (WdatePicker) == 'function') {
            WdatePicker({ el: DOM.$(id), maxDate: '#F{$dp.$D(\'' + name + '\')}' })
        }
    },
    getWdataPickerMinDate: function(valuelistselect) {
        if (!this.doCheck(valuelistselect))
            return;
        this.vlist = valuelistselect;
        var ls = this.vlist.split(",");
        var id = ls[0].trim();
        var name = ls[1].trim();

        if (typeof (WdatePicker) == 'function') {

            WdatePicker({ el: DOM.$(id), minDate: '#F{$dp.$D(\'' + name + '\')}' })
        }
    },
    setValues: function(_values) {
        var values;
        if (valueList == null || valueList == undefined) {
            return;
        } else if (valueList == "") {
            return;
        }
        if (_values == undefined || _values == null) {
            values = getValues();
        } else {
            values = _values.split(",");
        }
        var listBoxes = valueList.split(",");

        for (var i = 0; i < listBoxes.length; i++) {
            if (listBoxes[i] == null || listBoxes[i] == "") {
                continue;
            }
            var listBox = $(listBoxes[i]);
            if (listBox == null) {
                continue;
            }

            var _val = values[i];
            if (_val != null) {
                listBox.value = _val;
            } else {
                listBox.value = "";
            }
        }

    }
}




/***********************************************
*   华博JS代码表
*   @author:RobinSen
*   @since:2008-08-22
************************************************/

var seaflag = true;
var mnuid = "";
function selectTag(showContent, selfObj) {
    var tag = document.getElementById("tags").getElementsByTagName("li");
    var taglength = tag.length;
    for (i = 0; i < taglength; i++) {
        tag[i].className = "";
    }
    selfObj.parentNode.className = "selectTag";
    for (i = 0; j = document.getElementById("tagcontent" + i); i++) {
        j.style.display = "none";
    }
    document.getElementById(showContent).style.display = "block";
}
function changesea() {
    var obj = document.getElementById("search-table");
    if (seaflag) {
        obj.style.display = "none";
    } else {
        obj.style.display = "block";
    }
    seaflag = !seaflag;
}
function changemnu(objid) {
    var obj = document.getElementById(objid);
    if (mnuid != "") {
        var obj1 = document.getElementById(mnuid);
        obj1.className = mnuid;
    }
    obj.className = objid + "_on";
    mnuid = objid;
}
function changemnu1() {
    var obj1 = document.getElementById(mnuid);
    obj1.className = mnuid;
    mnuid = "";
}
/*全选,以fieldname来区分多个表格*/
function AutoSelectList(form, fieldname) {
    for (var i = 0; i < form.elements.length; i++) {
        if ((form.elements[i].type == 'checkbox') && (form.elements[i].name.indexOf(fieldname) > -1)) {
            form.elements[i].checked = !form.elements[i].checked;
        }
    }
}
/*全选,只有单个表格时用*/
function AutoSelectList2(form) {
    for (var i = 0; i < form.elements.length; i++) {
        form.elements[i].checked = !form.elements[i].checked;
    }
}
/*全选,以fieldname来区分多个表格*/
function AutoSelectList3(form, fieldname) {

    for (var i = 0; i < form.elements.length; i++) {
        if ((form.elements[i].type == 'checkbox') && (form.elements[i].name != fieldname.name)) {
            form.elements[i].checked = fieldname.checked;
        }
    }
}
/*取选择的值*/
function selectChecked(form, fieldname) {
    var x = new Array();
    for (var i = 0; i < form.elements.length; i++) {
        if ((true == form.elements[i].checked) && (form.elements[i].type == 'checkbox')
            && (form.elements[i].name.indexOf(fieldname) == -1))
            x.push(form.elements[i].value);
    }
    return x.join(",");
}
/* 选择当前节点时同时选中父节点*/
function changecheck(form, selectCheck) {
    for (var i = 0; i < form.elements.length; i++) {

        if (form.elements[i].name.indexOf("treecheckbox_") > -1) {
            var p = form.elements[i].getAttribute("parent");

            if (p != null && p == selectCheck.value) {
                form.elements[i].checked = selectCheck.checked;
            }
        }
    }
    p = selectCheck.getAttribute("parent");
    var pp = document.all("treecheckbox_" + p);
    if (selectCheck.checked && pp) {
        pp.checked = "checked";
    }
}
/*初始化*/
function initcheckselect(s, flag, form) {
    var arr = s.split(',');
    for (var i = 0; i < arr.length; i++) {
        var obj = document.all(flag + arr[i]);
        if (obj) obj.checked = "checked";
    }
}
/*初始化form*/
function initcheckselectfrm(s, flag, frm) {
    var arr = s.split(',');
    for (var i = 0; i < arr.length; i++) {
        var obj = frm.all(flag + arr[i]);
        if (obj) obj.checked = "checked";
    }
}
/*清空选择*/
function initclearcheckselectfrm(flag, frm) {
    if (frm == undefined || frm == null) {
        return;
    }
    for (var i = 0; i < frm.elements.length; i++) {
        if (frm.elements[i].name.indexOf(flag) > -1) {
            if (frm.elements[i].checked) {
                frm.elements[i].checked = false;
            }
        }
    }
}
/*选择的名称*/
function getCheckSelectNamefrm(s, flag, frm) {
    var arr = s.split(',');
    var list = new Array();
    for (var i = 0; i < arr.length; i++) {
        var obj = frm.all(flag + arr[i]);
        if (obj)
            list.push(obj.nodetext);
    }
    return list.join(',');
}
/*获取树选择项目的值*/
function getSelectCheck(form, flag) {
    var selectValue = new Array();
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].name.indexOf(flag) > -1) {
            if (form.elements[i].checked) {
                selectValue.push(form.elements[i].value);
            }
        }
    }
    return selectValue.join(",");
}
/* 获取树选择项目的的名称项*/
function getSelectCheckText(form, flag) {
    var selectValue = new Array();
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].name.indexOf(flag) > -1) {
            if (form.elements[i].checked) {
                selectValue.push(escape(form.elements[i].getAttribute("nodetext")));
            }
        }
    }
    return selectValue.join(",");
}
/*获取树所有项的值create by 2009-03-13*/
function getSelectCheckAll(form, flag) {
    var selectValue = new Array();
    for (var i = 0; i < form.elements.length; i++) {
        if (form.elements[i].name.indexOf(flag) > -1) {             
             selectValue.push(form.elements[i].value);             
        }
    }
    return selectValue.join(",");
}
/*
代码描述：单击选择变颜色 
 
传入参数：e.Item.Attributes.Add("OnClick","SetBgcolor('"+ClientID + "', 'DataGrid1', '"+e.Item.ItemIndex.ToString()+"');");
  
返回参数：无  

修改记录：姓名              日期                 内容
*/
var RowNO = 0
/*设置背景色*/
function selectBgcolor(varClientID, varDataGrid, Rowid) {
    var varID;
    varID = (varClientID != undefined && varClientID != null && varClientID != "" ? varClientID + "_" : varClientID) + varDataGrid;
    if (!document.all(varID))
        return false;
    if (document.all(varID).rows == undefined || document.all(varID).rows == null)
        return false;
    if (RowNO > 0) {
        if (typeof (document.all(varID).rows[RowNO]) == 'object') {
            document.all(varID).rows[RowNO].bgColor = "";
            if (document.all(varID).rows[RowNO].style) {
                document.all(varID).rows[RowNO].style.cursor = "";
            }
        }
    }
    RowNO = parseInt(Rowid) + 1;
    if (typeof (document.all(varID).rows[RowNO]) == 'object') {
        document.all(varID).rows[RowNO].bgColor = "#B9E3F5";
        if (document.all(varID).rows[RowNO].style) {
            document.all(varID).rows[RowNO].style.cursor = "hand";
        }
    }
}

/**/
function checkPWD(me) {
    $('chkPwd').style.display = 'none';
    $("chkPwd").innerHTML = '';
    if (me == "") {
        $("chkpswd").className = "PSW_P_0";
        $("chkPwd").innerHTML = "不能为空";
        $('chkPwd').style.display = '';
        return false;
    } else if (me.length < 6) {
        $("chkpswd").className = "PSW_P_1";
        $("chkpswdcnt").innerHTML = "太短";
        return false;
    } else if (!isPassword(me) || !/^[^%&]*$/.test(me) || me.length > 16) {
        $("chkpswd").className = "PSW_P_0";
        $("chkPwd").innerHTML = "请输入6～16位字符的密码,不包含&或$";
        $('chkPwd').style.display = '';
        return false;
    } else {
        /**/
        var csint = checkStrong(me);
        switch (csint) {
            case 1:
                $("chkpswdcnt").innerHTML = "很弱";
                $("chkpswd").className = "PSW_P_" + (csint + 1);
                break;
            case 2:
                $("chkpswdcnt").innerHTML = "一般";
                $("chkpswd").className = "PSW_P_" + (csint + 1);
                break;
            case 3:
                $("chkpswdcnt").innerHTML = "很强";
                $("chkpswd").className = "PSW_P_" + (csint + 1);
                break;
        }
        return true;
    }
}

function CharMode(iN) {
    if (iN >= 48 && iN <= 57) //数字 
        return 1;
    if (iN >= 65 && iN <= 90) //大写字母 
        return 2;
    if (iN >= 97 && iN <= 122) //小写 
        return 4;
    else
        return 8; //特殊字符 
}
//bitTotal函数 
//计算出当前密码当中一共有多少种模式 
function bitTotal(num) {
    modes = 0;
    for (i = 0; i < 4; i++) {
        if (num & 1) modes++;
        num >>>= 1;
    }
    return modes;
}
//checkStrong函数 
//返回密码的强度级别 
function checkStrong(sPW) {
    Modes = 0;
    for (i = 0; i < sPW.length; i++) {
        //测试每一个字符的类别并统计一共有多少种模式. 
        Modes |= CharMode(sPW.charCodeAt(i));
    }
    return bitTotal(Modes);
}


/**/
function isPassword(str) {
    var len;
    var i;
    len = 0;
    for (i = 0; i < str.length; i++) {
        if (str.charCodeAt(i) > 255) return false;
    }
    return true;
}
//
function isMobile(mobile) {
    return /^13\d{9}$/.test(mobile) | /^15\d{9}$/.test(mobile) | /^18\d{9}$/.test(mobile);
}
//
function isEmail(alt_email) {
    ///^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
    return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(alt_email);
}
function isTelephone(tele) {
    return /(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/.test(tele);
}

//检查手机号码
function checkMobile(me) {
    if (!isMobile(me.value)) {
        return false;
    }
    return true;
}
function checkEmail(me) {
    if (!isEmail(me.value)) {
        return false;
    }
    return true;
}
function checkTelephone(me) {
    if (!isTelephone(me.value)) {
        return false;
    }
    return true;
}
//计算字符数，一个中文2个字符
function fLen(Obj) {
    var nCNLenth = 0;
    var nLenth = Obj.length;
    for (var i = 0; i < nLenth; i++) {
        if (Obj.charCodeAt(i) > 255) {
            nCNLenth += 2;
        } else {
            nCNLenth++;
        }
    }
    return nCNLenth;
}

//
// 清除页面参数
//
function doPageClear(frm) {
    if (fieldDEFClear == null || fieldDEFClear == undefined) {
        return;
    }
    var args = fieldDEFClear.split(",");
    var formElements;
    for (var i = 0; i < args.length; i++) {
        formElements = document.getElementById(args[i]);
        if (formElements == null) {
            continue;
        }
        switch (formElements.type.toLowerCase()) {
            case 'text':
                formElements.value = "";
                break;
            case 'password':
                formElements.value = "";
                break;
            case 'textarea':
                formElements.value = "";
                break;
            case 'hidden':
                formElements.value = "";
                break;
            case 'select':
                formElements.value = "";
                break;
            case 'select-one':
                formElements.value = "";
                break;
            case 'select-multiple':
                formElements.value = "";
                break;
        }
    }
}




//显示提示层
function showMsgInfo(obj, objleftoffset, objtopoffset, title, info, objheight, showtype, objtopfirefoxoffset) {

    var p = getposition(obj);

    if ((showtype == null) || (showtype == "")) {
        showtype == "up";
    }
    document.getElementById('hintiframe' + showtype).style.height = objheight + "px";
    document.getElementById('hintinfo' + showtype).innerHTML = info;
    document.getElementById('hintdiv' + showtype).style.display = 'block';

    if (objtopfirefoxoffset != null && objtopfirefoxoffset != 0 && !isie()) {
        document.getElementById('hintdiv' + showtype).style.top = p['y'] + parseInt(objtopfirefoxoffset) + "px";
    }
    else {
        if (objtopoffset == 0) {
            if (showtype == "up") {
                document.getElementById('hintdiv' + showtype).style.top = p['y'] - document.getElementById('hintinfo' + showtype).offsetHeight - 30 + "px";
            }
            else {
                document.getElementById('hintdiv' + showtype).style.top = p['y'] + obj.offsetHeight + 1 + "px";
            }
        }
        else {
            document.getElementById('hintdiv' + showtype).style.top = p['y'] + objtopoffset + "px";
        }
    }
    document.getElementById('hintdiv' + showtype).style.left = p['x'] + objleftoffset + "px";
}



//隐藏提示层
function hideMsgInfo() {
    if (document.getElementById('hintdivup')) {
        document.getElementById('hintdivup').style.display = 'none';
    }
    if (document.getElementById('hintdivdown')) {
        document.getElementById('hintdivdown').style.display = 'none';
    }
}
//取得控件位置
function getposition(obj) {
    var r = new Array();
    r['x'] = obj.offsetLeft;
    r['y'] = obj.offsetTop;
    while (obj = obj.offsetParent) {
        r['x'] += obj.offsetLeft;
        r['y'] += obj.offsetTop;
    }
    return r;
}


//
// 显示提示层
//
function window.onload() {
    initShowMsg();
}
//
//
//
function initShowMsg() {
    var msg = "";
    var root = "../";
    if (getWebRoot()) {
        root = getWebRoot();
    }
    var tag = document.getElementById('saveBottomMessag');
    if (tag != null && tag != undefined) {
        msg = "<!--msg start-->" +
	          "  <span id=\"hintdivup\" style=\"display:none; position:absolute;z-index:500;border:\"> " +
              "  <div style=\"position:absolute; visibility: visible; width: 271px;z-index:501;\"> " +
              "  <p><img src=\"" + root + "images/commandbg.gif\" /></p> " +
              " <div class=\"messagetext\"><img src=\"" + root + "images/dot.gif\" /><span id=\"hintinfoup\" ></span></div> " +
              "  <p><img src=\"" + root + "images/commandbg2.gif\" /></p> " +
              "  </div>" +
              "  <iframe id=\"hintiframeup\" style=\"position:absolute;z-index:100;width:266px;scrolling:no;\" frameborder=\"0\"></iframe> " +
              "  </span>" +
              "  <!--msg center-->" +
              "  <span id=\"hintdivdown\" style=\"display:none; position:absolute;z-index:500;\">" +
              "  <div style=\"position:absolute; visibility: visible; width: 271px;z-index:501;\">" +
              "  <p><img src=\"" + root + "images/commandbg3.gif\" /></p>" +
              "  <div class=\"messagetext\"><img src=\"" + root + "images/dot.gif\" /><span id=\"hintinfodown\" ></span></div>" +
              "  <p><img src=\"" + root + "images/commandbg4.gif\" /></p>" +
               " </div>" +
              "  <iframe id=\"hintiframedown\" style=\"position:absolute;z-index:100;width:266px;scrolling:no;\" frameborder=\"0\"></iframe>" +
              "  </span>";
        tag.innerHTML = msg;
    }
}
//
//
//
function initShowMsgTag(_width, _height) {
    var msg = "";
    var root = "../";
    if (getWebRoot()) {
        root = getWebRoot();
    }
    if (_width == null || _width == undefined) {
        _width = 271;
    }
    if (_height == null || _height == undefined) {
        _height = 50;
    }
    var tag = document.getElementById('saveBottomMessag');
    if (tag != null && tag != undefined) {
        msg = "<!--msg start-->" +
	          "  <span id=\"hintdivup\" style=\"display:none; position:absolute;z-index:500;\"> " +
              "  <div style=\"position:absolute; visibility: visible; width: " + _width + "px;z-index:501;\"> " +
              "  <p><img src=\"" + root + "images/commandbg_2.gif\" /></p> " +
              " <div class=\"messagetext\" style='z-index:501;'><img src=\"" + root + "images/dot_2.gif\" /><span id=\"hintinfoup\" ></span></div> " +
              "  <p><img src=\"" + root + "images/commandbg2_2.gif\" /></p> " +
              "  </div>" +
              "  <iframe id=\"hintiframeup\" style=\"position:absolute;z-index:100;width:" + (_width - 5) + "px;scrolling:no;\" frameborder=\"0\"></iframe> " +
              "  </span>" +
              "  <!--msg center-->" +
              "  <span id=\"hintdivdown\" style=\"display:none; position:absolute;z-index:500;\">" +
              "  <div style=\"position:absolute; visibility: visible; width: " + _width + "px;z-index:501;\">" +
              "  <p><img src=\"" + root + "images/commandbg3_2.gif\" /></p>" +
              "  <div class=\"messagetext\" style='z-index:501;'><img src=\"" + root + "images/dot_2.gif\" /><span id=\"hintinfodown\" ></span></div>" +
              "  <p><img src=\"" + root + "images/commandbg4_2.gif\" /></p>" +
               " </div>" +
              "  <iframe id=\"hintiframedown\" style=\"position:absolute;z-index:100;width:" + (_width - 5) + "px;scrolling:no;\" frameborder=\"0\"></iframe>" +
              "  </span>";
        tag.innerHTML = msg;
    }
}


/*
DOM 操作 获得指定ID的节点
*/
var DOM = {

    $: function(id) {
        if (this.isDomNode(id)) {
            return id;
        }
        return document.getElementById(id || '');
    },
    createElement: function(tag, attrs, parent) {

        var e = document.createElement(tag);
        if (attrs) {
            for (o in attrs) e[o] = attrs[o];
        }
        if (!parent) {
            parent = document.body;
        }
        return parent.appendChild(e);
    },
    isDomNode: function(obj) {
        return (obj && (obj.tagName));
    },
    getPosition: function(e) {
        if (!e) { return null; }

        var ttop = e.offsetTop;

        var tleft = e.offsetLeft;
        while (e = e.offsetParent) {
            ttop += (e.offsetTop - e.scrollTop);
            tleft += (e.offsetLeft - e.scrollLeft);
        }
        return { X: tleft, Y: ttop };
    }
}
var MessageBox = {
    _innerName: "__msgboxWin",
    _tagName: null,
    _init: function(tagid, sflag, par) {
        var win = DOM.$(tagid);
        if (win) {
            return win;
        }

        if (this._tagName != null && this._tagName != undefined)
            par = this._tagName;

        win = DOM.createElement("DIV", { id: tagid, onselectstart: function() { return false; }, className: "msgbox" }, par);
        var str = "";
        if (sflag != true) {
            str = "<span class=msgbox_close onclick=\"this.parentNode.style.display='none';\"></span>" +
                        "<span class=msgbox_resize onmousedown=\"MessageBox.resize(this.parentNode);\"></span>";
        }
        win.innerHTML = str + "<table cellspacing=0 cellpadding=0 border=0 class=msgbox_tbl>" +
                                " <tr class=msgbox_title ondblclick=\"this.parentNode.parentNode.parentNode.style.display='none';\"><td onmousedown=\"MessageBox.move(this.parentNode.parentNode.parentNode.parentNode);\"></td></tr>" +
                                "   <tr><td class=msgbox_body><DIV></DIV></td></tr></table>" +
                                "   <IFRAME class=\"divIframe\" style=\"width:100%;height:100%;\" frameborder=0 border=0></IFRAME>";
        return win;
    },
    show: function(title, context, x, y, width, height) {
        try {
            var topwin = window;
            while (topwin != top) {
                topwin = topwin.parent;
            }

            var win = MessageBox._init("__msgboxWin");

            if (typeof (win.children[2].cells[0]) == "object")
                win.children[2].cells[0].innerText = title;
            if (typeof (win.children[2].cells[1].children[0]) == "object")
                win.children[2].cells[1].children[0].innerHTML = context;
            if (x && x != null && y && y != null) {
                win.style.marginLeft = 0;
                win.style.marginTop = 0;
                win.style.left = x;
                win.style.top = y;
            }
            if (width)
                win.style.width = width;
            if (height)
                win.style.height = height;
            win.style.display = "";
        }
        catch (e)
        { }
        return false;
    },
    hide: function() {
        MessageBox._init("__msgboxWin").style.display = "none";
    },
    showLoading: function(title, msg) {
        if (title == "" || title == null) title = "提示";
        if (msg == "" || msg == null) msg = "正在向服务器提交数据，请稍候......";
        var win = MessageBox._init("__msgboxLoaging", true);
        win.children[0].cells[0].innerText = title;
        win.children[0].cells[1].children[0].innerHTML = "<div class=msgbox_loading style='padding-top:16px;background-color:#Dfe3ff'><nobr>" + msg + "</nobr></div>";
        win.style.width = "320px"; win.style.height = "120px";
        win.style.marginLeft = "-160"; win.style.marginTop = "-60";
        win.style.display = "";
    },
    hideLoading: function() {
        MessageBox._init("__msgboxLoaging").style.display = "none";
    },
    resize: function(o) {
        MoveHandler.run(o, function(o, w, h) {
            var a = { x: false, y: true };
            if (o.offsetWidth + w > 320) {
                o.style.width = (o.offsetWidth + w); a.x = true;
            }
            if (o.offsetHeight + h > 120) {
                o.style.height = (o.offsetHeight + h); a.y = true;
            }
            return a;
        }, null);
    },
    move: function(o) {
        MoveHandler.run(o, function(o, w, h) {
            var a = { x: false, y: true };
            if (o.offsetLeft + w >= 0) { o.style.left = o.offsetLeft + w; o.style.marginLeft = 0; a.x = true; }
            if (o.offsetTop + h >= 0) { o.style.top = o.offsetTop + h; o.style.marginTop = 0; a.y = true; }
            return a;
        }, null);
    }
}
var MoveHandler = {
    _obj: [null, null, null],
    _pos: null,
    _null: function() { window.event.returnValue = false; return false; },
    _move: function() {
        if (typeof MoveHandler._obj[1] == 'function') {
            var b = MoveHandler._obj[1](MoveHandler._obj[0], event.clientX - MoveHandler._pos[0], event.clientY - MoveHandler._pos[1]);
            if (b.x == true) MoveHandler._pos[0] = event.clientX;
            if (b.y == true) MoveHandler._pos[1] = event.clientY;
        }
    },
    _end: function() {
        MoveHandler._obj[0].releaseCapture();
        window.document.detachEvent("onselectstart", MoveHandler._null);
        window.document.detachEvent("onmousemove", MoveHandler._move);
        window.document.detachEvent("onmouseup", MoveHandler._end);
        if (typeof MoveHandler._obj[2] == 'function') MoveHandler._obj[2](MoveHandler._obj[0], MoveHandler._pos[0], MoveHandler._pos[1]);
    },
    run: function(o, onmove, onend) {
        MoveHandler._obj[0] = o; MoveHandler._obj[1] = onmove; MoveHandler._obj[2] = onend;
        MoveHandler._pos = [event.clientX, event.clientY];
        o.setCapture();
        window.document.attachEvent("onselectstart", MoveHandler._null);
        window.document.attachEvent("onmousemove", MoveHandler._move);
        window.document.attachEvent("onmouseup", MoveHandler._end);
    },
    set: function(o, getOwner, onmove, onend) {
        o.onmousedown = function() {
            var e = event.srcElement;
            if (typeof getOwner == 'function') e = getOwner(e);
            if (e == null) return false;
            e.setCapture();
            MoveHandler._obj[0] = e; MoveHandler._obj[1] = onmove; MoveHandler._obj[2] = onend;
            MoveHandler._pos = [event.clientX, event.clientY];
            window.document.attachEvent("onselectstart", MoveHandler._null);
            window.document.attachEvent("onmousemove", MoveHandler._move);
            window.document.attachEvent("onmouseup", MoveHandler._end);
        }
    }
}