<!--
var ROOTPATH = "";
var WIDTH_DOUBLESCREEN=false;
var HEIGHT_DOUBLESCREEN=false;

function greturn()
{
	void(0);
}

function CheckDoubleScreen()
{
	if(screen.width>1900)
		WIDTH_DOUBLESCREEN=true;
	if(screen.height>1200)
		HEIGHT_DOUBLESCREEN=true;
}

CheckDoubleScreen();

function createForm(templateId,flowId,height,width)
{	
	var winUrl = ROOTPATH + "templateAction?modelMethod=Create&templateID=" + templateId;	
	if (flowId != "" && flowId != null)
	{
		winUrl = winUrl + "&flowID=" + flowId;
	}
	 
	OpenFormWindow(winUrl,height,width);
}

function createChangeForm(formId,flowId,height,width)
{	
	var winUrl = ROOTPATH + "templateAction?modelMethod=FormChangeFlowCreate&formID=" + formId;	
	if (flowId != "" && flowId != null)
	{
		winUrl = winUrl + "&flowID=" + flowId;
		OpenFormWindow(winUrl,height,width);
	}
	
}

function createApplyForm(templateId,flowId,height,width)
{	
	var winUrl = ROOTPATH + "templateAction?modelMethod=CreateApply&templateID=" + templateId;	
	if (flowId != "" && flowId != null)
	{
		winUrl = winUrl + "&flowID=" + flowId;
	}
	OpenFormWindow(winUrl,height,width);
}


function createFormOut(templateId,flowId,height,width)
{	
	var winUrl = ROOTPATH + "templateAction?out=1&modelMethod=Create&templateID=" + templateId;	
	if (flowId != "" && flowId != null)
	{
		winUrl = winUrl + "&flowID=" + flowId;
	}
	OpenFormWindow(winUrl,height,width);
}

function viewFormOut(formId,instanceId,height,width)
{
	var winUrl = "templateAction?out=1&modelMethod=View&formID=" + formId;
	if (instanceId != "" && instanceId != null)
	{
		winUrl = winUrl + "&instanceID=" + instanceId;
	}
	OpenFormWindow(winUrl,height,width);	
}

function createModuleForm(templateId,moduleId,height,width)
{
	height = height==null?"":height;
	width = width==null?"":height;
	if (moduleId != "" && moduleId != null)
	{
		var winUrl = ROOTPATH + "resources/jsp/flowSelection.jsp?templateID=" + templateId 
			+ "&moduleID=" + moduleId + "&height=" + height + "&width=" + width;
		ShowModal(winUrl,"","selectModelFlow");
	}else{
		createForm(templateId,"",height,width);
	}
}

function printTemplateByOffice(type){
  if(document.all.printTemplateFormId!=null && document.all.printTemplateFormId.value!=""){
     OpenFormWindow(ROOTPATH+"resources/jsp/officeTemp.jsp?formId="+document.all.printTemplateFormId.value+"&type="+type,"600","800");
   }else{
     if(confirm("没有设置打印模版。使用浏览器打印功能？"))
        window.print();
   }
}

function editTypeConfig(type,path,depid,depname)
{
    var modelUrl_model = "modelAction?modelAction=SysconfigModel&modelMethod=";
	if (type == "0")
	{
		modelUrl_model = modelUrl_model + "View_Single&type=0&templateID=" + path + "&depID=" + depid + "&depName=" + depname;
		OpenFormWindow(modelUrl_model,'500','700');
	}
}

function createModuleFlowForm(moduleId,height,width)
{
	height = height==null?"":height;
	width = width==null?"":height;
	if (moduleId != "" && moduleId != null)
	{
		var winUrl = ROOTPATH + "resources/jsp/formFlowSelection.jsp?moduleID=" + moduleId + "&height=" + height + "&width=" + width;
		ShowModal(winUrl,"","selectFormFlow");
	}else
	{
	  alert("没有配置模块名称");
	}
}

function createTypeForm(templateId,depId,depName)
{
	var winUrl = "templateAction?modelMethod=Create&templateID=" + templateId;
	winUrl = winUrl + "&depID=" + depId + "&depName=" + depName;
	OpenFormWindow(winUrl);		
}

