LeadingMIS.UI = function(){}

LeadingMIS.UI.isWindow = function(eventWindow)
{
	if((typeof(eventWindow) == "object") && ("document" in eventWindow))
	{
		return true;
	}
	else
	{
		return false;
	}
}

LeadingMIS.UI.isObjectArray = function(tempObject)
{
	if((typeof(tempObject) == "object") && ("length" in tempObject))
	{
		return true;
	}
	else
	{
		return false;
	}
}

LeadingMIS.UI.insertEventHandler = function(objectElement,strEvent,strFunction)
{
	var E = /^[\s]*(void)?[\s]*function[^\(\)]*\(\)[\s]*{[\s]*([\s\S]*)[\s]*}[\s]*$/;
	if(typeof(objectElement) == "object")
	{
		if(strEvent in objectElement)
		{
			var s = "";
			s += ";" + strFunction;
			if(objectElement[strEvent] != null)
			{
				s += ";" + objectElement[strEvent].toString().replace(E,"$2");
			}
			try
			{
			//	s = s.replace(/this/g,"window.event.srcElement");
				eval("objectElement[strEvent]=function(){" + s + "}");
				return true;
			}
			catch(e)
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}

LeadingMIS.UI.addEventHandler = function(objectElement,strEvent,strFunction)
{
	var E = /^[\s]*(void)?[\s]*function[^\(\)]*\(\)[\s]*{[\s]*([\s\S]*)[\s]*}[\s]*$/;
	if(typeof(objectElement) == "object")
	{
		if(strEvent in objectElement)
		{
			var s = "";
			if(objectElement[strEvent] != null)
			{
				s += ";" + objectElement[strEvent].toString().replace(E,"$2");
			}
			s += ";" + strFunction;
			try
			{
				eval("objectElement[strEvent]=function(){" + s + "}");
				return true;
			}
			catch(e)
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}

LeadingMIS.UI.getObjectSource = function(tempObject)
{
	if(tempObject)
	{
		return this.getObjectSource(tempObject.parentElement) + "[" + tempObject.tagName + "]" + tempObject.id + ".";;
	}
	else
	{
		return "";
	}
}

LeadingMIS.UI.selectObject = function(tempObject)
{
	switch(tempObject.type.toLowerCase())
	{
		case "input":
			tempObject.focus();
			tempObject.select();
			break;
		case "select":
			tempObject.focus();
			break;
		case "hidden":
			break;
		case "text":
			tempObject.focus();
			tempObject.select();
			break;
		default:
			tempObject.focus();
			break;
	}
}

LeadingMIS.UI.showPopup = function(tempMessage,tempObject,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	try
	{
		var popup = eventWindow.createPopup();
		popup.document.body.style.border = "thin dotted #CCCCCC";
		popup.document.body.style.wordWrap = "break-word";
		popup.document.body.style.wordBreak = "normal";
		popup.document.body.style.cursor = "default";
		popup.document.body.style.font = "normal normal bolder smaller normal 新宋体";
		popup.document.body.innerHTML = tempMessage;
		
	//	var left = (widthTemp / 2);
	//	var top = (heightTemp / 2);
	//	var width = (screen.width - widthTemp);
	//	var height = (screen.height - heightTemp);
		
	//	var left = ((256 - widthTemp) / 2);
	//	var top = ((361 - heightTemp) / 2);
	//	var width = (widthTemp);
	//	var height = (heightTemp);
		
	//	var aaa = LeadingMIS.UI.getAbsolute(tempObject);
		popup.show(tempObject.offsetLeft,tempObject.offsetTop + tempObject.offsetHeight,tempObject.offsetWidth,100,eventWindow.document.body);
	//	popup.show(left,top,width,height,window.document.body);
	}
	catch(e)
	{
		LeadingMIS.Error.setInfo(0,this.showPopup,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.showPopup","");
	}
}

LeadingMIS.UI.getAbsolute = function(objTemp)
{
	var left = 0;
	var top = 0;
	var obj = objTemp;
	while((obj != null) && (obj.tagName != "BODY"))
	{
		left += obj.offsetLeft;
		top += obj.offsetTop;
		obj = obj.parentElement;
	}
	return Array(left,top);
}

LeadingMIS.UI.formatValue = function(tempObject)
{
	if(typeof(tempObject.vType) != "undefined")
	{
		var tempValue = (typeof(tempObject.getValue) == "undefined")?(tempObject.value):(tempObject.getValue());
		if(tempValue.trim() != "")
		{
			switch(tempObject.vType.toLowerCase())
			{
				case "datetime"://DateTime
					if(typeof(tempObject.setValue) != "undefined")
					{
						tempObject.setValue(FormatDateTime(tempValue,0));
					}
					else
					{
						tempObject.value = FormatDateTime(tempValue,0);
					}
					break;
				case "date"://Date
					if(typeof(tempObject.setValue) != "undefined")
					{
						tempObject.setValue(FormatDateTime(tempValue,2));
					}
					else
					{
						tempObject.value = FormatDateTime(tempValue,2);
					}
					break;
				case "time"://Time
					if(typeof(tempObject.setValue) != "undefined")
					{
						tempObject.setValue(FormatDateTime(tempValue,3));
					}
					else
					{
						tempObject.value = FormatDateTime(tempValue,3);
					}
					break;
				case "int"://Int
				case "posint"://PosInt
				case "nonposint"://NonPosInt
				case "negint"://NegInt
				case "nonnegint"://NonNegInt
					if(typeof(tempObject.setValue) != "undefined")
					{
						tempObject.setValue(parseInt(tempValue));
					}
					else
					{
						tempObject.value = parseInt(tempValue);
					}
					break;
				case "decimal"://Decimal
				case "posdecimal"://PosDecimal
				case "nonposdecimal"://NonPosDecimal
				case "negdecimal"://NegDecimal
				case "nonnegdecimal"://NonNegDecimal
					if(typeof(tempObject.setValue) != "undefined")
					{
						tempObject.setValue(parseFloat(tempValue));
					}
					else
					{
						tempObject.value = parseFloat(tempValue);
					}
					break;
				default:
					break;
			}
		}
		else
		{
			;
		}
	}
	else
	{
		;
	}
}
//--------------------------------------------------------------------------------------------------------------
//-- 功能：全选或全不选
//-- 参数：sObj：源对象		dObj：目标对象
//-- 说明：查询列表页面首列列出带主键值的CheckBox需要这个功能
//-- 例如：<input id='Check_PHA051122000029'  class='inputcheckbox' type='checkbox' name='ActionPZ' value='PHA051122000029' >
//-- 作者：黄岳
//--------------------------------------------------------------------------------------------------------------
LeadingMIS.UI.selChk = function (obj, strName){
	try{
		var chkArray = document.getElementsByName(strName);
		for(var i=0;i<chkArray.length;i++)
		{
			if(chkArray[i].type == "checkbox" && chkArray[i].disabled==false){
				chkArray[i].checked = obj.checked;
			}
		}
	}
	catch(e){
		alert(e)
	}
}

/****************************************************
名称:LeadingMIS.UI.selAllChk(strName,eventWindow)
作者:刘晖
类型:Public
参数:输入		strName			string		checkbox的name
				eventWindow		window		当前也的window对象
     输出
说明:全选checkbox组
继承:LeadingMIS.UI.selChk(obj,strName)
	 LeadingMIS.UI.selAllChk1(strName)
示例:
LeadingMIS.UI.selAllChk("chk");
LeadingMIS.UI.selAllChk("chk",window);
****************************************************/
LeadingMIS.UI.selAllChk = function(strName,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	if(((eventWindow.event) != null) && ((eventWindow.event.srcElement) != null))
	{
		if(eventWindow.event.srcElement.type == "checkbox")
		{
			this.selChk(eventWindow.event.srcElement,strName);
		}
		else
		{
			this.selAllChk1(strName);
		}
	}
	else
	{
		this.selAllChk1(strName);
	}
}

//功能:	选中页面所有name=strName的CheckBox，用于列表的“全选”按钮
//注意: CheckBox的Name属性必须一致
//参数: strName:CheckBox的Name属性  
//返回： 
LeadingMIS.UI.selAllChk1 = function(strName)
{
	var chkArray = document.getElementsByName(strName);
    
	for(var i=0;i<chkArray.length;i++)
	{
		if(chkArray[i].disabled == false)
		{
			chkArray[i].checked = true;
		}
	}
}

//功能:	取消页面所有name=strName的CheckBox的选择，用于列表的“全不选”按钮
//注意: CheckBox的Name属性必须一致 
//参数: strName:CheckBox的Name属性  
//返回： 
LeadingMIS.UI.unselAllChk = function(strName)
{
	var chkArray = document.getElementsByName(strName);
    
	for(var i=0;i<chkArray.length;i++)
	{
		chkArray[i].checked = false;
	}
}

//功能:	确认用户是否进行删除操作
//注意: CheckBox的Name属性必须一致 
//参数: strName:CheckBox的Name属性  
//返回: 
LeadingMIS.UI.confirmDel = function(strName)
{
	var chkArray = document.getElementsByName(strName);
    var j = 0;
    var vConfirmDel = false;
	for(var i=0;i<chkArray.length;i++){
		if (chkArray[i].checked == true){
			j++;
		}
	}
	if(j>0){
		vConfirmDel = window.confirm("您确实要删除这 " + j + " 条记录吗？");
	}
	else{
		window.alert("您没有选择任何记录进行删除！");
		vConfirmDel = false;
	}
	return vConfirmDel;
}

LeadingMIS.UI.CommonSelectDialog = function(tempType,tempSign,tempSelectID,tempTilteL,tempTilteR,tempTilte,tempQuery,tempHeight,tempWidth,eventWindow)
{
	if(typeof(tempType) == "undefined")
	{
		return null;
	}
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	
	tempSign = (typeof(tempSign) == "undefined")?"1":tempSign;
	tempSelectID = (typeof(tempSelectID) == "undefined")?"":tempSelectID;
	tempTilteL = (typeof(tempTilteL) == "undefined")?"待选":tempTilteL;
	tempTilteR = (typeof(tempTilteR) == "undefined")?"已选":tempTilteR;
	tempTilte = (typeof(tempTilte) == "undefined")?"选择框":tempTilte;
	tempQuery = (typeof(tempQuery) == "undefined")?"":tempQuery;
	tempHeight = (typeof(tempHeight) == "undefined")?"600":tempHeight;
	tempWidth = (typeof(tempWidth) == "undefined")?"300":tempWidth;
	
	try
	{
		return eventWindow.showModalDialog("/SysFrames/UserControl/CommonSelectDialog/WebUI/CommonBackstair.aspx?type=" + tempType + "&sign=" + tempSign + "&selected=" + tempSelectID + "&tilteL=" + tempTilteL + "&tilteR=" + tempTilteR + "&tilte=" + tempTilte + "&query=" + tempQuery,null,"help=no;status=no;scroll=no;edge=raised;dialogHeight=" + (screen.height - tempHeight) + "px;dialogWidth=" + (screen.width - tempWidth) + "px;dialogLeft=" + (tempWidth / 2) + ";dialogTop=" + (tempHeight / 2) + ";");
	}
	catch(e)
	{
		LeadingMIS.Error.setInfo(0,this.CommonSelectDialog,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.CommonSelectDialog","");
		return null;
	}
}

LeadingMIS.UI.CommonDuty = function(tempSelectID,tempQuery,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	return this.CommonSelectDialog("selectDuty","1",tempSelectID,"待选职务","已选职务","职务选择框",tempQuery,400,500,eventWindow);
}

LeadingMIS.UI.CommonPerson = function(tempSelectID,tempQuery,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	return this.CommonSelectDialog("selectPerson","1",tempSelectID,"待选人员","已选人员","人员选择框",tempQuery,400,500,eventWindow);
}

//功能:	选择图标
//注意:  
//参数: VirtualPath 虚拟路径,NowFilePath 现在在的路径
//返回: 返回文件路径(站点的绝对路径)
LeadingMIS.UI.SelectImage = function(VirtualPath, NowFilePath)
{
	var tempWidth = 700;
	var tempHeight = 400;
	var strUrl = "/Common/Dialog/SelectImage/WebUI/FileList.aspx?VirtualPath=" + VirtualPath + "&NowFilePath=" + NowFilePath ;
	return window.showModalDialog(strUrl, null, "help=no;status=no;scroll=no;edge=raised;dialogHeight=" + (screen.height - tempHeight) + "px;dialogWidth=" + (screen.width - tempWidth) + "px;dialogLeft=" + (tempWidth / 2) + ";dialogTop=" + (tempHeight / 2) + ";");
}

//--------------------------------------------------------------------------------------------------------------
//-- 说明：取得单选框被选中的对象
//-- 参数：strRadioGroupName	对象名称
//-- 例如：var oCheck = getRadioChecked("edCheck");
//-- 作者：黄岳
//--------------------------------------------------------------------------------------------------------------
LeadingMIS.UI.getRadioChecked = function(strRadioGroupName)
{
	var chkArray = document.getElementsByName(strRadioGroupName);
	var oID = null
	for(var i=0;i<chkArray.length;i++)
	{
		if(chkArray[i].tagName=="INPUT" && chkArray[i].checked==true)
		{
			oID = chkArray[i];
			break;
		}
	}
	return oID ; 
}

//--------------------------------------------------------------------------------------------------------------
//-- 说明：取得复选框被选中的对象
//-- 参数：strCheckBoxName	对象名称
//-- 例如：var oCheckList = getCheckBoxChecked("edCheck");
//-- 作者：黄岳
//--------------------------------------------------------------------------------------------------------------
LeadingMIS.UI.getCheckBoxChecked = function(strCheckBoxName)
{
	var arrList = new Array();
	var chkArray = document.getElementsByTagName(strCheckBoxName);
	for(var i=0;i<chkArray.length;i++)
	{
		if(chkArray[i].checked==true)
		{
			arrList[arrList.length] = chkArray[i];
		}
	}
	return arrList;
}

//--------------------------------------------------------------------------------------------------------------
//-- 说明：set style of Radio and CheckBox 
//-- 参数：
//-- 例如：
//-- 作者：黄岳
//--------------------------------------------------------------------------------------------------------------
LeadingMIS.UI.setCheckBoxStyle = function()
{
	try{
		var chkArray = document.getElementsByTagName("INPUT");
		for(var i=0;i<chkArray.length;i++)
		{
			if(chkArray[i].type.toLowerCase()=="checkbox" ||  chkArray[i].type.toLowerCase()=="radio")
			{
				chkArray[i].className = "checkbox";
			}
		}
	}
	catch(e)
	{
		window.status = e.toString();
	}
}


/****************************************************
名称:LeadingMIS.UI.ShowCalendar(tempDate,tempSign,tempCh,tempFirst,tempStyle,tempObject,tempWidth,tempHeight,eventWindow)
作者:刘晖
类型:Public
参数:输入		tempDate		string		日期
				tempSign		char		选周(W)、选日(D)
				tempCh			char		显示农历(Y、N)
				tempFirst		string		周开始星期
				tempStyle		string		样式文件
				tempObject		object		日期控件对象
				tempWidth		string		对话框宽
				tempHeight		string		对话框高
				eventWindow		window		当前也的window对象
     输出						string		属性的相应值
说明:条用日期控件的方法
示例:
LeadingMIS.UI.ShowCalendar(tDate,"D","N","2","../style/blue.css",tempObj,"350","203",window);
LeadingMIS.UI.ShowCalendar(tDate,"D","N","2","../style/green.css",tempObj,"350","203",window);
****************************************************/
LeadingMIS.UI.ShowCalendar = function(tempDate,tempSign,tempCh,tempFirst,tempStyle,tempObject,tempWidth,tempHeight,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	
	var objectCalendar = new Object();
	var d = new Date();  
	var bakdate = d.getYear() + "-" + (d.getMonth()+1)  + "-" + d.getDate() ;
	objectCalendar.Date		= (typeof(tempDate) == "undefined" || tempDate=="" ) ? bakdate : tempDate;
	objectCalendar.Sign		= (typeof(tempSign) == "undefined")?"D":tempSign;
	objectCalendar.CH		= (typeof(tempCh) == "undefined")?"N":tempCh;
	objectCalendar.First	= (typeof(tempFirst) == "undefined")?"1":tempFirst;
	objectCalendar.Style	= (typeof(tempStyle) == "undefined")?"../style/blue.css":tempStyle;
	objectCalendar.Object	= (typeof(tempObject) == "undefined")?null:tempObject;
	
	var intWidth = (typeof(tempWidth) == "undefined")?"350":tempWidth;
	var intHeight = (typeof(tempHeight) == "undefined")?"203":tempHeight;
	
	try
	{
		var eventObject = eventWindow.document.createEventObject();
		var X = eventWindow.screen.width - eventObject.screenX;
		var Y = eventWindow.screen.height - eventObject.screenY;
		
		if((X >= intWidth) && (Y >= intHeight))
		{
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY;
		}
		else if((X > intWidth) && (Y < intHeight))
		{
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		else if((X < intWidth) && (Y > intHeight))
		{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY;
		}
		else //((X < intWidth) && (Y < intHeight))
		{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY - parseInt(intHeight);
		}
	//	strReturn = eventWindow.showModalDialog("/Common/Dialog/Calendar/WebUI/Calendar.htm",objectCalendar,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	//	return strReturn;
		return eventWindow.showModalDialog("/Common/Dialog/Calendar/WebUI/Calendar.htm",objectCalendar,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	}
	catch(e)
	{
		LeadingMIS.Error.setInfo(0,this.ShowCalendar,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.ShowCalendar","");
		return null;
	}
}

/****************************************************
名称:LeadingMIS.UI.setDate(tempObj[,tempDate[,eventWindow]])
作者:刘晖
类型:Public
继承:LeadingMIS.UI.ShowCalendar(tempDate,tempSign,tempCh,tempFirst,tempStyle,tempObject,tempWidth,tempHeight,eventWindow)
参数:输入		tempObj		string		显示日期对象
				tempDate	string		默认日期
				eventWindow	window		当前也的window对象
     输出
说明:设置日期控件的方法
示例:
LeadingMIS.UI.setDate("UserCode2")
LeadingMIS.UI.setDate("UserCode2","2005-1-1")
LeadingMIS.UI.setDate("UserCode2","2005-1-1",window)
****************************************************/
LeadingMIS.UI.setDate = function(tempObj,tempDate,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	
	if((typeof(tempObj) == "object") && (tempObj.type == "text"))
	{
		var tDate = (typeof(tempDate) == "undefined" || tempDate == "")?tempObj.value:tempDate;
		if(LeadingMIS.ValueType.isDateTime(tDate) != true)
		{
			tDate = FormatDateTime(Now(),2);
		}
		tDate = this.ShowCalendar(tDate,"D","N","2","../style/blue.css",tempObj,"350","203",eventWindow);
		if(typeof(tDate) != "undefined")
		{
			tempObj.value = tDate;
		}
	}
}

/********************************************************
名称:
作用:选择部门桌面
传入参数: 桌面地址引用
********************************************************/
LeadingMIS.UI.SelectDepartmentDesktop = function (strUrl)
{
	nLeft=event.screenX+10;
	nTop=event.screenY+10;
	//window.open("http://"+window.location.host + "/Common/Dialog/SelectDeptDesktop/WebUI/DeptDesktopSelect.aspx?PageUrl=aa");
	strReturn=window.showModalDialog("http://" +window.location.host + "/Common/Dialog/SelectDeptDesktop/WebUI/DeptDesktopSelect.aspx?PageUrl=" +escape(strUrl) ,"", "dialogLeft:" + nLeft + ";dialogTop:" + nTop + ";dialogWidth:250px;dialogHeight:300px;status:0;scroll:0;help:0");							
	return strReturn;
}

LeadingMIS.UI.SelectUserDialog = function(selectList,nonList,tempWidth,tempHeight,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	//[SelectList]		默认选中的项
	//[NonList]			从数据源中排除的项
	var objectSelect = new Object();
	objectSelect["SelectList"]	= (typeof(selectList) == "undefined")?"":selectList;
	objectSelect["NonList"]		= (typeof(nonList) == "undefined")?"":nonList;
	
	var intWidth = (typeof(tempWidth) == "undefined")?"350":tempWidth;
	var intHeight = (typeof(tempHeight) == "undefined")?"203":tempHeight;
	//debugger;
	try
	{
		var eventObject = eventWindow.document.createEventObject();
		var X = eventWindow.screen.width - eventObject.screenX;
		var Y = eventWindow.screen.height - eventObject.screenY;
		
		if((X >= intWidth) && (Y >= intHeight))
		{
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY;
		}
		else if((X > intWidth) && (Y < intHeight))
		{
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		else if((X < intWidth) && (Y > intHeight))
		{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY;
		}
		else //((X < intWidth) && (Y < intHeight))
		{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		return eventWindow.showModalDialog("/Common/Dialog/Select/SelectDialog1.aspx",objectSelect,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	}
	catch(e)
	{
		LeadingMIS.Error.setInfo(0,this.SelectUserDialog,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.ShowCalendar","");
		return null;
	}
}


//////////////////////
LeadingMIS.UI.SelectUserDialog1 = function(selectList,nonList,tempWidth,tempHeight,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	//[SelectList]		默认选中的项
	//[NonList]			从数据源中排除的项
	var objectSelect = new Object();
	objectSelect["SelectList"]	= (typeof(selectList) == "undefined")?"":selectList;
	objectSelect["NonList"]		= (typeof(nonList) == "undefined")?"":nonList;
	
	var intWidth = (typeof(tempWidth) == "undefined")?"350":tempWidth;
	var intHeight = (typeof(tempHeight) == "undefined")?"203":tempHeight;
	//debugger;
	try
	{
		var eventObject = eventWindow.document.createEventObject();
		var X = eventWindow.screen.width - eventObject.screenX;
		var Y = eventWindow.screen.height - eventObject.screenY;
		
		if((X >= intWidth) && (Y >= intHeight))
		{
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY;
		}
		else if((X > intWidth) && (Y < intHeight))
		{
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		else if((X < intWidth) && (Y > intHeight))
		{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY;
		}
		else //((X < intWidth) && (Y < intHeight))
		{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		return eventWindow.showModalDialog("/Common/Dialog/Select/SelectDialog3.aspx",objectSelect,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	}
	catch(e)
	{
		LeadingMIS.Error.setInfo(0,this.SelectUserDialog,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.ShowCalendar","");
		return null;
	}
}

LeadingMIS.UI.UserDialogList = function(selectList,nonList,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
//	return LeadingMIS.UI.SelectUserDialog(selectList,nonList,"450","275",eventWindow);
//  return LeadingMIS.UI.SelectUserDialog(selectList,nonList,"560","370",eventWindow);
	return LeadingMIS.UI.SelectUserDialog("selectList",nonList,"560","370",eventWindow);
}



///////////////
LeadingMIS.UI.UserDialogList1 = function(selectList,nonList,eventWindow)
{
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
//	return LeadingMIS.UI.SelectUserDialog(selectList,nonList,"450","275",eventWindow);
//  return LeadingMIS.UI.SelectUserDialog(selectList,nonList,"560","370",eventWindow);
	return LeadingMIS.UI.SelectUserDialog1("selectList",nonList,"385","370",eventWindow);
}


//-----------------------------------------------------------------
//输入
//[SelectList]		默认选中的项
//[NonList]			从数据源中排除的项
//[isMultilist]		是否可多选

//输出objet 
//[ItemArray]		选中的全部项				--  二维数组[i][0]为ID，[i][1]为Name
//[InsertArray]		新添加的项					--  二维数组[i][0]为ID，[i][1]为Name
//[DeleteArray]		在默认选中项中删除的项		--  二维数组[i][0]为ID，[i][1]为Name
/*
	eg:
		var obj = LeadingMIS.UI.SelectRole("SR050224000042,SR050224000016","",false);
		if(typeof(obj) != "undefined" && obj!=null)//点击确定
		{
		   	var ItemArray= " ItemArray = " ;
		   	for(var i= 0 ; i<obj["ItemArray"].length;i++)
		   	{
		   		ItemArray += " - " + obj["ItemArray"][i][1];
		   	}
		   	var InsertArray= " InsertArray = " ;
		   	for(var i= 0 ; i<obj["InsertArray"].length;i++)
		   	{
		   		InsertArray += " - " + obj["InsertArray"][i][1];
		   	}
		   	var DeleteArray= " DeleteArray = " ;
		   	for(var i= 0 ; i<obj["DeleteArray"].length;i++)
		   	{
		   		DeleteArray += " - " + obj["DeleteArray"][i][1];
		   	}
			alert(ItemArray + InsertArray + DeleteArray)
		} 
*/
//-----------------------------------------------------------------
LeadingMIS.UI.SelectRole = function(selectList, nonList, isMultilist, eventWindow){
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	var objectSelect = new Object();
	objectSelect["SelectList"]	= (typeof(selectList) == "undefined") ? "" : selectList;
	objectSelect["NonList"]		= (typeof(nonList) == "undefined") ? "" : nonList;
	objectSelect.isMultilist = (typeof(isMultilist) == "undefined") ?  true : isMultilist;
	try{
		var eventObject = eventWindow.document.createEventObject();
		var intWidth = 381;
		var intHeight = 382;
		var nLeft = 0;
		var nTop = 0;
		var X = eventWindow.screen.width - eventObject.screenX;
		var Y = eventWindow.screen.height - eventObject.screenY;
		if((X >= intWidth) && (Y >= intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY;
		}
		else if((X > intWidth) && (Y < intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		else if((X < intWidth) && (Y > intHeight)){
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY;
		}
		else{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		return eventWindow.showModalDialog("/Common/Dialog/SelectRole/WebUI/RoleList.aspx",objectSelect,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	}
	catch(e){
		LeadingMIS.Error.setInfo(0,this.SelectRole,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.SelectRole","");
		return null;
	}
}
/////////   SelectDepartment 
LeadingMIS.UI.SelectDepartment = function(select,nonList,isMultilist,eventWindow){
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	var objectSelect = new Object();
	objectSelect["SelectList"]	= (typeof(selectList) == "undefined") ? "" : selectList;
	objectSelect["NonList"]		= (typeof(nonList) == "undefined") ? "" : nonList;
	objectSelect.isMultilist = (typeof(isMultilist) == "undefined") ?  true : isMultilist;
	try{
		var eventObject = eventWindow.document.createEventObject();
		var intWidth = 381;
		var intHeight = 382;
		var nLeft = 0;
		var nTop = 0;
		var X = eventWindow.screen.width - eventObject.screenX;
		var Y = eventWindow.screen.height - eventObject.screenY;
		if((X >= intWidth) && (Y >= intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY;
		}
		else if((X > intWidth) && (Y < intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		else if((X < intWidth) && (Y > intHeight)){
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY;
		}
		else{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		return eventWindow.showModalDialog("/Common/Dialog/SelectDepartment/WebUI/DepartmentList.aspx",objectSelect,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	}
	catch(e){
		LeadingMIS.Error.setInfo(0,this.SelectRole,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.SelectDeparment","");
		return null;
	}	
}
	
	
	// SelectPost  
LeadingMIS.UI.SelectPost = function(selectList, nonList, isMultilist, eventWindow){
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	var objectSelect = new Object();
	objectSelect["SelectList"]	= (typeof(selectList) == "undefined") ? "" : selectList;
	objectSelect["NonList"]		= (typeof(nonList) == "undefined") ? "" : nonList;
	objectSelect.isMultilist = (typeof(isMultilist) == "undefined") ?  true : isMultilist;
	try{
		var eventObject = eventWindow.document.createEventObject();
		var intWidth = 381;
		var intHeight = 382;
		var nLeft = 0;
		var nTop = 0;
		var X = eventWindow.screen.width - eventObject.screenX;
		var Y = eventWindow.screen.height - eventObject.screenY;
		if((X >= intWidth) && (Y >= intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY;
		}
		else if((X > intWidth) && (Y < intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		else if((X < intWidth) && (Y > intHeight)){
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY;
		}
		else{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		return eventWindow.showModalDialog("/Common/Dialog/SelectPost/WebUI/PostList.aspx",objectSelect,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	}
	catch(e){
		LeadingMIS.Error.setInfo(0,this.SelectRole,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.SelectRole","");
		return null;
	}
}
///SelectPerson
LeadingMIS.UI.SelectPerson = function(selectList, nonList, isMultilist, eventWindow){
	eventWindow = (typeof(eventWindow) == "undefined")?window:eventWindow;
	var objectSelect = new Object();
	objectSelect["SelectList"]	= (typeof(selectList) == "undefined") ? "" : selectList;
	objectSelect["NonList"]		= (typeof(nonList) == "undefined") ? "" : nonList;
	objectSelect.isMultilist = (typeof(isMultilist) == "undefined") ?  true : isMultilist;
	try{
		var eventObject = eventWindow.document.createEventObject();
		var intWidth = 560;
		var intHeight = 370;
		var nLeft = 0;
		var nTop = 0;
		var X = eventWindow.screen.width - eventObject.screenX;
		var Y = eventWindow.screen.height - eventObject.screenY;
		if((X >= intWidth) && (Y >= intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY;
		}
		else if((X > intWidth) && (Y < intHeight)){
			nLeft = eventObject.screenX;
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		else if((X < intWidth) && (Y > intHeight)){
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY;
		}
		else{
			nLeft = eventObject.screenX - parseInt(intWidth);
			nTop = eventObject.screenY - parseInt(intHeight);
		}
		return eventWindow.showModalDialog("/Common/Dialog/SelectPerson/PersonList.aspx",objectSelect,"dialogLeft:" + nLeft + "px;dialogTop:" + nTop + "px;dialogWidth:" + intWidth + "px;dialogHeight:" + intHeight + "px;status:0;scroll:0;help:0");
	}
	catch(e){
		LeadingMIS.Error.setInfo(0,this.SelectRole,"传入的参数[eventWindow]不是[window]对象","LeadingMIS.UI.SelectRole","");
		return null;
	}
}

	//-----------------------------------------------------------------
	
//--------------------------------------------------------------------------------------------------------------
//-- 功能：读取数据时显示进度条（模拟版）
//-- 参数：Caption：Load条显示的内容		Title：Load条显示的标题
//-- 方法： show()     显示进度条
//--		close()    关闭进度条
//--		Create()   创建文本，加入到document
//-- 例子：	var myLoad=new LoadingClass(); 
//--		var myLoad=new LoadingClass("正是读取数据...");  
//--		var myLoad=new LoadingClass("正是读取数据...", "数据读取中,请稍候...");  
//--		myLoad.show();		//打开并显示
//			myLoad.close();     //关闭
//			delete myLoad;
//-- 作者：黄岳
//--------------------------------------------------------------------------------------------------------------

LeadingMIS.UI.LoadingClass = function(Caption, Title, bImage){
	this.objID = "IsLoading";
	this.strImg = "/Skins/Default/Images/Loading.gif";
	this.strCaption  = (Caption == null) ? "Loading..." : Caption;		//Load条显示的内容
	this.strTitle = (Title == null) ? "正在取得数据,请稍候..." : Title;	//Load条显示的标题
	this.strContainer = document.getElementsByTagName("TD");
	this.bShowImage = (bImage==null) ? true : bImage;
	this.IsLoad = false;
	this.Create = function(){
		var LoadDiv = window.document.all.item(this.objID,0);
		while (LoadDiv=="[object]"){
			window.document.body.removeChild(LoadDiv);
			LoadDiv = window.document.all.item(this.objID,0);
		}
		var objDiv = window.document.createElement("<div id='" + this.objID + "' style='POSITION:absolute;z-index:200;LEFT:0px;TOP:0px;WIDTH:100%;HEIGHT:100%;DISPLAY:none;'  oncontextmenu='return false' />");
		objDiv.setCapture(true);
		var strHTML = "<table border='0' width='100%' height='100%'>";
			strHTML += "	<tr>";
			strHTML += "		<td>";
			strHTML += "			<table align='center' valign='middle' height='40' width='100' border='0' title='" + this.strTitle + "'  style='cursor:hand;' ondblClick=\"document.all.item('" + this.objID + "',0).style.display = 'none';\">";
			strHTML += "				<tr>";
			strHTML += "					<td align='center' nowrap ><b>" + this.strCaption + "</b></td>";
			strHTML += "				</tr>";
			if(this.bShowImage)
			{
				strHTML += "				<tr>";
				strHTML += "					<td align='center'><img src='" + this.strImg + "'></td>";
				strHTML += "				</tr>";
			}
			strHTML += "			</table>";
			strHTML += "		</td>";
			strHTML += "	</tr>";
			strHTML += "</table>";
		objDiv.innerHTML = strHTML;
		window.document.body.insertAdjacentElement("afterBegin",objDiv);
	}
	this.show = function (){
		if(this.IsLoad == false){
			this.Create();
			this.IsLoad = true;
		}
		var LoadDiv = window.document.all.item(this.objID,0);
		if (LoadDiv=="[object]"){
			LoadDiv.style.display = "block" ;
		}
	}
	this.close = function(){
		var LoadDiv = window.document.all.item(this.objID,0);
		if (LoadDiv=="[object]"){
			LoadDiv.style.display = "none" ;
		}
	}
}