<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>转向页</title>
<link rel="stylesheet" href="../../inc/manage.css" type="text/css">
</head>
<!--#include file="../../inc/date_select.asp"-->
<script language="javascript">    
function checkform(){
	if (document.GoToPage.survey_sort.value=="0"){
		alert("分类不能为空!请选择分类!");
		return false;
	}
} 

function GetRadioValue(RadioName){//获取单选按钮(radio)的值
var obj;    
obj=document.GoToPage(RadioName);
if(obj!=null){
	var i;
	for(i=0;i<obj.length;i++){
		if(obj[i].checked){
			return obj[i].value;            
		}
	}
}
return null;
}         
</script>
<body>
<!--#include file="../../Dbconn.asp" -->
<!--#include file="../../manage/checkuserflag.asp"-->
<%call CheckUserFlag("01")%>
<%
turnPage DataPathFile

Function turnPage(DataPathFile)
	openDb DataPathFile
	sql="SELECT A_M_D_ID FROM A_Manage_Department where A_M_D_company_id=" & Session("DC_Manage_CompanyID")
	Set rs_d = DbConn.Execute(sql)
	if not rs_d.eof then'判断部门是否已经存在，存在则运行
		A_M_D_ID=rs_d("A_M_D_ID")
		rs_d.close
		set rs_d=nothing
		turn_to_page "survey_add.asp",0
	else
		Response.Write ("<Script Language=""javaScript"">alert('您还没有添加管理部门，现在马上转到“部门管理”页面进行添加！');location.replace(""../../manage/department_add.asp"");</Script>")
	end if
	closeDb
end Function

'Function turn_to_page(turnToPage,survey_CatalogID,survey_typeId,survey_id)
    'response.write "<form action=""" & turnToPage & """ method=""post"" name=""GoToPage"">"
	'response.write "<input type=""hidden"" name=""survey_CatalogID"" value=""" & survey_CatalogID & """>"
	'response.write "<input type=""hidden"" name=""survey_typeId"" value=""" & survey_typeId & """>"
    'response.write "<input type=""hidden"" name=""survey_id"" value=""" & survey_id & """>"
    'response.write "</form>"
    'response.write "<script language=""javascript"">"
    'response.write "document.GoToPage.submit(); "
   ' response.write "<script>"
'end Function