function selectFormAndFlow(moduleId,formId,flowId,height,width)
{
	var fid = "";
	var lid = "";
	var w = "";
	var h = "";
	if (formId != null && formId != "")
	{
		fid = formId;
	}
	if (flowId != null && flowId != "")
	{
		lid = flowId;
	}
	if (width != null && width != "")
	{
		w = width;
	}
	if (height != null && height != "")
	{
		h = height;
	}

	var urlStr = ROOTPATH + "modelAction?modelAction=ModuleTreeModel&modelMethod=View&type=forformandflow";	
	urlStr = urlStr + "&moduleId="+moduleId+"&formId="+fid+"&flowId="+lid+"&width="+w+"&height="+h;			
	if (fid == "" && lid == "")
	{
		ShowModal(urlStr,'选择','selectformandflow');
	}
	else if (fid == "")
	{
		ShowModal(urlStr,'选择','selectform');
	}
	else if (lid == "")
	{
		ShowModal(urlStr,'选择','selectform');
	}
}

function editForm(formId,taskId,flowId,height,width)
{
	var winUrl = "templateAction?modelMethod=Edit&formID=" + formId;
	if (taskId != "" && taskId != null)
	{
		winUrl = winUrl + "&taskID=" + taskId;
	}	
	OpenFormWindow(winUrl,height,width);	
}

function reEditForm()
{
	var winUrl = window.location.href;
	winUrl = winUrl.replace("View","ReEdit");
	var index = winUrl.indexOf("instanceID");
	if (index >= 0)
	{
		winUrl = winUrl.substring(0,index-1);
	}
	window.location.href = winUrl;
}

function editTypeForm(formId)
{
	var winUrl = "templateAction?modelMethod=Edit&formID=" + formId;	
	OpenFormWindow(winUrl);	
}

function viewForm(formId,instanceId,height,width)
{
	var winUrl = "templateAction?modelMethod=View&formID=" + formId;
	if (instanceId != "" && instanceId != null)
	{
		winUrl = winUrl + "&instanceID=" + instanceId;
	}
	OpenFormWindow(winUrl,height,width);	
}

function viewForm1(formId,instanceId,height,width)
{
	var winUrl = "../templateAction?modelMethod=View&formID=" + formId;
	if (instanceId != "" && instanceId != null)
	{
		winUrl = winUrl + "&instanceID=" + instanceId;
	}
	OpenFormWindow(winUrl,height,width);	
}

function submitForm(btnObj,type)
{
	var statusObj = document.getElementById("status");		
	var isUseFlow = document.getElementById("isUseFlow");
	var visit = document.getElementById("visitorIDs");
	//var v = visit.value;
	statusObj.value = "0";
	//issue form
	if (type == "2")
	{	
	    statusObj.value = "1";
	    if(visit!=null && visit.value==""){
	       if(!confirm("警告：发布范围或者访问范围为空。继续完成操作吗？"))
	          return false;
	    }			
	}
	if (isUseFlow != null && isUseFlow.value == "1")
	{		
		//hanlder workflow	
		if (submitFlow(type) == true)
		{
			var flowMethod = document.getElementById("flowMethod");
			flowMethod.value = type;
			return true;
		}		
		else
		{			
			return false;
		}			
	}
	else
	{								
		return true;		
	}
}

function saveConent()
{
	var cType = document.getElementById("contentType");
	
	if(cType!=null && cType.value == "HTML")
	{      
	   if (document.frames['NewsContent'].CurrMode!="EDIT") 
	   {
		  alert('其他模式下无法保存，请切换到设计模式');
		  return;
       }	  
	   var htmlcontent = document.frames["NewsContent"].document.frames("EditArea").document.body.innerHTML;
	   document.getElementById("content").value = htmlcontent;
	   return;
	}
	if (cType!=null && (cType.value == "WORD_IN" || cType.value == "EXCEL_IN"))
	{   
		TANGER_OCX_SaveDoc(cType.value);
	}
	return;
	
}

//delete one form
function deleteForm()
{	
	if (confirm("确定删除吗！"))
	{
		var modelMethod = document.getElementById("modelMethod");
		var isUseFlow = document.getElementById("isUseFlow");
		if (modelMethod != null)
		{
			modelMethod.value = "Delete";
		}
		if (isUseFlow != null && isUseFlow.value == "1")
		{
			var flowMethod = document.getElementById("flowMethod");
			flowMethod.value = "9";
		}		
		if (document.forms[0] != null)
			document.forms[0].submit();
	}
}

