var g_bDebugMode = false;//是否是调试模式
var g_isPrintDebugInfo = true;//是否打印调试信息
var g_isDisplayItemSetup = true;//是否开启密码设置窗口
var g_startFaceMode = true;//是否开启人脸模式
var g_isDynamicFace = true;//是否开户动态人脸模式
var g_isDragMode = true;//是否开启窗口拖动模式
var g_rightBottomNavMode = 1;//1为标准模式，2客户订制模式（隐掉首页按钮，加到右下方）
const PAGE_MARGIN = 6;
const VAR_MODE_STRING = 0;
const VAR_MODE_UIOBJ = 1;
const VAR_MODE_JSON = 2;
const UI_MODE_INPUT = 1;
const UI_MODE_SELECT = 2;
const UI_MODE_DIV = 3;
const UI_MODE_GROUPS = 4;
const VAR_MODE_PHOTO = 5;
const UI_MODE_CALENDAR = 6;
const UI_MODE_CALENDAR_TIME = 7;
const UI_MODE_CHECKBOX = 8;
const UI_MODE_SLIDER = 9;
const COMBINE_TIMER_MODE_UIOBJ = 10;
const INPUT_TYPE_PWD = 1;
const INPUT_TYPE_NUM = 2;
var g_TitleCutLen = 26;
var g_control = null;
var g_btn = null;
var LOWER_RESOLUTION_MODE = 0;
var LOW_RESOLUTION_MODE = 0;
var GENERAL_RESOLUTION_MODE = 0;
const POP_TABLE_PARENT_WIN = "pop_tab_parent_win";
var g_bottomNavItemJsons = null;
var g_genderObj = null;
var g_empTypeObj = null;
var g_yesOrNoNavItemJsons = null;
const SCALE_BOTTOM_NAV_MENU = 0.86;
var g_startProc = true;
var g_isCloseCurrentWinMode = true;//点击对话框的窗口闭门按钮，是否可以强制关闭当前窗口
var g_onlyMoveProcTab = false;
var g_item = null;
var g_isInitListUI = true;
var g_importEmpInfoIsDisplaySuccessTips = false;//是否显示导入人员成功提示，
var g_callBackObjs = null;
var POP_WIN_TAB_CLASS_NAME = "pop_win_tab_list";
const g_maskOpacity = 0.2;
const DIALOG_EDIT_WIN_INDEX = 901;
const SECOND_DIALOG_MASK_INDEX = 911;
const MAX_TOP_MASK = 915;
const SECOND_MASK = 910;
const MAX_BOTTOM_MASK = 900;
const g_aMaskIndex = new Array(MAX_BOTTOM_MASK,SECOND_MASK,MAX_TOP_MASK);
const MAX_TOP_PROC_TABLE = 989;
const MAX_TOP_PROC_MODE = 6;
const EMP_DEPT_TAB_ITEM_VAL = 0;//0默认为人员 1为部门
const EMP_DEPT_TAB_ITEM_KEY = "emp_dept_tab_item";
var SELECT_MAX_WIDTH = 200;//这个是可以修改的
const g_saveToLocalSplitChar = "AAAAAA";
const g_bottomMenuRightMargin = 50;//右下角菜单的右边距
const g_bottomMenuBottomMargin = 20;//右下角菜单的下边距
var g_singleCharWidth = 16;//单字符宽度
const g_checkBoxNormalBorderColor = "#55bdf0";
var g_stockTipsId = null;//放需要刷新消费的TIPS
var g_isHasCallbackError = false;
var g_cancelFaceRelateEmpPhoto = true;//人脸照片是否取消关联人员照片
var g_isModifyCancelFaceRelateEmpPhoto = g_cancelFaceRelateEmpPhoto;//是否修改
var g_isOnlyAddEmp = true;
var g_addEmpAndFaceAndPhotoMode = 2;//模式：1 加人--》加脸--》加照片，模式：2 加人、加照片--》加脸--》出错删除照片
var FORCE_EXIT_ERROR_CODE = -53;
var FAIL_CONNECTION_DEVICE = -108;
var IMPORT_EMPLOYEE_COMPARE_UI_MODE = 2;
var g_isHiddenCopyColsName = true;
var MALE = getLanTextByKey("T_MALE_TITLE");
var MALE_NUM = 0;
var g_isSelectedFaceToEmpPhoto = (MALE == "Male")?true:false;//默认是否选中人脸照片设置为人员照片

var FEMALE = getLanTextByKey("T_FEMALE_TITLE");
var FEMALE_NUM = 1;
var ADMIN = getLanTextByKey("T_ADMIN");
var GUEST = getLanTextByKey("T_GENERAL_EMP_TITLE");
var ERR_SERV_REGULAR = -2;
var MULTI_ERR_HEADER_CHARS = "--";
var ALAM_BK_COLOR = "ff0000";//红色
var SUCCESS_COLOR = "78cd51";//绿色
var DISABLED_BK_COLOR = "CCC";//灰色
var MAX_EXPORT_AMOUNT = 5000;
var STATUS_WIN_CLOSE_WATIT_TIME = 3000;//状态窗口关闭等待时间（单位：毫秒）
var g_temperatureFuncObj = {"open":((parseInt(getLanTextByKey("C_WEB_TEMPERATUER_OPEN"),10))?true:false),"dmode":getLanTextByKey("C_WEB_TEMPERATUER_DISPLAY_MODE"),"precision":parseInt(getLanTextByKey("C_WEB_TEMPERATUER_DECIMAL_PRECISON"),10)};//测温功能模块
const MAX_DEMICAL_COUNT = 2;
const NOT_OPEN_FILE = -56;
const DEFAULT_DEPT_ID = -1;
const NO_FOUND_DEPT_ERROR = -2;
const USB_EMP_IMPORT_PHOTO_DEFAULT_DIR = "DCIM\\";//806 usb导入默认文件名
var CURRENT_SELECT_DIR = "";//文件当前选择文件夹
var AS_ME_EVENT_TYPE_LEGAL_FACE = 13;

function PrintDebugInfo(info)
{
	_externalDebugLog(info);
}
/*2019-5-9:以前的不适用，逐步修改
需要页面居中窗口或控件的全局g_aControlsInPageCenter数组,
格式为{"id":id,"width":w,"height":h}
*/
var g_aControlsInPageCenter = [];
var g_keyF6Obj = {"times":0,"isOpen":false};
var g_keyZ6Obj = {"times":0,"isOpen":false};
(function(){
	"use strict";
	document.onkeydown = function () 
	{
  	if (window.event && window.event.keyCode == 13) 
       window.event.returnValue = false;
		else if(window.event && window.event.keyCode == 117) 
		{
				if(g_keyF6Obj["times"] > 1)
				{
					var row = document.getElementById("txt_more_title_short_cut");
          if(row == null)
            return;
					row.style.display = "";
					if(!g_keyF6Obj["isOpen"])
					{
						g_keyF6Obj["isOpen"] = true;
						operateRowDisplay(row);
					}
				}
				g_keyF6Obj["times"]++;		
				return;
		}
    else if (window.event && window.event.keyCode == 90) 
    {
      g_keyZ6Obj["times"]++;
      if(g_keyZ6Obj["times"] > 3)
      {
        if(typeof(productTest) != undefined)
            productTest();
      }
    }
		if(!g_keyF6Obj["isOpen"])
			g_keyF6Obj["times"] = 0;
	};
	//非调试模式禁用右键环境菜单和全局选择复制
	if (!g_bDebugMode){
		var releaseEventDisabler = function(){event.returnValue = false;};
		document.oncontextmenu = releaseEventDisabler;
		document.ondragstart = releaseEventDisabler;
		document.onselectstart=function(){
			var obj = event.srcElement;
			if((obj.nodeName).toUpperCase() === "INPUT")
			{
				if((obj.type)	.toUpperCase() === "TEXT")
				{
					event.returnValue = true;
					return;
				}
			}
			event.returnValue=false;
		};
		return;
	}
	//调试模式下允许所有事件通过，并能通过右键弹出调试菜单
	document.oncontextmenu = function(){
		if (_externalPopupDebugMenu !== undefined){
			event.returnValue = _externalPopupDebugMenu();
			return;
		}
		event.returnValue = true;
	};
}());
//尽早改写body样式，如果在onLoad函数中再改会导致内容闪烁或跳跃
(function(){
	"use strict";
	//读取字体与大小
	
	var szFontFamily = _externalGetUIText("C_WEB_FONT_FAMILY");
	var szFontSize = _externalGetUIText("C_WEB_FONT_SIZE");
	g_singleCharWidth = szFontSize;//修改单字符宽度
	if (szFontFamily === null && szFontSize === null){return;}
	var sheet = document.styleSheets[0];
	if(sheet == undefined | sheet == null)
		return;
	//var htmlCss = "html{font-size:28px;font-family:'微软雅黑';}";
	//sheet.appendChild(document.createTextNode(htmlCss)); 
	szFontFamily = '"'+replaceStr(szFontFamily,'|','","')+'"';
	sheet.addRule("html", "font-size:"+szFontSize+"px;font-family:"+szFontFamily+";");	
	
}());

var BK_COLOR_ERROR = "#ff5454";
var BK_COLOR_WARNNING = "#fabb3d";
var EMP_CARD_NULL = -1;

var IGNORE_KEYBOARD_INPUT_TIME = 200;
var STANDARD_TOAST_TIME_LEN = 1200;
MAX_CARD_NUMBER = "1099511627775";

var isDebug = true;
var g_initDisplayPageObj = null;
var g_isRefreshPage = true;
var g_isSelectMenuPopup = true;
var g_isLoad = false;

document.onclick=function(event)
{
	var event=event||window.event;
	closeOpenSelects(event);
	//关闭错误弹出窗口
	/*var toast = $(".toast_tips");   // 设置目标区域
	if (!toast.is(event.target) && toast.has(event.target).length === 0) 
	{
		var tab = document.getElementById(POP_TAB);
		if(tab != null)
			operateOpacity(tab,false,0,tab.callBackMehtod);
	}*/
};

document.onmousemove = mouseMove;
var mouseX = 0;//跟踪鼠标X坐标
var mouseY = 0;//跟踪鼠标Y坐标
function mouseMove(e)
{
	if(!g_isLoad)
		return;
	e = e || window.event;
	var x = e.pageX || (e.clientX +
	(document.documentElement.scrollLeft
	|| document.body.scrollLeft));
	var y= e.pageY || (e.clientY +
	(document.documentElement.scrollTop
	|| document.body.scrollTop));
	
	mouseX = x;
	mouseY = y;
}
function customConsole(txt)
{
	console.log(txt);
}
//根据控件id, 设置窗口拖动
function setDragleMode(id)
{
	if(g_isDragMode)
	{
		var mode = 1;
		var dPage = getPageDisplaySize();
		var obj = document.getElementById(id);
		setTimeout(function(){
				switch(mode)
				{
					case 1:
						$('#'+id).draggable({
							disabled : false,
							handle:'#'+id+'_title',
							onBeforeDrag : function (e) {
								hiddenPopTabChildNodePannel(true);						
							},
							onStartDrag:function(e){
								$(this).draggable('options').cursor = 'move';		
							},
							onDrag : function (e) {
								$(this).draggable('options').cursor = 'move';
							},
							onStopDrag:function(e,source){
								$(this).draggable('options').cursor = 'move';		//$(this).draggable('options').cursor = 'default';
								setTimeout(function(){setDrapControlPos(getFirstParentObjByTag(obj,"table"),dPage);},0);
							}
						});//第一种拖动模式
						break;
					case 2:
						$('#'+id).draggable({
								proxy:'clone'
						});//第二种拖动模式
						break;
					case 3:
						$('#'+id).draggable({
								proxy:function(source){
										var p = $('<div class="proxy">&nbsp;</div>');
										p.appendTo('body');
										return p;
								}
						});//第三种拖动模式
						break;
				}
			},500);
	}	
}
function setDrapControlPos(tab,dPage)
{
	var maxX = dPage.w - tab.clientWidth;
	var maxY = dPage.h - tab.clientHeight;
	//console.log(tab.offsetLeft + " > " + maxX + ", dPage.w = " + dPage.w + ", tab.clientWidth = "+tab.clientWidth);
	//console.log(tab.offsetTop + " > " + maxY + ", dPage.h = " + dPage.h + ", tab.clientHeight = "+tab.clientHeight);
	if(tab.offsetLeft > maxX)
		setTimeout(function(){tab.style.left = maxX + "px";},0);
	else if(tab.offsetLeft < 0)
		setTimeout(function(){tab.style.left = "0px";},0);
		
	if(tab.offsetTop > maxY)
		setTimeout(function(){tab.style.top = maxY + "px";},0);
	else if(tab.offsetTop < 0)
		setTimeout(function(){tab.style.top = "0px";},0);
}
function initPage()
{	
//	initSysPageFont();
	var iniPageTextMethodName = "initPageText";
	var initPageControlsPosMethodName = "initPageControlsPos";
	var bottomMenuModeObj = getUrlObjByMode(g_rightBottomNavMode);
	var bText = getLanTextByKey(bottomMenuModeObj["text"]);
	g_bottomNavItemJsons = [{text:getLanTextByKey("T_QUERY_RECORD_TIPS"),url:"query.htm",w:0,cw:0,posX:0},{text:getLanTextByKey(bottomMenuModeObj["text"]),url:bottomMenuModeObj["url"],w:0,cw:0,posX:0}];//{text:"系统设置",url:"adddevice.htm",w:0,cw:0,posX:0},
	g_yesOrNoNavItemJsons = {"0":getLanTextByKey("T_YES_TIPS"),"1":getLanTextByKey("T_NO_TIPS")};
	g_genderObj = {"0":getLanTextByKey("T_MALE_TITLE"),"1":getLanTextByKey("T_FEMALE_TITLE")};
	g_empTypeObj = {"1":getLanTextByKey("T_ADMIN"),"0":getLanTextByKey("T_GENERAL_EMP_TITLE")};
	g_isDisplayItemSetup = (getLanTextByKey("C_WEB_OPEN_SETUP_WIN") == "1")?true:false; 
	g_isDynamicFace = (getLanTextByKey("C_WEB_OPEN_DYNAMIC_MODE") == "1")?true:false;
	if(checkMethodName(iniPageTextMethodName))
		eval(iniPageTextMethodName + "();");	
	if(checkMethodName(initPageControlsPosMethodName))
		eval(initPageControlsPosMethodName + "(getPageDisplaySize());");	
}
function onResizePage()
{
	setTimeout(function(){delayOnResizePage();},10);
}
function delayOnResizePage()
{
	var dPage = getPageDisplaySize();
	initPageControlsPos(dPage);
	var obj = getZoomRateByDisplay(dPage);
	var scale  = (obj.zoom<1)?SCALE_BOTTOM_NAV_MENU*0.74:SCALE_BOTTOM_NAV_MENU*0.94;
	bottomNavMenuZoom(scale);//obj.zoom*SCALE_BOTTOM_NAV_MENU
	reSizeFont(obj);
	resizePopwin();
	var tabs = document.getElementsByClassName("tab_list_class");
	if(tabs != null)
	{
		for(var i = 0; i < tabs.length; i++)
		{
			var w = (tabs[i].parentNode).scrollWidth;
			setTabListCols(tabs[i],w);
		}
	}
}
function setTabListCols(tab,totalWidth)
{
	if((tab.colsScale) == null | (tab.colsScale).length < 1)
		return;
	var total = 0;
	var fRow = tab.rows[0];
	var sRow = tab.rows[1];
	var lastCellNotZeroIndex = -1;
	for(var i = (tab.colsScale).length - 1; i >= 0; i--)
	{
		if((tab.colsScale)[i] != 0)
		{
			lastCellNotZeroIndex = i;
			break;	
		}
	}
	for(var i = 0; i < (tab.colsScale).length; i++)
		total += (tab.colsScale)[i];
	var addWidth = 0;var str = "";
	for(var i = 0; i < lastCellNotZeroIndex; i++)
	{
		var newW = parseInt(((tab.colsScale)[i]*totalWidth)/total,10);
		addWidth += newW;str += "(" + i + ")("+(tab.colsScale)[i]+"*"+totalWidth+")/"+total+" = " + newW + "\t";
		(fRow.cells[i]).style.width = newW + "px";	
		var pannel = getFirstChildObjByTag(fRow.cells[i],"div");
		var classStr = pannel.className;
		if(classStr != undefined && classStr.indexOf("icon_select_") > -1)
		{}
		else
			pannel.style.width = (size-12) + "px";
	}
	//var iniW = parseInt((g_aTabColWidth[lastCellNotZeroIndex]*totalWidth)/total,10);
	(fRow.cells[lastCellNotZeroIndex]).style.width = (totalWidth - addWidth - 1) + "px";
	str += "(" + lastCellNotZeroIndex + ")("+totalWidth+" - "+addWidth+" - 1) = " + (totalWidth - addWidth - 1) + "\t";
	var str2 = "\r\n";
	if(sRow != undefined)
	{
		str2 += i + "-";
		for(var i = 0; i < (tab.rows).length; i++)
		{
			sRow = tab.rows[i];
			for(var j = 0; j < sRow.cells.length; j++)		
			{
				var size = parseInt(((fRow.cells[j]).style.width).replace("px",""),10);
				(sRow.cells[j]).style.width = size + "px";//((fRow.cells[i]).scrollWidth) + "px";//
				var pannel = getFirstChildObjByTag(sRow.cells[j],"div");
				//icon_select_
				var classStr = pannel.className;
				if(classStr != undefined && classStr.indexOf("icon_select_") > -1)
				{}
				else
					pannel.style.width = (size-12) + "px";
				str2 += j+")"+(sRow.cells[j]).style.width+"\t";
			}
			str2 = "\r\n";
		}
	}
	//alert(str + "\r\ng_aTabColWidth = " + g_aTabColWidth+"\r\n==" +str2);
}

function reSizeFont(obj)
{
	var htmlNode = document.getElementsByTagName("html")[0];//document.body.parentNode;//	
  var setFontSize = parseInt(_externalGetUIText("C_WEB_FONT_SIZE"),10);
	var baseFontSize = parseInt(setFontSize*obj.fontSize,10);
	htmlNode.style.cssText = "font-size:"+baseFontSize+"px;";
}
function setLeftNavMenuUIStyle(mColor,index,cmode)
{
	updateNavMenu(mColor,index,cmode);
	setMenuUI(cmode);
}
var v16LeftMenuMode = 1;
var v17CorAdviceLeftMenuMode = 2;
var g_cLeftMenuMode = v17CorAdviceLeftMenuMode;
function setMenuUI(mode)
{
	var arr = new Array("_add_device_","_add_emp_","_add_groups_","_setup_device_");
	for(var i = 0; i < arr.length; i++)
	{
		var cadC1 = document.getElementById("circle"+arr[i]+"c1");
		var cadC2 = document.getElementById("circle"+arr[i]+"c2");
		var num = document.getElementById("fo_title"+arr[i]+"num");		
		if(mode == v17CorAdviceLeftMenuMode)
		{
			cadC1.style.opacity = "0";
			cadC2.style.opacity = "0";
			num.style.display = "block";
		}
	}
}
function updateNavMenu(mColor,index,cmode)
{
	mColor = (cmode == v17CorAdviceLeftMenuMode)?"#368fca":mColor;
	var unSelectedColor = "#969696";
	var nUnSelectedColor = "#00ccff";
	var selectedColor = "#368fca";
	var aColors = [{start:4,end:14},{start:24,end:46},{start:60,end:86},{start:100,end:100}];
	var aCircles = new Array("circle_add_device","circle_add_emp","circle_add_groups","circle_setup_device");
	var lineStop1 = document.getElementById("stop_line_2");
	var lineStop2 = document.getElementById("stop_line_3");
	lineStop1.setAttribute("style","stop-color:"+mColor);
	lineStop1.setAttribute("offset",aColors[index-1].start + "%");
	lineStop2.setAttribute("offset",aColors[index-1].end + "%");
	for(var i = 0; i < 4; i++)
	{
		document.getElementById(aCircles[i]).initColor = unSelectedColor;		
		document.getElementById(aCircles[i].replace("circle","re")).initColor = unSelectedColor;		
		document.getElementById(aCircles[i].replace("circle","icon")).initColor = unSelectedColor;		
		document.getElementById(aCircles[i].replace("circle","title")).initColor = unSelectedColor;		
	}
	for(var i = index -1;i >= 0; i--)
	{
		var circle = document.getElementById(aCircles[i]);
		circle.setAttribute("fill",(i == index -1)?nUnSelectedColor:mColor);
		circle.initColor = (i == index -1)?nUnSelectedColor:mColor;
		document.getElementById(aCircles[i].replace("circle","re")).initColor = (i == index -1)?nUnSelectedColor:mColor;
		var icon = document.getElementById(aCircles[i].replace("circle","icon"));
		icon.className = (icon.className).replace("div_main_icon","div_main_icon_selected");
		icon.initColor = (i == index -1)?nUnSelectedColor:selectedColor;
		icon.style.color = icon.initColor;
		var title = document.getElementById(aCircles[i].replace("circle","title"));
		title.className = (title.className).replace("div_main_font","div_main_font_selected");
		title.initColor = icon.initColor;
		title.style.color = title.initColor;
	}
}
function operateImgBk(obj,idStr,initColor,newColor,isOver)
{
	var cObj = document.getElementById("circle_"+idStr);
	var iconObj = document.getElementById("icon_"+idStr);//document.getElementById("test").innerText = (getObjKeyVal(bkObj.style));
	var tObj = document.getElementById("title_"+idStr);
	cObj.style.fill =((isOver)?newColor:cObj.initColor);//alert(bkObj.style.fill);
	iconObj.style.color = ((isOver)?newColor:iconObj.initColor);
	tObj.style.color = ((isOver)?newColor:tObj.initColor);//document.getElementById("div_add_device_page_title").innerText =obj.initColor;
}
function getZoomRateByDisplay(dPage)
{
	var obj = new Object();
	var body = document.body;
	if(dPage.w < 1580)
	{
		//1280*720 1366*768
		LOWER_RESOLUTION_MODE = 0.6;
		obj.zoom = LOWER_RESOLUTION_MODE;
		obj.fontSize = 0.8;
		obj.margin = 4;	
		body.style.overflow = "auto";	
	}
	else if(dPage.w < 1900)
	{
		//1600*900
		LOW_RESOLUTION_MODE = 0.8;
		obj.zoom = LOW_RESOLUTION_MODE;
		obj.fontSize = 0.9;
		obj.margin = 4;
		body.style.overflow = "hidden";	
	}
	else
	{
		//1920*1080
		GENERAL_RESOLUTION_MODE = 1;
		obj.zoom = GENERAL_RESOLUTION_MODE;
		obj.fontSize = 1;
		obj.margin = 80;
		body.style.overflow = "hidden";	
	}
	return obj;
}
//////////底部菜单开始//////////////////////////

