<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Collection" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.formEngine.*" %>
<%@ page import="net.sz600.system.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%
	String sRelateValue = SzConvert.toSpaceStr(request.getParameter("relateValue"));
	String sTriggerName = SzConvert.toSpaceStr(request.getParameter("triggerName"));
	BdTrigger bdTrigger = new BdTrigger();
	BdTriggerInfo tableInfo = bdTrigger.getInfo(sTriggerName);
	//取得已经填写的值
%>
<%
    int i = 0;
    int j = 0;

	String s_info[] = bdTrigger.getValue(sTriggerName, sRelateValue);		

	String strObj = tableInfo.getFieldDesc();
	strObj = strObj.replaceAll(";", ",");
	String obj_str[] = strObj.split(",");
%>
<script language="javascript">
    var objCount;
    objArray = new Array();
    objCount = 0;  
    var valueArray = new Array();
<%
    int iObjCount = 0;
    if (obj_str != null) {
    	iObjCount = obj_str.length;
    }
    for (i =0; i<iObjCount; i++) {
%>
        objArray[objCount] = new Array("<%=obj_str[i]%>");  
        valueArray[objCount] = new Array("<%=s_info[i]%>");         
        objCount++;
<%    	
    }    	
%> 
</script>
<form name="formHidden">
  <input type="button" value="测试" onClick="javascript:FunOk();">
</form>

<script language="javascript">
  function FunOk() {

    //确定，获取
    var vName = "";
    var vId = "0";
    var j = 0;
    
    var k = 0;
    
    //var oWindow = window.dialogArguments;
    var oWindow = window.opener;
    var objName = "";
    var obj = null;
    
    for (k=0; k<objCount; k++) {        
        if (objArray[k] == "" || objArray[k] == null ) {
        	continue;
        }
        
		objName = "formUpdate." + objArray[k];		
		//判断objName的类型		
      	if (objName != "") {
      		obj = eval("oWindow." + objName);
      		if (obj != null && obj.id != null) {
      			eval("oWindow." + objName + ".value='" + valueArray[k] + "';");
      		} else {
      		    //CheckRadio(obj, valueArray[k]);
      		    oWindow.test(objArray[k], valueArray[k]);
      		}

      	}
    }    
    window.close();

  }
  
  FunOk();
</script>