//delete all selected form
function deleteForms()
{	
	if (confirm("确定删除吗！"))
	{
		var modelMethod = document.getElementById("dataform").modelMethod;
		var deleteList = document.getElementById("dataform").DeleteList;
		var deleteFormIdList = document.getElementsByName("deleteFormId");
		var isUseFlow = document.getElementById("isUseFlow");
		var ids = "";
		if(deleteFormIdList!=null){
		    for(i=0;i<deleteFormIdList.length;i++){
		       if(deleteFormIdList[i].checked)
		           ids = ids +","+deleteFormIdList[i].value;
		    }
		    if(deleteList!=null){
		       deleteList.value = ids;
		       
		    }
		}
		if(deleteList == null || deleteList.value==""){
		    alert("请先选择");
		    return;
		}
		if (modelMethod != null)
		{
			modelMethod.value = "DeleteList";
		}
		
		if (isUseFlow != null && isUseFlow.value == "1"){
			var flowMethod = document.getElementById("flowMethod");
			flowMethod.value = "9";
		}		
		if (document.getElementById("dataform") != null){
			document.getElementById("dataform").submit();
		}
			
	}
}

//remove all selected form (not delete)
function removeForms()
{	
	if (confirm("确定移除吗！"))
	{
		var modelMethod = document.getElementById("dataform").modelMethod;
		var deleteList = document.getElementById("dataform").DeleteList;
		var deleteFormIdList = document.getElementsByName("deleteFormId");
		var isUseFlow = document.getElementById("isUseFlow");
		var ids = "";
		if(deleteFormIdList!=null){
		    for(i=0;i<deleteFormIdList.length;i++){
		       if(deleteFormIdList[i].checked)
		           ids = ids +","+deleteFormIdList[i].value;
		    }
		    if(deleteList!=null){
		       deleteList.value = ids;
		       
		    }
		}
		if(deleteList == null || deleteList.value==""){
		    alert("请先选择");
		    return;
		}
		if (modelMethod != null)
		{
			modelMethod.value = "RemoveList";
		}	
		if (document.getElementById("dataform") != null){
			document.getElementById("dataform").submit();
		}
			
	}
}

//read  selected form (marked read)
function readForms(formid)
{	
	var formobj = document.getElementById(formid)
	if (formobj && confirm("确定把选择的文件设置为已读吗！"))
	{
		var modelMethod = formobj.modelMethod;
		var readList = formobj.ReadList;
		var formIdList = formobj.formId;
		var ids = "";
		if(formIdList!=null){
		    for(i=0;i<formIdList.length;i++){
		       if(formIdList[i].checked)
		           ids = ids +","+formIdList[i].value;
		    }
		    if(readList!=null){
		       readList.value = ids;
		       
		    }
		}

		if(readList == null || readList.value==""){
		    alert("请先选择");
		    return;
		}

		if (modelMethod != null)
		{
			modelMethod.value = "ReadList";
		}
		
	    formobj.submit();		
	}
}

function copyForm()
{	
	if (confirm("确定复制吗！"))
	{
		var modelMethod = document.getElementById("modelMethod");
		if (modelMethod != null)
		{
			modelMethod.value = "CopyCreate";
			if (document.forms[0] != null)
			document.forms[0].target ="_parent";
			return true;
		}

	}
	   return false;
	
}

function replyForm()
{	
	var btn;
	if (document.ireplyinfo)
	{
		btn = ireplyinfo.document.all.ireplybutton;	
		
	}	
	if (btn != null)
	{			
		btn.click();
	}
}

function goApp(appId)
{	
	var fObj = document.ssoform;
	if (fObj == null)
	{		
		fObj = parent.document.ssoform;
	}
    fObj.modelMethod.value = "Sso";
    fObj.unID.value = appId;    
    fObj.submit();
}

function goAppManagement(appId)
{	
	var fObj = document.ssoformmain;
	if (fObj == null)
	{		
		fObj = parent.document.ssoformmain;
	}
	fObj.modelMethod.value = "AppManagement";
    fObj.unID.value = appId;
      
    fObj.submit();
}


//地址本选择
//ptype:个人地址本，1、显示，0、不显示
//utype:组织机构，1、只选择用户 2、只选择部门 3、用户与部门都允许选择
//rtype:角色，1、显示，0、不显示
//sflag:不选择默认赋值是否为全部，1、返回“全部，*”值对
//count:选择数量,0为不限制
//field:赋值域包括ID和name，格式为“name,id”
//serial:
function showAddress(ptype,utype,rtype,sflag,count,field,serial)
{		
	var urlStr = ROOTPATH + "uum/addressTree.jsp?utype=" + utype + "&rtype=" + rtype + "&ptype=" + ptype + "&count=" + count + "&sflag=" + sflag + "&fields=" + field + "&serial=" + serial;
	ShowModal(urlStr,"选择","address");		
}