function getBottomNavBtn(jsons)
{  
	//var jsons = [{text:"系统设置",url:"",w:0,cw:0,posX:0},{text:"记录查询",url:"",w:0,cw:0,posX:0},{text:"考勤与更多设置",url:"",w:0,cw:0,posX:0}];//
	var sp = document.getElementById("sp_calac");
	var len = jsons.length;
	if(len < 2)
		return;
	var maxW = 0;
	for(var i = 0; i < len;i++)
	{
		sp.innerText = jsons[i].text;	
		jsons[i].w = sp.offsetWidth;
		maxW = (maxW<jsons[i].w)?jsons[i].w:maxW;
		jsons[i].w += 20;
	}
	sp.innerText = "";
	//maxW += (jsons[0].url != "query.htm" && jsons[0].url != "SCS:AC_FINGERPRINT_SAMPLED")?16:0;
	var menuTotoalWidth = 0;
	var startX = 44;
	var btnHeight = 44;
	var arc = 20;	
	var margin = 4;
	maxW += margin*2;
	
	jsons[0].cw = jsons[0].w;//maxW
	jsons[0].posX = startX;
	var btn1 = document.getElementById("p_left_btn1");
	var btn1F = document.getElementById("p_left_btn1_fore");
	var d1 = "m"+jsons[0].posX+" 0a"+arc+" "+arc+" 0 0,0 0 "+btnHeight+"l"+jsons[0].cw+" 0l0 "+(-btnHeight)+"l"+(-jsons[0].cw)+" 0Z";
	btn1.setAttribute("d",d1);
	btn1F.setAttribute("d",d1);
	menuTotoalWidth += (jsons[0].posX + jsons[0].cw +margin);
	
	jsons[1].cw = jsons[1].w;//maxW
	if(len == 3)
	{
		var btn2 = document.getElementById("p_left_btn2");
		var btn2F = document.getElementById("p_left_btn2_fore");
		jsons[1].posX = jsons[0].cw+margin+startX;
		var d2 = "m"+jsons[1].posX+" 0l"+jsons[1].cw+" 0l0 "+btnHeight+"l"+(-jsons[1].cw)+" 0l0 "+(-btnHeight)+"Z";
		btn2.setAttribute("d",d2);
		btn2F.setAttribute("d",d2);
		menuTotoalWidth += (jsons[1].cw +margin);
	}
	
	var lastIndex = (len == 3)?2:1;
	jsons[lastIndex].cw = jsons[lastIndex].w;//maxW
	var btn3 = document.getElementById("p_left_btn3");
	var btn3F = document.getElementById("p_left_btn3_fore");
	jsons[lastIndex].posX = jsons[0].cw+margin+((len < 3)?0:margin)+jsons[0].posX+((len==3)?jsons[1].cw:0);
	var d3 = "m"+jsons[lastIndex].posX+" 0l"+jsons[lastIndex].cw+" 0a20 20 0 0,1 0 "+btnHeight+"l"+(-jsons[lastIndex].cw)+" 0l0 "+(-btnHeight)+"Z";
	btn3.setAttribute("d",d3);
	btn3F.setAttribute("d",d3);
	menuTotoalWidth += jsons[lastIndex].cw;
	
	var idStr = "_left_btn";
	var secondPaddingLeft = (lan == "zh_CN")?16:4;
	for(var i=0; i < len;i++)
	{
		var fo = document.getElementById("fo"+idStr+(i+1));
		var page = document.getElementById("page"+idStr+(i+1));		
		page.innerHTML = jsons[i].text;
		//page.innerHTML = ((jsons[i].url != "query.htm" && jsons[i].url != "SCS:AC_FINGERPRINT_SAMPLED")?'<span class="icon_return"></span>':'') + jsons[i].text;
		fo.setAttribute('x',jsons[i].posX+ parseInt((jsons[i].cw-jsons[i].w)/2,10)+((i == len-1)?secondPaddingLeft:0)+((i==0)?-6:0));		
	}
	
	var navBottomMenu = document.getElementById("svg_nav_menu");
	//var standardWidth = (len<3)?parseInt(menuTotoalWidth/3*2,10):menuTotoalWidth;
	menuTotoalWidth += btnHeight;
	navBottomMenu.initWidth = menuTotoalWidth;
	navBottomMenu.initHeight = btnHeight;
	navBottomMenu.setAttribute('width', menuTotoalWidth);
	navBottomMenu.setAttribute('height', btnHeight);
	navBottomMenu.setAttribute('viewBox', "0 0 "+(menuTotoalWidth)+" "+btnHeight);
	navBottomMenu.style.right = g_bottomMenuRightMargin + "px";
	var dPage = getPageDisplaySize();
	var obj = getZoomRateByDisplay(dPage);
	navBottomMenu.style.bottom = ((obj.zoom<1)?g_bottomMenuBottomMargin*0.15:g_bottomMenuBottomMargin) + "px";//parseInt(20*SCALE_BOTTOM_NAV_MENU,10)
	/*navBottomMenu.setAttribute('width', parseInt(menuTotoalWidth*0.88,10));
	navBottomMenu.setAttribute('height', parseInt(btnHeight*0.88,10));*/
	var scale  = (obj.zoom<1)?SCALE_BOTTOM_NAV_MENU*0.74:SCALE_BOTTOM_NAV_MENU*0.94;
	bottomNavMenuZoom(scale);
}
function bottomNavMenuZoom(zoom)
{
	var navBottomMenu = document.getElementById("svg_nav_menu");
	if(navBottomMenu == null)
		return;
	navBottomMenu.setAttribute('width', parseInt(navBottomMenu.initWidth*zoom,10));//
	navBottomMenu.setAttribute('height', parseInt(navBottomMenu.initHeight*zoom,10));
	
}
function operateBottomNavBkByOver(obj,isOver)
{
	var oPath = document.getElementById(obj.id.replace("_fore",""));
	
	oPath.setAttribute("style","fill:url(#"+((isOver)?"rg_selected_hover":"rg_selected")+");stroke:#368fca;stroke-width:1;");
}
function bItemJumpToPage(index)
{
	//g_bottomNavItemJsons
	if(g_bottomNavItemJsons.length == 3)
		jumpToPageByURL(g_bottomNavItemJsons[index-1].url);
	else
	{
		jumpToPageByURL(g_bottomNavItemJsons[((index == 3)?2:index)-1].url);
	}
}
/////////底部菜单结束///////////////////////
////////////状态列表窗口//////////////////////
var STATUS_LIST_DEFAULT_ID = "tab_status_list";
var STATUS_POP_WIN_DEFAULT_ID = "pop_win_status_list";
function startStatusListWin(cw,ch,idStr,popWinId,mode,customExitMode,callBackByClosedMethod)
{
	var maxPopTabHeghtMargin = 100;
	startProcess(3);
	var dPage = getPageDisplaySize();
	var w = (cw == undefined)?1000:cw;
	var h = (ch == undefined)?500:ch;
	//alert(w + "," + h + "\r\n" + dPage.h+" - "+maxPopTabHeghtMargin+" = " + (dPage.h - maxPopTabHeghtMargin));
	h = (h < (dPage.h - maxPopTabHeghtMargin))?h:(dPage.h - maxPopTabHeghtMargin);
	var scrollYw = (h < (dPage.h - maxPopTabHeghtMargin))?0:16;
	var left = parseInt((dPage.w - w)/2,10);
	var top = parseInt((dPage.h - h)/2,10);
	var popDiv = document.createElement("div");
	var tabStatus = (idStr == undefined)?STATUS_LIST_DEFAULT_ID:idStr;
	var wId = (popWinId == undefined)?STATUS_POP_WIN_DEFAULT_ID:popWinId;
	//title,aPos,listId,mode,zIndex,pWinId,callBackByClosedMethod,isStopBtn
	var nMode = TABLE_STATUS_LIST_MODE;
	if(mode != undefined && mode != null)
		nMode = mode;
	var isStopBtn = true;
	if(customExitMode != undefined)
		isStopBtn = -2;
		//getTabList(title,aPos,listId,mode,zIndex,pWinId,callBackByClosedMethod,isStopBtn,callBackByClosedBeforeMethod)
	var tab = null;
	
	if(callBackByClosedMethod != undefined && callBackByClosedMethod != "")
		tab = getTabList(getLanTextByKey("T_STATUS_LIST_TITLE"),new Array(w,h,left,top),tabStatus,nMode,SECOND_DIALOG_MASK_INDEX,wId,callBackByClosedMethod,isStopBtn);
	else
		tab = getTabList(getLanTextByKey("T_STATUS_LIST_TITLE"),new Array(w,h,left,top),tabStatus,nMode,SECOND_DIALOG_MASK_INDEX,wId,null,isStopBtn);	
	
	document.body.appendChild(tab);
	resizePopwin();
}

///////////////////////////////////////////////////
//多函数链(FuncList)调用机制
//将多个函数的调用请求放到全局数组。每次执行数组尾部的调用请求
//并将该请求从数组中移除。重复该步骤直到数组为空。
/*
[{"method":objFunc,"callback":objFunc,"params":obj}]
*/
var g_funcList = null;
var g_msDelayFuncExecute = 3;
//注意：最先调用的函数请求放到数组尾部
function setFuncList(funcArray){g_funcList = funcArray;}
//返回值为0表示成功结束。返回值<0表示错误结束。返回值大于0表示还有函数请求未完成
function callTailOfFuncList()
{
	if (typeof(g_funcList) !== "object")
		return -1;
	else if(g_funcList.length <= 0)
		return 0;

	var Tail = g_funcList.pop();
	//根据请求调用方法
	if(Tail.callback == undefined)
		Tail.callback = null;
	
	setTimeout(function(){Tail.method(Tail.params,Tail.callback);},g_msDelayFuncExecute);	
}
function checkIsFuncList()
{
	if(g_funcList == null)
		return 0;
	return 	(g_funcList.length > 0);
}
/*
使用示例：
function callTailOfGetDeviceAllData()
{
	if (callTailOfFuncList() == 0){
		//比如隐藏mask
	}else if (callTailOfFuncList < 0){
		//
	}else{
		//
	}
}
*/
///////////////////////////////////////////////////

function getRowOperateBtns(editTips,delTips,editMethodName,delMethodName,customBtnNum)
{
	var pack = document.createElement("div");
	pack.style.cssText = "width:120px;overflow:hidden;";
	var editBtn = createAbtn("icon_edit icobtn",editTips,editMethodName);
	editBtn.style.cssText = "padding-top:7px;width:36px;";
	var delBtn = createAbtn("icon_del delicobtn",delTips,delMethodName);
	delBtn.style.cssText = "padding-top:7px;width:36px;margin-left:6px;";
	var queryPhotoBtn = createAbtn("icon_browser_img icobtn","","delEmp");
	queryPhotoBtn.style.cssText = "padding-top:7px;width:36px;margin-left:6px;";
	var customBtn = null;
	if(customBtnNum != undefined)
	{
		if(customBtnNum == 1)
		{
			customBtn = createAbtn("icon_init icobtn",getLanTextByKey("T_INIT_DEVICE_TIPS"),"customBtnCallBackMethodByPara");
			customBtn.style.cssText = "padding-top:7px;width:36px;margin-left:6px;";	
		}
	}
	pack.appendChild(editBtn);
	
	if(customBtn != null)
		pack.appendChild(customBtn);
	pack.appendChild(delBtn);
	return pack;
}
function getCheckBoxById(id,className,callBackMethodName,borderColor,isCheckedStatus)
{
		var cb = document.createElement("div");
		cb.value = id;
		if(callBackMethodName != undefined | callBackMethodName != null | callBackMethodName != "")
			cb.hideFunction = callBackMethodName;
		cb.onclick = function(){checkBoxOnClickEvent(this);};
		var isSelectedStyle = "background:#55bdf0;color:#fff;border:#55bdf0 solid 2px;";
		var isUnselectedStyle = "background:#fff;color:#fff;border:#55bdf0 solid 2px;";
		var isMultiUnselectedStyle = "background:#ccc;color:#ccc;border:#f49d1a solid 2px;";
		var isDisabledselectedStyle = "background:#f6f6f6;color:#ccc;border:#ccc solid 2px;";
		var bColor = (borderColor != undefined)?borderColor:"#55bdf0";
		var statusStyle = (isCheckedStatus == undefined | !isCheckedStatus)?isUnselectedStyle:isSelectedStyle;
		if(isCheckedStatus == -1)
			statusStyle = isMultiUnselectedStyle;
		else if(isCheckedStatus == -2)
		{
			statusStyle = isDisabledselectedStyle;
			cb.disabled = true;
		}
		else
			cb.disabled = false;
		cb.style.cssText = "width:18px;height:18px;padding:0px;border-radius:5px;cursor:pointer;margin:auto;font-size:0.8rem;" + statusStyle;
		if(borderColor != undefined)
			cb.style.border = bColor +" solid 2px";
		
		var status = (isCheckedStatus == undefined | isCheckedStatus == -1 | isCheckedStatus == -2)?false:isCheckedStatus;
		//console.log("className="+className+",status="+status);
		cb.checked = status;
		//console.log("cb.checked="+cb.checked+",id="+className+id);
		cb.initBorderColor = bColor;
		cb.className = "icon_select_ok " + ((className != undefined)?className:"");	
		if(className != undefined)
			cb.id = className+id;
		
		return cb;
}
function setCheckbox(cb,isChecked,isExecuteCallBackMethod)
{
	if(cb.disabled)
		return;
	cb.checked = (isChecked == -1 | isChecked == -2 | isChecked == false)?false:true;
	var isSelectedStyle = "background:#55bdf0;color:#fff;border:#55bdf0 solid 2px;";//"background:#55bdf0;color:#fff;";//
	var isUnselectedStyle = "background:#fff;color:#fff;border:#55bdf0 solid 2px;";//"background:#fff;color:#fff;";//
	var isMultiUnselectedStyle = "background:#ccc;color:#ccc;border:#f49d1a solid 2px;";//"background:#ccc;color:#ccc;";//
	var isDisabledselectedStyle = "background:#f6f6f6;color:#f6f6f6;border:#ccc solid 2px;";
	var statusStyle = '';
	if(isChecked == true)
		statusStyle = isSelectedStyle;
	else if(isChecked == false)
		statusStyle = isUnselectedStyle;
	else if(isChecked == -1)
		statusStyle = isMultiUnselectedStyle;
	else if(isChecked == -2)
	{
		statusStyle = isDisabledselectedStyle;
		cb.disabled = true;
	}
	//"width:18px;height:18px;padding:0px;border-radius:5px;padding:0px;cursor:pointer;margin:auto;font-size:0.8rem;" + statusStyle;
	cb.style.cssText = "width:18px;height:18px;border:"+cb.initBorderColor+" solid 2px;padding:0px;border-radius:5px;cursor:pointer;margin:auto;font-size:0.8rem;text-align:center;" + statusStyle;
	if(isExecuteCallBackMethod == undefined)
		isExecuteCallBackMethod = true;
	if(isExecuteCallBackMethod)
	{
		if(checkMethodName(cb.hideFunction))
			eval(cb.hideFunction+"("+cb.id+");");
	}
}
function checkBoxOnClickEvent(cb)
{
	setCheckbox(cb,(!cb.checked));
	//if(checkMethodName(cb.hideFunction))
		//eval(cb.hideFunction+"("+cb.id+");");
}
function setEasyUICheckBox(cb)
{return;
	$("#"+cb.id).checkbox({
		onChange:function(){
			if(checkMethodName(cb.hideFunction))
				eval(cb.hideFunction+"("+cb.id+");");
			}
		});
	
}
/*用于选择的数组变化，未选中就删除，不存在就增加*/
function delOrAddArrEleByIsExist(item,Arr,isSelected)
{
	var isExistItem = false;
	var existIndex = -1;
	for(var i = 0;i<Arr.length;i++)
	{
		if(	item.nID == Arr[i].nID)
		{
			isExistItem = true;
			existIndex = i;
			break;
		}
	}
	if(!isExistItem | Arr == null | Arr.length == 0)
		Arr.push(item);
	else
		Arr.splice(existIndex,1);
	return Arr;
}
/*用于选择的数组变化，未选中就修改，不存在就增加*/
function ModifyOrAddArrEleByIsExist(item,Arr,isSelected,isDel)
{
	var isExistItem = false;
	var existIndex = -1;
	
	for(var i = 0;i<Arr.length;i++)
	{
		if(	item.nID == Arr[i].nID)
		{
			isExistItem = true;
			existIndex = i;
			break;
		}
	}
	if(isDel)
	{
		if(isExistItem)
			Arr.splice(existIndex,1);
	}
	else if(!isExistItem | Arr == null | Arr.length == 0)
	{
		item.checked = isSelected;
		Arr.push(item);
	}
	else
	{
		Arr[existIndex].checked = isSelected;
	}
	return Arr;
}
function initSysPageFont()
{
	var sysFont = getLanTextByKey('C_WEB_FONT_FAMILY');
	sysFont = '"'+replaceStr(sysFont,'|','","')+'"';
	modifyStyleCssText("","fontFamily",sysFont,true);
}
//className为空串,改所有。
function modifyStyleCssText(className,attribute,val,isStyle)
{
	var ocssRules =document.styleSheets[0].cssRules || document.styleSheets[0].rules || window.CSSRule.STYLE_RULE;
	
	for(var i = 0; i < ocssRules.length; i ++)
	{
		//alert(i+"==>"+ocssRules[i]["selectorText"]);
		var test = (ocssRules[i]["selectorText"] == '.QsTitleDescText')?true:false;
		for(var key in ocssRules[i])
		{	
			var obj = (isStyle)?ocssRules[i]["style"]:ocssRules[i];
			if(className != "")
			{
				if(ocssRules[i]["selectorText"] == ("." + className))
				{
					for(var key1 in obj)
					{
						if(key1 == attribute)
						{
							obj[attribute] = val;
						}
					}
				}
			}
			else
			{
				for(var key1 in obj)
				{
					if(key1 == attribute)
					{
						obj[attribute] = val;
					}
				}
			}		
			if(key == "selectorText")
			{
				var obj = ocssRules[i]["style"];
				for(var key1 in obj)
				{
					if(key1 == attribute)
					{
						obj[attribute] = val;
					}
				}
			}
		}
	}
}
function checkMethodName(methodName)
{
	var isFunction =false;
	try
	{
		//这里的代码需要用try一下,因为当showFace为定义时会抛出异常
		isFunction = (typeof(eval(methodName))=="function");
	}
	catch(e)
	{
		return false;
	}
	return isFunction;
}
function refreshPage()
{
	if(!g_isRefreshPage)
	{
			g_isRefreshPage = true;
			return;
	}
	location.reload();
}

var g_scrollBarWidth = 0;
function getScrollBarWidth () {
	"use strict";
	if (g_scrollBarWidth !== 0) {return g_scrollBarWidth;}
	var inner = document.createElement('p');
	inner.style.width = "100%";
	inner.style.height = "200px";

	var outer = document.createElement('div');
	outer.style.position = "absolute";//指定绝对定位从而不影响文档其它元素的位置
	outer.style.top = "0px";
	outer.style.left = "0px";
	outer.style.visibility = "hidden";
	outer.style.width = "200px";
	outer.style.height = "150px";
	outer.style.overflow = "hidden";
	outer.appendChild (inner);

	document.body.appendChild(outer);
	var w1 = parseInt(inner.offsetWidth);
	outer.style.overflow = 'scroll';
	var w2 = parseInt(inner.offsetWidth);
	if (w1 === w2) {w2 = parseInt(outer.offsetWidth);}

	document.body.removeChild(outer);
	g_scrollBarWidth = w1 - w2;
	return g_scrollBarWidth;
}

