﻿	// 如文件修改后不正常，UltraEdit文件-〉转换-〉ACSCII转UTF8
	// 下面的变量是框架页面输出时自动产生的
	if (typeof(windowMode)=='undefined') windowMode=0;	//	windowMode: 0-框架窗口；1-模式窗口；2-弹出窗口; -1 -孤立的窗口
  if (typeof(OnPageComplete)=='undefined') OnPageComplete="";
  if (typeof(DotNetVersion)=='undefined') DotNetVersion="1.1";
  if (typeof(ScreenMode)=='undefined') ScreenMode=0;
  if (typeof(IsPostBack)=='undefined') IsPostBack=false;
  if (typeof(HideJsError)=='undefined') HideJsError=true;
	
	var WebPageFormName = "MainForm";
	var _GlobalVar = null;
	var _Session = new Array();		// 全局数组变量，用 SessionPush(obj)和SessionPop()方法存入和取出变量数据
	var theParentWindow = top;
	var IsFunctionMainPage = window.name=='MainFunctionFrame';
	var IsMainFramePage = document.location.href.toLowerCase().indexOf("mainframe.aspx")>=0;
	
  if (!IsWCPWindow(top))
	{
		windowMode = -1;
		theParentWindow = window;
	}
	else
	{
		if (IsMainFramePage || top.IsMainFramePage)
		{
			theParentWindow = top;
			windowMode=0;
		}else
		if (top.dialogArguments != undefined)	
		{
			theParentWindow = top.dialogArguments;
			windowMode=1;
		}else{
			if (IsWCPWindow(top.opener))
			{	// 弹出窗口
				theParentWindow = top.opener.top;
				windowMode = 2;
			}
		}
	}
	if (IsFunctionMainPage)
		GetTopWindow().ShowLeftMenuZone(document.location.href.indexOf("_M0=")>=0);

	WindowFocus();

	if (HideJsError)
		window.onerror = function(sMsg,sUrl,sLine) { GetFrameWindow().SetStatusMessage("警告："+sMsg+"  行号："+sLine+"  地址："+sUrl);return true; } 

	function IsWCPWindow(win)
	{
		try
		{
			return win.ScreenMode<99;
		}catch(e){
			return false;
		}	
	}
	
	function GetFrameWindow()	// 获取平台顶层窗口
	{
		if (IsMainFramePage)
			return window;
		else
		if (IsWCPWindow(top) && top!=window)
			return top.GetFrameWindow();
		else
		if (theParentWindow!=window && IsWCPWindow(theParentWindow))
			return theParentWindow.GetFrameWindow();
		else
			return window;
	}
	
	function GetParentWindow()	// 获取当前页面在本系统中的父窗口
	{
		return theParentWindow;
	}

	function GetTopWindow()
	{
		if (IsWCPWindow(top))
			return top;
		else
			return window;
	}

	function SessionPush(obj)
	{
		if (GetFrameWindow()._Session[GetFrameWindow()._Session.length - 1] != obj)
		{GetFrameWindow()._Session.push(obj);}
	}	
	
	function SessionPop()
	{
		if(GetFrameWindow()._Session.length>0)
		{return GetFrameWindow()._Session.pop();}
		else return null;
	}
		
	function SessionClear()
	{
		_Session = new Array();
	}
		
	var statusMessage=" 操作员：徐四海";

	function SetStatusMessage(msg)
	{ 
		if (msg!="") msg = "◆ "+msg;
		if (GetUserName()!="")
		{
			msg = " 〖用户："+GetUserName()+"〗       " + msg;
			if (GetDepName()!="")
			{msg = " 【部门："+GetDepName()+"】 " + msg;}
		}
		GetTopWindow().window.status=msg;
	}

	function getStatusMessage(){return statusMessage;}

	function setHomePage()
	{
		var strHref=window.location.href;
		this.style.behavior='url(#default#homepage)';
		this.setHomePage(GetIndexPage());
	}	
	
	function Window_Resize(_document)
	{
		if (typeof(_document)=="undefined") _document = document;
		var winMode = _document.parentWindow.windowMode;  // winMode: 0-框架窗口；1-模式窗口；2-弹出窗口; -1 -孤立的窗口
		if (PageScrollMode!=-1)
		{
			if (PageScrollMode==0)
			{
				_document.body.scroll = "no";
			}else{
				_document.body.scroll = "yes";
			}
			return;
		}

		if (IsFunctionMainPage) 
			top.MainFunctionFrame.height = "100%";

		if (winMode==-1) ScreentWidth = "100%";
		var isWebSite  = ScreentWidth != "100%";
		var FrameHeight    = _document.body.clientHeight;
		var FramePageHeight= _document.body.scrollHeight;
		var FrameWidth     = _document.body.clientWidth;
		var FramePageWidth = _document.body.scrollWidth;

		if (isWebSite && IsFunctionMainPage)
		{
			if (FrameHeight < FramePageHeight - 5)
				top.MainFunctionFrame.height = FramePageHeight;
		}else{
			if (FrameHeight < FramePageHeight - 5 || FrameWidth < FramePageWidth - 5)
				_document.body.scroll="yes";
			else
				_document.body.scroll="no";
		}
	}

	function SelectColor(defaultColor)
	{
		var color = showModalDialog("../../Common/Html/SelectColor.html",defaultColor,'DialogHeight:270px;DialogWidth:420px;status:no;');
		return color;
	}
	
	function SelectDate()
	{
		var date = window.showModalDialog("/BasePage.aspx?_Ascx=/Sys/FrameWork/Common/Ascx/SelectDate.ascx",window,"dialogHeight:210px; dialogWidth:296px;status:no;scroll:no");
		if (date)
			return date;
		else
			return "";		
	}
	
	function Set_SelectDate(obj){var _date = SelectDate();obj.value = _date;}
	
	function selectControlDate(obj)
	{
		var oldDate = obj.value;
		Set_SelectDate(obj);
		if (obj.value=="")
			obj.value = oldDate;
	}

	function NotNull(str)
	{
		if (str == null)
			return "";
		else
			return str;
	}

	function WaitingBegin(msg)
	{
		if (GetTopWindow()!=window)
			GetTopWindow().WaitingBegin(msg);
		else{
			if (typeof(msg)=="undefined") msg = "操作正在执行中，请稍候 ……";
			if (msg=="") msg = "请稍候……";
			var waitbar = document.getElementById("WaitingWindow");
			if (waitbar==null)
			{
				var oDiv=document.createElement("span");
				document.body.appendChild(oDiv);
				oDiv.innerHTML = callBackEvent("WaitingWindowHTML");
				waitbar = document.getElementById("WaitingWindow");
			}
			waitbar.style.display = "";
			document.getElementById("WaitingWindowMessage").innerText = msg;
		}
	}
	
	function WaitingEnd(){
		if (GetTopWindow()!=window)
			GetTopWindow().WaitingEnd();
		else
		{
			var waitbar = document.getElementById("WaitingWindow");
			if (waitbar!=null)
				waitbar.style.display="none";
		}
	}

	function GetServerData(ascx)
	{
		//alert("废止使用：GetServerData(ascx)");
		return window.showModalDialog("/Sys/FrameWork/Common/BasePage/ServerData.aspx?ascx="+ascx,window,"dialogleft=2000px; dialogtop=2000px;dialogwidth=0px; dialogheight=0px; status=no; help=no; scroll=no;");
	}
	
	//后台反函数为Wesoft.Sys.FrameWork.Common.Utils.WesoftString.ToScriptTextSafe
	function FromScriptTextSafe(str)
	{
		str = str.replace(/＜/g,"<");
		str = str.replace(/＞/g,">");
		str = str.replace(/＇/g,"'");
		str = str.replace(/＂/g,'"');
		str = str.replace(/@#/g,"\r\n");

		return str;
	}

	function DeleteArrayElement(Arrays,n) 
	{
	  if(n<0)
	    return Arrays;
	  else
	    return Arrays.slice(0,n).concat(Arrays.slice(n+1,Arrays.length));
	}

	function Hashtable()
	{       
	  this.keylist = new Array;
	  this.objlist = new Array;
	  
	  this.add = function(key,obj)
	  {
	  	for (var i=0;i<this.keylist.length;i++)
	  	{
	  		if (this.keylist[i]==key)
	  		{
			  	this.objlist[i]=obj;
	  			return;
	  		}
	  	}
	  	this.keylist.push(key);
	  	this.objlist.push(obj);
	  }
	  
	  this.remove = function(key)
	  {
	  	for (var i=0;i<this.keylist.length;i++)
	  	{
	  		if (this.keylist[i]==key)
	  		{
			  	this.keylist = DeleteArrayElement(this.keylist,i);
			  	this.objlist = DeleteArrayElement(this.objlist,i);
	  			return;
	  		}
	  	}
	  }
	  
	  this.obj = function(key)
	  {
	  	for (var i=0;i<this.keylist.length;i++)
	  	{
	  		if (this.keylist[i]==key)
			  	return this.objlist[i];
	  	}
	  	return null;
	  }
	  
	  this.containsKey = function(key)
	  {
	  	for (var i=0;i<this.keylist.length;i++)
	  	{
	  		if (this.keylist[i]==key)
			  	return true;
	  	}
	  	return false;
	  }
	  
	}

	function NameValueEnity(name,value){
		this.Name = name;
		this.Value = value;
	}

	function AddParameterToURL(curl,parameterList)
	{
		if (parameterList == null || parameterList =="")
			return curl;

		var ParArray  = new Array();
		var TempArray = new Array();
		var	params = parameterList.split("&");   
		for (var i=0;i<	params.length;i++)
		{
			var temp=params[i];
			var p = temp.indexOf("=");
			var pName  = temp.substring(0,p);
			var pValue = temp.substring(p+1);
			ParArray.push(new NameValueEnity(pName,pValue));
		}			

		var ind =curl.indexOf("?");
		var newPar = curl.substring(ind);
	
		if( newPar != null && newPar !=""){
			var	params = newPar.split("&");   
			for (var i=0;i<	params.length;i++)
			{
				var temp=params[i];
				var p = temp.indexOf("=");
				var pName  = temp.substring(0,p);
				var pValue = temp.substring(p+1);
				TempArray.push(new NameValueEnity(pName,pValue));
			}	
		}

		for(var i=0;i<ParArray.length;i++)
		{
			var temp=ParArray[i];
			var has =0;
			for(var j=0;j<TempArray.length;j++)
			{
				var myTemp = TempArray[j];
				if(temp.Name == myTemp.Name)
				{
					myTemp.Value = temp.Value;
					has =1;
				}
			}
			if(has ==0)
				TempArray.push(temp);
		}

		var parString = "";
		for(var i=0;i<TempArray.length;i++)
		{
			var myTemp = TempArray[i];
			parString+=myTemp.Name;
			parString+="=";
			parString+=myTemp.Value;
			parString+="&"			
		}
		curl = curl.substring(0,ind)+parString;
		curl = curl.substring(0,curl.lastIndexOf("&"));

		return curl;
	}
	
	function GotoSystem(sid,screenMode,newWindow)
	{
		var url = "";
		if (screenMode==0)
			url = "/Sys/FrameWork/SysModule/MainFrame/MainFrame.aspx?_SID=";
		else
			url = "/MainPage.aspx?_SID=";
		url = url + sid;
		if (newWindow)
			window.open(url);
		else
			GetTopWindow().location = url;
	} 
	
	function OpenOATaskURL(url){window.open('/index.aspx?_SID=OA&TaskURL='+escape(url),'WesoftWCP');}

	function getRadioValue(name){
		var value="";
		var fm = document.getElementsByName(WebPageFormName);
		for(i=0;i<document.all.MainForm.elements.length;i++)
		{ 
			if(document.all.MainForm.elements[i].type=="radio" && document.all.MainForm.elements[i].checked && document.all.MainForm.elements[i].name==name)
			{
				value=document.all.MainForm.elements[i].value;
				break;
			}
		}
		return value;
	}
		
	function GetUrlHost()
	{
		alert("不要使用GetUrlHost()，请使用GetHostUrlPrefix()来代替");
		return GetHostUrlPrefix();
	}
	
	function RemoveUrlHost(html)
	{
		var reg = new RegExp(GetHostUrlPrefix(),'g');
		return html.replace(reg,"");
	}
	
	function Confirm(theWindow,title)
	{
		var captionyes 		= arguments.length>=3?arguments[2]:"是";
		var captionno 		= arguments.length>=4?arguments[3]:"否";
		var captioncancel = arguments.length>=5?arguments[4]:"取消";
		var remarkyes 		= arguments.length>=6?arguments[5]:"";
		var remarkno 			= arguments.length>=7?arguments[6]:"";
		var remarkcancel 	= arguments.length>=8?arguments[7]:"";
		var _url="/Sys/FrameWork/Common/Html/Confirm.html?title="+escape(title)
					+"&captionyes="+escape(captionyes)
					+"&captionno="+escape(captionno)
					+"&captioncancel="+escape(captioncancel)
					+"&remarkyes="+escape(remarkyes)
					+"&remarkno="+escape(remarkno)
					+"&remarkcancel="+escape(remarkcancel);

		var retv = theWindow.showModalDialog(_url,theWindow,"dialogWidth:432px;dialogHeight:170px;status:no;scroll:no");
		if (typeof(retv)=='undefined')
		{
			retv = -1;
		}
		return retv;
	}

	// 控制鼠标右键菜单
	function ControlContextMenu()
	{
		document.oncontextmenu = function()
		{
			if (event.srcElement.oncontextmenu)
				return false;
			
			try{HideAdviceMenu();}catch(e){;}
			var isText=(event.srcElement.tagName=='INPUT'||event.srcElement.type=='text'); 
			return isText
		};
	}
	
	// 控制页面内容选定
	function ControlSelectMenu()
	{
		document.onselectstart = function()
		{
			var isText=(event.srcElement.tagName=='INPUT'||event.srcElement.tagName=='TEXTAREA'||event.srcElement.type=='text');
			return isText
		};
	}

	// 关闭弹出页面并调用父页面的关闭事件，第2个参数可选，即当前功能的PFD
	function CloseReturn(returnValues)
	{
		var _pfd = arguments.length>=2?arguments[1]:0;
		if (returnValues && parent.opener)
		{
			if (typeof(returnValues)!="string")
			{
				alert("CloseReturn弹出窗口回调函数只能返回字符串类型的返回值！");
				return;
			}
			if (returnValues.indexOf("'")>=0)
			{
				alert("CloseReturn弹出窗口回调函数返回的返回值中不能出现单引号！");
				return;
			}
			var cmd = "parent.opener.subWindowClose";
			if (_pfd!=0)
				cmd += "_"+_pfd;

			if(typeof(eval(cmd))=="object")  
			{
				eval(cmd + "('"+escape(returnValues)+"');");
			}else
			{
				cmd = cmd.substring(cmd.lastIndexOf(".")+1,cmd.length);
				//alert('本弹出页面具有返回值，但父页面已关闭或没有处理函数 '+cmd+' ！');
			}
		}
		GetTopWindow().close();
	}
	
	function SetCookie(cName,cValue,days)
	{	// cookies 最大 4096 Bytes
		var paras = ";path=/";
		if (typeof(days)=='undefined') days = 30;	// 默认30天
		if (days > 0)
		{
			var expires = new Date();
			expires.setTime(expires.getTime() + days*24*60*60*1000);
			paras += ";expires="+expires.toGMTString();
		}
		paras = cName + "=" + escape(cValue) + paras;
		if (paras.length > 4096)
		{
			alert("SetCookie()cookies内容总长超过限度"+paras.length+" > 4096 Bytes!");
		}else
			document.cookie = paras;
	}

	function GetCookie(cName)
	{
		var cookies = document.cookie.split(';');
		for (var i=0;i<cookies.length;i++)
		{
			var cookieName = cookies[i].split('=');
			if (cookieName[0].replace(/ /g,"")==cName)
			{
				if (cookieName.length!=2)
					return "";
				else
					return unescape(cookieName[1]);
			}
		}
		return "";
	}
	
	function GotoPage(currentDocument,gotoUrl)
	{
		SetCookie("GotoPage",currentDocument.location.toString(),0);
		currentDocument.location=gotoUrl;	
	}
	
	function GotoBack(currentDocument)
	{		
		GotoBack(currentDocument,null);
	}	
	
	function GotoBack(currentDocument,parameterList)
	{
		var curl = GetCookie("GotoPage");
		if (curl=="")
		{
			history.back();
			return;
		}
		SetCookie("GotoPage","",0);
		currentDocument.location = AddParameterToURL(curl,parameterList);
	} 

	function LogOut()
	{
		GetTopWindow().document.location = GetIndexPage() + "?events=logoff&_SID="+GetSystemID();
	}

	function ShowObject(obj)
	{
		var s = "";
		if (typeof(obj)=="string")
			s = obj;
		else if (typeof(obj)=="object")
		{
			for (prop in obj) 
			{ 
				s += prop + "=" + obj[prop]+"\n"; 
			} 
		}else
			s = obj;
		
		alert(s);
	}
	
	function GetRealID(uniqueID)
	{
		if (DotNetVersion=="1.1")
		{
			uniqueID = uniqueID.replace(/_/g,"");
			uniqueID = uniqueID.replace(/:/g,"");
		}else
		if (DotNetVersion=="2.0")
		{
			uniqueID = uniqueID.replace(/_/g,"");
			uniqueID = uniqueID.replace(/:/g,"");
		}else
		{
		}

		return uniqueID;
	}

	function WordEditor(id,openMode,fromModelID,downloadFileName)
	{	//id:打开或编辑的Word文件ID;openMode:  2-读写；  1-只读;fromModelID:新建时的模板文件ID
		if (typeof(fromModelID)=='undefined')
			fromModelID = 0;
		var urls = "/BasePage.aspx?_SID=OA&_Ascx=/Sys/FrameWork/Common/Ascx/WordEditor/DocumentEditor.ascx&ResourceClass=Other&ResourceID="+id+"&openMode="+openMode+"&CopyFromID="+fromModelID;
		if (typeof(downloadFileName)!='undefined')
			urls += "&DownloadFileName="+escape(downloadFileName);
		var reValue = window.showModalDialog(urls,window,'DialogTop=0;DialogLeft=0;DialogHeight='+window.screen.availHeight+'px;DialogWidth='+window.screen.availWidth+'px;status=no;');
		if(id==0 && reValue)
	    return reValue.resourceID;
		else
			return 0;
	}

	function StringBuffer() {       
	  this.__strings__ = new Array;       
	}       
	
	StringBuffer.prototype.append = function(str) {       
	  this.__strings__.push(str);       
	}       

	StringBuffer.prototype.toString = function() {       
	  return this.__strings__.join("");       
	}

	Date.prototype.addDay = function(days)
	{
		alert(days);
	}
	
	function FormSelectChange(selectControl)
	{	// 动态表单中select事件
		var selectID = selectControl.id.replace(":","").replace("@","");
		var cmd = "SelectChange_"+selectID+"(selectControl)";
		try{eval(cmd)}catch(e){;};
	}
	
	function GetURLParameter(parameterName,parameterLists,seprator)
	{
		if (typeof(seprator)=="undefined") seprator = "&"; 
		if (typeof(parameterLists)=="undefined") 
			parameterLists = document.location.href;
		var p = parameterLists.indexOf(".aspx?");
	  if (p!=-1)
	  	parameterLists = parameterLists.substring(p+6,parameterLists.length);
	  else
	  {
	   	p = parameterLists.indexOf(".html?");
	   	if (p!=-1)
	    	parameterLists = parameterLists.substring(p+6,parameterLists.length);
	  }
		parameterLists = seprator+parameterLists;
		var p1 = parameterLists.indexOf(seprator+parameterName+"=");
		if (p1==-1)
			return "";
		var p2 = parameterLists.indexOf(seprator,p1+seprator.length);
		if (p2==-1)
			parameterLists = parameterLists.substr(p1+seprator.length,parameterLists.length);
		else
			parameterLists = parameterLists.substr(p1+seprator.length,p2-p1-seprator.length);

		return parameterLists.substr(parameterName.length+1);
	}
	 
	function Refresh()
	{
		if (IsPostBack)
			__doPostBack("","");
		else
			document.location = document.location.href;
	}
	
	function getLeftOf(val,flag)
	{
		var p = val.indexOf(flag);
		if (p==-1)
		{
			return val;
		}else{
			return val.substring(0,p);
		}
	}
	
	function getRightOf(val,flag)
	{
		var p = val.indexOf(flag);
		if (p==-1)
		{
			return "";
		}else{
			return val.substring(p+flag.length);
		}
	}
	
	function OpenMainMenu(menuName,_M1,_M2,pfd,parameters)	// 打开指定的主菜单
	{
		if (GetFrameWindow()!=window)
		{
			GetFrameWindow().OpenMainMenu(menuName,_M1,_M2,pfd,parameters);
			return;
		}
		if (typeof(_M1)=='undefined') _M1 = 0;
		if (typeof(_M2)=='undefined') _M2 = 0;
		if (typeof(pfd)=='undefined') pfd = 0;
		var mainmenus = document.getElementsByName("MainMenu");
		if (typeof(menuName)=='undefined') menuName = mainmenus[0].childNodes[0].innerText;

		for (var i=0;i<mainmenus.length;i++)
		{
			if (pfd==0 || mainmenus[i].WesoftPFD==pfd)
			{
				if (mainmenus[i].childNodes[0].innerText==menuName)
				{
					var sUrl = mainmenus[i].href;
					if (_M1>0)
						sUrl = sUrl.replace("LeftMenu.aspx?","LeftMenu.aspx?_M1="+_M1+"&");
					if (_M2>0)
						sUrl = sUrl.replace("LeftMenu.aspx?","LeftMenu.aspx?_M2="+_M2+"&");
					IsShowHomePage = false;

					if (typeof(parameters)!='undefined')
					{
						sUrl += "&parameters="+escape(parameters);
					}

					window.open(sUrl,mainmenus[i].target);
					if (mainmenus[i].onclick!=null)
						mainmenus[i].onclick(mainmenus[i]);
					else if (mainmenus[i].parentElement.onclick!=null)
						mainmenus[i].parentElement.onclick(mainmenus[i]);
					
					return;	// mainmenus[i];
				}
			}
		}
		alert("没有找到指定的主菜单项“"+menuName+"”（pfd:"+pfd+"）");
	}
	
	function IMChat(user)
	{
		var logonname = "";
		if (typeof(user)=='number')
		{
			logonname = GetPersonInfo(user,"LogonName");
		}else
			logonname = user;
		document.location = "Wesoft://chat/"+logonname;
	}
	
	function WindowFocus()
	{
		//if (!IsPostBack && windowMode!=0 && GetTopWindow()==window)
		//	window.focus();
	}
	function GetApplicationPath(){return "";}

	function SetDocumentTitle(docTitle)
	{
		document.title = docTitle;
		if (IsFunctionMainPage)
			top.document.title = docTitle;
	}
		
	// PageProperty 动态列表获取数值
	function getDataItemValues(prefix,controlTag)
	{
		return GetPropertyDataItemValues(prefix,controlTag);
	}
	
	function GetPropertyDataItemValues(prefix,controlTag)
	{
		if (typeof(prefix)=='undefined') prefix = "";
		if (typeof(controlTag)=='undefined') controlTag = "";
		var result = "";
		var radioGroupNames = ",";  	//记录已经处理过的选项按钮组的名称
		var objects = null;
		if (controlTag=="")
			objects = document.all;
		else
			objects = document.getElementsByTagName(controlTag);

		for (var i=0;i<objects.length;i++)
		{ 
			var obj = objects[i];
			if( obj.id && obj.attributes && obj.attributes["WesoftType"] && obj.attributes["WesoftType"].value=='PageProperty' )
			{
				if (prefix!="" )
				{
					if (obj.id.length <= prefix.length )
						continue;
					if (obj.id.substring(0,prefix.length) != prefix )
						continue;
				}				
				var curValue;
				var isAppend = true;	//是否附加值
				if(obj.type && obj.type == 'checkbox')
				{	//复选框
					curValue = obj.checked?1:0; 
				}
				else if(obj.type && obj.type == 'radio')
				{	//选项按钮或组
					var curGroupName = obj.getAttribute("name");
					if (radioGroupNames.indexOf(","+curGroupName+",")==-1)
					{
						radioGroupNames += curGroupName+",";
						curValue = getRadioGroupValue(curGroupName);
						if (curValue=="")		//如果返回值中已经存在选项按钮组的值，则不附加值，或者该选项没有选中且只有一个按钮的情况下也不附加值
							isAppend = false;
					}
				}
				else
				{	//单行、多行文本框，下拉框，列表框
					curValue = escape(obj.value);
				}

				if (isAppend && curValue != undefined)
				{
					result+="&"+obj.id+"="+curValue;
				}
			}
		}

		if (result.length>0)
			result = result.substring(1,result.length);
		return result;
	}
	
	function SetPropertyDataItemValues(valueLists,seprator,prefix)
	{
		if (typeof(seprator)=='undefined') seprator = "";
		if (seprator=='') seprator = "[NewLine]";
		if (seprator=="[NewLine]") 
			seprator = "\r\n";
		else if (seprator=="[AND]") 
			seprator = "&";
		else
		{
			alert("SetPropertyDataItemValues的参数seprator的取值错误，只能为[NewLine]-换行、[AND]-&符号，不能为“"+seprator+"”");
			return;
		}
		
		if (typeof(prefix)=='undefined') prefix = "";
		var radioGroupNames = ",";  	//记录已经处理过的选项按钮组的名称
		for (var i=0;i<document.all.length;i++)
		{ 
			var obj = document.all[i];
			if( obj.id && obj.attributes && obj.attributes["WesoftType"] && obj.attributes["WesoftType"].value=='PageProperty' )
			{
				var parameterName = obj.id;
				if (prefix!="" )
				{
					if (obj.id.length <= prefix.length )
						continue;
					if (obj.id.substring(0,prefix.length) != prefix )
						continue;
						
					parameterName = obj.id.substring(prefix.length,obj.id.length);
				}				
				var curValue = unescape(GetURLParameter(parameterName,valueLists,seprator));
				if (curValue=="") continue;
				if(obj.type && obj.type == 'checkbox')
				{	//复选框
					obj.checked = curValue=="1";
				}
				else if(obj.type && obj.type == 'radio')
				{	//选项按钮或组
					var curGroupName = obj.getAttribute("name");
					if (radioGroupNames.indexOf(","+curGroupName+",")==-1)
					{
						radioGroupNames += curGroupName+",";
						setRadioGroupValue(curGroupName,curValue);
					}
				}
				else
				{	//单行、多行文本框，下拉框，列表框
					obj.value = curValue;
				}
			}
		}
	}
	
	function getRadioGroupValue(groupName)
	{	//获取选项组中选中的值
		var curRadioGroup = document.getElementsByName(groupName);
		for(var i=0;i<curRadioGroup.length;i++)
		{
			if(curRadioGroup[i].checked)
			{
				return curRadioGroup[i].value;
			}
		}
		return "";
	}
	
	function setRadioGroupValue(groupName,selectValue)
	{	//设置选项组中选中的值
		var curRadioGroup = document.getElementsByName(groupName);
		for(var i=0;i<curRadioGroup.length;i++)
		{
			if (selectValue==curRadioGroup[i].value)
			{
				curRadioGroup[i].checked = true;
				break;
			}
		}
	}

	function GetHostName(){return document.location.hostname;}	// 192.168.0.6
	function GetHostUrlPrefix() // http://192.168.0.6    或    http://192.168.0.6:88
	{
		return document.location.protocol + "//" + document.location.host;
	}
		
	function OpenApplication(url,appid)
	{
		if (typeof(appid)=='undefined')
			appid = "_blank";

		if(IsLogon()=="1")
		{
			if (url.indexOf('?')>=0)
				url += "&Token="+GetToken();
			else
				url += "?Token="+GetToken();
		}
		else
		{
			url="/index.aspx?_sid=OA&AppURL="+escape(url);
		}
		window.open(url,appid)
	}

	function SelectBox(actionFunction)
	{		//<input type="text" class="SelectBox" onclick="SelectBox(Set_SelectDate)" />
		var obj = window.event.srcElement;
		if (window.event.offsetX+20>obj.offsetWidth)
		{
			//alert(window.event.offsetX+":"+window.event.offsetY+"="+obj.offsetWidth);
			if (typeof(actionFunction)!="undefined")
			{
				if (typeof(actionFunction)!="function")
					alert("SelectBox的onclick事件的actionFunction参数必须是一个处理函数function(obj)类型！");
				else
					actionFunction(obj);
			}
		}
	}
	
	function UnescapeFormAction()
	{
		 if (DotNetVersion == '2.0')
		 {
		  document.getElementById("MainForm").action=unescape(document.getElementById("MainForm").action);
		 }
	}

	function GetSignPicture(personid)
	{
		return "/Sys/Flex/CAService.ashx?sessionid="+GetToken()+"&events=SignPicture&PersonID="+personid;
	}
	
	document.write('<script language="javascript" src="/Sys/FrameWork/Common/JavaScript/json2.js"></script>');
	document.write('<script language="javascript" src="/Sys/FrameWork/Common/JavaScript/BasePage.js"></script>');
	//document.write('<script language="javascript" src="file://E:/Interface.js"></script>');