function showFenlei(field)
{		
	var urlStr = ROOTPATH + "webinfo/addressTree.jsp?fields="+field;
	ShowModal(urlStr,"选择","address");		
}

//地址本，显示本部门和其他地址
//mydept：0一般地址本，1只显示本部门，2显示本部门和全部组织机构
function showAddressRelative(mydept,ptype,utype,rtype,sflag,count,field,serial)
{		
	var urlStr = ROOTPATH + "uum/addressTree.jsp?utype=" + utype + "&rtype=" + rtype + "&ptype=" + ptype + "&count=" + count + "&sflag=" + sflag + "&fields=" + field + "&serial=" + serial+ "&mydept=" + mydept;
	ShowModal(urlStr,"选择","address");		
}

//设置范围的地址本
//range：范围部门或者用户id，多个用“,”分隔
function showFlowAddress(ptype,utype,rtype,sflag,count,field,range)
{		
	var urlStr = ROOTPATH + "uum/addressTree.jsp?range="+range+"&utype=" + utype + "&rtype=" + rtype + "&ptype=" + ptype + "&count=" + count + "&sflag=" + sflag + "&fields=" + field;
	ShowModal(urlStr,"选择","address");		
}
function showFlowAddressRelative(mydept,ptype,utype,rtype,sflag,count,field,range)
{		
	var urlStr = ROOTPATH + "uum/addressTree.jsp?mydept=" + mydept + "&range="+range+"&utype=" + utype + "&rtype=" + rtype + "&ptype=" + ptype + "&count=" + count + "&sflag=" + sflag + "&fields=" + field;
	ShowModal(urlStr,"选择","address");		
}

function showFlowActorAddress(utype,templateid,sflag,count,field,serial)
{		
	var urlStr = ROOTPATH + "workflow/flowActorAddressTree.jsp?utype=" + utype + "&mydept="+templateid+"&count=" + count + "&sflag=" + sflag + "&fields=" + field + "&serial=" + serial;
	ShowModal(urlStr,"选择","address");		
}

function selectModule(type)
{
	var winUrl = ROOTPATH + "modelAction?modelAction=ModuleTreeModel&modelMethod=View&type=" + type;
	ShowModal(winUrl,'选择','selectmodule');
}

function selectMessage()
{
	var winUrl = ROOTPATH + "modelAction?modelAction=PersonalSettingModel&modelMethod=View&type=1";
	ShowModal(winUrl,'选择','selectmsg');
}

function deleteElement()
{
	if (confirm("确定删除？"))
	{
		var modelMethod = document.getElementById("modelMethod");
		if (modelMethod != null)
		{
			modelMethod.value = "Delete";
			
			if (document.forms[0] != null)
				document.forms[0].submit();
		}	
	}
}

function copyElement()
{   
    var unID = document.forms[0].unID.value;
    var type = document.forms[0].templateType.value;
    var winUrl = ROOTPATH + "modelAction?modelAction=FormTemplateModel&modelMethod=Copy&unID=" + unID + "&type=" + type;
	OpenFormWindow(winUrl,"400","500");
}

var i = 1;
function addAttachment()
{
	var tableObj = document.getElementById("attachmentTable");
	var row = tableObj.insertRow(tableObj.rows.length);
	var fileStr = '<input type="file" name="fileControl_' + i + '" class="file">';
	row.setAttribute("rindex", i);
	var attcol = row.insertCell(0);		
	attcol.innerHTML = fileStr;
	fileStr = '<input type="button" class="button_all" onclick="deleteAttachment(this);" value="删除" btnIndex="' + i + '"/>'
	var btncol = row.insertCell(1);
	btncol.innerHTML = fileStr;
	i++;
} 

function deleteAttachment(obj)
{
	var tableObj = document.getElementById("attachmentTable");
	for (i=0;i<tableObj.rows.length; i++)
	{
		if (tableObj.rows[i].rindex == obj.btnIndex)
		{		
			var curRow = tableObj.rows[i];
			tableObj.deleteRow(curRow.rowIndex);
			break;
		}
	}	
}

function addAttachment_1(tableObj)
{
	var x = tableObj.rows.length;
	var id = tableObj.id;
	var attname = id + "_" + x;
	var row = tableObj.insertRow(tableObj.rows.length);
	var fileStr = '<input type="file" name="' + attname + '" class="file">';
	row.setAttribute("rindex", x);
	var attcol = row.insertCell(0);	
	attcol.innerHTML = fileStr;
	fileStr = '<input type="button" class="button_all"'
			+ ' onclick="deleteAttachment_1(this,document.getElementById(\''
			+ id
			+ '\'));"'
			+ ' value="删除" btnIndex="' + x + '"/>';
	var btncol = row.insertCell(1);
	btncol.innerHTML = fileStr;

} 