Function turn_to_page(turnToPage,survey_id)
%><form name="GoToPage" method="post" action="<%=turnToPage%>" onSubmit="return checkform();">
<%'response.write "<input type=""hidden"" name=""survey_CatalogID"" value=""" & survey_CatalogID & """>"
	'response.write "<input type=""hidden"" name=""survey_typeId"" value=""" & survey_typeId & """>"
    response.write "<input type=""hidden"" name=""survey_id"" value=""" & survey_id & """>"%>
<table width="90%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" align="center" height="100%">
    <table width="450" height="169" border="0" cellpadding="0" cellspacing="1" bgcolor="#B1C3D9">
      <tr>
        <td height="25" colspan="4" background="../../images/s3wcn_bt2.gif"><table width="93%" border="0" align="center" cellpadding="0" cellspacing="2">
  <tr>
    <td width="11%" align="right"><img src="../../images/tb2.gif" width="21" height="25"></td>
    <td width="89%" align="left" class="head_07">请选择问卷参数：</td>
  </tr>
</table></td>
        </tr>
      <!--<tr>
        <td width="66" height="34" align="right" bgcolor="#FFFFFF"><font color=red>*</font>功能：</td>
        <td colspan="3" bgcolor="#FFFFFF"><label><input type="radio" name="survey_gl" id="survey_gl" value="1" />
网上在线问卷调查</label>
  <label><input type="radio" name="survey_gl" id="survey_gl" value="2" disabled/>
网上在线测试（评分）</label></td>
      </tr>-->
      <tr>
        <td height="31" align="right" bgcolor="#FFFFFF"><font color=red>*</font>分类：</td>
        <td height="31" colspan="3" bgcolor="#FFFFFF">&nbsp;
        <%newsort=request.cookies("current_newsort") '当前的问卷分类
  		if newsort="" then newsort="0"%>
        <script language="javascript">
              function chang_news_type(){
                  if(document.GoToPage.survey_sort.value=="root_tag"){
                      alert("请选择相关的子分类!");
                      document.GoToPage.survey_sort.value="<%=newsort%>";
                  }
              }
          </script>
              <select name="survey_sort" id="survey_sort" style="WIDTH: 260px; COLOR: navy; font-size:9pt" onChange="javascript:chang_news_type();">    
                <%Set ObjDCW = Server.CreateObject("dc_data100_v1_0.C_A_Config")
                sql_str=" where Catalog_company_id=" & Session("DC_Manage_CompanyID")
				if Session("DC_Manage_DepartmentID")<>0 then
					sql_str=sql_str & " and CatalogBig=" & Session("DC_Manage_DepartmentID")
				end if
				sql_str=sql_str & " order by CatalogID"
				survey_s=ObjDCW.read_record(D_data,DataPathFile,"DC_Title_catalog","CatalogID,CatalogName,CatalogBig",sql_str)
				myrs_root_count=ubound(D_data)
				for i=0 to myrs_root_count-1 step 1
					myrs_root=split(D_data(i),",")
					survey_s_t=ObjDCW.read_record(D_data_t,DataPathFile,"DC_Title_type","ID,TypeName"," where CatalogID=" & myrs_root(0) & " order by ID")
					myrs_child_count=ubound(D_data_t)
					if myrs_child_count>0 then
						Response.Write "<option value='root_tag' style='color:black;background:#f0f0f0'>⊙" & myrs_root(1)
						
						departmentID=myrs_root(2)
						if departmentID<>"" then
							departM=ObjDCW.read_record(D_data_Dep,DataPathFile,"A_Manage_Department","A_M_D_Name"," where A_M_D_ID=" & departmentID)
							if departM=0 then
								response.write "-"
							else
								totalput = UBound(D_data_Dep)
								rs_dep=split(D_data_Dep(0),",")
								response.write "(" & rs_dep(0) & ")"
							end if
						end if
					
						response.write "</option>"
						for j=0 to myrs_child_count-1 step 1
							myrs_child=split(D_data_t(j),",")
							Response.Write "<option value='" & myrs_root(0) & "," & myrs_child(0) & "' " & object_selected(newsort,cstr(myrs_child(0))) & ">┠—" & myrs_child(1) & "</option>"							
						next
					end if
				next
%>
                <option value="0" <%=object_selected(newsort,"0")%>></option>
              </select>
              <a href="survey_catalog.asp" target="_self"><font color=blue>分类管理</font></a></td>
      </tr>
      <tr>
        <td height="31" align="right" bgcolor="#FFFFFF">开始日期：</td>
        <td width="146" height="31" bgcolor="#FFFFFF">&nbsp;
<script>
var myDate=new Date();
this.year=myDate.getYear(); //定义year属性，年份，默认值为当前系统年份。
this.month=myDate.getMonth()+1; //定义month属性，月份，默认值为当前系统月份。
this.date=myDate.getDate(); //定义date属性，日，默认值为当前系统的日。
document.write("<input name='Date1' type='text' id='Date1' onclick='calendar()' value='"+this.year+"-"+this.month+"-"+this.date+"' size='9' readonly='true' class='inptxt'>");
</script></td>
        <td width="68" align="right" bgcolor="#FFFFFF">结束日期：</td>
        <td width="165" bgcolor="#FFFFFF">&nbsp;
<script>
this.year2=myDate.getYear(); //定义month属性，月份，默认值为当前系统月份。
document.write("<input name='Date2' type='text' id='Date2' onclick='calendar()' value='"+this.year2+"-"+this.month+"-"+this.date+"' size='9' readonly='true' class='inptxt'>");
</script>
        </td>
      </tr>
      <tr>
        <td height="42" colspan="4" align="center" bgcolor="#FFFFFF"><input name="survey_gl" type="hidden" id="survey_gl" value="2">
        <input type="submit" name="button" id="button" value=" 下一步 " /></td>
        </tr>
    </table>
    <br>
    <table width="450" border="0" cellspacing="10" cellpadding="0">
      <tr>
        <td><p class="head_06"><br>
          <img src="../../images/light.gif" width="16" height="17">创建问卷步骤：<br>
          第一步：选择问卷参数；<br>
          第二步：编辑问卷；<br>
          第三步：发布问卷（这一步很关键，不然投不了票）。 </p>
          </td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<%end Function

function object_selected(current_value,value)
	  if current_value=value then
		  sel_str="selected"
	  else
		  sel_str=""
	  end if
	  object_selected=sel_str
end function
%>
</body>
</html>