function ResizeContent(){
	"use strict";
	var scrollBarWidth = getScrollBarWidth();
	/*var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	var strInfo = "IE Version:"+arVersion+"\nScrollBarWidth:"+scrollBarWidth+"\n";*/
	//有些页面标题用Title做ID，有些页面标题用MainTitle做ID
	var objTitle = document.getElementById("Title");
	if (!objTitle){objTitle = document.getElementById("MainTitle");}
	var objCont = document.getElementById("MainContent");
	var objText = document.getElementById("MainText");

	/*strInfo += "objCont:"+objCont+"\nobjText"+objText+"\nobjTitle" +
		objTitle + "\n";
	strInfo += "document.width:"+document.height+"\n";
		strInfo += "document.documentElement.clientWidth:"+document.documentElement.clientWidth+"\n";
		strInfo += "document.documentElement.clientHeight:"+document.documentElement.clientHeight+"\n";
		strInfo += "document.body.clientWidth:"+document.body.clientWidth+"\n";
		strInfo += "document.body.clientHeight:"+document.body.clientHeight+"\n";
		strInfo += "document.body.scrollWidth:"+document.body.scrollWidth+"\n";
		strInfo += "document.body.scrollHeight:"+document.body.scrollHeight+"\n";
		strInfo += "document.body.offsetWidth:"+document.body.offsetWidth+"\n";
		strInfo += "document.body.offsetHeight:"+document.body.offsetHeight+"\n";
		strInfo += "objTitle.clientHeight:"+objTitle.clientHeight+"\n";*/
	if (objTitle && objCont){
		var windowWidth = document.documentElement.clientWidth;
		var windowHeight = document.documentElement.clientHeight;
		if (parseInt(windowWidth) === 0)//早期IE版本不支持documentElement
		{
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
		var titleHeight = objTitle.clientHeight;
		objCont.style.top = '0px';
		objCont.style.width = windowWidth + 'px';
		objCont.style.height = Math.max(0, windowHeight - titleHeight) + 'px';
		var nWidth;
		if (objCont.scrollHeight > parseInt(objCont.style.height)){
			nWidth = windowWidth - 12 - scrollBarWidth;
		}else{
			nWidth = windowWidth - 12;
		}
		objText.style.width = (nWidth < 0 ? 0 : nWidth) + 'px';
	}
}

function getPageDisplaySize()
{
	var obj = new Object();
	var root = document.documentElement;
	obj.w = root.clientWidth;
	obj.h = root.clientHeight;
	return obj;
}
////////////通用工具 开始/////////////
/*判断控件的ellipsis设置是否使用*/
function isEllipsis(dom) 
{
		var checkDom = dom.cloneNode(), parent, flag;
		if( dom.offsetWidth != 0)
			checkDom.style.width = dom.offsetWidth + 'px';
		else
			checkDom.style.width = dom.style.width;
		checkDom.style.height = dom.offsetHeight + 'px';
		checkDom.style.overflow = 'auto';
		checkDom.style.position = 'absolute';
		checkDom.style.zIndex = -1;
		checkDom.style.opacity = 0;
		checkDom.style.whiteSpace = "nowrap";
		checkDom.innerHTML = dom.innerHTML;
	
		parent = dom.parentNode;
		parent.appendChild(checkDom);
		flag = checkDom.scrollWidth > checkDom.offsetWidth;
		parent.removeChild(checkDom);
		return flag;
}
function removeControlById(id,isRemoveMask)
{
	var control = document.getElementById(id);
	if(isRemoveMask)
		removeMask();	
  if(control != null)
	 return (control.parentNode).removeChild(control);	
  else
   return null;
}
function zoomObj(num,obj)
{
		var paras = (obj.style.transform).split("(");
		var val = parseFloat(paras[1].replace(")",""),10);				
		obj.style.transform = "scale("+(val + num)+")";
} 
function getObjKeyVal(obj,start,end)
{
	var str = '';var i = 0;
	for(var key in obj)
	{
		i++;
		if(start != undefined)
		{
			if(i < start)	
				continue;
		}
		
		if(end != undefined)
		{
			if(i > end)	
				break;
		}
		if(obj[key] != null & obj[key] != "")
			str += (key + '==>'+obj[key]+"\r\n");
		
	}
	return str;
}
function queryObjsByKeyVal(objs,key,lookVal)
{
		var nObjs = [];
		for(var i = 0; i < objs.length; i++)
		{//alert(i + "-->"+objs[i][key]+",lookVal="+lookVal);
			if(objs[i][key] != undefined)
			{
				if(	objs[i][key] == lookVal)
					nObjs.push(objs[i]);
			}	
		}
		return nObjs;
}
function createAbtn(className,tips,methodName)
{
		var btn = document.createElement("a");
		btn.className = className;	
		if(tips != "")
		{
			btn.tips = tips;
			setEasyUITooltips(btn,'top');
		}
		if(checkMethodName(methodName))
			btn.onclick = function(){eval(methodName+"(this);")};
		return btn;
}
function setEasyUITooltips(obj,pos,maxw,delayHideMode)
{
	if(obj.id != undefined)
		pushTipsIdToStockTips(obj.id);
	if(delayHideMode == undefined)
		delaySetEasyUITooltips(obj,pos,maxw,0);
	else
		delaySetEasyUITooltips(obj,pos,maxw,delayHideMode);	
}
function delaySetEasyUITooltips(obj,pos,maxw,delayHideMode)
{
	var top = "top";
	var maxW = 220;
	var hideMode = 0;
	if(pos != undefined)
		top = pos;
	if(maxw != undefined)
		maxW = maxw;
	else if(obj.tipsWidth != undefined)
		maxW = obj.tipsWidth;
	if(delayHideMode != undefined)
		hideMode = delayHideMode;
	
	$(obj).tooltip({
				position: top,
				trackMouse:true,
				showDelay:300,
				hideDelay:300,
				content: '<div class="div_tips" style="max-width:'+maxW+'px;word-wrap:break-word ;">'+obj.tips+'</div>',
				onShow: function()
				{
					$(this).tooltip('tip').css({
						backgroundColor: '#ffe8ad',
						borderColor: '#25c6fc'
					});
					if(hideMode>0)
						setTimeout(function (){$(obj).tooltip('hide');},hideMode*500);
				}
	});
}
function hideEasyUITooltips(obj)
{
	$(obj).tooltip("destroy");
}
//批量销毁tips
function pushTipsIdToStockTips(id)
{
	if(id == undefined)
		return;
	if(id == "")
		return;
		
	if(g_stockTipsId == null)
		g_stockTipsId = new Array();
	var isAdd = true;
	for(var i = 0; i < g_stockTipsId.length; i++)
	{
		if(g_stockTipsId[i]["key"] == id)
		{
			$("#"+id).tooltip("destroy");	
			isAdd = false;
		}
	}
	if(isAdd)
		g_stockTipsId.push({"key":id,"identify":"notab"});
}
//根据identify 批量销毁tips
function delTipsIdFromStockTips(identify)
{
	if(g_stockTipsId == null)
		return;
	for(var i = 0; i < g_stockTipsId.length; i++)
	{
		if(g_stockTipsId[i]["identify"] == identify)
			$("#"+g_stockTipsId[i]["key"]).tooltip("destroy");		
	}
}
//根据class 批量销毁tips
function delTipsIdFromStockTips(className)
{
	var icons = document.getElementsByClassName(className);
	if(icons == null)
		return;
	for(var i = 0; i < icons.length; i++)
		$(icons[i]).tooltip("destroy");	
}
var customConfirm = function(){
	this.mode = CONFIRM_MASK_TIP_MODE;
	this.cancelMethod = "confirmCancelCallBack";
	this.isHasCallBack = true;
	this.init = function(msg,confirmCallBackMethodName,mode,title,width){
		if(mode != undefined)
			this.mode = mode;
		this.isHasCallBack = (confirmCallBackMethodName == undefined | confirmCallBackMethodName == "")?false:true;
    //var toastWidth = 420;
		this.createConfirm(msg,confirmCallBackMethodName,((title == undefined)?"":title),((width == undefined)?420:width));
		};
	this.createConfirm = function(msg,confirmCallBackMethodName,title,toastWidth){
			var mode = this.mode;
			var confirmId = "POP_TAB_CONFIRM";
			if(mode == CONFIRM_MASK_TIP_MODE | mode == CONFIRM_LIST_DATA_TIP_MODE)
				startProcess(5,null);
			else if(mode == CONFIRM_DIALOG_MASK_TIP_MODE | mode ==CONFIRM_LIST_DATA_DIALOG_MASK_TIP_MODE)
				startProcess(4,null);
			else if(mode == CONFIRM_DIALOG_TOP_MASK_TIP_MODE)
			{
				startProcess(MAX_TOP_PROC_MODE,null);
			}
			var oTab = document.getElementById(POP_TAB);
			
			if(mode ==CONFIRM_LIST_DATA_DIALOG_MASK_TIP_MODE)
				toastWidth = 600;
      
			var fistColWidth = 50;
			var tab = document.createElement('table');   
			tab.cellPadding = "0";
			tab.className = POP_WIN_TAB_CLASS_NAME;
			tab.cellSpacing = "0";
			tab.border = "0";
			tab.id = confirmId;
			tab.class = "toast_tips";
			tab.width = toastWidth + "px";
			tab.style.cssText = 'background:#00ccff; opacity:0;height:auto;min-height: 30px; color:#fff; line-height:30px; text-align:center; border-radius:4px; position:fixed; top:40%;left:40%;z-index:990; -webkit-box-shadow:0 0 10px rgba(95, 95, 95, .5);border:#1e8fc6 solid 1px; ';
			var row = tab.insertRow();
			row.id = confirmId+'_title';
			var cell  = row.insertCell();
			cell.align = "center";
			//cell.width = "16px";
			cell.style.cssText = 'height:36px;width:'+fistColWidth+'px;wpadding:4px 0px 4px 0px;background-color:#1e8fc6;';/*上右下左*/
			
			var icon = document.createElement("div");
			var obj = getListIcoByMode(mode);
			obj.title = (title == "")?obj.title:title;
			icon.className = obj.className + " normal_ico";
			icon.style.cssText = 'color:#fff;max-width:30px;';
			cell.appendChild(icon);
			
			cell  = row.insertCell();
			cell.align = "left";	
			cell.style.cssText = 'padding:4px 4px 4px 10px;background-color:#36a9e1;color:#fff;';	
			cell.innerHTML = "<span class='title3 style='float:left;'>"+obj.title+"</span>";
			
			if(obj.close)
			{
				var closeObj = document.createElement('a'); 
				tab.id = POP_TAB;
				closeObj.style.cssText = "float:right;";
				closeObj.className = "icon_close icobtn";				
				closeObj.onclick = function(){
					operateOpacity(tab,false,0,callBackMehtod);
					if(checkMethodName(this.cancelMethod))
						eval(this.cancelMethod);
				};
				cell.appendChild(closeObj);
			}
			row = tab.insertRow();
			cell  = row.insertCell();	
			cell.colSpan = "2";
			cell.vAlign="middle";
			cell.align = "left";
			if(mode == CONFIRM_LIST_DATA_DIALOG_MASK_TIP_MODE |  mode == CONFIRM_LIST_DATA_TIP_MODE)
			{
				cell.style.cssText = 'padding:10px 0px 10px 0px;background-color:#fff;';
				cell.appendChild(msg);
			}
			else if(mode != CONFIRM_LIST_DATA_DIALOG_MASK_TIP_MODE)
			{
				cell.style.cssText = 'height:50px;padding:4px 6px 4px 4px;background-color:#fff;';
				var tipObj = getStatusIconByMode(mode);
				tipObj.style.float = "left";
				cell.appendChild(tipObj);				
				cell.innerHTML += "<div style='color:#000;float:left;margin-left:6px;width:"+(toastWidth - fistColWidth - 10)+"px;word-wrap: break-word;word-break: normal;'>" + msg + "</div>";			
			}
			row = tab.insertRow();
			cell  = row.insertCell();	
			cell.colSpan = "2";
			cell.vAlign="middle";
			cell.align = "right";
			cell.style.cssText = 'padding:4px 4px 4px 4px;background-color:#fff;border-top:#ccc dotted 1px;';
			if(this.isHasCallBack)
				cell.appendChild(this.getConfimBtn(tab,getLanTextByKey("T_PAGE_CANCE_BUTTON"),false,this.cancelMethod,"comfirm_cancel_btn"));
			cell.appendChild(this.getConfimBtn(tab,getLanTextByKey("T_PAGE_OK_BUTTON"),true,confirmCallBackMethodName,"comfirm_ok_btn"));
			document.body.appendChild(tab); 
			resizePopwin();
			tab.hasCloseBtn = true;
			operateOpacity(tab,true,1);
			setTimeout(function(){setDragleMode(confirmId);},500);
		};
	this.getConfimBtn = function(tab,text,isOk,callBackMethodName,id){
			var btn = document.createElement("a");
			btn.href = "#";
			btn.style.cssText = "float:right;margin-right:0.6em;margin-bottom:4px;padding: 6px 8px;line-height:1rem;";
			btn.className = "normalbtn";
			btn.innerText = text;
			if(id != undefined)
				btn.id = id;
			btn.isOk = isOk;
			
			btn.customMethod = callBackMethodName;
			var mode = this.mode;
			if(isOk)
			{
				btn.onclick = function(){
					if(this.disabled)
						return;	
					btn.disabled = true;
					operateOpacity(tab,false,1);
					if(mode == CONFIRM_MASK_TIP_MODE | CONFIRM_LIST_DATA_TIP_MODE)//
					{operateOpacity(tab,false,1);cancelProcess();}
					else if(mode == CONFIRM_DIALOG_MASK_TIP_MODE | mode == CONFIRM_LIST_DATA_DIALOG_MASK_TIP_MODE | mode == CONFIRM_DIALOG_TOP_MASK_TIP_MODE)
					{
            removePopByMode(tab,false,1,mode);
            cancelProcess(null,4);
          }
					btnCallBackMethod(btn);
					};
			}
			else
			{
				btn.onclick = function(){
					if(mode == CONFIRM_MASK_TIP_MODE | mode == CONFIRM_LIST_DATA_TIP_MODE)
					{operateOpacity(tab,false,1);cancelProcess();}
					else if(mode == CONFIRM_DIALOG_MASK_TIP_MODE | mode == CONFIRM_LIST_DATA_DIALOG_MASK_TIP_MODE | mode == CONFIRM_DIALOG_TOP_MASK_TIP_MODE)
					{removePopByMode(tab,false,1,mode);cancelProcess(null,4);	}
					btnCallBackMethod(btn);
					};
			}
			return btn;
		};
	};
function popEditConfirm(callBackMethod,mode)
{
	var sConfirm = new customConfirm();
	var tips = replaceStr(getLanTextByKey("T_SAVE_CONFIRM_TIPS"),"%1","<br/>");
	var cMode = CONFIRM_DIALOG_MASK_TIP_MODE;
	if(mode != undefined)
		cMode = mode;
	
	sConfirm.init(tips,callBackMethod,cMode);	
}

function btnCallBackMethod(btn)
{
	if(btn.customMethod != undefined)
		eval(btn.customMethod + "(" + btn.isOk + ");");
}
function showToast(msg,mode,seconds,aSize,callBackMehtod,isDisplayMask)
{ 
  //console.log("toast start");
	msg = replaceStr(msg,"\n","<br/>");
	var oTab = document.getElementById(POP_TAB);//((oTab != null) + " && "+(mode != DIALOG_MASK_TIP_MODE));TOAST_MASK_TIP_MODE
	if(oTab != null && mode != DIALOG_MASK_TIP_MODE)
		(oTab.parentNode).removeChild(oTab); 
	if(mode == DIALOG_MASK_TIP_MODE)
		startProcess(5,null);
	
	if(mode == TOAST_MASK_TIP_MODE)
	{
		if(isDisplayMask != undefined)
			setMask(mode,isDisplayMask);
		else
			setMask(mode);
	}
	var toastWidth = 420;
	var fistColWidth = 50;
	if(aSize != undefined)
		toastWidth = aSize[0];
	var duration=isNaN(seconds)?3000:seconds*1000;
	var tab = document.createElement('table');   
	tab.cellPadding = "0";
	tab.className =POP_WIN_TAB_CLASS_NAME;;
	tab.cellSpacing = "0";
	tab.border = "0";
	tab.class = "toast_tips";
	tab.width = toastWidth + "px";
	tab.style.cssText = 'background:#00ccff; opacity:0;height:auto;min-height: 30px; color:#fff; line-height:30px; text-align:center; border-radius:4px; position:fixed; top:40%;left:40%;z-index:999999; -webkit-box-shadow:0 0 10px rgba(95, 95, 95, .5);border:#1e8fc6 solid 1px; ';// left:'+(parseInt((dPage-toastWidth)/2,10))+'px; width:'+toastWidth+'px;
	var row = tab.insertRow();
	var cell  = row.insertCell();
	cell.align = "center";
	//cell.width = "16px";
	cell.style.cssText = 'height:36px;width:'+fistColWidth+'px;wpadding:4px 0px 4px 0px;background-color:#1e8fc6;';/*上右下左*/
	var icon = document.createElement("div");
	var obj = getListIcoByMode(mode);
	icon.className = obj.className + " normal_ico";
	icon.style.cssText = 'color:#fff;max-width:30px;';
	cell.appendChild(icon);
	
	cell  = row.insertCell();
	cell.align = "left";	
	cell.style.cssText = 'padding:4px 4px 4px 10px;background-color:#36a9e1;color:#fff;';	
	//if(title == undefined)
	//	title = "Tips";
	cell.innerHTML = "<span class='title3 style='float:left;'>"+obj.title+"</span>";
	
	if(callBackMehtod != undefined && callBackMehtod != "")
		tab.callBackMehtod = callBackMehtod;
	else
		tab.callBackMehtod = "";
	tab.hasCloseBtn = obj.close;
	if(obj.close)
	{
		var closeObj = document.createElement('a'); 
		tab.id = POP_TAB;
		closeObj.style.cssText = "float:right;";
		closeObj.className = "icon_close icobtn";
		closeObj.onclick = function(){
			operateOpacity(tab,false,0,callBackMehtod);
			if(mode == TOAST_MASK_TIP_MODE)
				setTimeout(function (){removeMask();},800 + duration);
		};
		cell.appendChild(closeObj);
	}
	
	row = tab.insertRow();
	cell  = row.insertCell();	
	cell.colSpan = "2";
	cell.vAlign="middle";
	cell.align = "left";
	cell.style.cssText = 'height:50px;padding:4px 10px 4px 10px;background-color:#fff;';
	var tipObj = getStatusIconByMode(mode);
	tipObj.style.float = "left";
	cell.appendChild(tipObj);
		
	cell.innerHTML += "<span style='color:#000;float:left;margin-left:6px;width:"+(toastWidth - fistColWidth - 10)+"px;'>" + msg + "</span>";
  document.body.appendChild(tab); 
	resizePopwin();
	operateOpacity(tab,true,500);
	if(!obj.close)
	{
		operateOpacity(tab,false,500 + duration,callBackMehtod);
		
		if(mode == TOAST_MASK_TIP_MODE)
			setTimeout(function (){removeMask();},800 + duration);
	}
  //console.log("toast end");
}
function resizePopwin(className)
{
	var dPage = getPageDisplaySize();
	var tabs = document.getElementsByClassName((className == undefined)?POP_WIN_TAB_CLASS_NAME:className);
	for(var i = 0; i < tabs.length; i++)
	{
		tabs[i].style.top = (parseInt((dPage.h-getElementHeightByObj(tabs[i]))/2,10))+'px';
		tabs[i].style.left = (parseInt((dPage.w-getElementWidthByObj(tabs[i]))/2,10))+'px';
	}
}
var GENERAL_TIPS_MODE = 0;
var GENERAL_ALARM_MODE = 1;
var DIALOG_MASK_TIP_MODE = 2;
var TOAST_MASK_TIP_MODE = 6;
var CONFIRM_MASK_TIP_MODE = 11;
var CONFIRM_DIALOG_MASK_TIP_MODE = 12;
var CONFIRM_LIST_DATA_DIALOG_MASK_TIP_MODE = 13;
var CONFIRM_LIST_DATA_TIP_MODE = 14;
var CONFIRM_DIALOG_TOP_MASK_TIP_MODE = 15;
function getListIcoByMode(mode)
{
	var obj = new Object();
	if(mode < GENERAL_TIPS_MODE)
	{
		obj.className = "icon_error_list";
		obj.title = getLanTextByKey("T_ERROR_TIPS_TITLE");
		obj.close = true;
	}
	else if(mode == GENERAL_TIPS_MODE | mode == DIALOG_MASK_TIP_MODE)
	{
		obj.className = "icon_tips_list";
		obj.title = getLanTextByKey("T_OPERATE_TIPS_TITLE");
		obj.close = false;
	}
	else if(mode == GENERAL_ALARM_MODE)
	{
		obj.className = "icon_alarm_list";
		obj.title = getLanTextByKey("T_ALARM_TIPS_TITLE");
		obj.close = false;
	}
	else if(mode == CONFIRM_MASK_TIP_MODE)
	{
		obj.className = "icon_confirm";
		obj.title = getLanTextByKey("T_CONFIRM_TIPS_TITLE");
		obj.close = false;
	}
	else if(mode == CONFIRM_DIALOG_MASK_TIP_MODE)
	{
		obj.className = "icon_confirm";
		obj.title = getLanTextByKey("T_CONFIRM_TIPS_TITLE");
		obj.close = false;
	}
	else
	{
		obj.className = "icon_log_list";
		obj.title = getLanTextByKey("T_OPERATE_TIPS_TITLE");
		obj.close = false;
	}
	return obj;
}
function removePopByMode(tab,isToMax,duration,mode)
{
	setTimeout(function() {  
			var d = (isToMax)?0.3:0.5; 
			if(isToMax) 
				tab.style.webkitTransition = '-webkit-transform ' + d + 's ease-out, opacity ' + d + 's ease-out';  
			else
				tab.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';  
			tab.style.opacity = (isToMax)?'1':'0';
			if(!isToMax)  
				setTimeout(function() { 
				if(tab != undefined && tab != null)
					document.body.removeChild(tab);
				cancelProcess(null,4);
				}, ((duration)?d * 1000:1000)); //setTimeout(function() { document.body.removeChild(tab); cancelProcess(callBackMehtod);}, ((duration)?d * 1000:1000)); 
			else
				setTimeout(function() {
					if(tab.hasCloseBtn)
						changeProcToMask();
					//else
					//	cancelProcess(callBackMehtod); 
					}, d * 1000 ); 
	}, duration); 	
}
function operateOpacity(tab,isToMax,duration,callBackMehtod)
{
	setTimeout(function() {  
			var d = (isToMax)?0.3:0.5; 
			if(isToMax) 
				tab.style.webkitTransition = '-webkit-transform ' + d + 's ease-out, opacity ' + d + 's ease-out';  
			else
				tab.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';  
			tab.style.opacity = (isToMax)?'1':'0';
			if(!isToMax)  
				setTimeout(function() { 
				if(tab != undefined && tab != null)
				{
					try{
						if(document.body.contains(tab))
						{
							document.body.removeChild(tab);
							delaySetMask();
						}
					}
					catch(e)
					{
						
					}
				}
				cancelProcess(null,4);
				}, ((duration)?d * 1000:1000));
			else
				setTimeout(function() {
					if(tab.hasCloseBtn)
						changeProcToMask();
					}, d * 1000 ); 
	}, duration); 	
} 

/*
根据类或字体大小计算字符串长度
*/
function calcStrWidthByStyle(className,fontSize,str)
{
	var rW = 0;
	var sp = document.createElement("sp");	
	sp.id = "sp_temp_calac_str";	
	if(className)
		sp.className = className;
	if(fontSize > 0)
		sp.style.fontSize = fontSize + "rem";
	document.body.appendChild(sp);
	sp.innerText = str;	
	rW = sp.offsetWidth;
	(sp.parentNode).removeChild(sp);
	return rW;
}
/////////////通用工具 结束///////////

//************************获取控件的位置和长度 查找关键词获取控件位置*************************
//获取控件左绝对位置
function getAbsoluteLeft(objectId) {
	var o = document.getElementById(objectId);
	var oLeft = o.offsetLeft;           
	while(o.offsetParent!=null) { 
		var oParent = o.offsetParent;    
		oLeft += oParent.offsetLeft; 
		o = oParent;
	}
	return oLeft;
}
//获取控件上绝对位置
function getAbsoluteTop(objectId) {
	var o = document.getElementById(objectId);
	var oTop = o.offsetTop;
	while(o.offsetParent!=null)
	{  
		var oParent = o.offsetParent; 
		oTop += oParent.offsetTop;  // Add parent top position
		o = oParent;
	}
	return oTop;
}
//获取控件宽度
function getElementWidth(objectId) {
	var x = document.getElementById(objectId);
	return x.offsetWidth;
}
//获取控件高度
function getElementHeight(objectId) {
	var y = document.getElementById(objectId);
	return y.offsetHeight;
}
//----------------------------------
//获取控件左绝对位置
function getAbsoluteLeftByObj(o) {
	if(o == null)
		return 0;
	var oLeft = o.offsetLeft;            
	while(o.offsetParent!=null) { 
	var oParent = o.offsetParent;    
	oLeft += oParent.offsetLeft ;
	o = oParent;
	}
	return oLeft;
}
//获取控件上绝对位置
function getAbsoluteTopByObj(o) {
	if(o == null)
		return 0;
	var oTop = o.offsetTop;
	while(o.offsetParent!=null)
	{  
	var oParent = o.offsetParent; 
	oTop += oParent.offsetTop;  // Add parent top position
	o = oParent;
	}
	return oTop;
}
//获取控件宽度
function getElementWidthByObj(o) {
	if(o == null)
		return 0;
	return o.offsetWidth;
}
//获取控件高度
function getElementHeightByObj(o) {
	if(o == null)
		return 0;
	return o.offsetHeight;
}

/*创建页面左右导航按钮
var paras = new Array(bMargin,btnMarginTop,w,h)*/
function createMargnNavAcBtn(idStr,isLeft,paras,url)
{
	var initA = document.getElementById(idStr);
	if(initA != null)
	 (initA.parentNode).removeChild(initA);
	var aBtn = document.createElement("a");	
	if(idStr  != "")
		aBtn.id = idStr;
	// id="div_nav_left_btn" class="icon_left_nav_sword nav_btn" onclick="location.href = 'WizardHome.htm';" style="position:absolute;width:70px;height:70px;left:290px;top:0px;cursor:pointer;z-index:900;"
	aBtn.className = ((isLeft)?"icon_left_nav_sword":"icon_right_nav_sword")+" nav_btn";
	aBtn.style.cssText = "position:absolute;width:"+paras[2]+"px;height:"+paras[3]+"px;"+((isLeft)?"left:":"right:")+paras[0]+"px"+";top:"+paras[1]+"px;cursor:pointer;z-index:900;";
	aBtn.onclick = function (){jumpToPageByURL(url);};
	
	document.body.appendChild(aBtn);
}

///////////功能定制 开始//////////////
function getMaxWidthStringByJson(json,className,fontSize)
{
	var maxSelectWidth = 0;
	for(var key in json)
	{
		var cw = calcStrWidthByStyle(className,fontSize,json[key]);//alert(key+"==>"+json[key]+":"+cw);
		maxSelectWidth = (maxSelectWidth<cw)?cw:maxSelectWidth;
	}
	return 	maxSelectWidth;
}
////////////功能定制 结束/////////////////




/*高级设置按钮onmouseover onmouseout响应
headerStr按钮头的id字符串
midStr按钮中间的id字符串
tailStr按钮尾部的id字符串
*/
function operateSetupBtnBk(headerStr,midStr,tailStr,isOver)
{
	var btnHeader = document.getElementById(headerStr);
	var btnMid = document.getElementById(midStr);
	var btnTail = document.getElementById(tailStr);
	if(isOver)
	{
		btnHeader.style.backgroundPosition = "0px -38px";
		btnMid.style.backgroundPosition = "0px -38px";
		btnTail.style.backgroundPosition = "0px -38px";
	}
	else
	{
		btnHeader.style.backgroundPosition = "0px 0px";
		btnMid.style.backgroundPosition = "0px 0px";
		btnTail.style.backgroundPosition = "0px 0px";
	}
}


function modifyColorAndBkByOver(obj,isOver,bkColor,color)
{
	if(isOver)
	{
		obj.initColor = obj.style.color;
		obj.initBk = obj.style.backgroundColor;
		obj.style.backgroundColor = bkColor;
		obj.style.color = color;
	}
	else
	{
		obj.style.backgroundColor = obj.initBk;
		obj.style.color = obj.initColor;
	}
}
var SETUP_PROC_MASK_TO_FIRST = 4;
function modifyObjBkImgPosByOver(obj,isOver,initX,initY,currentX,currentY)
{
	if(isOver)
		obj.style.backgroundPosition = currentX+"px "+currentY+"px";
	else
		obj.style.backgroundPosition = initX+"px "+initY+"px";
}
function setMask(mode,isDisplay)
{//MAX_TOP_MASK
	var initBk = document.getElementById("div_proc_page");
	
	if(initBk != null)
		(document.body).removeChild(initBk);
	var bk = document.createElement("div");
	bk.id = "div_proc_page";
	var zIndex = MAX_BOTTOM_MASK;
	if(mode == 4 | mode == 5)
		zIndex = SECOND_MASK;
	else if(mode == MAX_TOP_PROC_MODE)
		zIndex = MAX_TOP_MASK;
	else
		zIndex = MAX_BOTTOM_MASK ;
	var disp = (isDisplay)?"bolck":"none";
	bk.style.cssText = "position:absolute;width:100%;height:100%;display:"+disp+";left:0px;top:0px;z-index:"+zIndex +";opacity:"+g_maskOpacity+";filter:alpha(opacity=60);background-color:#575757;";
  //console.log("mode="+mode+",zIndex="+zIndex+",MAX_TOP_MASK="+MAX_TOP_MASK+",MAX_TOP_PROC_MODE="+MAX_TOP_PROC_MODE);
	(document.body).appendChild(bk);	
	/*
	if(initBk == null)
	{
		var bk = document.createElement("div");
		bk.id = "div_proc_page";
		bk.style.cssText = "position:absolute;width:100%;height:100%;display:none;left:0px;top:0px;z-index:"+MAX_BOTTOM_MASK +";opacity:"+g_maskOpacity+";filter:alpha(opacity=60);background-color:#575757;";
		(document.body).appendChild(bk);
	}
	else
	{
		if(mode == 4 | mode == 5)
			initBk.style.zIndex = SECOND_MASK;
		else if(mode == MAX_TOP_PROC_MODE)
			initBk.style.zIndex = MAX_TOP_MASK;
		else
			initBk.style.zIndex = MAX_BOTTOM_MASK ;
	}	*/
}
function delaySetMask()
{
	var bk = document.getElementById("div_proc_page");
	var aPopWins = document.getElementsByClassName("pop_win_tab_list");//pop_win_tab_list
	var arr = new Array();
	var zIndex = -1;
	var len = aPopWins.length;
	if(len == 0)
	{
		removeMask();
		return;	
	}
	for(var i = 0; i < len; i++)
		arr.push(parseInt(aPopWins[i].style.zIndex,10));
	if(arr.length > 1)
		arr.sort();
	for(var i = 0; i < g_aMaskIndex.length; i++)
	{
		if(g_aMaskIndex[i] < arr[aPopWins.length - 1])
			zIndex = g_aMaskIndex[i];
	}
	if(zIndex != -1)
	{
		if(bk == null)
			setMask();
		bk = document.getElementById("div_proc_page");
		if(bk != null)
		{
			bk.style.display = "block";
			bk.style.zIndex = zIndex;
		}
	}
}
function removeMask()
{
	var initBk = document.getElementById("div_proc_page");
	if(initBk != null)
		(initBk.parentNode).removeChild(initBk);
}
function checkIsStartProcess()
{
	var bk = document.getElementById("div_proc_page");
	var procTab = document.getElementById("tab_proc_page");
	if(bk == null && procTab == null)
		return 0;
	if(bk == null)
		return 0;
	if(bk != null && procTab == null)
		return  -100;
	if(bk.style.display == "block" && procTab.style.display == "block")
		return 1;
	if(bk.style.display == "block")
		return -1;//弹出窗口mask遮罩的情况
	return -100;
}
function startProcess(mode,obj)
{
	if(!g_startProc)
		return;
	/*
	var initBk = document.getElementById("div_proc_page");
	if(initBk == null)
	{
		var bk = document.createElement("div");
		bk.id = "div_proc_page";
		bk.style.cssText = "position:absolute;width:100%;height:100%;display:none;left:0px;top:0px;z-index:"+MAX_BOTTOM_MASK +";opacity:"+g_maskOpacity+";filter:alpha(opacity=60);background-color:#575757;";
		(document.body).appendChild(bk);
	}
	else
	{
		if(mode == 4 | mode == 5)
			initBk.style.zIndex = SECOND_MASK;
		else if(mode == MAX_TOP_PROC_MODE)
			initBk.style.zIndex = MAX_TOP_MASK;
		else
			initBk.style.zIndex = MAX_BOTTOM_MASK ;
	}	
*/
	
	setMask(mode);
	var dPage = getPageDisplaySize();
	var procTab = document.getElementById("tab_proc_page");
	if(procTab != null)
		(document.body).removeChild(procTab);	
	procTab = document.createElement("table");
	procTab.id = "tab_proc_page";
	procTab.style.cssText = "position:absolute;left:0;top:0px;z-index:"+MAX_TOP_PROC_TABLE+";";
	var row = procTab.insertRow();
	var cell = row.insertCell();
	cell.vAlign = "middle";
	cell.align = "center";
	//cell.style.backgroundColor = "#ccc";
	
	var procChildTab = document.createElement("table");
	procChildTab.cellPadding = "0";
	procChildTab.cellSpacing = "0";
	procChildTab.border = "0";
	row = procChildTab.insertRow();
	var tdStatus = row.insertCell();
	tdStatus.id = "td_status";
	tdStatus.vAlign = "middle";
	tdStatus.align = "center";
	row = procChildTab.insertRow();
	row.id = "row_cancel";
	var cellBtn = row.insertCell();
	cellBtn.vAlign = "middle";
	cellBtn.align = "center";
	cellBtn.style.padding = "16px"
	if(mode == undefined | mode == 1 | mode == 4 | mode == MAX_TOP_PROC_MODE)
	{
		var img = document.createElement("img");	
		//img.style.marginLeft = "10px";
		img.id = "img_proc";
		img.src = "images/process.gif";
		tdStatus.appendChild(img);
		
	}
	else if(mode == 2)
	{		
		if(obj == undefined)
			return;
		if(tdStatus != null)
		{
			tdStatus.appendChild(obj);
			cellBtn.style.backgroundColor = "#fff";
		}
	}
	var a = document.createElement("a");
	a.id = "a_cancel";
	a.href = "javascript:void(0);";
	a.className = "normalbtn";
	a.onclick = forceCancelProcess;
	a.innerText = getLanTextByKey("T_CANCEL_OP");
	cellBtn.appendChild(a);
	
	if(mode != 3 & mode != 5)
	{
		cell.appendChild(procChildTab);
		(document.body).appendChild(procTab);	
	}
	else
		procChildTab = null;
	setMask(mode);
	resizeProcess(dPage);
}
function resizeProcess(dPage)
{
	var bk = document.getElementById("div_proc_page");
	var procTab = document.getElementById("tab_proc_page");
	if(bk != null)
	{
		//bk.style.width = dPage.w + "px";
		//bk.style.height = dPage.h + "px";
		bk.style.display = "block";
	}
	if(procTab != null)
	{
		var w = getElementWidthByObj(procTab);
		var h = getElementHeightByObj(procTab);
		procTab.style.left = parseInt((dPage.w - w)/2,10) + "px";
		procTab.style.top = parseInt((dPage.h - h)/2,10) + "px";
	}
}
function cancelProcess(callBackMehtod,mode)
{	
	if(!g_startProc)
		return;
	var bk = document.getElementById("div_proc_page");
	var procTab = document.getElementById("tab_proc_page");
	
	if(g_onlyMoveProcTab)
	{
		g_onlyMoveProcTab = false;
		if(bk != null)
			bk.style.zIndex = MAX_BOTTOM_MASK ;
		
		if(procTab != null)
			(procTab.parentNode).removeChild(procTab);
		if(callBackMehtod != undefined)
			eval(callBackMehtod);		
		return;
	}
	
	if(bk != null)
	{
		if(mode != undefined)
			delaySetMask();
		else
			delaySetMask();
	}
	if(procTab != null)
		(procTab.parentNode).removeChild(procTab);
	if(callBackMehtod != undefined)
		eval(callBackMehtod);
}
function changeProcToMask()
{
	var row = document.getElementById("row_cancel");
	var img = document.getElementById("img_proc");
	if(row != null)
		row.style.display = "none";
	if(img != null)
		img.style.display = "none";
}
var g_isForceExited = false;
var g_forceCancelProcessCallBackMethod = null;
function forceCancelProcess()
{
	if(this.disabled)
		return;
	setTimeout(function(){delaySetMask();},300);
	g_startProc = true;
	cancelProcess(null,4);
	setAbtnStatus(this,true);
	g_isForceExited = true;	
	if(g_forceCancelProcessCallBackMethod != null)
		g_forceCancelProcessCallBackMethod();
	_externalRequestStopOperation();
}
function updateControlAbsoluteCenterPos(dPage,obj)
{
	var w = getElementWidthByObj(obj);
	var h = getElementHeightByObj(obj);
	var top = parseInt((dPage.h - h)/2,10);
	var left = parseInt((dPage.w - w)/2,10);
	obj.style.top = top+"px";
	obj.style.left = left+"px";
	resizeProcess(dPage);
}
function removePopTabWin(id,mode)
{
	var tabs = document.getElementsByClassName(POP_WIN_TAB_CLASS_NAME);
	for(var i = 0; i < tabs.length;i++)
	{
		if(id == undefined)
		{
			(tabs[i].parentNode).removeChild(tabs[i]);
		}
		else if(id == tabs[i].id)
			(tabs[i].parentNode).removeChild(tabs[i]);	
	}
	delaySetMask();
	if(mode == undefined)
		cancelProcess();
	else if(mode == 4)
		cancelProcess(null,4);
}
var g_isToastTips = false;
//getTabList(getLanTextByKey("T_STATUS_LIST_TITLE"),new Array(w,h,left,top),tabStatus,nMode,SECOND_DIALOG_MASK_INDEX,wId,callBackByClosedMethod,isStopBtn);
var g_fixedHeight = -1;
function getTabList(title,aPos,listId,mode,zIndex,pWinId,callBackByClosedMethod,isStopBtn,callBackByClosedBeforeMethod)
{
	g_isForceExited = false;
	var nCallBackByClosedMethod = "";
	if(callBackByClosedMethod != undefined && callBackByClosedMethod != null)
		nCallBackByClosedMethod = callBackByClosedMethod;
	var tab = document.createElement("table");	
	tab.id = (pWinId == undefined)?POP_TAB:pWinId;
	tab.style.cssText = "position:absolute;z-index:"+((zIndex == undefined)?DIALOG_EDIT_WIN_INDEX:zIndex)+";height:"+aPos[1]+"px;width:"+aPos[0]+"px;left:"+aPos[2]+"px;top:"+aPos[3]+"px;border:#368fca solid 1px;box-shadow: 1px 1px 5px 1px #bfbfbf;";
	tab.cellPadding = "0";
	tab.cellSpacing = "0";
	tab.className = POP_WIN_TAB_CLASS_NAME;
	var row = tab.insertRow();
	row.id = tab.id+"_title";
	var cell  = row.insertCell();
	cell.align = "center";
	cell.style.cssText = 'width:38px;height:36px;padding:4px;background-color:#55bdf0;';
	var icon = document.createElement("div");
	var obj = getTabListTitleIcon(mode);
	
	icon.className = obj.className + " normal_ico";
	icon.style.cssText = 'color:#fff;';
	cell.appendChild(icon);
	
	cell  = row.insertCell();
	cell.align = "left";
	cell.style.cssText = 'height:36px;padding:4px;background-color:#55bdf0;color:#fff;';	
	//var addCardMethod = "onblur='returnControlFocus(this);' oninput='usbAddCardNumber(this);' onchange='completeUsbAddCardNumber(this);'";//onchange='usbAddCardNumber(this);'
  var addCardMethod = "onblur='returnControlFocus(this);' oninput='usbAddCardNumber(this);'";
	cell.innerHTML = "<span id='title_"+tab.id+"' class='title3'>"+title+"</span><input id='txt_usb_add_card' value='' "+addCardMethod+" style='width:0px;height:0px;background-color:#55bdf0;border:#55bdf0 solid 0px;'/>";
	//if(obj.close)
	{
		var closeObj = document.createElement('a'); 
		closeObj.id = tab.id+"_close";
		
		closeObj.nCallBackByClosedMethod = nCallBackByClosedMethod;	
		closeObj.callBackByClosedBeforeMethod = callBackByClosedBeforeMethod;
		closeObj.className = "icon_close icobtn";		
		
		closeObj.onclick = function(){onClickCloseWin(this);};
		
			
		cell.appendChild(closeObj);
		closeObj.style.cssText = "float:right;display:"+((obj.close)?";":"none;");
	}
	
	row = tab.insertRow();
	cell  = row.insertCell();	
	cell.colSpan = "2";
	cell.vAlign="top";
	cell.align = "right";
	cell.style.cssText = 'padding:4px;background-color:#fff;';	
	
	var tabc = document.createElement("table");	
	if(listId != "")
		tabc.id = listId;
	tabc.width = '100%';
	tabc.className = "tab_edit_list";
	tabc.border = "0";
	tabc.cellPadding = "0";
	tabc.cellSpacing = "0";
	cell.style.cssText = "padding:2px;background-color:#fff;";
	var iCell = cell;
  var pack = document.createElement("div");
		pack.className = "custom_scroll_style";
	if(mode == TABLE_STATUS_LIST_MODE | mode == TABLE_STATUS_LIST_CLOSE_MODE)
	{
		pack.style.cssText = "width:100%;height:"+460+"px;background-color:#fff;overflow-y:auto;";//460
		var arr = new Array("icon_log_tips","icon_log_important","icon_log_alarm","icon_log_error");
		for(var i = 0;i<TABLE_STATUS_LIST_MAX_ROWS_AMOUNT;i++)
		{
			var cRow = tabc.insertRow();
			var cCell = cRow.insertCell();
			cCell.width = "5%";
			cCell.align = "right";
			cCell.vAlign = "top";
			cCell.id = listId+"_"+i+"_0";
			//cCell.innerHTML = '<span class="'+arr[i%4]+'" style="font-size:1.6rem;"></span>';
			cCell = cRow.insertCell();
			cCell.width = "95%";
			cCell.id = listId+"_"+i+"_1";
			//cCell.innerHTML = "我是中国人";
		}
    pack.appendChild(tabc);
		cell.appendChild(pack);
		setTimeout(function(){pack.style.height = (iCell.scrollHeight) + "px";},200);
	}
	else
  {
    //var pHeight = (g_fixedHeight > 0)?("height:"+g_fixedHeight+"px"):"";
		//pack.style.cssText = "width:100%;"+pHeight+"background-color:#fff;overflow-y:auto;";//460
    
    pack.style.cssText = "width:100%;height:"+(aPos[1]-40)+"px;background-color:#fff;overflow-y:auto;";//460
    pack.appendChild(tabc);
		cell.appendChild(pack);
  }
		
	
	if(isStopBtn == -2)
	{
		row = tab.insertRow();
		row.id = "tr_status_tab_list_stop_button";
		cell  = row.insertCell();	
		cell.colSpan = "2";
		cell.vAlign="bottom";
		cell.align = "center";
		cell.style.cssText = 'padding:4px;background-color:#fff;';	
		var a = document.createElement("a");
		a.id = "a_cancel";
		a.style.marginBottom = "1rem";
		a.href = "javascript:void(0);";
		a.className = "normalbtn";
		a.onclick = exitCancelProcess;
		a.innerText = getLanTextByKey("T_CANCEL_OP");
		cell.appendChild(a);
	}
	else if(isStopBtn == true)
	{
		row = tab.insertRow();
		row.id = "tr_status_tab_list_stop_button";
		cell  = row.insertCell();	
		cell.colSpan = "2";
		cell.vAlign="bottom";
		cell.align = "center";
		cell.style.cssText = 'padding:4px;background-color:#fff;';	
		var a = document.createElement("a");
		a.id = "a_cancel";
		a.style.marginBottom = "1rem";
		a.href = "javascript:void(0);";
		a.className = "normalbtn";
		a.onclick = forceCancelProcess;
		a.innerText = getLanTextByKey("T_CANCEL_OP");
		cell.appendChild(a);
	}	
	return tab;
}
function onClickCloseWin(closeObj)
{
	if(!g_isCloseCurrentWinMode && (!g_isToastTips))
	{
		showToast(getLanTextByKey("T_NOT_FORCE_CLOSE_WIN_TITLE"),DIALOG_MASK_TIP_MODE,2);
		//g_isToastTips = true;
		return;
	}
	g_isToastTips = true;
	if(closeObj.callBackByClosedBeforeMethod != undefined && closeObj.callBackByClosedBeforeMethod != "")
	{
		eval(closeObj.callBackByClosedBeforeMethod);
		return;//这是confirm模式，在具体页面回调中实现
	}
		
	var tab = document.getElementById((closeObj.id).replace("_close",""));
	(tab.parentNode).removeChild(tab);
	removePopTabChildNodeRelativeUI(-1);			
	var tabs = document.getElementsByClassName(POP_WIN_TAB_CLASS_NAME);			
	if(tabs != null)
	{
		
		if(tabs.length > 0){
			cancelProcess(closeObj.nCallBackByClosedMethod,4);}
		else{
			cancelProcess(closeObj.nCallBackByClosedMethod);}
	}
	else{
		cancelProcess(closeObj.nCallBackByClosedMethod);}
	delaySetMask();
	
}
var g_isForceUSRAddCardInputFocus = true;
function returnControlFocus(input)
{
	if(g_isForceUSRAddCardInputFocus)
		input.focus();	
}
function displayWinCloseIcon(isDisplay,tabid)
{
	var id = POP_TAB;
	if(tabid != undefined && tabid != "")
		id = tabid;
	
	var closeIcon = document.getElementById(id + "_close");	
  if(closeIcon != null)
  {
    closeIcon.style.display = "";
	   removeTabListStopOperationRow();//移除停止按钮
  }	
}
function removePopTabChildNodeRelativeUI(isHidden)
{return;//暂时取拖动
	var comboxes = document.getElementsByClassName("combo-p");
	for(var i = comboxes.length - 1; i >= 0; i--)
	{
		if(isHidden == -1)
		{
			comboxes[i].style.display = "block";		
			(comboxes[i].parentNode).removeChild(comboxes[i]);
		}
		else if(isHidden && (comboxes[i].style.display) == "block")
			comboxes[i].style.display = "none";		
	}
}
function hiddenPopTabChildNodePannel(isHidden)
{
	var comboxes = document.getElementsByClassName("combobox-f combo-f textbox-f");// combobox-f combo-f textbox-f
	for(var i = comboxes.length - 1; i >= 0; i--)
		$(comboxes[i]).combobox('hidePanel');
	comboxes = document.getElementsByClassName("datebox-f");//datebox-f combo-f textbox-f
	for(var i = comboxes.length - 1; i >= 0; i--)
		$(comboxes[i]).combobox('hidePanel');
}
function removeTabListStopOperationRow()
{
	var row = document.getElementById("tr_status_tab_list_stop_button");	
	if(row != null)
		(row.parentNode).removeChild(row);
}
function focusToEditInput()
{
		(this.tofocus).focus();
}
function getTabListTitleIcon(mode)
{
	var obj = new Object();
	if(mode == TABLE_EDIT_MODE)
	{
		obj.className = "icon_edit";
		obj.close = true;
	}
	else if(mode == TABLE_QUERY_MODE)
	{
		obj.className = "icon_query";
		obj.close = true;
	}
	else if(mode == TABLE_STATUS_LIST_MODE)
	{
		obj.className = "icon_log_list";
		obj.close = false;
	}
	else if(mode == TABLE_STATUS_LIST_CLOSE_MODE)
	{
		obj.className = "icon_log_list";
		obj.close = true;
	}
	else
	{
		obj.className = "icon_log_list";
		obj.close = false;
	}
	return obj;
}
/*
json{"mode":1,"msg":"msg"}
*/
//item.nLevel 级别。0普通提示（黑）1着重提示（蓝）2警告（桔）3错误（红）4操作成功（绿色）4取消操作（红色）
const LOG_NORMAL_TIPS = 0;
const LOG_IMPORTANT_TIPS = 1;
const LOG_WARN_TIPS = 2;
const LOG_ERROR_TIPS = 3;
const LOG_SUCCESS_TIPS = 4;
const LOG_CANCEL_TIPS = 5;
function insertStatusTabItem(pidStr,json)
{console.log(json);
	var arr = new Array({icon:"icon_log_tips",color:"#000",fcolor:"#7bce55"},{icon:"icon_log_important",color:"#368fca",fcolor:"#7bce55"},{icon:"icon_log_alarm",color:"#fdae47",fcolor:"#fdae47"},{icon:"icon_log_cancel_tips",color:"#e66859",fcolor:"#e66859"},{icon:"icon_log_success_tips",color:"#7bce55",fcolor:"#7bce55"},{icon:"icon_log_cancel_tips",color:"#e66859",fcolor:"#7bce55"});
	for(var i = TABLE_STATUS_LIST_MAX_ROWS_AMOUNT - 1; i > 0; i--)
	{
		var preRowIndex = i -1;
		if(preRowIndex >= 0) 
		{
			var obj1 = document.getElementById(pidStr+"_"+i+"_0");
			var obj2 = document.getElementById(pidStr+"_"+i+"_1");
			if(obj1 != null)
				obj1.innerHTML = document.getElementById(pidStr+"_"+preRowIndex+"_0").innerHTML;
			if(obj2 != null){
				obj2.innerHTML = document.getElementById(pidStr+"_"+preRowIndex+"_1").innerHTML;
				
			}			
		}
		else
		{
			break;
		}
	}
	var index = 0;
	if(json.mode < 0)
		index = 3;
	else if(json.mode > arr.length) 
		index = 0;
	else
		index = json.mode;
	var iconCell = document.getElementById(pidStr+"_0_0");
	var contentCell = document.getElementById(pidStr+"_0_1");
	if(iconCell != null)
		iconCell.innerHTML = '<span class="'+arr[index].icon+'" style="font-size:1.6rem;color:'+arr[index].fcolor+';"></span>';
	if(contentCell != null)
		contentCell.innerHTML = '<span style="color:'+arr[index].color+';">'+replaceStr(json.msg,"\n","<br/>")+'</span>';
	if(json["btn"] != undefined){
		json["btn"].style.marginLeft = "4px";
		contentCell.appendChild(json["btn"]);
	}
		
}
function insertTabCustomEditItem(pidStr,arr,editInputId,isWeek,item,isDisabledSave)
{
		var tab = document.getElementById(pidStr);
		tab.className = "tab_list";
		tab.width = "100%";
		tab.border = "0";
		if(isWeek)
		{
			var weekSelect = document.createElement("input");
			weekSelect.id = "select_week_schedual";
			weekSelect.style.cssText = "float:left;width:80px;";
			var holidaySelect = document.createElement("input");
			holidaySelect.id = "select_holiday_schedual";
			holidaySelect.style.cssText = "float:left;width:80px;";
			holidaySelect.data = g_yesOrNoNavItemJsons;
			holidaySelect.callbackMethod = "callbackEditWeekSchedual";
			weekSelect.data = g_yesOrNoNavItemJsons;
			weekSelect.callbackMethod = "callbackEditWeekSchedual";
			
			var row = tab.insertRow();
			var cellStyle = "border-left:#ccc solid 0px;border-right:#ccc solid 0px;height:50px;background-color:#f1fafc;padding-top:0.1rem;";
			var cell = row.insertCell();
			cell.colSpan = 2;
			cell.style.cssText = cellStyle;
			cell.align = "right";
			cell.vAlign = "middle";
			cell.innerHTML = '<span style="">'+getLanTextByKey("T_START_WEEK_SCHEDUAL_TIPS")+'</span>';
			cell = row.insertCell();
			cell.colSpan = 2;
			cell.style.cssText = cellStyle;
			cell.vAlign = "middle";
			cell.appendChild(weekSelect);
			weekSelect.default = (item["m_dwFlag"][1] == -1)?"1":item["m_dwFlag"][1]+"";
			initInputSelectUIByEasyUI(weekSelect);
			
			if(item["m_dwFlag"][1] == -1)
			{
				var uiObj1 = lookForFirstChildNodesByClass(cell,"textbox combo");
				uiObj1.style.backgroundColor = g_bColorMultiVal;
				var uiObj2 = lookForFirstChildNodesByClass(cell,"textbox-text validatebox-text validatebox-readonly textbox-prompt");
				//alert(uiObj2 + " == " +uiObj2.id);
				uiObj2.style.backgroundColor = g_bColorMultiVal;
				uiObj1.tips = getLanTextByKey("T_MULTI_VAL_SELECT_DIFFERENT_TIPS");	
				setEasyUITooltips(uiObj1);	
			}
			
			cell = row.insertCell();
			cell.colSpan = 2;
			cell.style.cssText = cellStyle;
			cell.align = "right";
			cell.vAlign = "middle";
			cell.innerHTML = '<span style="">'+getLanTextByKey("T_START_HOLIDAY_SCHEDUAL_TIPS")+'</span>';
			cell = row.insertCell();
			cell.colSpan = 2;
			cell.style.cssText = cellStyle;
			cell.vAlign = "middle";
			cell.appendChild(holidaySelect);
			holidaySelect.default = (item["m_dwFlag"][0] == -1)?"1":item["m_dwFlag"][0]+"";
			initInputSelectUIByEasyUI(holidaySelect);
			
			if(item["m_dwFlag"][0] == -1)
			{
				var uiObj1 = lookForFirstChildNodesByClass(cell,"textbox combo");
				uiObj1.style.backgroundColor = g_bColorMultiVal;
				var uiObj2 = lookForFirstChildNodesByClass(cell,"textbox-text validatebox-text validatebox-readonly textbox-prompt");
				//alert(uiObj2 + " == " +uiObj2.id);
				uiObj2.style.backgroundColor = g_bColorMultiVal;
				uiObj1.tips = getLanTextByKey("T_MULTI_VAL_SELECT_DIFFERENT_TIPS");	
				setEasyUITooltips(uiObj1);	
			}
			/*
			cell = row.insertCell();
			cell.style.cssText = cellStyle;
			cell = row.insertCell();
			cell.style.cssText = cellStyle;
			cell = row.insertCell();
			cell.style.cssText = cellStyle;
			*/
			for(var i = 0; i < arr.length; i++)
			{
				row = tab.insertRow();	//alert(arr[i]);		
				for(var j = 0; j < arr[i].length; j++)
				{
						cell = row.insertCell();
						cell.align = "center";
						cell.vAlign = "middle";
						if(((typeof(arr[i][j])+"").toUpperCase()) == "OBJECT")
						{//if(j == 1)alert(arr[i][j]);
							var input = arr[i][j];//document.createElement("input");
							input.type = "text";
							input.style.cssText = "width:80px;";
							input.value = input.id;
							//arr[i][j].id = editInputId+i+"_"+j;
							cell.appendChild(input);
							$(input).timespinner({
								value: '00:00',     //初始时间
								min: '00:00',       //最小值
								max: '23:59',      //最大值
								/*spin:function () {
             
        },*/
							onChange: function(){
									var callBackMehtod = 'changeTimeSpinnerCallBackMethod';
										if(checkMethodName(callBackMehtod))
											upTimeSpinnerCallBackMethod(this);
									return true;
							},
							onSpinUp: function () {
										var callBackMehtod = 'upTimeSpinnerCallBackMethod';
										//if(checkMethodName(callBackMehtod))
										//	upTimeSpinnerCallBackMethod(this);
								},
								onSpinDown: function () {
										var callBackMehtod = 'downTimeSpinnerCallBackMethod';
										if(checkMethodName(callBackMehtod))
											downTimeSpinnerCallBackMethod(this);
								}
							});
						}
						else if(((typeof(arr[i][j])+"").toUpperCase()) == "STRING")
						{
							cell.innerText = arr[i][j];
						}
				}	
			}
		}
		else
		{
			for(var i = 0; i < arr.length; i++)
			{
				var row = tab.insertRow();
				var cell = row.insertCell();
				cell.align = "center";
				cell.vAlign = "middle";
				cell.style.border = "0px";
				cell.innerText = arr[i];
				
				cell = row.insertCell();
				cell.align = "left";
				cell.vAlign = "middle";
				cell.style.border = "0px";
				var input = document.createElement("input");
				input.type = "text";
				input.id = editInputId+i;
				input.changeMethodName = "changeDateBoxVal";
				input.style.cssText = "width:80px;";
				cell.appendChild(input);
				initEasyUIDateBox(input);
				i++;
				cell = row.insertCell();
				cell.align = "center";
				cell.vAlign = "middle";
				cell.style.border = "0px";
				cell.innerText = arr[i];
				
				cell = row.insertCell();
				cell.align = "left";
				cell.vAlign = "middle";
				cell.style.border = "0px";
				input = document.createElement("input");
				input.id = editInputId+i;
				input.style.cssText = "width:80px;";
				input.type = "text";
				input.value = editInputId+i;
				input.changeMethodName = "changeDateBoxVal";
				cell.appendChild(input);
				initEasyUIDateBox(input);
			}
		}
		var row = tab.insertRow();	
		var cell = row.insertCell();
		cell.align = "center";
		cell.style.cssText = "border-left:0px;border-right:0px;border-bottom:0px;";
		cell.colSpan = arr[0].length;
		var aBtn = document.createElement("a");
		aBtn.id = "btn_save_week_setup";
		aBtn.className = "normalbtn";
		aBtn.href = "#";
		aBtn.onclick = function(){
			if(isWeek)
				submitWeekSchedual(this);
			else
				submitHolidaySchedual(this);
			};
		aBtn.style.cssText = "margin-top:10px;";
		aBtn.innerText = getLanTextByKey("T_SAVE");
		setAbtnStatus(aBtn,isDisabledSave)
		if(item != undefined)
			aBtn.hideContent = item;
		cell.appendChild(aBtn);
		//cell.innerHTML = '<a id="a_week_setup" class="normalbtn" href="#" onclick="' + ((isWeek)?"submitWeekSchedual("+cell+");":"submitHolidaySchedual("+cell+");") + '" style="margin-top:10px;">'+getLanTextByKey("T_SAVE")+'</a>';
}

function initEasyUIDateBox(input)
{
	var buttons = $.extend([], $.fn.datebox.defaults.buttons);
    buttons.splice(1, 0, {
		text: getLanTextByKey('T_CLEAR_BUTTON'),
		handler: function(target){
                    //清除日期信息
		    $(target).datebox("setValue","");
		    //关闭日期选择框
		     $(target).datebox('hidePanel');
						if(checkMethodName("changeDateBoxVal"))
							changeDateBoxVal(input,0);//setTimeout(function (){changeDateBoxVal($(target),0);},50);
		}
	});
	$(input).datebox({
					value: '',
					editable:false,
					required: false,
					buttons: buttons,//增加清除按钮,
					showSeconds: false,
					formatter: function(date){ 
						var years=date.getFullYear();//获取年
						var months=date.getMonth()+1;//获取日
						var dates=date.getDate();//获取月
						if(months<10 && months > 0){//当月份不满10的时候前面补0，比如09
							months='0'+months;
						}
						else if(months>12)
							months = 12;
						else if(months < 1)
							months = 1;
						
						if(dates<10 && dates > 0){//当日期不满10的时候前面补0，比如09
							dates='0'+dates;
						}
						else if(dates > 31)
							dates = 31;
						else if(dates < 1)
							dates = 1;
						return months+"-"+dates;//根据自己的需要修改
					},
					onSelect: function(date){
						if(checkMethodName(input.changeMethodName))
							setTimeout(function (){changeDateBoxVal(input,date);},1);
						callBackDateBoxSelect(input,date);
						return;
					},
					onChange: function(){
						
					//	callBackDateBoxChange(input);
						 
						/*var years=date.getFullYear();//获取年
						var months=date.getMonth()+1;//获取日
						var dates=date.getDate();//获取月
						*/
					}
				});	
}
function callBackDateBoxChange(input)
{
	if(is_SelectingDateBox)
		return;
	var date = $(input).datebox('getValue');
	date = date.split("-");
	var years = parseInt(date[0],10);//获取年
	var months = parseInt(date[1],10);//获取日
	var dates = parseInt(date[2],10);//获取月
	var d = new Date(years,months,0);
  var maxDays = d.getDate();
	if(months<10 && months > 0){//当月份不满10的时候前面补0，比如09
		months='0'+months;
	}
	else if(months>12)
		months = 12;
	else if(months < 1)
		months = 1;
	
	if(dates<10 && dates > 0){//当日期不满10的时候前面补0，比如09
		dates='0'+dates;
	}
	else if(dates > maxDays)
		dates = maxDays;
	else if(dates < 1)
		dates = 1;
	//alert("callBackDateBoxChange = "+years+"-"+months+"-"+dates);
	if(lan == "en")
		setTimeout(function(){$(input).datebox('setValue', months+"/"+dates+"/"+years);},0);
	else
		setTimeout(function(){$(input).datebox('setValue', years+"-"+months+"-"+dates);},0);
	
}
var is_SelectingDateBox = false;
function callBackDateBoxSelect(input,date)
{
	is_SelectingDateBox = true;
	var years=date.getFullYear();//获取年
	var months=date.getMonth()+1;//获取日
	var dates=date.getDate();//获取月
	var d = new Date(years,months,0);
  var maxDays = d.getDate();
	//return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
	//alert(date.getFullYear()+":"+(date.getMonth()+1)+":"+date.getDate());
	if(months<10 && months > 0){//当月份不满10的时候前面补0，比如09
		months='0'+months;
	}
	else if(months>12)
		months = 12;
	else if(months < 1)
		months = 1;
	
	if(dates<10 && dates > 0){//当日期不满10的时候前面补0，比如09
		dates='0'+dates;
	}
	else if(dates > maxDays)
		dates = maxDays;
	else if(dates < 1)
		dates = 1;
	if(lan == "en")
		setTimeout(function(){$(input).datebox('setValue', months+"/"+dates+"/"+years);is_SelectingDateBox = false;},5);
	else
		setTimeout(function(){$(input).datebox('setValue', years+"-"+months+"-"+dates);is_SelectingDateBox = false;},5);
}
function setAbtnStatus(btn,isDisabled,nClass)
{
	if(btn == null)
		return;
	btn.disabled = isDisabled;
	var newClass = "normalbtn";
	if(nClass != undefined && nClass != "")
		newClass = nClass;
	btn.className = (isDisabled)?"normalbtn_disabled":newClass;
}
function setIcoAbtnStatus(btn,isDisabled,nClass)
{
	btn.disabled = isDisabled;
	var newClass = "icobtn";
	if(nClass != undefined && nClass != "")
		newClass = nClass;
	
	if(isDisabled)
	{
		if((btn.className).indexOf("icobtn_disabled") < 0)
			btn.className = (btn.className).replace(newClass,"icobtn_disabled");
	}
	else
	{	
		if((btn.className).indexOf("icobtn_disabled") > -1)	
			btn.className = (btn.className).replace("icobtn_disabled",newClass);
	}
}
function setIcoDelBtnStatus(btn,isDisabled,nClass)
{
	if(btn == null)
		return;
	btn.disabled = isDisabled;
	var newClass = "delicobtn";
	if(nClass != undefined && nClass != "")
		newClass = nClass;
	if(isDisabled)
	{
		if((btn.className).indexOf("delicobtn_disabled") < 0)
			btn.className = (btn.className).replace(newClass,"delicobtn_disabled");
	}
	else
	{	
		if((btn.className).indexOf("delicobtn_disabled") > -1)	
			btn.className = (btn.className).replace("delicobtn_disabled",newClass);
	}
}
function getSpacePosByNum(num)
{
	var blankPos = "";
	for(var i = 0; i< num; i++)
		blankPos += "&nbsp;";
	return blankPos;
}
function insertTabEditItem(pidStr,jsons,isExistPhoto)
{
	var controlWidth = 300;
	var tab = document.getElementById(pidStr);
	var group = -1;	
	var cellBorderWidth = 0;
	var isExpand = true;
	var rowBkColor = "#fff";
	var ptab = null;
	var spaceNum = 20;
	
	var isInsertPhoto = (!isExistPhoto);
	var contentCellScale = "auto";
	for(var i = 0;i<jsons.length;i++)
	{	
		if(jsons[i]["expand"] != undefined)
		{			
			var row = tab.insertRow();
			var cell  = row.insertCell();	
			if(jsons[i]["json"] == undefined)
			{
				cell.align = "left";
				cell.innerHTML = jsons[i].title;
				if(jsons[i]["titleId"] != undefined)
					cell.id = jsons[i]["titleId"];
				isExpand = jsons[i]["expand"];
				cell.style.cssText = "cursor:pointer;background-color:"+((isExpand)?jsons[i]["expandbk"]:jsons[i]["collapsebk"]);
				var ico = getExpandOrColapseIcon(isExpand);
				cell.appendChild(ico);
				row.style.cssText = "border-top:#368fca solid 1px;";
				
				group++;
				row.parentgroup = group;
				row.id = "row_"+ jsons[i]["id"];
				if(jsons[i]["disabled"] != undefined)
				{
					row.disabled = (jsons[i]["disabled"])?true:false;
					if(row.disabled & jsons[i]["tips"] != undefined)
					{
						row.id = "row_"+jsons[i]["id"];
						row.tips = jsons[i]["tips"];
						setEasyUITooltips(row,"top",200);
					}
				}
				else
					row.disabled = false;
				row.ico = ico;
				row.hideContent = jsons[i];
				row.expandbk = jsons[i]["expandbk"];
				row.collapsebk = jsons[i]["collapsebk"];
				rowBkColor = jsons[i].backgroundcolor;
				
				if(jsons[i]["shortcut"] == undefined)
					row.shortcut = "";
				else
				{
					row.shortcut = jsons[i]["shortcut"];
					row.id = jsons[i]["id"] + "_short_cut";
				}
				
				if(jsons[i]["display"] != undefined)
				{
					row.style.display = eval('"'+jsons[i]["display"]+'"');//直接等于字符变量jsons[i]["display"]，有问题
				}
				row.onclick = function (){operateRowDisplay(this);};
				if(jsons[i]["overcolor"] != undefined)
				{
					row.onmouseout = function(){operateEditRowTitleOver(this,false);};
					row.onmouseover = function(){operateEditRowTitleOver(this,true);};
				}
			}
			else
			{
				cell.align = "center";
				cell.style.backgroundColor = rowBkColor;
				if(jsons[i]["json"]["mode"] == UI_MODE_GROUPS)
						cell.appendChild(jsons[i]["json"]["obj"]);	
			}
			row = tab.insertRow();
			row.group = group;
			row.style.backgroundColor = rowBkColor;
			row.style.display = (isExpand)?"":"none";
			cell  = row.insertCell();	
			ptab = document.createElement("table");
			ptab.width = "100%";
			cell.appendChild(ptab);
		}
		else if(jsons[i]["text"] != undefined)
		{
			var row = tab.insertRow();
			var cell  = row.insertCell();	
			cell.align = "center";
			cell.colSpan = (jsons[i]["mode"] < 2000)?4:2;//两处判断是否需要四列还是两列的问题
			cell.innerHTML = jsons[i].title;
			if(jsons[i]["titleId"] != undefined)
				cell.id = jsons[i]["titleId"];
		}
		else
		{
			if(i == 0)
			{
				var row = tab.insertRow();
				var cell  = row.insertCell();	
				rowBkColor = "#f1fafc";
				row.style.backgroundColor = rowBkColor;
				ptab = document.createElement("table");
				ptab.width = "100%";
				cell.appendChild(ptab);
			}
			
			if(ptab != null)
			{
				var tControlWidth = controlWidth;
				var row = ptab.insertRow();
				cell  = row.insertCell();	
				cell.align = "center";	
				cell.style.border = "#ccc solid "+cellBorderWidth+"px";
				cell.innerHTML = cutStringByLen(jsons[i].title,g_TitleCutLen);
				if(jsons[i]["titleId"] != undefined)
					cell.id = jsons[i]["titleId"];
				cell.tips = (cell.innerHTML.indexOf("...") > -1)?jsons[i].title:""
				if(jsons[i].title == "")
					cell.innerHTML =getSpacePosByNum(spaceNum);
				if(cell.innerHTML.indexOf("...") > -1)
					setEasyUITooltips(cell);
				
				cell  = row.insertCell();	
				cell.align = "left";
				cell.style.border = "#ccc solid "+cellBorderWidth+"px";
				cell.width = contentCellScale;
				var input = null;	
				
				if(jsons[i]["mode"] != undefined  && jsons[i]["mode"] < 1000)
				{
					if(jsons[i]["callback"] == undefined | jsons[i]["callback"] == "")
						input = getEditInput(jsons[i].id,jsons[i].placeholder,30,jsons[i]["mode"]);
					else
          {
            if(jsons[i]["maxVal"] != undefined && jsons[i]["minVal"] != undefined)
              input = getEditInput(jsons[i].id,jsons[i].placeholder,30,jsons[i]["mode"],jsons[i]["callback"],new Array(jsons[i]["minVal"],jsons[i]["maxVal"]));
            else
              input = getEditInput(jsons[i].id,jsons[i].placeholder,30,jsons[i]["mode"],jsons[i]["callback"]);
          }						
				}
				else if(jsons[i]["mode"] == 1000)
				{
					input = getEditInput("","");
					input.style.display = "";				
				}
				else
					input = getEditInput(jsons[i].id,jsons[i].placeholder);				
				
				if(jsons[i]["cwidth"] != undefined)
					tControlWidth = jsons[i]["cwidth"];				
				input.style.width = tControlWidth + "px";
				if(jsons[i]["json"] != undefined)
					setUItoCellByEasyUI(jsons[i]["json"],cell,tControlWidth);
				else
				{
					if(jsons[i]["val"] != undefined)
					{
						input.value = jsons[i]["val"];
						input.initVal = input.value;
					}
					if(jsons[i]["title"] != "")
					{
						cell.appendChild(input);		
						if(jsons[i]["require"] != undefined)
						{
							if(jsons[i]["require"])
							{
								var sp = document.createElement("sp");
								sp.style.cssText = "color:red;margin-left:0.2rem;font-size:1.2rem;font-weight:bold;";
								sp.id = "sp_tips_"+i+"_0";
								sp.tips = getLanTextByKey("T_REQUIRED_INPUT_TIPS");
								sp.innerText = "*";
								cell.appendChild(sp);	
								setEasyUITooltips(sp);
							}
						}
					}
				}
			
				//alert("jsons[i+1]['expand']="+jsons[i+1]["expand"] + ",," + jsons[i]["json"] + "，，" + jsons[i].title);				
				if(jsons[i+1] == undefined)
					continue;
				if(jsons[i+1]["expand"] != undefined)
				{
					cell  = row.insertCell();	
					cell  = row.insertCell();					
					continue;
				}
				i++;
				if((jsons[i]["mode"] > 2000))//两处判断是否需要四列还是两列的问题
					continue;
				cell  = row.insertCell();	
				cell.align = "center";	
				cell.style.border = "#ccc solid "+cellBorderWidth+"px";
				cell.innerHTML = cutStringByLen(jsons[i].title,g_TitleCutLen);
				if(jsons[i]["titleId"] != undefined)
					cell.id = jsons[i]["titleId"];
				cell.tips = (cell.innerHTML.indexOf("...") > -1)?jsons[i].title:""
				if(cell.innerHTML.indexOf("...") > -1)
					setEasyUITooltips(cell);				
				if(jsons[i].title == "")
					cell.innerHTML = getSpacePosByNum(spaceNum);
				cell  = row.insertCell();	
				cell.style.border = "#ccc solid "+cellBorderWidth+"px";
				cell.align = "left";	
				cell.width = contentCellScale;
				if(jsons[i]["mode"] != undefined)
				{
					if(jsons[i]["callback"] == undefined | jsons[i]["callback"] == "")
						input = getEditInput(jsons[i].id,jsons[i].placeholder,30,jsons[i]["mode"]);
          else
          {
            if(jsons[i]["maxVal"] != undefined && jsons[i]["minVal"] != undefined)
              input = getEditInput(jsons[i].id,jsons[i].placeholder,30,jsons[i]["mode"],jsons[i]["callback"],new Array(jsons[i]["minVal"],jsons[i]["maxVal"]));
            else
              input = getEditInput(jsons[i].id,jsons[i].placeholder,30,jsons[i]["mode"],jsons[i]["callback"]);
          }
				}
				else
					input = getEditInput(jsons[i].id,jsons[i].placeholder);
				tControlWidth = controlWidth;
				if(jsons[i]["cwidth"] != undefined)				
					tControlWidth = jsons[i]["cwidth"];	
				if(jsons[i]["json"] != undefined)
				{
					setUItoCellByEasyUI(jsons[i]["json"],cell,controlWidth);
				}
				else
				{
					if(jsons[i]["val"] != undefined)
					{
						input.value = jsons[i]["val"];
						input.initVal = input.value;
					}
					if(jsons[i]["title"] != "")
						cell.appendChild(input);	
					else
						cell.innerHTML = getSpacePosByNum(54);	
				}
				input.style.width = tControlWidth + "px";	
				if(group == 0 & !isInsertPhoto)
				{
					cell  = row.insertCell();
					cell.align = "right";
					i++;
					if(jsons[i]["json"] != undefined)
						setUItoCellByEasyUI(jsons[i]["json"],cell,controlWidth);
					isInsertPhoto = true;
				}
			}
		}
	}
	//document.getElementById("test").innerText = tab.innerHTML;
}
function operateEditRowTitleOver(obj,isOver)
{
	var json = obj.hideContent;
	obj.style.backgroundColor = (!isOver)?json.backgroundcolor:json.overcolor;
	for(var i = 0;i<obj.childNodes.length;i++)
	{
		if(obj.childNodes[i] != undefined & (obj.childNodes[i]).style.backgroundColor != undefined)
				(obj.childNodes[i]).style.backgroundColor = obj.style.backgroundColor;
	}
}
var g_currentOperateRow = null;
function operateRowDisplay(obj)
{
	if(obj.disabled)
	{
		g_currentOperateRow = null;
		return;
	}
	var json = obj.hideContent;
	var tab = getFirstParentObjByTag(obj,"table");
	var isExpand = !(obj.ico).status;
	(obj.ico).status  = isExpand;
	(obj).style.cssText = "cursor:pointer;background-color:"+((isExpand)?obj["expandbk"]:obj["collapsebk"])+";border-top:#368fca solid "+((isExpand)?0:1)+"px;";
	(obj.cells[0]).style.cssText = "cursor:pointer;background-color:"+((isExpand)?obj["expandbk"]:obj["collapsebk"])+";";
	(obj.ico).className = ((isExpand)?"icon_collapse":"icon_expand") + " normal_ico";
	for(var i = 0; i < tab.rows.length; i++)
	{
		if((tab.rows[i]).group != undefined)	
		{//
			if(	(tab.rows[i]).group == obj.parentgroup)
			{
				if((tab.rows[i]).operation == undefined)
					(tab.rows[i]).style.display = (isExpand)?"":"none";
			}
		}
	}
}
function getOperateBtnGroups(id,text,tips,methodName,className,hideData)
{
	var btnSave = createAbtn(className + " icobtn",tips,methodName);
	btnSave.id = id;
	btnSave.innerHTML = "&nbsp;"+text;
	if(hideData != undefined)
		btnSave.hideContent = hideData;
	return btnSave;
}
function getExpandOrColapseIcon(isExpand)
{
	var ico = document.createElement("div");
	if(isExpand == undefined)
		ico.className = "icon_collapse normal_ico";
	else	
		ico.className = ((!isExpand)?"icon_expand":"icon_collapse") + " normal_ico";
	ico.style.cssText = "float:right;";	
	ico.status = (ico.className.indexOf("icon_collapse") > -1)?true:false;
	return ico;	
}
function setUItoCellByEasyUI(obj,cell,w)
{
	if(obj.mode != VAR_MODE_UIOBJ)
		obj["obj"].style.width = w + "px";	
	switch(obj.mode)
	{
		case UI_MODE_SELECT:
      if(obj.isSort != undefined)
        setSelectUItoCellByEasyUI(obj,cell,obj.isSort);
      else
			 setSelectUItoCellByEasyUI(obj,cell);
			break;
		case VAR_MODE_UIOBJ:	
			cell.appendChild(obj.obj);
			break;
		case VAR_MODE_PHOTO:	
			cell.rowSpan = 3;	
			(obj.obj).style.width = "110px";
			cell.appendChild(obj.obj);
			break;
		case UI_MODE_CALENDAR:	
			setCalendarUItoCellByEasyUI(obj,cell,false);
			break;
		case UI_MODE_CALENDAR_TIME:	
			setCalendarUItoCellByEasyUI(obj,cell,true);
			break;
		case UI_MODE_SLIDER:	
			setSliderUItoCellByEasyUI(obj,cell);
			break;
		case COMBINE_TIMER_MODE_UIOBJ:
			setCombineTimerUItoCellByEasyUI(obj,cell);
			break;
	}
}
function setSliderUItoCellByEasyUI(obj,cell)
{
	var kit = getEditInput(obj["obj"].id + "_kit","",25,9,"changeSliderPos",new Array(((obj["minVal"] == undefined)?0:obj["minVal"]),obj["maxVal"]));//document.createElement("input");
	kit.style.cssText = "float:left;margin-left:262px;width:2rem;padding:2px;border:#95b8e7 solid 1px;text-align:center;font-size:0.8rem;background-color:#fff;display:"+((obj["isKit"])?"block":"none")+";";
	kit.value = obj["default"];
	//kit.id = obj["obj"].id + "_kit";
	kit.rid = obj["obj"].id;
	//kit.oninput = changeSliderPos;
	cell.appendChild(kit);
	cell.appendChild(obj["obj"]);
	if(obj["maxVal"] < 1)
	{
		var len = ((obj["maxVal"]+"").split("."))[1].length;
		obj["maxVal"] = (Math.pow(10,len))*obj["maxVal"];
	}
	$('#'+obj["obj"].id).slider({
    mode: 'h',
		width:((obj["isKit"])?240:290),
		showTip: false,
		value:obj["default"],
		min:0,
		max:obj["maxVal"],
		//rule:[0,'|',25,'|',50,'|',75,'|',100],
    tipFormatter: function(value){
			return value + '%';
    },
		onChange: function(val){
			//时间更新	
			if(checkMethodName(obj["obj"]["callbackMethod"]))
				eval("setTimeout(function(){"+obj["obj"]["callbackMethod"]+"("+obj["obj"].id+");},20);");	
		},
		onComplete: function(val){
			var t = document.getElementById(obj["obj"].id + "_kit");
			t.value = val;	
		}
	});
	obj["obj"].mode = "slider";
	obj["obj"].initVal = obj["default"];
	obj["obj"].callbackMethod = obj["obj"]["callbackMethod"];
}
function changeSliderPos(obj)
{
	//console.log(obj.id);
	$('#'+ obj.rid).slider('setValue',parseInt($('#'+ obj.id).val(),10));
}
function setCalendarUItoCellByEasyUI(obj,cell,isTime)
{
	cell.appendChild(obj["obj"]);
	if(isTime)
	{
		$(obj["obj"]).datetimebox({
			value: ((obj["default"] != undefined)?obj["default"]:""),
			required: false,
			showSeconds: false,
			onSelect: function(date){
				//alert(date.getFullYear()+":"+(date.getMonth()+1)+":"+date.getDate());
			}
		});
	}
	else
	{
		var curDate = new Date();
		var buttons = $.extend([], $.fn.datebox.defaults.buttons);
	    buttons.splice(1, 0, {
			text: getLanTextByKey('T_CLEAR_BUTTON'),
			handler: function(target){
									    //清除日期信息
			    $(target).datebox("setValue","");
			    //关闭日期选择框
			     $(target).datebox('hidePanel');
							if(checkMethodName("changeDateBoxVal"))
								changeDateBoxVal(obj["obj"],0);//setTimeout(function (){changeDateBoxVal($(target),0);},50);
			}
		});
		var initDateStr = curDate.getFullYear()+"-"+(curDate.getMonth()+1)+"-"+curDate.getDate();
		if(obj["default"] != undefined && obj["default"] != "")
			initDateStr = obj["default"];
		obj["obj"].initVal = initDateStr;
		$(obj["obj"]).datebox({
			value: initDateStr,
			editable:false,
			required: false,
			buttons: buttons,//增加清除按钮,
			showSeconds: false,
			onSelect: function(date){
				if(checkMethodName("changeDateBoxVal"))
					setTimeout(function (){changeDateBoxVal(obj["obj"],date);},1);
				if(obj["callback"] != undefined)
				{	
					if(checkMethodName(obj["callback"]))
						setTimeout(function(){
							eval(obj["callback"]+"("+obj["obj"].id+");");
							},40);
				}
			},
			//配置formatter，只返回年月 之前是这样的d.getFullYear() + '-' +(d.getMonth()); 
	    formatter: function (date) { 
					if(lan == "en")
	        	return ((date.getMonth()+1)+"/"+date.getDate()+"/"+date.getFullYear()); 
					else
	        	return (date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()); 
	    }
		});
		obj["obj"].mode = "datebox";
		obj["obj"].initVal = initDateStr;
	}
}
function setSelectUItoCellByEasyUI(obj,cell,isSort)
{
	var jsons = (isSort != undefined)?(getArrJsonByObj(obj["data"],isSort)):(getArrJsonByObj(obj["data"]));
	var id = obj["obj"].id;
	
	cell.appendChild(obj["obj"]);
	$(obj["obj"]).combobox({
    data:jsons,
    valueField:'id',
    textField:'text',
		editable:false,
		onSelect: function (){
				if(obj["obj"]["callbackMethod"] != undefined)
				{	
					if(checkMethodName(obj["obj"]["callbackMethod"]))
						setTimeout(function(){obj["obj"]["callbackMethod"]();},20);
				}
				
				if(obj["obj"]["callback"] != undefined)
				{	
					if(checkMethodName(obj["obj"]["callback"]))
						setTimeout(function(){		
							executeSelectOnchangeCallBackMethod(obj["obj"]["callback"],id);
							},40);
				}
				
			},
		panelHeight:getSelectSizeByDataLen(jsons.length)
	});
	if(obj["default"] != undefined)
	{
		$(obj["obj"]).combobox('select', obj["default"]);
		(obj["obj"]).initVal = obj["default"];
	}
	else
	{
		$(obj["obj"]).combobox('select', '-1');
		(obj["obj"]).initVal = "-1";
	}
	
	obj["obj"].mode = "select";
	if(obj["disabled"] != undefined && obj["disabled"])
		$(obj["obj"]).combobox('disable'); //enable可用
}
function executeSelectOnchangeCallBackMethod(m,id)
{
	try{
		eval(m+"("+id+");");
	}catch(e)
	{
		//console.log(e);	
	}
}
function getSelectSizeByDataLen(len)
{
	return ((len<6)?'auto':'300');	
}
function getArrJsonByObj(obj,isSort)
{//console.log(isSort);
	var objs = [];
	var keys = (isSort == undefined)?((Object.keys(obj)).sort()):(Object.keys(obj));
  if(isSort != undefined)
  {//console.log(keys);
    //keys.reverse(); console.log(keys);
  }
    
  var str = "";
	for(var i = 0; i<keys.length;i++)
	{
		if(obj[keys[i]] != "" && obj[keys[i]] != null && obj[keys[i]] != undefined)
		{
			objs.push({id:keys[i],text:obj[keys[i]]});
			str += i+")id="+keys[i]+", text="+obj[keys[i]]+"\r\n";
		}
	}
  if(isSort != undefined)
  {
    var arr = objs.reverse();
    return arr;
  }    
  else
    return sortObjsByKey(objs,"id");
}
/*
function printObjs(arrObj,index)
{
	console.log("******开始"+index+"******");
	for(var i = 0; i<arrObj.length;i++)
		console.log(i+")"+JSON.stringify(arrObj[i]));
	console.log("******结束"+index+"******");
}*/
function sortObjsByKey(arrObj,key)
{
	var nArrObj = new Array();
	var isEspecialIndex = -1;
	for(var i = 0; i<arrObj.length;i++)
	{
		var tIndex = i;
		for(var j = i; j < arrObj.length; j++)
		{
			if(parseInt(arrObj[tIndex][key],10) > parseInt(arrObj[j][key],10))
				tIndex = j;
			
		}
		if(i != tIndex)
		{
			var temp = arrObj[i]["id"];
			arrObj[i]["id"] = arrObj[tIndex]["id"];
			arrObj[tIndex]["id"] = temp;
			
			temp = arrObj[i]["text"];
			arrObj[i]["text"] = arrObj[tIndex]["text"];
			arrObj[tIndex]["text"] = temp;
		}
	}	 
	for(var i = 0; i<arrObj.length;i++)
	{
		if(parseInt(arrObj[i][key],10) == 10000 && isEspecialIndex == -1)
		{
			isEspecialIndex = i;
			break;
		}
	}
	if(isEspecialIndex != -1)
	{
		var temp = arrObj[1];
		arrObj[1] = arrObj[isEspecialIndex];		
		arrObj[isEspecialIndex] = temp;		
	}	
	return arrObj;
}

function getEasyUISelectMenu(id,w,callBackMethodName)
{
	var input = document.createElement("input");
	input.id = id;
	if(callBackMethodName != undefined)
		input.callback = callBackMethodName;
	if(w != undefined)
		input.style.width = ((w > SELECT_MAX_WIDTH)?SELECT_MAX_WIDTH:w)+"px";
	else
		input.style.width = "120px";
	return 	input;
	/*var selectObj = document.createElement("select");
	selectObj.id = id;
	return 	selectObj;*/
}
function getEasyUISlider(id,w,callbackMethod)
{
	var div = document.createElement("div");
	div.id = id;
	div.callbackMethod = callbackMethod;
	return div;
}
function getEasyUICalendar(id,aSize)
{	//<input id="dt" type="text" name="birthday">
	var calendar = document.createElement("input");
	calendar.id = id;
	calendar.type="text";
	//calendar.style.cssText = "width:180px;height:180px;";
	return 	calendar;
}
function getEditInput(id,placeholder,h,mode,callBackMethodName,aLimit)
{
	var input  = document.createElement("input");
	input.className = "edit_text";
	input.autocomplete = "on";//autocomplete="off"
	if(id != "")
		input.id = id;
	var cH = 30;
	if(h != undefined)
		cH = h;
	input.style.cssText = 'height:'+cH+'px;';
	input.placeholder=placeholder;
	if(aLimit != undefined && aLimit.length > 1)
	{
		input.maxVal = aLimit[1];
		input.minVal = aLimit[0];	
	}
	if(mode != undefined)	
		input = setEditInputByMode(input,mode,(callBackMethodName != undefined)	?callBackMethodName:null);
	return input;
}
function setEditInputSatus(id,isEdit)
{
	var editInput = document.getElementById(id);
	
	if(isEdit)
	{
		editInput.style.backgroundColor = "#e4e4e4";
		editInput.style.color = "#959595";
		editInput.disabled = true;
	}
	else
	{
		editInput.style.backgroundColor = "#ffffff";
		editInput.style.color = "#000";
		editInput.disabled = false;
	}
}
function setEditInputByMode(input,mode,callBackMethodName)
{
	input.mode = "input";
	if(callBackMethodName == null)
		callBackMethodName = "";
	switch(mode)
	{//1字符串长度为30 2字符串长度为50 3字符串长度为100
		case 1:
			input.maxLength = 30;
			input.customType = "string";
			input.oninput = function(){
					if(callBackMethodName != "")
						eval(callBackMethodName + "("+this.id+");");
			};
			input.onkeypress = function (){
				checkEditInputLimitChar(this);
				//if(callBackMethodName != "")
				//	eval(callBackMethodName + "(this);");
				};
			break;
		case 2:
			input.maxLength = 50;
			input.customType = "string";
			input.oninput = function(){
					if(callBackMethodName != "")
						eval(callBackMethodName + "("+this.id+");");
			};
			input.onkeypress = function (){
				checkEditInputLimitChar(this);
				//if(callBackMethodName != "")
				//	eval(callBackMethodName + "(this);");
				};
			break;
		case 3:
			input.maxLength = 100;
			input.customType = "string";
			input.oninput = function(){
					if(callBackMethodName != "")
						eval(callBackMethodName + "("+this.id+");");
			};
			input.onkeypress = function (){
				checkEditInputLimitChar(this);
				//if(callBackMethodName != "")
			//		eval(callBackMethodName + "(this);");
				};
			break;
		case 4:
			input.maxLength = 20;
			input.customType = "string";
			input.oninput = function(){
					if(callBackMethodName != "")
						eval(callBackMethodName + "("+this.id+");");
			};
			input.onkeypress = function (){
				checkEditInputLimitChar(this);
				//if(callBackMethodName != "")
				//	eval(callBackMethodName + "(this);");
				};
			break;
		case 5:
			input.maxLength = 200;
			input.customType = "string";
			input.oninput = function(){
					if(callBackMethodName != "")
						eval(callBackMethodName + "("+this.id+");");
			};
			input.onkeypress = function (){
				checkEditInputLimitChar(this);
				//if(callBackMethodName != "")
				//	eval(callBackMethodName + "(this);");
				};
			break;
		case 9:/*minVal-maxVal*/
			if(input.maxVal == undefined)
				break;
      //console.log(input.id + ") " + callBackMethodName);
			input.maxLength = (input.maxVal+"").length + MAX_DEMICAL_COUNT + 1;
			input.customType = "number";
			input.oninput = function(){
				/*if(this.value != this.value.replace(/[^\d.]/g,''))
					this.value = this.value.replace(/[^\d]/g,'');
				var num = parseInt(this.value,10);
				if(num >= input.maxVal)
					this.value = input.maxVal;
				else if( num <= input.minVal)
					this.value = input.minVal;
          */ 
        onInputMethod(this);
				if(callBackMethodName != "")
				{
					var method = callBackMethodName + '('+this.id+');';
					eval(method);
          
				}
			};
			break;
		case 10:/*0-50*/
			input.maxLength = 2;
			input.customType = "number";
			input.oninput = function(){
				if(this.value != this.value.replace(/[^\d.]/g,''))
					this.value = this.value.replace(/[^\d]/g,'');
				var num = parseInt(this.value,10);
				if(num >50)
					this.value = 50;
				else if( num < 0)
					this.value = 0;
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			break;
		case 11:/*0-255*/
			input.maxLength = 3;
			input.customType = "number";
			input.oninput = function(){
				if(this.value != this.value.replace(/[^\d.]/g,''))
					this.value = this.value.replace(/[^\d]/g,'');
				var num = parseInt(this.value,10);
				if(num >255)
					this.value = 255;
				else if( num < 0)
					this.value = 0;
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			break;
		case 12:/*密码数字六位*/
			input.maxLength = 6;
			input.customType = "number";
			input.oninput = function(){
			if(this.value != this.value.replace(/[^\d]/g,''))//this.value.replace(/[^\d.]/g,''),排除.号
					this.value = this.value.replace(/[^\d]/g,'');
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			break;
		case 121:/*密码数字20位 限制数字的字母*/
			input.maxLength = 20;
			input.customType = "string";
			input.type = "password";			
			input.oninput = function(){
				//this.value = this.value.replace(/[^\d]/g,'');
				var reg = /^[0-9a-zA-Z]+$/;
				if(this.value == "")
				{
					this.style.borderColor = "#35a5e5";
					this.placeholder = getLanTextByKey("T_PLS_INPUT_SOFTWARE_PWD_TIPS");
				}
				else if(!reg.test(this.value)){				
					this.value = "";
					this.style.borderColor = "red";
					this.placeholder = getLanTextByKey("T_LOGIN_PWD_ERROR_TIPS");
				}
				else
					this.style.borderColor = "#35a5e5";
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			input.onkeypress = function (){
				checkEditInputLimitChar(this);
				};
			break;
		case 13:/*卡号1099511627775*/
			input.maxLength = 17;
			input.customType = "number";
			input.oninput = function(){
				if(this.value != this.value.replace(/[^\d]/g,''))//排除.号
					this.value = this.value.replace(/[^\d]/g,'');
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			break;
		case 14:/*端口，32767    端口数值是0-65535*/
			input.maxLength = 5;
			input.customType = "number";
			input.className = "edit_text_disabled";
			input.disabled = true;
			input.oninput = function(){
				if(this.value != this.value.replace(/[^\d.]/g,''))
					this.value = this.value.replace(/[^\d]/g,'');
				var num = parseInt(this.value,10);
				if(num >32767)
					this.value = 32767;
				else if( num < 0)
					this.value = 0;
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			break;
		case 15:/*IP地址*/
			input.maxLength = 16;
			input.customType = "string";
			input.oninput = function(){
				//console.log("=="+this.value);
				if(this.value != this.value.replace(/[^\d.]/g,''))
					this.value = this.value.replace(/[^\d.]/g,'');
				//console.log("***"+this.value);
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			break;
		case 16:/*MAX_EMPS_AMOUNT*/
			input.maxLength = 5;
			input.customType = "number";
			//input.className = "edit_text_disabled";
			//input.disabled = true;
			input.oninput = function(){
				if(this.value != this.value.replace(/[^\d.]/g,''))
				{console.log("==" + this.value);
					this.value = this.value.replace(/[^\d]/g,'');
				}
				var num = parseInt(this.value,10);
				if(num >MAX_EMPS_AMOUNT)
				{console.log("++" + this.value);
					this.value = MAX_EMPS_AMOUNT;
				}
				else if( num < 0)
				{console.log("**" + this.value);
					this.value = 0;
				}
				if(callBackMethodName != "")
					eval(callBackMethodName + "("+this.id+");");
				};
			break;
	}
	return input;
}
function onInputMethod(obj)
{
  setTimeout(function(){onInputDelayMethod(obj.id)},1000);
}
function onInputDelayMethod(id)
{
  var obj = document.getElementById(id);
  if(obj.value != obj.value.replace(/[^\d.]/g,''))
  {
    obj.value = obj.value.replace(/[^\d]/g,'');
  }
    
  var num = 0;
  if((obj.value).indexOf(".") > -1)
    num = parseFloat(obj.value);
  else
    num = parseInt(obj.value,10);
  if(num >= obj.maxVal)
    obj.value = obj.maxVal;
  else if( num <= obj.minVal)
    obj.value = obj.minVal;
}
function checkEditInputLimitChar(obj)
{
	var char = String.fromCharCode(window.event.keyCode);
	var aLimitChars = new Array('/','\\','"',"'");
	var preChar = "";
	for(var i = 0; i < aLimitChars.length; i++)
	{
		if(aLimitChars[i] == char)
		{
			window.event.returnValue = false;
		}
	}
	//setTimeout(function(){;displayTipsByObjPos(obj,obj.error,true,200);},100);
	//window.event.returnValue = false;
}
function insertTabStatusItem(pidStr,oJson)
{
	var maxRowAmount = 14;
	var tab = document.getElementById(pidStr);
	var row = tab.insertRow(0);
	var len = tab.rows.length;
	
	if(len >= maxRowAmount)
		tab.deleteRow(len -1);
	var cell  = row.insertCell();
	cell.align = "center";
	cell.style.width = "40px";
	cell.appendChild(getStatusIconByMode(oJson.mode));
	
	cell  = row.insertCell();
	cell.style.width = "100%";
	cell.className = "QsItemTitleDescText";
	cell.align = "left";
	cell.style.cssText = 'padding:4px;';
	cell.innerHTML = oJson.msg;
	
}
function getAlarmLevel(level)
{
	switch(level)
	{
		case 0:
			return 1;
		case 1:
			return 4;
		case 2:
			return 3;
		case 3:
			return 2;
				
	}	
}
/*0普通提示（黑）1着重提示（蓝）2警告（桔）3错误（红）*/
function getStatusIconByMode(mode)
{
	var className = "icon_log_tips";
	if(mode < 0)
		className = "icon_log_error";
	else
	{
		switch(mode)
		{
			case 0:
				 className = "icon_log_tips";
				 break;
			case 1:
				className = "icon_log_important";
				 break;
			case 2:
				className = "icon_log_alarm";
				 break;
			case 3:
				className = "icon_log_error";
				 break;
			default:
				className = "icon_log_success";
				break;	
		}
	}
		var iconDiv = document.createElement("div");
		iconDiv.className = className + " log_icon";
		//iconDiv.style.backgroundColor = "#ccc";
		//iconDiv.style.cssText = 'width:22px;height:22px;background:url(images/btns.png) -93px '+((-341)-22 * (mode - 1))+'px no-repeat;';
		
		return iconDiv;
}
function getPageIconByAbsolutePos(leftPos,dPage,isHome)
{
	var homeId = "a_home_btn";
	var jumpToDetailPage = "a_detail_page";
	var modeObj = getUrlObjByMode(g_rightBottomNavMode);
	if(isHome && !modeObj["isHiddenHomePage"])
	{
		var initHome = document.getElementById(homeId);
		if(initHome != null)
			(initHome.parentNode).removeChild(initHome);
		var homeIcon = document.createElement("a");
		homeIcon.style.cssText = "position:absolute;left:"+(10+leftPos)+"px;top:10px;z-index:500;font-size:1.6em;";	
		homeIcon.className = "icon_home";
		homeIcon.id = homeId;
		homeIcon.onclick = function(){jumpToPageByURL('WizardHome.htm');};
		homeIcon.innerHTML = "<span style='font-size:1em!important;margin-left:4px;'>"+getLanTextByKey("T_HOME_TITLE")+"</span>";
		document.body.appendChild(homeIcon);
	}
	if(g_isDisplayItemSetup)
	{
		var setBtnId = "a_setup_btn";
		var initSsetBtn = document.getElementById(setBtnId);
		if(initSsetBtn != null)
			(initSsetBtn.parentNode).removeChild(initSsetBtn);
		var setBtn = document.createElement("a");
		setBtn.style.cssText = "position:absolute;right:10px;top:10px;z-index:500;font-size:2.4rem;";	
		setBtn.className = "icon_pwd_set";//"icon_set";
		setBtn.id = setBtnId;
		setBtn.tips = getLanTextByKey("T_SOFTWARE_SETUP_TITILE");//getLanTextByKey("T_SOFTWARE_SETUP_TIPS");
		setBtn.onclick = function(){popSoftwareSetWin(setBtn.tips);};
		//setBtn.innerHTML = "<span style='font-size:1em!important;margin-left:4px;'>设置</span>";
		document.body.appendChild(setBtn);
		setEasyUITooltips(setBtn,"left");
	}
	return;
	var initSetupIcon = document.getElementById(jumpToDetailPage);
	if(initSetupIcon != null)			
		(initSetupIcon.parentNode).removeChild(initSetupIcon);
	var moreSetupIcon = document.createElement("a");
	moreSetupIcon.style.cssText = "position:absolute;right:10px;bottom:30px;z-index:500;";	
	moreSetupIcon.href = "javascript:;";
	moreSetupIcon.onclick = function(){jumpToPageByURL(modeObj["url"]);};
	moreSetupIcon.className = "normalbtn";
	moreSetupIcon.id = jumpToDetailPage;
	moreSetupIcon.innerText = getLanTextByKey(modeObj["text"]);
	document.body.appendChild(moreSetupIcon);
	//<a class="normalbtn" href="javascript:;" onclick="jumpToPageByURL('SCS:AC_FINGERPRINT_SAMPLED');""></a>
}
function getUrlObjByMode(mode)
{
	var obj = {"isHiddenHomePage":false,"url":"SCS:AC_ATT_SETUP","text":"T_MORE_SETUP_BUTTON_TITLE"};
	switch(mode)
	{
		case 1:
			break;
		case 2:
			obj = {"isHiddenHomePage":true,"url":"WizardHome.htm","text":"T_HOME_TITLE"};
			break;
		default:
			break;
	}	
	return obj;
}
function popSoftwareSetWin(title)
{
	startProcess(3);
	var dPage = getPageDisplaySize();
	var w = 560;
	var h = 170;
	var left = parseInt((dPage.w - w)/2,10);
	var top = parseInt((dPage.h - h)/2,10);
	var popDiv = document.createElement("div");
	//getTabList(getLanTextByKey(getLanTextKeyByMode(btn.mode).key),new Array(w,h,left,top),deviceContainerId,TABLE_EDIT_MODE,SECOND_DIALOG_MASK_INDEX,popId,"closeSelectWin();",-100,"closeEditWinCallBack();");	
	var tab = getTabList(title,new Array(w,h,left,top),TABLE_ROW_EDIT_ID,TABLE_EDIT_MODE,SECOND_DIALOG_MASK_INDEX,POP_TAB,"closeSelectWin();",-100,"closeSoftwareSetWinCallBack();");	
	document.body.appendChild(tab);
	var pwdObj = getInputPack(null,"txt_confirm_pwd",getLanTextByKey("T_PLS_INPUT_SOFTWARE_PWD_TIPS"),121,"baseSoftwareSetCallBack","saveLoginPwd");
	var jsons = [
							/*{id:"txt_base_title",title:getLanTextByKey("T_SOFTWARE_SETUP_TITILE"),colspan:2,expand:true,backgroundcolor:"#f1fafc",expandbk:"#a0d7f2",collapsebk:"#b3cbe7",disable:false},*/
							{id:"txt_init_pwd",title:getLanTextByKey("T_SOFTWARE_INIT_PWD_TIPS"),placeholder:getLanTextByKey("T_PLS_INPUT_SOFTWARE_PWD_TIPS"),val:"",mode:121,callback:"baseSoftwareSetCallBack"},
							{id:"",title:"",placeholder:"",val:"",mode:2001,require:true,callback:"baseSoftwareSetCallBack"},
							{id:"txt_pwd",title:getLanTextByKey("T_SOFTWARE_NEW_PWD_TIPS"),placeholder:getLanTextByKey("T_PLS_INPUT_SOFTWARE_PWD_TIPS"),val:"",mode:121,callback:"baseSoftwareSetCallBack"},
							{id:"",title:"",placeholder:"",val:"",mode:2001},
							{id:"txt_confirm_pwd",title:getLanTextByKey("T_SOFTWARE_CONFIRM_PWD_TIPS"),placeholder:getLanTextByKey("T_PLS_INPUT_SOFTWARE_PWD_TIPS"),val:"",json:{obj:pwdObj,data:null,mode:VAR_MODE_UIOBJ,default:""}}
	];
	insertTabEditItem(TABLE_ROW_EDIT_ID,jsons,false);	
	setDragleMode(POP_TAB);
	
	setIcoAbtnStatus(document.getElementById("btn_save_confirm_pwd"),true);
}
function closeSoftwareSetWinCallBack()
{
	if(!document.getElementById("btn_save_confirm_pwd").disabled)
		popEditConfirm("callBackConfirmCloseSoftwareSetWin",CONFIRM_DIALOG_TOP_MASK_TIP_MODE);
	else
		setTimeout(function(){removePopTabWin(POP_TAB);},200);
	
}
function callBackConfirmCloseSoftwareSetWin(isDel)
{
	if(isDel)
		removePopTabWin(POP_TAB);
}
function baseSoftwareSetCallBack(id)
{
	var obj = id;
	if(typeof(id) != "object")
		obj = document.getElementById(id);
	var cVal = "";
	
	if(obj.mode == "input")
		cVal = obj.value;
	
	var btn = document.getElementById("btn_save_confirm_pwd");
	
	if(cVal.trim() != "")
		setIcoAbtnStatus(btn,false);
	else
	{
		setIcoAbtnStatus(btn,checkSoftwareSetNullPwd());
	}
	return;
}
function checkSoftwareSetMultPwd(cid,initPwd)
{
	var arr = new Array("txt_init_pwd","txt_pwd","txt_confirm_pwd");//"txt_init_pwd","txt_pwd","txt_confirm_pwd"
	var initPwd = document.getElementById(arr[0]);
	var confirmPwd = document.getElementById(arr[2]);
	var pwd = document.getElementById(arr[1]);
	var ret = false;
	if(initPwd.initVal != undefined)
	{
		if(confirmPwd.value == initPwd.initVal && pwd.value == initPwd.initVal)
			ret = true;
	}	
	return ret;
}
function checkSoftwareSetNullPwd()
{
	var arr = new Array("txt_init_pwd","txt_pwd","txt_confirm_pwd");//"txt_init_pwd","txt_pwd","txt_confirm_pwd"
	for(var i = 0; i < arr.length; i++)
	{
		var obj = document.getElementById(arr[i]);
		if((obj.value).trim() != "")
			return false;
	}
	return true;
}
//验证日期时间格式，支持：2020-12-11 08：24：15或2020/12/11 08：24：15
function chekcDateTimeValidated(dtStr)
{
  var reDateTime = /^(?:19|20)[0-9][0-9]([-/])(?:(?:0[1-9])|(?:1[0-2]))([-/])(?:(?:[0-2][1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]:[0-5][0-9]$/;
  
  return reDateTime.test(dtStr);
}
function saveLoginPwd(obj)
{
	if(obj.disabled)
		return;
	var initPwd = document.getElementById("txt_init_pwd");
	/*if(initPwd.value == "" | initPwd.value == " " |initPwd.value == "　" )
	{
		//document.getElementById("txt_init_pwd").focus();
		$('#txt_init_pwd').focus().select();
		return;	
	}*/
	var pwd = document.getElementById("txt_pwd");
	var confirmPwd = document.getElementById("txt_confirm_pwd");
	if((pwd.value+"") != (confirmPwd.value+""))
	{
		showToast(getLanTextByKey("T_PWD_DIFFERENT_ERROR_TIPS"),DIALOG_MASK_TIP_MODE,2);
		delaySetMask();
		//document.getElementById("txt_confirm_pwd").focus();
		$('#txt_confirm_pwd').focus().select();
		return;	
	}
	//showToast("保存设置完成！",DIALOG_MASK_TIP_MODE,2);delaySetMask();
	ChangePassword(initPwd.value, pwd.value);
}
function ChangePassword(szOldPwd, szNewPwd)
{
	var ret = _externalChangePassword(szOldPwd, szNewPwd);
	eval ('var err = ' + ret);
	/*成功返回值：{nCode:0}
	出错返回值{nCode:-1,szMsg:XXX}
	*/
	if (err.nCode < 0)
	{
		showToast(err.szMsg,DIALOG_MASK_TIP_MODE,2);
		delaySetMask();
	}
	else
		removeControlById(POP_TAB,true);
}
function getInputPack(item,idStr,placeholder,inputMode,callBack,clickMethod)
{
	var cardTab  = document.createElement("table"); 
	cardTab.style.margin = "0px";
	cardTab.border = "0";
	cardTab.cellPadding = "0";
	cardTab.cellSpacing = "0";
	var cardRow = cardTab.insertRow();
	var cellStyleText = "border:#ccc solid 0px;padding:0px;";
	var cardCell = cardRow.insertCell();	
	cardCell.style.cssText = cellStyleText;
	cardCell.valign = "middle";
	var pack  = document.createElement("div"); 
	var btnSaveCardNo = createAbtn("icon_save icobtn","",clickMethod);//new Object();
	
	if(item == undefined | item == null)
	{
		btnSaveCardNo.cid = "txt_number";		
		btnSaveCardNo.hideContent = item;
		btnSaveCardNo.cid = "txt_number";
	}
	else
	{
		btnSaveCardNo.cid = "txt_number_"+((item.nID == undefined)?0:item.nID);
		btnSaveCardNo.hideContent = item;
		btnSaveCardNo.cid = "txt_number_"+((item.nID == undefined)?0:item.nID);		
	}
	btnSaveCardNo.id = idStr.replace("txt","btn_save");
	//btnSaveCardNo.title = btnSaveCardNo.id;
	btnSaveCardNo.style.cssText = "margin-left:6px;";
	
	setIcoAbtnStatus(btnSaveCardNo,true);	
	
	var intputCard = null;
	if(inputMode != undefined)
	{
		if(callBack != undefined && callBack != "")
			intputCard = getEditInput(idStr,placeholder,30,inputMode,callBack);
		else
			intputCard = getEditInput(idStr,placeholder,30,inputMode);
	}
	else
		intputCard = getEditInput(idStr,"");	
	intputCard.style.cssText = "width:300px;";
	setEditInputByMode(intputCard,inputMode,callBack);
	//intputCard.type = (inputMode == 121)?"text":"password";
	intputCard.hideContent = item;
	intputCard.mode = "input";
	if(item != undefined && item != null)
	{
		intputCard.initVal = intputCard.value;
	}
	cardCell.appendChild(intputCard);
	pack.appendChild(btnSaveCardNo);
	
	cardCell = cardRow.insertCell();
	cardCell.style.cssText = cellStyleText;
	cardCell.valign = "middle";
	cardCell.appendChild(pack);	
	return cardTab;
}
function objMousePropertySetNull(obj)
{
	obj.onmouseover = null;
	obj.onmouseout = null;
	obj.onclick = null;
}
function updateSysTextByKey(key,idStr,mode,isHidden)
{
	var obj = document.getElementById(idStr);
	if(obj == null)
	{
		showToast('"'+idStr+'"'+"这个控件没有找到",DIALOG_MASK_TIP_MODE,2);
		return;
	}
	if(mode == 0)
	{
		if(isHidden == undefined)
			obj.style.display = "block";
		else if(!isHidden)
			obj.style.display = "block";
		obj.innerText = getLanTextByKey(key); 
	}
}
//获取文本
function getLanTextByKey(key)
{
	var res = _externalGetUIText(key);//{name:"TOM",age:45};
	if(res == null)
	{
		return (g_bDebugMode)?key:"";	
	}
	return res;
}
//页面跳转
var g_currentUrlKey = "currentURL";
var g_preUrlKey = "preURL";
function jumpToPageByURL(url)
{
  //2020-07-20:修订右下角菜单第一项点击到考勤设置页面后，不能正常返回原页面
  if(url == "SCS:AC_ATT_SETUP")
  {
    location.href = url;
    return;
  }
  //2020-07-20
  var currentUrlKey = GetStore(g_currentUrlKey,false);
  //console.log("jumptoUrl = " + url + ", currentUrlKey = " + currentUrlKey + ", g_preUrlKey = " + g_preUrlKey);
	SetStore(g_preUrlKey,currentUrlKey,false);
	SetStore(g_currentUrlKey,url,false);
	location.href = url;
}
function UnLoad()
{
	_externalRequestStopOperation();
}

//永续字串代码//////////////////////////////////////////////////////////////////////////////////
function SetStore(key,valStr,isSave)
{
	return _externalSetStore(key/*字串索引，索引值由使用者自行定义，理论上没有上限*/, valStr, isSave/*该值为真时表示退出软件重启也能获取到*/);
}

function GetStore(key,isSave)
{
	return _externalGetStore(key/*字串索引，当索引以前未设置过时，则可能反回0长度字串（除非后面的参数为真且以前设置过）*/, isSave/*该值为真时表示尽量从永续池中读取值*/);
}
//查找指定类型的父节点
function getFirstParentObjByTag(control,tagName)
{
	if(control == null)
		return null;
	while((control.nodeName.toUpperCase()) != (tagName.toUpperCase()))
	{
		if(control.parentNode == null)
			return control;
		control = control.parentNode;		
	}
	return control;
}
//按类名查找容器内的子节点
function getChildObjsByTag(container,className,objs)
{
	if(objs == null)
		objs = new Array();
	if(container == null)
		return null;
	className = className.toUpperCase();
	for(var i = 0; i < container.childNodes.length; i++)
	{	
		var node = container.childNodes[i];
		var nodeClassName = "";
		if(node.className != undefined)
			nodeClassName = (node.className).toUpperCase();
		
		if(nodeClassName.indexOf(className) > -1)
			objs.push(node);
		if((node.childNodes).length > 0)
			objs = getChildObjsByTag(node,className,objs);
	}
	return objs;
}
//查找指定类型的子节点
function getFirstChildObjByTag(control,tagName)
{
	if(control == null)
		return null;
	tagName = tagName.toUpperCase();
	for(var i = 0; i < control.childNodes.length; i++)
	{
		var cNode = (control.childNodes[i]).nodeName.toUpperCase();
		if(cNode == tagName)
			return control.childNodes[i];
		if((control.childNodes[i]).childNodes.length > 0)
		{
			var node = getFirstChildObjByTag(control.childNodes[i],tagName);
			cNode = node.nodeName.toUpperCase();
			if(cNode == tagName)
				return node;
		}
	}
	return control;
}
//查找指定类型的子节点中的某个类名
function lookForFirstChildNodesByClass(control,cName)
{
	if(control == null)
		return undefined;
	
	for(var i = 0; i < control.childNodes.length; i++)
	{
		var cNodeClass = "";
		if((control.childNodes[i]).className != undefined)
			cNodeClass = (control.childNodes[i]).className
	
		if(cNodeClass == cName)
			return control.childNodes[i];
		if((control.childNodes[i]).childNodes.length > 0)
		{
			cNodeClass = "";
			var node = lookForFirstChildNodesByClass(control.childNodes[i],cName);
			if(node != undefined )
			{
				if(node.className != undefined)
					cNodeClass = node.className;
			}
			if(cNodeClass == cName)
				return node;
		}
	}	
}

/*封装自定义input
mode:1密码
*/
function initSelfInput(tips,initText,inputId,mode,len,h,maxLen,error)
{//alert("tips="+tips+",initText="+initText+",inputId="+inputId+",mode="+mode+",len="+len+",h="+h+",maxLen="+maxLen);
	/*var isBig = true;
	var div = document.createElement("div");
	if(h != undefined & h != -1)
	{
		div.style.marginTop = "3px";
		isBig = false
	}
	
	var divHeader = document.createElement("div");
	divHeader.style.cssText = "float:left;width:"+((isBig)?7:4)+"px;height:"+((isBig)?45:h)+"px;background:url(images/input_text_header"+((isBig)?"":"_s")+".png) 0px "+((isBig)?-45:-h)+"px repeat-x;";
	var divMid = document.createElement("div");	
	divMid.style.cssText = "float:left;width:auto!important;height:"+((isBig)?45:h)+"px;background:url(images/input_text_mid"+((isBig)?"":"_s")+".png) 0px "+((isBig)?-45:-h)+"px repeat-x;font-size:1.4em;text-align:center;overflow:hidden;";
	*/
	var input = document.createElement("input");
	if(error != undefined & error != "")
	{
		input.error = error;
	}
	input.setAttribute("placeholder",tips);
	input.type = "text";
	if(inputId != "")
		input.id = inputId;
	if(len > 50)
		input.style.width = (len - 14) + "px";
	if(maxLen != undefined)
		input.maxLength = maxLen;
	else
		input.maxLength = 100;
	if(initText != "")
		input.value = initText;
	if(mode == 1)
	{
		input.type = "password";
		input.onkeypress = function(){checkInputIsNumberByStr(this);};
	}
	else if(mode == 2)
	{//特指卡号，在这里直接限制大小 
		input.onkeypress = function(){checkInputIsNumberAndMaxLimitByStr(this);};
		input.limit = MAX_CARD_NUMBER;
	}
	else
		input.onkeypress = function(){limitIligalChar(this);};
	/*if(error != undefined & error != "")
	{
		input.error = error;
	}
	if(maxLen != undefined)
		input.maxLength = maxLen;
	else
		input.maxLength = 100;
	if(!isBig)
		input.style.cssText = "height:"+(h-12) + "px;font-size:0.7em!important;margin-top:0px;padding:2px;";
	if(inputId != "")
		input.id = inputId;
	input.className = "packEditInput";
	if(len > 50)
		input.style.width = (len - 14) + "px";
	input.value = (initText == "")?tips:initText;
	if(mode == 1)
	{
		input.type = "password";
		input.value = (initText == "")?"":initText;
		input.onkeypress = function(){checkInputIsNumberByStr(this);};
	}
	else if(mode == 2)
	{//特指卡号，在这里直接限制大小 
		input.onkeypress = function(){checkInputIsNumberAndMaxLimitByStr(this);};
		input.limit = MAX_CARD_NUMBER;
	}
	else
		input.onkeypress = function(){limitIligalChar(this);};
	input.tips = tips; 
	if(initText != "")
		input.style.color = "#000";
	input.isBig = isBig;
	input.packheight = h;
	input.onfocus = function(){modifySelfInputStyle(this,true);};
	input.onblur = function(){modifySelfInputStyle(this,false);};
	divMid.appendChild(input);
	
	var divTail = document.createElement("div");
	divTail.style.cssText = "float:left;width:"+((isBig)?7:4)+"px;height:"+((isBig)?45:h)+"px;background:url(images/input_text_tail"+((isBig)?"":"_s")+".png) 0px "+((isBig)?-45:-h)+"px repeat-x;";
	
	div.appendChild(divHeader);
	div.appendChild(divMid);
	div.appendChild(divTail);*/
	return input;
}
function checkInputIsNumberByStr(obj)
{
	var char = String.fromCharCode(window.event.keyCode);
	if (char >= "0" && char <= "9")
		return;
	setTimeout(function(){displayTipsByObjPos(obj,obj.error,true,200);},100);
	window.event.returnValue = false;
}
function checkInputIsNumberAndMaxLimitByStr(obj)
{
	var char = String.fromCharCode(window.event.keyCode);
	if (char >= "0" && char <= "9")
	{
		var str = obj.value + char;
		//document.getElementById("div_emp_info_list").innerHTML = char;
		if(checkBigNumberLimit(str,obj.limit))
			return;
	}
	setTimeout(function(){;displayTipsByObjPos(obj,obj.error,true,200);},100);
	window.event.returnValue = false;
}
function checkBigNumberLimit(numStr,limitStr)
{//ALERT(numStr+","+limitStr);
	//	1099511627775
	if(numStr.length < limitStr.length)
		return true;
	else if(numStr.length > limitStr.length)
		return false;
	for(var i = 0; i < limitStr.length; i++)
	{
		if(parseInt(numStr.charAt(i),10) > parseInt(limitStr.charAt(i),10))
			return false;
	}
	return true;	
}
function limitIligalChar(obj)
{
	var char = String.fromCharCode(window.event.keyCode);
	if (char.charCodeAt(0) != 34 & char.charCodeAt(0) != 39 & char.charCodeAt(0) != 47 & char.charCodeAt(0) != 96)
		return;
	setTimeout(function(){;displayTipsByObjPos(obj,obj.error,true,200);},100);
	window.event.returnValue = false;
}
function modifySelfInputStyle(input,isFocus)
{
	var packDiv = input.parentNode.parentNode;
	var posY = (input.isBig)?-45:(-(input.packheight));
	for(var i = 0; i < packDiv.childNodes.length; i++)
	{
		var div = packDiv.childNodes[i];	
		if(div.nodeName == "DIV")
		{
			div.style.backgroundPosition = "0px "+((!isFocus)?posY:0)+"px"
		}
	}
	if(input.tips != "")
	{
		if(input.value  == "" | compareStringPercent(input.value,input.tips,isFocus))//input.value == input.tips
		{
			if(input.type != "password")			
				input.value = (isFocus)?"":input.tips;
			if(isFocus)
				input.style.color = "#000";
			else
				input.style.color = "#dedede";
		}
		else
			input.style.color = "#000";
	}	
}
function compareStringPercent(str1,str2,isFocus)
{
	var sStr = "",bStr = "";
	bStr = (str1.length > str2.length)?str1:str2;
	sStr = (str1.length > str2.length)?str2:str1;
	var len = bStr.length;
	var percent = 0;
	for(var i = 0;i<len;i++)
	{
		if(bStr.charAt(i) == sStr.charAt(i))
			percent++;
	}	
	
	return ((percent/len) > 0.88)?true:false;
}
function checkIP(ip)    
{  
	var sArr = new Array("0","1","2","3","4","5","6","7","8","9",".");
	for(var i = 0; i < ip.length; i++)
	{
		var isValidate = false;
		for(var j = 0; j < sArr.length; j++)
		{
			if(ip.charAt(i) == sArr[j])
				isValidate = true;
		}
		
		if(!isValidate)
			return false;
	}
   var re=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/
;///^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;//正则表达式   
   if(re.test(ip))   
   {  
	 		ip.match(re);
			if (RegExp.$1<=255&&RegExp.$1>=0
			  &&RegExp.$2<=255&&RegExp.$2>=0
			  &&RegExp.$3<=255&&RegExp.$3>=0
			  &&RegExp.$4<=255&&RegExp.$4>=0)
			{
				return true; 
			}
			else
			{
				return false;
			}
 
      // if( RegExp.$1<256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256) 
      // return true;   
   }   
   
   return false;    
}
function checkMask(mask) 
{ 
	if(!checkIP(mask))
		return false;
    obj=mask; 
		var exp=/^(254|252|248|240|224|192|128|0)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)$/; 
    var reg = obj.match(exp); 
    if(reg==null) 
    { 
         return false; //"非法"
    } 
     else 
    { 
         return true; //"合法"
    } 
}
//////////下拉式菜单开始////////////
function initSelectObj(idStr,aItems,isTips,onChangeMethodName)
{	
	if(aItems == null)
		return ;
	if(aItems[0] == undefined)
		return;
	var rowHeight = 30;
	var selectWidth = 306;
	var pDiv = document.createElement("div");
	pDiv.isPopup = false;
	pDiv.className = "div_pop_menu";
	pDiv.style.cssText = "position:absolute;width:"+selectWidth+"px;height:"+(rowHeight*1 + 10)+"px!important;;overflow:hidden!important;z-index;800;";
	if(idStr != "")
		pDiv.id = idStr;
	
	var tab = document.createElement("table");
	tab.className = "tab_list";
	tab.cellPadding = "0";
	tab.cellSpacing = "0";
	tab.width = "100%";
	var styleText = "height:"+rowHeight+"px!important;padding-top:4px!important;padding-bottom:4px!important;border:#ccc solid 0px;cursor:pointer;";
	for(var i = 0; i < aItems.length; i++)
	{
		var row = tab.insertRow();
		row.style.backgroundColor = "#f9f9f9";
		row.id = (idStr != "")?idStr+"_item_"+i:"div_select_item_"+i;
		row.number = i;
		row.pnode = pDiv.id;
		row.hideContent = aItems[i];
		row.onmouseover = function(){modifyColorAndBkByOver(this,true,'#8e8f8f','#fff');modifyIconByOver(this,true);};//modifyIconByOver(this,true,pX,pY,mX,mY);
		row.onmouseout = function(){modifyColorAndBkByOver(this,false,'#8e8f8f','#fff');modifyIconByOver(this,false);};//modifyIconByOver(this,false,pX,pY,mX,mY);
		row.status = 0;
		//for(key in aItems[i])
		//	alert(key + "-->" +aItems[i].key);
		row.val = (isTips & i == 0)?-1:aItems[i].val;
		row.onclick = function(){operatePopSelect(this,((isTips)?aItems.length:aItems.length-1),rowHeight,isTips,onChangeMethodName);};
		
		var td = row.insertCell();
		td.style.cssText = styleText + "border-top:#d4d4d5 solid 1px!important;border-left:#d4d4d5 solid 1px!important;"+((i == aItems.length - 1)?"border-bottom:#d4d4d5 solid 1px!important;":"");
		td.valign = "middle";
		td.align = "center";
		td.innerHTML = aItems[i].text;
		//td.val = aItems[i].val;		
		td = row.insertCell();
		td.style.cssText = styleText + "border-top:#d4d4d5 solid 1px!important;border-right:#d4d4d5 solid 1px!important;"+((i == aItems.length - 1)?"border-bottom:#d4d4d5 solid 1px!important;":"");
		td.valign = "middle";
		td.align = "center";
		//td.innerHTML = (i == 0 & isTips)?'<div style="width:17px;height:17px;background:url(images/btns.png) -100px -100px no-repeat;"></div>':'';
		var img  = document.createElement("div");
		img.isimg = true;
		//img.onclick = function(){operatePopSelect(getFirstParentObjByTag(img,"TR"),((isTips)?aItems.length:aItems.length-1),rowHeight,isTips,onChangeMethodName);};
		img.style.cssText = 'width:17px;height:17px;background:url(images/btns.png) '+aItems[i].modifyPosX+'px '+aItems[i].modifyPosY+'px no-repeat;';
		//td.innerHTML = '<div style="width:17px;height:17px;background:url(images/btns.png) '+aItems[i].modifyPosX+'px '+aItems[i].modifyPosY+'px no-repeat;"></div>';	
		td.appendChild(img);
		td.val = aItems[i].value;
		
		if(i == 0)
		{
			var rowHidden = tab.insertRow();
			rowHidden.style.backgroundColor = "#f9f9f9";
			rowHidden.id = (idStr != "")?idStr+"_item_0"+i:"div_select_item_0"+i;
			rowHidden.number = -1;
			rowHidden.pnode = pDiv.id;
			rowHidden.val = (isTips)?-1:aItems[i].val;
			rowHidden.hideContent = aItems[i];
			rowHidden.onmouseover = function(){modifyColorAndBkByOver(this,true,'#8e8f8f','#fff');modifyIconByOver(this,true);};//modifyIconByOver(this,true,pX,pY,mX,mY);
			rowHidden.onmouseout = function(){modifyColorAndBkByOver(this,false,'#8e8f8f','#fff');modifyIconByOver(this,false);};//modifyIconByOver(this,false,pX,pY,mX,mY);
			rowHidden.status = 0;
			rowHidden.onclick = function(){operatePopSelect(this,((isTips)?aItems.length:aItems.length-1),rowHeight,isTips,onChangeMethodName);};
			td = rowHidden.insertCell();
			td.style.cssText = styleText + "border-top:#d4d4d5 solid 1px!important;border-left:#d4d4d5 solid 1px!important;"+((i == aItems.length - 1)?"border-bottom:#d4d4d5 solid 1px!important;":"");
			td.valign = "middle";
			td.align = "center";
			td.innerHTML = aItems[i].text;
			//td.val = aItems[i].val;		
			td = rowHidden.insertCell();
			td.style.cssText = styleText + "border-top:#d4d4d5 solid 1px!important;border-right:#d4d4d5 solid 1px!important;"+((i == aItems.length - 1)?"border-bottom:#d4d4d5 solid 1px!important;":"");
			td.valign = "middle";
			td.align = "center";
			//td.innerHTML = (i == 0 & isTips)?'<div style="width:17px;height:17px;background:url(images/btns.png) -100px -100px no-repeat;"></div>':'';
			img  = document.createElement("div");
			img.isimg = true;
			//img.onclick = function(){operatePopSelect(getFirstParentObjByTag(img,"TR"),((isTips)?aItems.length:aItems.length-1),rowHeight,isTips,onChangeMethodName);};
			img.style.cssText = 'width:17px;height:17px;background:url(images/btns.png) '+aItems[i].modifyPosX+'px '+aItems[i].modifyPosY+'px no-repeat;';
			//td.innerHTML = '<div style="width:17px;height:17px;background:url(images/btns.png) '+aItems[i].modifyPosX+'px '+aItems[i].modifyPosY+'px no-repeat;"></div>';
			td.appendChild(img);	
			td.val = aItems[i].value;
			rowHidden.style.display = "none";
		}
	}
	pDiv.appendChild(tab);
	//pObj.appendChild(pDiv);
	return pDiv;
}
function closeOpenSelects(e)
{
	var obj=e.srcElement;  //event在ie中自带有，可以不用传入，其他少数浏览器需要传入
  if(obj.nodeName == "DIV")
	{
		if(obj.isimg)
			obj = obj.parentNode;
	}
	var selectObjs = document.getElementsByTagName("div");
	for(var i = 0; i < selectObjs.length; i++)
	{
		if(selectObjs[i].className == "div_pop_menu")
		{
			var div = getFirstParentObjByTag(obj,"div");
			if(obj == null)
				continue;
			if(div.id == selectObjs[i].id)
			{
				continue;
			}
			
			if(selectObjs[i].isPopup)
			{
				var rowHeight = 30;
				selectObjs[i].style.height  = (rowHeight + 10) + "px";
				selectObjs[i].isPopup = false;
				var row = document.getElementById((selectObjs[i].id)+"_item_0");
				resetOtherPopSelectItem(row);	
			}
			
		}
	}
}
function operatePopSelect(row,amount,rowHeight,isTips,onChangeMethodName)
{
	var pack = getFirstParentObjByTag(row,"div");
	var splitChar = "_item_";
	var aId = (row.id).split(splitChar);
	var rowHidden = document.getElementById(aId[0] + splitChar + "00");
		
	var isBeyondSize  = parseInt(pack.style.height.replace("px",""),10) > parseInt(rowHeight * 1.5);
	//document.getElementById("div_tab_title").innerHTML = "================================  "+isBeyondSize + " ---- " + pack.style.height.replace("px","") + " = " + rowHeight + ",,"+pack.nodeName;
	if(isBeyondSize)
	{
		var firstRow = document.getElementById(aId[0] + splitChar + "0");;
	//	if(row.number != 0)
		{
			displaySelectedItem(row,firstRow,rowHidden,new Array("number","onmouseover","onmouseout","onclick","hideContent","val"),isTips,onChangeMethodName);
		}			
		resetOtherPopSelectItem(row);		
		pack.style.height  = (rowHeight + 10) + "px";
		
		return;
	}
	
	if(!row.status)
	{
		resetOtherPopSelectItem(row);
		row.status  =1;
		pack.style.height  = (rowHeight*(amount + 5)) + "px";
		pack.isPopup = true;
	}
	else
	{
		row.status  =0;
		pack.style.height  = (rowHeight + 10) + "px";
		pack.isPopup = false;
	}	
	
}
function displaySelectedItem(row,firstRow,rowHidden,aProperties,isTips,onChangeMethodName)
{
	firstRow.childNodes[0].innerHTML = row.childNodes[0].innerHTML;
	firstRow.childNodes[1].innerHTML = (row.childNodes[1].innerHTML).replace("-133","-115");
	if(row.rowIndex == 1)
	{
		rowHidden.style.display = "none";
	}
	else
		rowHidden.style.display = (row.childNodes[0].innerText == rowHidden.childNodes[0].innerText)?"none":"block";		
	
	for(var i = 0; i < aProperties.length; i++)
	{
			eval("firstRow."+aProperties[i]+" = row."+aProperties[i]);
	}
	if(onChangeMethodName != "")
	{
		eval(onChangeMethodName+"('"+row.childNodes[0].innerHTML+"',"+firstRow.val+",'"+row.pnode+"',row.hideContent);");
	}
}
function resetOtherPopSelectItem(row)
{
	for(var i = 0; i < (row.parentNode).childNodes.length; i++)
	{
		(row.parentNode).childNodes[i].status  =0;
	}
}
///////下拉式菜单结束////////
/*
删除指定连续字符，mode:0从头1从尾，其它任意位置
*/
function delConCharsInString(str,char,pos,mode)
{
	str = new String(str);
	for(var i=0;i<str.length;i++)
	{
		if(str.charAt(i) == char)
		{
			if(i>pos+1)
				break;
			
			return delConCharsInString(str.replace(char,""),char,i,mode);
		}
	}
	return str;
}
function getLastCharInString(str)
{
	str = new String(str);	
	return str.charAt(str.length-1);
}
function get3DButtonByParas(txt,idStr,txtWidth,tailFuncImgSrc,onclickMethodName)
{
	/*<div id="div_setup_btn_pack" style="float:right;margin-right:10px;margin-top:4em;cursor:pointer;" onclick="jumpToPageByURL('SCS:ADVANCE_MODE');" onmouseover="operateSetupBtnBk('div_setup_btn_header','div_setup_btn_mid','div_setup_btn_tail',true);" onmouseout="operateSetupBtnBk('div_setup_btn_header','div_setup_btn_mid','div_setup_btn_tail',false);">
											<div id="div_setup_btn_header" style="float:left;width:16px;height:37px;background:url(images/setup_btn_header.png) 0px 0px;"></div>
											<div id="div_setup_btn_mid" style="float:left;width:80px;height:37px;background:url(images/setup_btn_mid.png) repeat-x;font-size:1.4em;text-align:center;">
												<div class="QsBtnText" style="margin-top:0.5em;">高级设置</div>
											</div>
											<div id="div_setup_btn_tail" style="float:left;width:45px;height:37px;background:url(images/setup_btn_tail.png) 0px 0px;"></div>
										</div>*/	
	var headerId = idStr+'_header';
	var midId = idStr+'_mid';
	var tailId = idStr+'_tail';
	var pack = document.createElement("div");
	pack.style.cssText = "cursor:pointer;min-width:"+(16+txtWidth+45+20)+"px;";
	pack.onmouseover = function(){operateSetupBtnBk(headerId,midId,tailId,true);};
	pack.onmouseout = function(){operateSetupBtnBk(headerId,midId,tailId,false);};
	pack.onclick = function(){eval(onclickMethodName+";");};
	
	var header = document.createElement("div");
	header.style.cssText = "float:left;width:16px;height:37px;background:url(images/setup_btn_header.png) 0px 0px;";	
	header.id = headerId;
	var mid = document.createElement("div");
	mid.style.cssText = "float:left;min-width:"+txtWidth+"px;height:37px;background:url(images/setup_btn_mid.png) repeat-x;font-size:1.4em;text-align:center;";
	mid.id = midId;
	var content = document.createElement("div");
	content.style.cssText = "margin-top:0.5em;";
	content.className = "QsBtnText";
	content.innerText = txt;
	mid.appendChild(content);
	var tail = document.createElement("div");
	tail.style.cssText = "float:left;width:45px;height:37px;background:url(images/"+tailFuncImgSrc+") 0px 0px;";
	tail.id = tailId;
	
	pack.appendChild(header);
	pack.appendChild(mid);
	pack.appendChild(tail);
	return pack;
}
//替换所有
function replaceStr(str,oStr,nStr)
{
	if(str == undefined | str == "")
		return "";
		
	if(str.indexOf(oStr) > -1)
	{		
		return replaceStr(str.replace(oStr,nStr),oStr,nStr);
	}	
	return str;
}

////////左侧导航栏 开始/////////////////////
function initNavTitleTextPos(scrollTop)
{
	var aTitleId = new Array("div_add_device_title","div_add_emp_title","div_add_info_title","div_setup_device_title");
	var img = document.getElementById("img_quick_guide_pic");	
	img.style.display = "block";
	var left = getAbsoluteLeftByObj(img);
	var top = getAbsoluteTopByObj(img);
	var tObjHeight = 31 ;
	var tObj1 = document.getElementById(aTitleId[0]);
	var nTop = top + 100 - scrollTop;
	tObj1.style.left = "10px";
	tObj1.style.top = nTop+"px";
	tObj1.style.display = "block";
	var tObj2 = document.getElementById(aTitleId[1]);
	tObj2.style.left = "10px";
	nTop += 240;
	tObj2.style.top = nTop+"px";
	tObj2.style.display = "block";
	var tObj3 = document.getElementById(aTitleId[2]);
	tObj3.style.left = "10px";
	nTop += 256;
	tObj3.style.top = nTop+"px";
	tObj3.style.display = "block";
	var tObj4 = document.getElementById(aTitleId[3]);
	tObj4.style.left = "10px";
	nTop += 250;
	tObj4.style.top = nTop+"px";
	tObj4.style.display = "block";
}

function getURLByCharFromEnd(url,splitChar,endIndex)
{
	var aUrls = url.split(splitChar);
	var urlsStr = "";
	var start = aUrls.length - 1 - endIndex;
	if(start < 0)
		return null;
	for(var i = start; i < aUrls.length; i++)
	{
			urlsStr += aUrls[i] + ((i != aUrls.length -1)?"/":"");
	}
	return urlsStr;
}
function operateLeftNavBk(index,isOver)
{
	var img = document.getElementById("img_quick_guide_pic");	
	var aFrontNames = getURLByCharFromEnd(img.src,"/",1).split("_");//(img.src).split("_");
	if(isOver)
	{
		img.src = aFrontNames[0]+"_"+index+".png";
	}
	else
	{ 
		img.src = aFrontNames[0]+"_0.png";
	}
	
}
function linkLeftNavBk(dTitle,index,isOver)
{
	operateLeftNavBk(index,isOver);
	dTitle.style.color = (!isOver)?"#000":"#368fca";
	//dTitle.style.fontWeight = ((!isOver)?"lighter":"bold");
}
function operateNavBtnPos(btnId,isOver)
{
	var btn = document.getElementById(btnId);	
	var aPosStr = (btn.style.backgroundPosition).split(" ");
	if(isOver)
	{
		aPosStr[1] = "0px";
	}
	else
	{
		aPosStr[1] = "-89px";			
	}
	btn.style.backgroundPosition = aPosStr[0] +" "+aPosStr[1];
}
////////左侧导航栏 结束/////////////////////
//初始化下边绝对位置按钮
function initBottomBtnMarginTop(idStr)
{
	var dPage = getPageDisplaySize();
	var detailSetupBtn = document.getElementById(idStr);
	var detailSetupBtnLeft = getAbsoluteLeftByObj(detailSetupBtn);
	var detailSetupBtnParentTop = getAbsoluteTopByObj(detailSetupBtn.parentNode);
	//var detailSetupBtnTop = getAbsoluteTopByObj(detailSetupBtn);
	var detailSetupBtnH = getElementHeightByObj(detailSetupBtn);
	var reduceSpan = (dPage.h<900)?10:30;
	detailSetupBtn.style.marginTop = (dPage.h - detailSetupBtnParentTop - detailSetupBtnH - reduceSpan)+"px";	
}
/*idStr可以id字符串，也可以是对象*/
function displayTipsByOver(idStr,isOver,w,indicatePos,isTop)
{
	//title 转移到 tips
	removeTips();
	setTimeout(function(){delayDisplayTipsByOver(idStr,isOver,w,indicatePos,isTop,true);},10);
}
function delayDisplayTipsByOver(idStr,isOver,w,indicatePos,isTop,isMousePos)
{
	if(!isOver)
		return;
	
	var obj = getObjByStrOrObj(idStr);
	
//	var objLeft = getAbsoluteLeftByObj(obj);
	var objTop = getAbsoluteTopByObj(obj);
	var objH = getElementHeightByObj(obj);
	var objW = getElementWidthByObj(obj);
	var dPage = getPageDisplaySize();
	
	var maxHeight = parseInt(dPage.h*0.3,10);
	var width = 200;
	if(w != undefined)
		width = w;
	else
		width = -1;
	var minMargin = 30;
	
	var iPos = 20;
	if(indicatePos != undefined)
		iPos = indicatePos;
	var iTop = false;
	if(isTop != undefined)
	{
		if(objTop > maxHeight)
			iTop = false;
		else
			iTop = isTop;
	}
	
	var mLeft = mouseX;//objLeft+objW;
	var mTop = 0;//objTop+objH;
	
	if(mLeft + width > dPage.w)
			mLeft = dPage.w - width - minMargin;
	
	//document.getElementById("div_emp_list_title").innerText = obj.tips+",new Array("+mLeft+","+mTop+","+width+","+iPos+","+objTop+"),"+iTop+","+true+","+isMousePos;//div_access_controller_desc div_emp_list_title
	if(obj.tips != undefined)
	{
		if(obj.tips != "")
			createTipsByPosText(obj.tips,new Array(mLeft,mTop,width,iPos,objTop),iTop,true,isMousePos);
	}
}
function displayTipsByObjPos(idStr,tips,isTop,len,isMousePos)
{
	var obj = getObjByStrOrObj(idStr);
	var objLeft = getAbsoluteLeftByObj(obj);
	var objTop = getAbsoluteTopByObj(obj);
	var objH = getElementHeightByObj(obj);
	var objW = getElementWidthByObj(obj);
	var dPage = getPageDisplaySize();
	if(isTop)
	{
		createTipsByPosText(tips,new Array(objLeft+parseInt(objW/2,10),objTop + parseInt(objH*1,10),len,20),isTop,false,isMousePos);
	}
	else
	{
		createTipsByPosText(tips,new Array(objLeft+parseInt(objW/2,10),objTop,len,20),isTop,false,isMousePos);
	}
}
function removeTips()
{
	setTimeout(function(){
	var tab = document.getElementById("tab_tips");
	if(tab != null)
		(document.body).removeChild(tab);
	},5);
}
function createTipsByPosText(tips,aPos,isTop,isObj,isMousePos)
{
		var tab = document.createElement("table");
		tab.id = "tab_tips";
		tab.cellPadding = "0";
		tab.cellSpacing = "0";
		tab.border = "0";
		tab.style.cssText = "position:absolute;left:"+aPos[0]+"px;top:"+aPos[1]+"px;z-index:999;";
		//第一行
		var row = tab.insertRow();
		var cell = row.insertCell();
		cell.align = "right";
		cell.vAlign = "bottom";
		cell.style.cssText = "line-height:4px;font-size:4px;";
		var img = document.createElement("img");
		img.style.cssText = "margin:0px;padding:0px;";
		img.src = "images/tips_left_top_img.png";
		cell.appendChild(img);
		
		cell = row.insertCell();
		cell.style.cssText = "background:url(images/tips_top_mid_img.png) repeat-x;height:15px;line-height:4px;font-size:4px;padding-left:"+aPos[3]+"px;padding:0px;";
		cell.vAlign = "bottom";
		//cell.style.cssText = "background-color:#25fc2a;";
		img = document.createElement("img");
		img.style.cssText = "margin:0px;padding:0px;";
		img.src = "images/tips_top_triangle_img.png";
		if(isTop)
			cell.appendChild(img);
		
		cell = row.insertCell();
		cell.align = "left";
		cell.vAlign = "bottom";
		img = document.createElement("img");
		img.style.cssText = "margin:0px;padding:0px;";
		img.src = "images/tips_right_top_img.png";
		cell.style.cssText = "line-height:4px;font-size:4px;";
		cell.appendChild(img);
		//第二行
		row = tab.insertRow();
		cell = row.insertCell();
		cell.align = "right";
		cell.style.cssText = "background:url(images/tips_left_mid_img.png) repeat-y;";
		
		cell = row.insertCell();
		if(aPos[2] != -1)
			cell.width = aPos[2]+"px";
		else if(tips.length > 20 & tips.length < 60)
			cell.width = "200px";
		else if(tips.length >= 60)
			cell.width = "300px";
		cell.style.cssText = "background-color:#ffe8ad;padding:4px;word-break:break-all;white-space:normal;";
		//cell.noWrap = "nowrap";
		cell.innerText = tips;
		
		cell = row.insertCell();
		cell.align = "left";
		cell.style.cssText = "background:url(images/tips_right_mid_img.png) repeat-y;";
		
		row = tab.insertRow();
		cell = row.insertCell();		
		cell.align = "right";
		cell.vAlign = "top";
		cell.style.cssText = "padding-top:0px;";
		img = document.createElement("img");
		img.style.cssText = "margin:0px;";
		img.src = "images/tips_left_bottom_img.png";
		cell.style.cssText = "line-height:10px;font-size:4px;";
	  cell.appendChild(img);
		
		cell = row.insertCell();
		cell.vAlign = "top";
		cell.id = "cell_tips_"+aPos[3];
		cell.style.cssText = "background:url(images/tips_bottom_mid_img.png) repeat-x;height:20px;padding-left:"+aPos[3]+"px;padding-top:0px;";
		img = document.createElement("img");
		img.style.cssText = "margin:0px;padding:0px;";
		img.src = "images/tips_bottom_triangle_img.png";
		if(!isTop)
			cell.appendChild(img);
		
		cell = row.insertCell();
		cell.align = "left";
		cell.vAlign = "top";
		img = document.createElement("img");
		img.style.cssText = "margin:0px;padding:0px;";
		img.src = "images/tips_right_bottom_img.png";
		cell.style.cssText = "line-height:10px;font-size:4px;";
		cell.appendChild(img);
		
		document.body.appendChild(tab);
		var objW = getElementHeightByObj(tab);
		tab.style.left = (aPos[0] + parseInt(objW*0.2,10))+"px";
		if(parseInt(objW*0.3,10) < aPos[3])
			document.getElementById("cell_tips_"+aPos[3]).style.paddingLeft = "5px";
		if(isMousePos)
		{
			var objH = getElementHeightByObj(tab);
			tab.style.top = (mouseY-objH - 3)+"px";//document.getElementById("div_emp_list_title").innerHTML = "mouseY:"+mouseY+",left:"+aPos[0];
		}
		else
		{
			tab.style.top = aPos[1]+"px";
			setTimeout(function(){removeTips();},STANDARD_TOAST_TIME_LEN);
		}
}	
/*id可以id字符串，也可以是对象*/
function getObjByStrOrObj(id)
{	
	if(((typeof(id)+"").toUpperCase()) == "STRING")
		return document.getElementById(id);
	return id;
}
function cutStringByLen(str,len)
{
  var r=/[^\x00-\xff]/g;
	if(str === undefined)
		return "";
	
  if(str.replace(r,"mm").length<=len)
	{
		return str;
	}
  var m=Math.floor(len/2);
  for(var i=m;i<str.length;i++)
	{
      if(str.substr(0,i).replace(r,"mm").length>=len)
          return str.substr(0,i)+"...";
  }
  return str;
}
function copyString(str)
{
	// 创建input元素，给input传值，将input放入html里，选择input
	var w = document.createElement('input');
	w.value = str;
	document.body.appendChild(w);
	w.select();		
	// 调用浏览器的复制命令
	document.execCommand("Copy");		
	// 将input元素隐藏，通知操作完成！
	w.style.display='none';
	(w.parentNode).removeChild(w);
	//console.log('操作成功！');	
}
function setTitleProc(tabid,text,isCancel)
{
	var titleSpan = document.getElementById('title_'+tabid);
  
	if(titleSpan ==undefined | titleSpan == null)
		return;
	var title = titleSpan.innerHTML;
	var splitChar = " ------ ";
	if(isCancel == undefined | (!isCancel))
	{
		if(title.indexOf(splitChar) < 0)
			titleSpan.innerHTML +=  splitChar + "" + text+"<span id='sp_per'></span><img src='images/proc.gif' style='margin-left:0.2rem;margin-top:0px;width:60px;'/>";
	}
	else
	{
		if(title.indexOf(splitChar) > -1)
		{
			 var aTitle = title.split(splitChar);
			 titleSpan.innerHTML = aTitle[0]; 	
		}
	}
}
var g_procPercent = -1;
function updateTitlePercent(curNum,totalNum,start,reTry)
{
  if(reTry != undefined)
  {
    if(reTry)
      g_procPercent = -1;
  }
	var spPer = document.getElementById("sp_per");
	
	if(spPer != undefined && spPer != null)
	{
		var curPercent = parseInt((curNum-start)/(totalNum-start)*100);
		if(curPercent > g_procPercent)
		{
			spPer.innerHTML = " " + curPercent + "%";	
			g_procPercent = curPercent;
		}
		else
			g_procPercent = -1;
	}
}
function getDotByNum(num,char)
{
	var str = "";
	for(var i = 0; i < num; i++)
		str += char;
	return str;	
}
var g_dateSplitChar = "-";
function getTodayDataStr()
{
	var date = new Date();
	var year = date.getFullYear();
	var month = date.getMonth() + 1;
	var strDate = date.getDate();
	return year + g_dateSplitChar + month + g_dateSplitChar + strDate;		
}
//获取字符串的字节数
function calcBytesAmountByString(str, charset)
{
   /* var total = 0,charCode,i,len;
    charset = (charset != undefined)?charset.toLowerCase() : '';
    if(charset === 'utf-16' || charset === 'utf16')
		{
        for(i = 0, len = str.length; i < len; i++)
				{
            charCode = str.charCodeAt(i);
            if(charCode <= 0xffff){
                total += 2;
            }else{
                total += 4;
            }
        }
    }
		else
		{
        for(i = 0, len = str.length; i < len; i++)
				{
            charCode = str.charCodeAt(i);
            if(charCode <= 0x007f) {
                total += 1;
            }else if(charCode <= 0x07ff){
                total += 2;
            }else if(charCode <= 0xffff){
                total += 3;
            }else{
                total += 4;
            }
        }
    }
    return total;*/
		///<summary>获得字符串实际长度，中文2，英文1</summary>
        ///<param name="str">要获得长度的字符串</param>
        var realLength = 0, len = str.length, charCode = -1;
        for (var i = 0; i < len; i++) {
            charCode = str.charCodeAt(i);
            if (charCode >= 0 && charCode <= 128)
                realLength += 1;
            else
                realLength += 2;
        }
				//console.log("str = " + str + ",  len = "+ realLength);
        return realLength;
}
function checkInputLimitChar(str)
{
	var char;
	var i = 0;
	char = (str + "").charAt(i++)
	var aLimitChars = new Array('/','\\','"',"'");
	while(char)
	{
		for(var j = 0; j < aLimitChars.length; j++)
		{
			if(aLimitChars[j] === char)
				return false;
		}
		try{
			char = str.charAt(i++);
		}
		catch(e)
		{
			break;	
		}
	}
	return true;
}
function checkStringLenValidate(str,len)
{
	if(getStringBytesAmount(str,"utf-8") > len)
		return false;
	return true;
}
function getStringBytesAmount(str,charset)
{
	/**
 * 计算字符串所占的内存字节数，默认使用UTF-8的编码方式计算，也可制定为UTF-16
 * UTF-8 是一种可变长度的 Unicode 编码格式，使用一至四个字节为每个字符编码
 * 
 * 000000 - 00007F(128个代码)      0zzzzzzz(00-7F)                             一个字节
 * 000080 - 0007FF(1920个代码)     110yyyyy(C0-DF) 10zzzzzz(80-BF)             两个字节
 * 000800 - 00D7FF 
   00E000 - 00FFFF(61440个代码)    1110xxxx(E0-EF) 10yyyyyy 10zzzzzz           三个字节
 * 010000 - 10FFFF(1048576个代码)  11110www(F0-F7) 10xxxxxx 10yyyyyy 10zzzzzz  四个字节
 * 
 * 注: Unicode在范围 D800-DFFF 中不存在任何字符
 * {@link http://zh.wikipedia.org/wiki/UTF-8}
 * 
 * UTF-16 大部分使用两个字节编码，编码超出 65535 的使用四个字节
 * 000000 - 00FFFF  两个字节
 * 010000 - 10FFFF  四个字节
 * 
 * {@link http://zh.wikipedia.org/wiki/UTF-16}
 * @param  {String} str 
 * @param  {String} charset utf-8, utf-16
 * @return {Number}
 */
	if(charset == undefined)
		charset = 'utf-8';
	else
		charset = charset.toLowerCase();
	var total = 0,
			charCode,
			i,
			len;
	charset = charset ? charset.toLowerCase() : '';
	if(charset === 'utf-16' || charset === 'utf16'){
			for(i = 0, len = str.length; i < len; i++){
					charCode = str.charCodeAt(i);
					if(charCode <= 0xffff){
							total += 2;
					}else{
							total += 4;
					}
			}
	}else{
			for(i = 0, len = str.length; i < len; i++){
					charCode = str.charCodeAt(i);
					if(charCode <= 0x007f) {
							total += 1;
					}else if(charCode <= 0x07ff){
							total += 2;
					}else if(charCode <= 0xffff){
							total += 3;
					}else{
							total += 4;
					}
			}
	}
	return total;
}
function calcCharsAmountByString(str,chars)
{
	var aStr = str.split(chars);
	return aStr.length;
}

/**
*判断是否是数字
*
**/
function isRealNum(val)
{
    // isNaN()函数 把空串 空格 以及NUll 按照0来处理 所以先去除，
    
　　if(val === "" || val ==null){
        return false;
　　}
   if(!isNaN(val)){　　　　
　　//对于空数组和只有一个数值成员的数组或全是数字组成的字符串，isNaN返回false，例如：'123'、[]、[2]、['123'],isNaN返回false,
   //所以如果不需要val包含这些特殊情况，则这个判断改写为if(!isNaN(val) && typeof val === 'number' )
　　　 return true; 
　　}

　else{ 
　　　　return false; 
　　} 
}
function filterJPGByName(fName)
{
	var asExtName = new Array("jpg","JPeg");
	return filterFileByName(fName,asExtName);
}
/*
fName文件名
asExtName扩展名
*/
function filterFileByName(fName,asExtName)
{
	if(fName.indexOf(".") > 0)
	{
		var aName = fName.split(".");
		var lastIndex = aName.length - 1;
		aName[lastIndex] = aName[lastIndex].toLocaleUpperCase();
		for(var i = 0; i < asExtName.length; i++)
		{
			if(aName[lastIndex] === asExtName[i].toLocaleUpperCase())
			{
				return false;
			}
			
		}
	}
	
	return true;
}
function getImportCompleteTime(start,curTime,key)
{
	var span = parseInt((curTime - start)/1000);
	var hours = parseInt(span/3600);
	var minutes = parseInt((span % 3600)/60);	
	var seconds = span % 60;
	var msg = "";
	if(key == undefined)
		msg = getLanTextByKey("T_IMPORT_SUCCESS_TIPS");
	else
		msg = getLanTextByKey(key);
	msg = msg.replace("%1",hours);	
	msg = msg.replace("%2",minutes);
	msg = msg.replace("%3",seconds);
	
	return msg;
}
function getSelectFilePath(filterStr,title)
{
	return _externalSelectFile(filterStr,title);	
}
//设置复合控件timespinner和input
function setCombineTimerUItoCellByEasyUI(obj,cell)
{
	cell.appendChild(obj["obj"]);	
	var timeStart = getTimeByBytes(obj["default"][1],false,":");
	var timeEnd = getTimeByBytes(obj["default"][1],true,":");
	setEasyUISpinnerTimer(obj["obj"].id+"_start",timeStart,obj["default"][1]);
	setEasyUISpinnerTimer(obj["obj"].id+"_end",timeEnd,obj["default"][1])
}
//设置easyUI timespinner
function setEasyUISpinnerTimer(id,dVal,dNum)
{
	$("#"+id).timespinner({
			value: dVal,     //初始时间
			min: '00:00',       //最小值
			max: '23:59',      //最大值
			/*spin:function () {
             
        },*/
		onChange: function(){
				var callBackMehtod = 'changeTimeSpinnerCallBackMethod';
					if(checkMethodName(callBackMehtod))
						upTimeSpinnerCallBackMethod(this);
				return true;
		},
		onSpinUp: function () {
					var callBackMehtod = 'upTimeSpinnerCallBackMethod';
					//if(checkMethodName(callBackMehtod))
					//	upTimeSpinnerCallBackMethod(this);
			},
			onSpinDown: function () {
					var callBackMehtod = 'downTimeSpinnerCallBackMethod';
					if(checkMethodName(callBackMehtod))
						downTimeSpinnerCallBackMethod(this);
			}
	});
	document.getElementById(id).initVal = dNum;
	document.getElementById(id).initValStr = dVal;
	document.getElementById(id).mode = "timespinner";
}
function getCombineLightUI(ids,callBackMethod,delayDefault)
{//id,placeholder,h,mode,callBackMethodName,aLimit
	var pannel = document.createElement("div");
	pannel.id = ids[1];
	var input = getEditInput(ids[0],"10-255",30,9,callBackMethod,new Array(10,60));
	if(delayDefault != undefined)
	{
		input.value = delayDefault;
		input.initVal = delayDefault;
	}
	input.mode = "input";
	var cPannel = document.createElement("div");
	cPannel.id = ids[1] + "_node";
	var startInput = document.createElement("input");
	startInput.type = "text";
	startInput.style.cssText = "width:80px;";
	startInput.id = ids[1]+"_start";	
	
	var endInput = document.createElement("input");
	endInput.type = "text";
	endInput.style.cssText = "width:80px;";
	endInput.id = ids[1]+"_end";
	
	var sp = document.createElement("sp");
	sp.innerText = ' -- ';
	
	cPannel.appendChild(startInput);
	cPannel.appendChild(sp);
	cPannel.appendChild(endInput);
	pannel.appendChild(cPannel);
	pannel.appendChild(input);
	return pannel;
}
function getWholedwWXSegY(sTime,eTime,sChar)
{
	var eNum = getdwWXSegY(eTime,sChar);
	var sNum = getdwWXSegY(sTime,sChar);
	eNum = eNum<<16;
	return eNum | sNum;
}
function getdwWXSegY(tStr,sChar)
{
	var aTime = tStr.split(sChar);
	//HH MM
	var num = (parseInt(aTime[1],10))<<8;
	num |= (parseInt(aTime[0],10));
	return num;
}
function getTimeByBytes(num,isHigh,sChar)
{	
//HH MM HH MM
	if(isHigh)
		num = num >>> 16;
	else
		num = (num & 65535);
	return getItmeByInt(num,sChar);
}
function getItmeByInt(num,sChar)
{
	var time = (num & 255);	
	time += sChar + (num>>>8);
	return time;
}
function isNormalInteger(str) {

    var n = Math.floor(Number(str));
  
    return n !== Infinity && String(n) === str && n >= 0;

}
//对象深度拷贝
function deepClone(o) {
    // 判断如果不是引用类型，直接返回数据即可
    if (typeof o === 'string' || typeof o === 'number' || typeof o === 'boolean' || typeof o === 'undefined') {
        return o
    } else if (Array.isArray(o)) { // 如果是数组，则定义一个新数组，完成复制后返回
        // 注意，这里判断数组不能用typeof，因为typeof Array 返回的是object
        console.log(typeof [])  // --> object
        var _arr = []
        o.forEach(item => { _arr.push(item) })
        return _arr
    } else if (typeof o === 'object') {
        var _o = {}
        for (let key in o) {
            _o[key] = deepClone(o[key])
        }
        return _o
    }
}