function deleteAttachment_1(obj,tableObj)
{
	for (i=0;i<tableObj.rows.length; i++)
	{
		if (tableObj.rows[i].rindex == obj.btnIndex)
		{		
			var curRow = tableObj.rows[i];
			tableObj.deleteRow(curRow.rowIndex);
			break;
		}
	}	
}

function fillTableData(tableId,rowCount)
{	
	var table;
	var rCount;		
	var cCount;
	var len = 0;
	
	table = document.getElementById(tableId);
	if (table != null)
	{
		rCount = table.rows.length;
		var headRow = table.rows[2];	
		cCount = headRow.cells.length;
		len = rowCount - rCount +3;
					
		if (table != null && len != 0)
		{			
			for(i = 0;i < len;i++)
			{
				var row = table.insertRow(table.rows.length);
				for(j = 0;j < cCount;j++)
				{
					cell = row.insertCell(j);		
					cell.className = "tableBodyColumn";	
					cell.innerHTML = "&nbsp;";	
				}
			}		
		}
	}	
}

function validateFormElements(formObj)
{
	if (formObj != null)
	{
		var elements = formObj.elements;
		var fieldObj;
		for(i = 0; i < elements.length; i++)
		{
			fieldObj = elements[i];
			if (fieldObj.type && fieldObj.type == "text")
			{
				if (fieldObj.value == "")
				{
					alert("不能为空!");
					return false;
				}
			}
		}
		return true;
	}
	else
		return true;
}

function switchDiv(curdivId,otherdivId,divId)
{	
	var divObj = document.getElementById(divId);
	var cDiv = document.getElementById(curdivId);
	var oDiv = document.getElementById(otherdivId);
	if (curdivId.indexOf("show") >= 0)
	{		
		divObj.style.display = "inline";
					
	}
	else
	{
		divObj.style.display = "none";		
	}
	cDiv.style.display = "none";
	oDiv.style.display = "inline";	
}

function switchDivIframe(curdivId,otherdivId,divId,iframeId)
{	
	var divObj = document.getElementById(divId);
	var cDiv = document.getElementById(curdivId);
	var oDiv = document.getElementById(otherdivId);
	if (curdivId.indexOf("show") >= 0)
	{		
		divObj.style.display = "inline";
		window.frames[iframeId].document.location.reload();
					
	}
	else
	{
		divObj.style.display = "none";		
	}
	cDiv.style.display = "none";
	oDiv.style.display = "inline";	
}

function getMutilInputValue(name,type)
{	
	var iObj = document.all[name];
	var selIds = "";
	var selNames = "";
	if (iObj != null)
	{								
		if (iObj.length)
		{
			if (type == "radio")
			{					
				for(i = 0; i < iObj.length; i++)
				{
					if (iObj[i].checked)
					{						
						selIds = iObj[i].value;
						selNames = iObj[i].text;						
						break;
					}
				}
			}
			else if (type == "checkbox")
			{
				for(i = 0; i < iObj.length; i++)
				{
					if (iObj[i].checked)
					{						
						selIds = selIds + iObj[i].value + ",";
						selNames = selNames + iObj[i].text + ",";					
					}
				}
				selIds = selIds.substring(0,selIds.length - 1);
				selNames = selNames.substring(0,selNames.length - 1)
			}
		}
		else
		{
			if (iObj.checked)
			{
				selIds = iObj.value;
				selNames = iObj.text;
			}
		}
	}	
	var result = new Array();
	result[0] = selIds;
	result[1] = selNames;
	return result;
}

function ShowModal(url, title, size)
{
	var sOpt = new String();
	switch( size )
	{
	    case "verysmall":
	        sOpt = 'status:yes;dialogWidth:200px;dialogHeight:300px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "small" : 
			sOpt = 'status:yes;dialogWidth:490px;dialogHeight:300px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "middle" : 
			sOpt = 'status:yes;dialogWidth:490px;dialogHeight:375px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "moduleview" : 
			sOpt = 'status:yes;dialogWidth:600px;dialogHeight:550px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "big" : 
			sOpt = 'status:yes;dialogWidth:950px;dialogHeight:750px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "password" : 
			sOpt = 'status:yes;dialogWidth:370px;dialogHeight:225px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "changeinfo" : 
			sOpt = 'status:yes;dialogWidth:420px;dialogHeight:320px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "address" : 
			sOpt = 'status:yes;dialogWidth:270px;dialogHeight:400px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "selectmodule" : 
			sOpt = 'status:yes;dialogWidth:200px;dialogHeight:265px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;	
		case "selectflow" : 
			sOpt = 'status:yes;dialogWidth:280px;dialogHeight:350px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;	
		case "selectform" : 
			sOpt = 'status:yes;dialogWidth:260px;dialogHeight:200px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "selectformandflow" : 
			sOpt = 'status:yes;dialogWidth:260px;dialogHeight:300px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "selectmsg" : 
			sOpt = 'status:yes;dialogWidth:380px;dialogHeight:285px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "userinfo" : 
			sOpt = 'status:yes;dialogWidth:400px;dialogHeight:305px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "mydesk" : 
			sOpt = 'status:yes;dialogWidth:300px;dialogHeight:305px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "docbank" : 
			sOpt = 'status:yes;dialogWidth:490px;dialogHeight:360px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "selectModelFlow" : 
			sOpt = 'status:yes;dialogWidth:310px;dialogHeight:190px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "selectFormFlow" : 
			sOpt = 'status:yes;dialogWidth:340px;dialogHeight:220px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
	    case "sso" : 
			sOpt = 'status:yes;dialogWidth:490px;dialogHeight:420px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "formCreate" : 
			sOpt = 'status:yes;dialogWidth:490px;dialogHeight:450px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "formatt" : 
			sOpt = 'status:yes;dialogWidth:580px;dialogHeight:395px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
		case "full" : 
			sOpt = 'status:yes;dialogWidth:100%;dialogHeight:100%;resizable:yes;center:yes;edge:sunken;unadorned:1;help:no';
			break;
	   case "formform" : 
			sOpt = 'status:yes;dialogWidth:600px;dialogHeight:300px;resizable:no;center:yes;edge:sunken;unadorned:1;help:no';
			break;
	}
	outVal = window.showModalDialog(url, window, sOpt);	
}

function OpenFormWindow(url,pheight,pwidth)
{
	var handle;
	var width;
	var height;
	if (pheight == "" || pheight == null)
	{
		height=700;
	}
	else
	{
		height = pheight;
	}
	if (pwidth == "" || pwidth == null)
	{
		width=980;	
	}
	else
	{
		width = pwidth;
	}	
    OpenWindow(url,"",height,width,"yes","no","yes","no","yes",false,false,"");
}

function OpenFullWindow(url,pheight,pwidth)
{
	var handle;
	var width;
	var height;
	if (pheight == "" || pheight == null)
	{
		height=700;
	}
	else
	{
		height = pheight;
	}
	if (pwidth == "" || pwidth == null)
	{
		width=980;	
	}
	else
	{
		width = pwidth;
	}	
    OpenWindow(url,"",height,width,"yes","no","yes","no","yes",true,false,""); 	
}

function CloseWindowAndReloadParent()
{
	try
	{   
		ReloadParentWindow();			
		CloseWindow();		
	}
	catch(err)
	{				
		CloseWindow();
	}
}

function CloseWindowAndReloadSpecifiedWindow(framename)
{
	ReloadSpecifiedWindow(framename);
	CloseWindow();
}

function ReloadParentWindow()
{	
	if (top.opener != null)
	{   
		var dd = getHomePage(top.opener.location.href);
		top.opener.location.href = dd;		
	}
	else
	{	
		ReloadModalWindow();
	}
}

function ReloadWindow()
{	
	var dd = getHomePage(window.location.href);
	window.location.href = dd;		
}

function ReloadIfrParentWindow()
{		
	var dd = getHomePage(window.parent.location.href);
	window.parent.location.href = dd;
}

function ReloadSpecifiedWindow(framename)
{
	//var tempframe = top.opener.parent.frames[framename];	
	//tempframe.src=tempframe.src;		
	if (top.window.dialogArguments != null)
	{
		 ReloadModalWindow()
	}
	else
	{				
		var tempframe = parent.parent.frames[framename];		
		if (tempframe == null)
		{			
			tempframe = parent.frames[framename];
		}		
		tempframe.location.href=tempframe.location.href;
	}
}

function ReloadSpecifiedWindow2(framename)
{
	//var tempframe = top.opener.parent.frames[framename];	
	//tempframe.src=tempframe.src;		
	if (top.window.dialogArguments != null)
	{
		 ReloadModalWindow()
	}
	else
	{				
		var tempframe = parent.frames[framename];		
		if (tempframe == null)
		{			
			tempframe = frames[framename];
		}		
		tempframe.location.href=tempframe.location.href;
	}
}

function ReloadSpecifiedFrame(framename)
{	
	if (top.window.dialogArguments != null)
	{				
		var tempframe = top.window.dialogArguments.parent.frames[framename];		
		if (tempframe != null)
		{			
			tempframe.location.href=tempframe.location.href;
		}				
	}	
}

function ReloadModalWindow()
{		
	if (top.window.dialogArguments != null)
	{
		var dd = getHomePage(top.window.dialogArguments.location.href);
		top.window.dialogArguments.location.href = dd;
	}
}

function CloseWindow()
{		
	top.window.close();	
}

function CloseViewFormWindow()
{		
	//if (window.dialogArguments != null)
//	{
	//	var dd = getHomePage(window.dialogArguments.location.href);
	//	window.dialogArguments.location.href = dd;
	//}
	//if (opener != null && !opener.closed)
//	{   
	//	var dd = getHomePage(opener.location.href);
	//	opener.location.href = dd;		
	//}
	window.close();	
}


function IsDoubleScreen()
{
	if(WIDTH_DOUBLESCREEN||HEIGHT_DOUBLESCREEN)
		return true;
	else
		return false;
}
function getHomePage(tt){
    if(tt==null)
      tt = "";
    var ss = tt.indexOf("modelAction");
    var s = tt.indexOf("modelAction?");
	if(ss>0 && s<0 )
		tt = tt +"?modelMethod=Home";
	return tt;
}

function GetMaxSingleScreenWidth()
{
	if(WIDTH_DOUBLESCREEN)
		return screen.availWidth/2;
	else
		return screen.availWidth + 8;
}

function GetMaxSingleScreenHeight()
{
	if(HEIGHT_DOUBLESCREEN)
		return screen.availHeight/2;
	else
		return screen.availHeight + 10;
}

function OpenWindow(url, name, height, width, status, toolbar, scrollbars, menubar, resizable, isDoubleScreen, isModal, modalAguments)
{      
   var DEFAULT_NAME = "_blank";
   var DEFAULT_BAR = "no";
   var realName,realUrl,realWidth,realHeight,realStatus,realToolbar,realScrollbars;
   var realMenuBar,realResizable;
   var realIsModal,realModalArguments;
   var iTop,iLeft,opts;
   var handle;
   var realIsDoubleScreen;   
   
   if(url==null) 
   { 
      return;  
   } 
   realUrl = url;   
   
   realName = GetParameterValue(name,null, DEFAULT_NAME);
   
   realWidth = GetParameterValue(width,null, screen.width);
   
   realHeight = GetParameterValue(height,null, screen.height);
   
   realStatus = GetParameterValue(status,null, DEFAULT_BAR);
   
   realToolbar = GetParameterValue(toolbar,null, DEFAULT_BAR);
   
   realScrollbars = GetParameterValue(scrollbars,null, DEFAULT_BAR);
   
   realMenuBar = GetParameterValue(menubar,null, DEFAULT_BAR);
   
   realResizable = GetParameterValue(resizable,null, DEFAULT_BAR);
   
   realIsDoubleScreen = GetParameterValue(isDoubleScreen, null, false);
   
   realIsModal = GetParameterValue(isModal, null , false);
   
   realModalArguments = GetParameterValue(modalAguments, null , window);
     
   if(realIsDoubleScreen==false)
   {
		iTop=(GetMaxSingleScreenHeight()-realHeight)/2;
		iLeft=(GetMaxSingleScreenWidth()-realWidth)/2;
   }
   else
   {
		iTop=(screen.height-realHeight)/2;
		iLeft=(screen.width-realWidth)/2;        
   }
   if(iTop<0) 
   {
		iTop = 1;
   }
   if(iLeft<0)
   {
	  iLeft =1;
   }  
   if(realIsModal)
   {
        opts = GetDialogOptions(iLeft, iTop, realHeight, realWidth, realStatus, realToolbar, realScrollbars, realMenuBar, realResizable);		
		handle = window.showModalDialog(realUrl, realModalArguments, opts);		
   }
   else
   {
        opts = GetWindowOptions(iLeft, iTop, realHeight, realWidth, realStatus, realToolbar, realScrollbars, realMenuBar, realResizable);   		
		handle = window.open(realUrl, realName, opts); 		
   }
  
   if (document.all)
	{		  
		handle.moveTo(iLeft,iTop);			
		handle.resizeTo(width, height);					
		handle.outerWidth=width;						
		handle.outerHeight=height;								
	}
	
   //return handle;
}

function GetWindowOptions(left, top, height, width, status, toolbar, scrollbars, menubar, resizable)
{
   var arg = "";
   arg = arg + "height=" + height +", width=" + width + ", ";
   arg = arg + "status="+status+", toolbar="+toolbar+", ";
   arg = arg + "scrollbars="+scrollbars+", menubar="+menubar+", ";
   arg = arg + "left=" + left +", top=" + top +", ";
   arg = arg + "resizable="+resizable;	   
   return arg;
}

function GetDialogOptions(left, top, height, width,  status, toolbar, scrollbars, menubar, resizable)
{
   var arg = "";
   arg = arg + "dialogLeft=" + left +"px; dialogTop=" + top + "px; ";
   arg = arg + "dialogHeight=" + height +"px; dialogWidth=" + width + "px; ";
   arg = arg + "status="+status+"; toolbar="+toolbar+"; ";
   arg = arg + "scrollbars="+scrollbars+"; menubar="+menubar+"; ";  
   arg = arg + "resizable="+resizable;	
   return arg;
}

function GetParameterValue(paramValue, compareValue, defaultValue)
{
	if(paramValue==compareValue) return defaultValue;
	return paramValue;
}

function ReplaceUrl(url)
{
	return url.replace(" ", "+");
}

function loadFlowInit(state)
{
	if (state == 'complete')
	{
		iflowPanel.flowPageScript();
	}
}

function submitFlowInit()
{
	//当存在流程操作，并且流程操作是提交或者办结时，执行流程提交脚本
	var flowMethod = document.getElementById("flowMethod");
	if (document.getElementById("iflowPanel") != null && flowMethod!=null && (flowMethod.value=="1" || flowMethod.value=="2"))
	{
		return iflowPanel.flowSubmitScript();
	}
	  window.onbeforeunload = nullfunc;   
    window.onunload = nullfunc; 
	
	return true;
}

function viewFlowFig(formId,instanceID,taskID)
{
   var urlStr = ROOTPATH + "modelAction?modelAction=ViewFlowFigModel&instanceID="+instanceID+"&taskID="+taskID;
   	OpenFormWindow(urlStr,'450','700')
}

function flowDrag(){
   document.all.modelMethod.value = 'ToDragBack';
   document.all.isUseFlow.value = '0';
   document.forms[0].target = '_blank';
   document.forms[0].submit();
   window.close();
   
}

function flowAppendActor(){
   document.all.modelMethod.value = 'ToAppendTask';
   document.all.isUseFlow.value = '0';
   document.forms[0].target = '_blank';
   document.forms[0].submit();
   window.close();
   
}

function editArrange(id) 
{				
	var modelUrl_model = "../modelAction?modelAction=ArrangeModel&modelMethod=";
	if (id == "")
		return;	
	ShowModal(modelUrl_model + "Edit&unID=" + id,"","middle");
}

function getChineseMonthOrDay(index1){
      var numberstring="一二三四五六七八九十";
      var value = "";
	  if(index1 ==0) {
	    document.write("十");
	  }
	  if(index1 < 10){
	    value = numberstring.substring(0+(index1-1),index1);
	  }
	  else if(index1 < 20 ){
	    value = "十"+numberstring.substring(0+(index1-11),(index1-10));
	   }
	  else if(index1 < 30 ){
	    value = "二十"+numberstring.substring(0+(index1-21),(index1-20));
	   }
	  else{
	    value = "三十"+numberstring.substring(0+(index1-31),(index1-30));
	  }
	  return value;
}

function getChinaesYear(index1){
      var numberstring="〇一二三四五六七八九";
      var value = "";
      for(i=0;i<index1.length;i++){
         value = value + numberstring.substr(index1.charAt(i),1);
	  }
	  return value;
}

function getChineseDate(year,month,day){
	   return getChinaesYear(year)+"年"+getChineseMonthOrDay(month)+"月"+getChineseMonthOrDay(day)+"日";
}
//创建收藏夹
function putFavorite(){
   var url = document.location;
   var obj = document.getElementById("title");
   var title = "";
   if(obj!=null){
      title = obj.value;
   }
   var favorite = "modelAction?modelAction=FavoriteModel&modelMethod=InitCreateUrl&title="+title+"&url="+url;
   ShowModal(favorite,"","small");
}

function nullfunc(){   
          
    }  


-->

