<!--#include file="config.asp" -->
<%
dim readJsCkeck
readJsCkeck=0'用来看是否已读出了JS验证代码,0表示没有读出，1表示已读出
dim dbconn
dim dconn
survey_id=request("id")
bo=request("bo")'b=1表示是预览模式
Set ObjSurvey = Server.CreateObject("dc_data100_v1_0.survey")
ObjSurvey.readsurvey "",WebPath,DataPathFile,survey_id,Survey_title,Survey_title_exp,D_T_Active,turnToPage,is_password,is_pw_same,D_T_S_password,D_T_S_e_pw_str,is_lz,is_cookies,StartDate,OverDate
'response.write "<br>StartDate=" & StartDate
'response.write "<br>OverDate=" & OverDate
'response.end
'if StartDate>Date() or Date()>OverDate then
	'response.redirect "survey-over.html"
'end if
%>
<script>
function addLoadEvent(func){<%'//在打开页面时可以同时载入多个函数的函数%>
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {  
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
function checkform(gggg){
	<%if bo<>1 then%>
	addCookie(gggg,1,0.0000000000001);
	//alert("运行到了这里" + gggg + "/cookies的值"+ getcookie(gggg));
	<%end if%>
}

function IsNum(s){<%'//判断是否为数字%>
    if (s!=null && s!=""){
       return !isNaN(s);}
    return false;
}
function IsNumZ(s){<%'//判断是否是正整数%>
    if(s!=null){
        var r,re;
        re = /\d*/i;<%' //\d表示数字,*表示匹配多个数字%>
        r = s.match(re);
        return (r==s)?true:false;
    }
    return false;
}
function GetRadioValue(RadioName){<%'//获取单选按钮(radio)的值%>
var obj;    
obj=document.dcform(RadioName);
if(obj!=null){
	var i;
	for(i=0;i<obj.length;i++){
		if(obj[i].checked){
			return obj[i].value;            
		}
	}
}
return null;
}


function checkbox(BoxName)<%'//获取复选框的值%>
{
	var str=document.getElementsByName(BoxName);
	var objarray=str.length;
	var chestr="";
	for (i=0;i<objarray;i++){
		if(str[i].checked == true){
		   chestr+=str[i].value+",";
		 }
	}
	if(chestr == ""){
		return null;
		}
	else{
		return chestr;
		}
}

function getcookie(Name) { <%'//读cookies值%>
	var search = Name + "=" 
	var returnvalue = ""; 
	if (document.cookie.length > 0) { 
	offset = document.cookie.indexOf(search) 
	if (offset != -1) { 
	offset += search.length 
	end = document.cookie.indexOf(";", offset); 
	if (end == -1) 
	end = document.cookie.length; 
	returnvalue=unescape(document.cookie.substring(offset, end)) 
	} 
	} 
	return returnvalue; 
} 
	
function addCookie(name,value,expireHours){<%'//写cookies%>
      var cookieString=name+"="+escape(value);
      if(expireHours>0){
             var date=new Date();
             date.setTime(date.getTime+expireHours*3600*1000);
             cookieString=cookieString+"; expire="+date.toGMTString();
      }
      document.cookie=cookieString;
}
function check(receiveArray,checkItem){ 
　　var index = -1;<%'//　函数返回值用于布尔判断 %>
　　for (var i=0;i<receiveArray.length;i++){ 
　　　　if (receiveArray[i]==checkItem){ 
　　　　　　index=i; 
　　　　　　break; 
　　　　} 
　　}
　　return index; 
}

<%'//判断数组中是否有相同的元素，如果有，则返回值为1%>
function ArrayYN(receiveArray){<%'//receiveArray,需要判断的数组%>
　　var arrResult　=　new　Array();<%'　　//定义一个新的数组.方便与以后是数组元素作比较 %>
　　for (var i=0;i<receiveArray.length;i++){ 
　　　　if (check(arrResult,receiveArray[i])　==　-1){　<%'//在这里做i元素与所有以前保留的元素做比较，如果为-1，则表示不相同，则添加到新的数组中 %>
　　　　　　arrResult.push(receiveArray[i]);<%'　//　添加该元素到新数组。如果if内判断为false（即已添加过），则不添加。%>
			 ins=0;
　　　　} else{
			ins=1;
			break;
		}
　　} 
　　return ins; 
}
</script>
<html>
<head>
<title><%=Survey_title%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="盛维在线调查系统v9.0免费版">
<meta name="Author" content="盛维中国">
<meta name="keywords"  content="<%=Survey_title%>,问卷调查,调查系统,问卷系统,在线调查系统">
<meta name="description" content="<%=Survey_title%>，盛维在线调查系统由盛维中国（www.servor.cn）提供。">
<link rel="stylesheet" href="inc/survey.css" type="text/css">
</head>
<STYLE type=text/css id="survey_style"> 
BODY {
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_body", survey_id)
response.write css%>
}
div, form, img, ul, ol, li, dl, dt{margin:0;padding:0;border:0px none;}
dd{margin:0;padding:0;border:0px none;clear:both;text-align:left;margin-top:4pt;margin-bottom:4pt;FONT-SIZE: 12px; color: red; background:#ffffff;}
dd a{color:#333333;}
dd a:visited{color:#999999;}
dd a:hover{color:#FF5800;}
h1, h2, h3, h4, h5, h6 {margin:0;padding:0;}
.survey_set {
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_survey_set", survey_id)
response.write css%>
}
.survey_question_answer {
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_survey_question_answer", survey_id)
response.write css%>
}
.question {
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_question", survey_id)
response.write css%>
}
.question_exp{<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_question_exp", survey_id)
response.write css%>}
.answer{
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_answer", survey_id)
response.write css%>
}
.info_title{
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_info_title", survey_id)
response.write css%>
}
.info_exp{<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_info_exp", survey_id)
response.write css%>}
.mouse {
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_mouse", survey_id)
response.write css%>
}
.input_class {
<%css=ObjSurvey.readcss(WebPath, DataPathFile, "css_input_class", survey_id)
response.write css%>
}
.onMouse {   
event:expression(   
onmouseover=function()   
{   
this.style.backgroundColor='#FEF6E7'   
},   
onmouseout=function()   
{   
this.style.backgroundColor='#ffffff'   
}   
)
}
</STYLE>
<style type="text/css">
#floater {
	position: absolute;
	left: 500;
	top: 146;
	width: 484;
	visibility: visible;
	z-index: 10;
}
</style>
<body>
<%
if bo=1 then
	ObjSurvey.show_noPublishedInfo
end if
ObjSurvey.main "",WebPath,DataPathFile,survey_id,Survey_title,Survey_title_exp,D_T_Active,turnToPage,is_password,is_pw_same,D_T_S_password,D_T_S_e_pw_str,is_lz,is_cookies,StartDate,OverDate,readJsCkeck,bo
%>
</body>
</html>
<%
'============
Function readsurvey(ismb, WebPath, DataPathFile, survey_id, Survey_title, Survey_title_exp, D_T_Active, turnToPage, is_password, is_pw_same, D_T_S_password, D_T_S_e_pw_str, is_lz, is_cookies, D_T_StartDate, D_T_OverDate)
    OpenD WebPath
    OpenDB DataPathFile
    

            
            If Not IsNumeric(survey_id) Then
                Response.Redirect ("index.asp")
            End If
            'sqlstr_1 = "SELECT Survey_title,Survey_title_exp,D_T_Active,turnToPage,is_password,is_pw_same,D_T_S_password,D_T_S_e_pw_str,is_lz,is_cookies,D_T_StartDate,D_T_OverDate FROM " & ismb & "DC_Title_survey where D_T_S_ID=" & survey_id
            sqlstr_1 = "SELECT * FROM " & ismb & "DC_Title_survey where D_T_S_ID=" & survey_id
            Set rs_survey = Server.CreateObject("Adodb.recordset")
            rs_survey.open sqlstr_1, DbConn, 1, 1
            If ismb = "mb_" Then '如果是模板则运行
                If Not rs_survey.EOF Then
                    Set ObjCAC = Server.CreateObject("dc_data100_v1_0.C_A_Config")
                    ObjCAC.insertCss DataPathFile, survey_id '加入样式表
                    Survey_title = rs_survey("Survey_title")
                    Survey_title_exp = rs_survey("Survey_title_exp")
                    D_T_Active = 1 '是否为编辑状态,1表示是，0表示否
                    turnToPage = 1 '投票后转向页面 1投票后关闭 2返回投票页 3显示三维柱状统计图 4显示曲线统计图 5显示三维饼状图 6显示统计报表
                    is_password = 0 '是否使用密码?
                    is_pw_same = 1 '是否是相同密码
                    D_T_S_password = "" '密码
                    D_T_S_e_pw_str = "" '密码列表
                    is_lz = "" '是否需要验证码
                    is_cookies = 0 '是否开启cookies防作弊功能
                    D_T_StartDate = "" 'rs_survey("D_T_StartDate")
                    D_T_OverDate = "" 'rs_survey("D_T_OverDate")
                    rs_survey.Close
                    Set rs_survey = Nothing
                End If
            Else
                If Not rs_survey.EOF Then
                    Set ObjCAC = Server.CreateObject("dc_data100_v1_0.C_A_Config")
                    ObjCAC.insertCss DataPathFile, survey_id '插入样式表
                    Survey_title = rs_survey("Survey_title")
                    Survey_title_exp = rs_survey("Survey_title_exp")
                    D_T_Active = rs_survey("D_T_Active") '是否为编辑状态,1表示是，0表示否
                    turnToPage = rs_survey("turnToPage") '投票后转向页面 1投票后关闭 2返回投票页 3显示三维柱状统计图 4显示曲线统计图 5显示三维饼状图 6显示统计报表
                    is_password = rs_survey("is_password") '是否使用密码?
                    is_pw_same = rs_survey("is_pw_same") '是否是相同密码
                    D_T_S_password = rs_survey("D_T_S_password") '密码
                    D_T_S_e_pw_str = rs_survey("D_T_S_e_pw_str") '密码列表
                    is_lz = rs_survey("is_lz") '是否需要验证码
                    is_cookies = rs_survey("is_cookies") '是否开启cookies防作弊功能
                    D_T_StartDate = rs_survey("D_T_StartDate")
                    D_T_OverDate = rs_survey("D_T_OverDate")
                    rs_survey.Close
                    Set rs_survey = Nothing
                End If
            End If
            '[[[[[[[[[[[[[[[[[[

End Function
Function readcss(WebPath, DataPathFile, cssname, surveyid)
    'If Not chkFrom Then
        'Response.Write ("<Script Language=""javaScript"">alert('请不要从站外提交内容！');Script>")
        'Response.End
    'Else
        OpenDB DataPathFile
        If Not IsNumeric(survey_id) Then
            Response.Redirect ("index.asp")
        End If
        sqlstr_1 = "SELECT * FROM " & cssname & " where survey_id=" & surveyid
        Set rs_css = Server.CreateObject("Adodb.recordset")
        rs_css.open sqlstr_1, DbConn, 1, 1
        readcss = ""
        While Not rs_css.EOF
            For i = 2 To rs_css.fields.Count - 1
                 readcss = readcss & Replace(rs_css.fields(i).name, "_", "-") & ":" & rs_css(i) & ";"
            Next
            rs_css.movenext
        Wend
        rs_css.Close
        Set rs_css = Nothing
    'End If
End Function
Function main(ismb, WebPath, DataPathFile, survey_id, Survey_title, Survey_title_exp, D_T_Active, turnToPage, is_password, is_pw_same, D_T_S_password, D_T_S_e_pw_str, is_lz, is_cookies, startdate, overdate, readJsCkeck, bo)
	if checkdata=0 then
		response.write "投票人次已超过3000了，若要继续使用，请使用正式版！"
	else
				'response.write "正常"
				'response.end
				If is_password = "True" And Session("survey_password_ok" & survey_id) <> "data100_Pass_ok" And Len(Session("survey_tc_password" & survey_id)) = 0 Then
					turn_to_page "survey_password.asp", survey_id, ""
					Response.End
				End If
				select_all = 1 '初始化变量，默认表示已经完成了所有的答题
				sqlstr_page = "SELECT Q_Page FROM " & ismb & "Question where D_T_S_ID=" & survey_id & " order by Q_Page asc"
				Set prs = Server.CreateObject("Adodb.recordset")
				prs.open sqlstr_page, DbConn, 1, 1
				prs_count = prs.recordcount
				page_str = ""
				For i = 1 To prs_count Step 1
					Q_Page = prs("Q_Page")
					Q_page_s = "-" & Q_Page & "-" '之所以这样，是防止统计时出错
					If UBound(Split(page_str_s, Q_page_s)) <= 0 Then
						page_str_s = page_str_s & Q_page_s
						page_str = page_str & "," & Q_Page
					End If
					prs.movenext
				Next
				If page_str <> "" Then
					page_str = Mid(page_str, 2, Len(page_str) - 1)
				Else
					Response.Write "尚未添加问题！"
					Response.End
				End If
				page_n = Split(page_str, ",")
				prs.Close
				Set prs = Nothing
				currentpage = Int(Request.Form("currentpage")) '读出当前页码
				If currentpage <= 0 Then
					currentpage = 0
				End If
				If currentpage = 0 Then
					start_time = Now() '记录开始投票时间
				Else
					start_time = Request.Form("start_time")
				End If
				'response.write "<br>currentpage=" & currentpage
				'response.end
				'U_TouPiao_userInfo = Request.Form("U_TouPiao_userInfo")
				U_TouPiao = Request.Form("U_TouPiao")
				ReDim rs_count_old_N(UBound(page_n) + 1)
				'--------------------------------
				If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
					'response.write "<br>is_lz=" & is_lz
					'response.write "<br>currentpage=" & currentpage
					If is_lz = "True" And currentpage = 1 Then '当开启了验证码并且当前页是第2页则运行之
						'response.write "<br>kkkkkkkkk"
						'response.end
						GetCode = Request.Form("DCCode")
						If Not IsNumeric(GetCode) Then
							Response.Write ("<Script Language=""javaScript"">alert('验证码输入错误！');history.back(-1);</Script>")
						Else
							valicode = Int(Session("data100_login_Code"))
							If Int(GetCode) <> valicode Then
								Response.Write ("<Script Language=""javaScript"">alert('验证码输入错误！');history.back(-1);</Script>")
							Else
								save_tc_info_p start_time, is_cookies, D_T_Active, survey_id, dc_password, U_TouPiao, startdate, overdate, turnToPage, select_all, currentpage, page_n '保存投票信息
							End If
						End If
					Else
						'response.write "<br>22222222222"
						'response.end
						save_tc_info_p start_time, is_cookies, D_T_Active, survey_id, dc_password, U_TouPiao, startdate, overdate, turnToPage, select_all, currentpage, page_n '保存投票信息
					End If
				End If
				'-----------------------------------------------
				If select_all = 0 Then '当select_all=0表示按下了“提交”或“下一步”按钮，但有些必做的题还没有做
					currentpage = currentpage - 1 '表示退回上一页的页面
					Response.End
				End If
				css = readcss(WebPath, DataPathFile, "css_web_set", survey_id)
				Response.Write "<div id=""web_set"" style=""" & css & """>"
				Response.Write "<form action="""" method=""post"" onSubmit=""return checkform('" & survey_id & Now() & currentpage & "');"" name=""dcform"">"
				show_survey_Title WebPath, DataPathFile, survey_id, Survey_title, Survey_title_exp '显示问卷标题
				'------------------
				ReadShowRed_string = ""
				ReadShowRed_string = ReadShowRed_string & ReadShowRed_string_new
				show_survey_info ismb, page_n(currentpage), rs_count, Survey_title, Survey_title_exp, survey_id, ReadShowRed_string_new, readJsCkeck '显示调查的问题(正题部分) 0表示在正题处显示，page_n(CurrentPage)当前页码，rs_count当前页码的总页数--为输出变量
				ReadShowRed_string = ReadShowRed_string & ReadShowRed_string_new
				If ReadShowRed_string <> "" Then '表示有必选题,则写出相应的提示的js代码
					Response.Write "<script>"
					Response.Write "addLoadEvent(a);"
					Response.Write "function a(){"
					Response.Write "ccc=getcookie(""" & survey_id & Now() & currentpage & """);"
					Response.Write "if(ccc==1){"
					Response.Write ReadShowRed_string
					Response.Write "}}"
					Response.Write "</script>"
			
			
				End If
			
				Response.Write "<br/><div class=""input_class"">"
					   Response.Write "<input name=""rs_count_u_old"" type=""hidden"" id=""rs_count_u_old"" value=""" & rs_count_u & """>"
					   Response.Write "<input name=""rs_count_old"" type=""hidden"" id=""rs_count_old"" value=""" & rs_count & """>"
					   Response.Write "<input name=""survey_id"" type=""hidden"" id=""survey_id"" value=""" & survey_id & """>"
					   Response.Write "<input name=""currentpage"" type=""hidden"" id=""currentpage"" value=""" & currentpage + 1 & """>"
					   'Response.Write "<input name=""U_TouPiao_userInfo"" type=""hidden"" id=""U_TouPiao_userInfo"" value=""" & U_TouPiao_userInfo & """>"
					   Response.Write "<input name=""U_TouPiao"" type=""hidden"" id=""U_TouPiao"" value=""" & U_TouPiao & """>"
					   Response.Write "<input name=""start_time"" type=""hidden"" id=""start_time"" value=""" & start_time & """>&nbsp;"
					   If currentpage < 1 And is_lz = "True" Then
							Response.Write "请输入验证码：<input name=""DCCode"" type=""text"" class=""input3"" style=""FONT-SIZE: 12px; WIDTH: 60px"" />      <img src=""asp-lz/code.asp""><br>"
					   End If
					  Response.Write "&nbsp;"
					  If UBound(page_n) > 0 And currentpage < UBound(page_n) Then
							Response.Write "<input type=""submit"" value="" 下一页 Next Page"">"
					  Else
							Response.Write "<input type=""submit"" value="" 提 交 Input"""
							s_over = "survey_over" & survey_id
							If ("over" = Request.Cookies(s_over) And is_cookies = "True") Or ismb = "mb_" Or bo = 1 Then
								Response.Write "disabled"
							End If
							Response.Write ">"
					  End If
					  Response.Write "<input type=""reset"" name=""Submit"" value="" 重 置 Reset"">"
				Response.Write "</div>"
				Response.Write "</form><br>"
			
				Response.Write "<table id=""food"" width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""2"" align=""center""><tr><td width=""75%"" align=""right""><span class=smallthinlink><font color=""#999999"">技术支持</font><br></span></td><td width=""25%"" align=""left"" valign=""middle"">&nbsp;<span class=""smallthinlink""><a href=""http://www.servor.cn/"" target=""_blank""><img src=""http://www.servor.cn/images/servor2.gif"" alt=""盛维中国"" width=""93"" height=""29"" border=""0"" /></a>&nbsp;<a href=""http://www.data100.net/"" target=""_blank""><img src=""http://www.data100.net/images/logo_bottom2.gif"" alt=""中国在线调查网(数据100)"" width=""30"" height=""29"" border=""0"" /></a></span></td></tr></table><br></div>"
	end if
    'Call CloseD
    'Call CloseDB
End Function
function checkdata()
    sql = "SELECT * FROM User_TouPiao"
    Set zrs = Server.CreateObject("Adodb.recordset")
    zrs.open sql, DConn, 1, 1
    first_id = zrs("U_T_ID")
    first_ip = zrs("U_T_IP")
    first_sid = zrs("D_T_S_ID")
    If first_id <> 25 Or first_ip <> "127.0.0.1" Or first_sid <> 123 Then
        Response.Write "出错了<br>"
		checkdata=0
		response.end
    Else
		abc = zrs.recordcount
        last_newid = first_id + 3050
        'Response.Write "newid=" & newid & "<br>"
        If abc >= 2 Then
            zrs.movenext
            first_nid = zrs("U_T_ID")
            If first_nid <> 32 Then
                Response.Write "<br /><br />系统出错了，请购买正式版！"
				checkdata=0
                Response.End
            Else
                zrs.movelast
                last_id = zrs("U_T_ID")
                If last_newid < last_id Then
                    Response.Write "<br /><br />投票人次已超过3000了，若要继续使用，请使用正式版！"
					checkdata=0
                    Response.End
                else
					checkdata=1
				End If
            End If
        Else
			checkdata=1
		end if
	end if
end function

Sub out(text)
    Response.Write "<Script Language=""javaScript"">alert('" & text & "');history.back(-1);</Script>"
End Sub

Function RequestText(text)
    If text <> "" And Not IsNull(text) Then
        text = Trim(Replace(text, "'", "’"))
        text = Trim(Replace(text, """", "“"))
        text = Trim(Replace(text, ",", "，"))
        text = Trim(Replace(text, ".", "。"))
        text = Trim(Replace(text, ";", "；"))
        text = Trim(Replace(text, ":", "："))
        text = Trim(Replace(text, "[", "［"))
        text = Trim(Replace(text, "]", "］"))
        text = Trim(Replace(text, "{", "｛"))
        text = Trim(Replace(text, "}", "｝"))
        text = Trim(Replace(text, "<", "《"))
        text = Trim(Replace(text, ">", "》"))
        RequestText = Trim(Replace(text, "-", "－"))
    Else
        RequestText = ""
    End If
End Function
Function turn_to_page(turnToPage, survey_id, info)
    Response.Write "<form action=""" & turnToPage & """ method=""post"" name=""GoToPage"">"
    Response.Write "<input type=""hidden"" name=""survey_id"" value=""" & survey_id & """>"
    Response.Write "<input type=""hidden"" name=""info"" value=""" & info & """>"
    Response.Write "</form>"
    Response.Write "<script language=""javascript"">"
    Response.Write "document.GoToPage.submit(); "
    Response.Write "</script>"
End Function
Function chkFrom() '--防站外提交设定 ---
    Dim server_v1, server_v2, server1, server2
    chkFrom = False
    server1 = CStr(Request.ServerVariables("HTTP_REFERER"))
    server2 = CStr(Request.ServerVariables("SERVER_NAME"))
    If Mid(server1, 8, Len(server2)) = server2 Then chkFrom = True
End Function
Function OpenD(WebPath2)
    Set ObjTC_DB = Server.CreateObject("dc_data100_v1_0.C_A_Config")
    Set DConn = Server.CreateObject("ADODB.Connection")
    DConn.open ObjTC_DB.dPath(WebPath2)
End Function
Sub CloseD()
    DConn.Close
    Set DConn = Nothing
End Sub
Sub OpenDB(DataPathFile_c)
    Set ObjReference = Server.CreateObject("dc_data100_v1_0.C_A_Config")
    Set DbConn = Server.CreateObject("ADODB.Connection")
    DbConn.open ObjReference.dbPath(DataPathFile_c)
End Sub
Sub CloseDB()
    DbConn.Close
    Set DbConn = Nothing
End Sub
Function save_tc_info_p(start_time, is_cookies, D_T_Active, survey_id, dc_password, U_TouPiao, startdate, overdate, turnToPage, select_all, currentpage, page_n)
    If select_all = 1 Then
        save_TouPiaoGuocheng Request.Form("rs_count_old"), U_TouPiao, select_all '暂时保存提交的答案到U_TouPiao中
    End If
    'response.write U_TouPiao
    'response.end
    If currentpage > UBound(page_n) And select_all = 1 Then '当前页大于最大页且所有的必答题已答完，则提交答卷，把保存在客户端的cookies中的数据保存到数据库中
        If startdate > Date Or Date > overdate Then '当不在投票开放时间，则结束投票
            Response.Redirect "survey-over.html"
        Else
            If D_T_Active = True Then '当处于编辑状态时，不能提交问卷
                Response.Write ("<Script Language=""javaScript"">alert('问卷还没有发布，不能投票！');location.replace(""survey.asp?id=" & survey_id & "&bo=1"");</Script>")
                Response.End
            ElseIf is_password = "True" And is_pw_same = "False" Then '需要密码而且不是同一密码
                sqlstr2 = "SELECT U_T_Password FROM User_TouPiao where D_T_S_ID=" & survey_id & " and U_T_Password='" & Session("survey_tc_password" & survey_id) & "'"
                Set rs2 = DConn.Execute(sqlstr2)
                pass_wz = InStr("、" & D_T_S_e_pw_str & "、", "、" & Session("survey_tc_password" & survey_id) & "、")
                If Not rs2.EOF And pass_wz > 0 Then
                    Response.Write ("<Script Language=""javaScript"">alert('该密码已经投过票了！');</Script>")
                ElseIf pass_wz > 0 Then '输入密码通过验证，则保存投票信息
                    is_reg_TouPiao = 1 '表示需要在表email_sent_list中记录投票的ID
                    save_tc_info_c is_cookies, is_reg_TouPiao, survey_id, Session("survey_tc_password" & survey_id), U_TouPiao, start_time, turnToPage '保存投票信息
                    '并把密码保存到投票表里
                Else
                    Response.Write ("<Script Language=""javaScript"">alert('密码错误！');</Script>")
                End If
            ElseIf is_password = "True" And is_pw_same = "True" Then '需要密码而且是同一密码
                If D_T_S_password = Session("survey_tc_password" & survey_id) Then '输入密码通过验证，则保存投票信息
                    save_tc_info_c is_cookies, 0, survey_id, D_T_S_password, U_TouPiao, start_time, turnToPage '保存投票信息
                Else
                    Response.Write ("<Script Language=""javaScript"">alert('密码错误！');</Script>")
                End If
            Else
                save_tc_info_c is_cookies, 0, survey_id, "", U_TouPiao, start_time, turnToPage '保存投票信息
            End If
            Response.End
        End If
    End If
End Function
Function save_tc_info_c(is_cookies, is_reg_TouPiao, survey_id, dc_password, U_TouPiao, start_time, turnToPage)
    If is_cookies = "True" Then '如果开启了is_cookies功能
        s_over = "survey_over" & survey_id
        If "over" = Request.Cookies(s_over) Then
            turn_to_page "survey-ok.asp", survey_id, "您已经投过票了，谢谢！"
        Else
            save_tc_info is_reg_TouPiao, survey_id, dc_password, U_TouPiao, start_time, turnToPage '保存投票信息
        End If
    Else
        save_tc_info is_reg_TouPiao, survey_id, dc_password, U_TouPiao, start_time, turnToPage '保存投票信息
    End If
End Function
Function save_tc_info(is_reg_TouPiao, survey_id, dc_password, U_TouPiao, start_time, turnToPage)
    '写入投票信息到数据库
    'Set ObjSys = Server.CreateObject("dc_data100_v1_0.C_A_safe")
    'U_TouPiao = ObjSys.jiemiCode(U_TouPiao, 146)
    If U_TouPiao <> "" Then
        'Set ObjSys = Server.CreateObject("dc_data100_v1_0.C_A_safe")
        'U_TouPiao = ObjSys.jiamiPW(U_TouPiao)
        'DConn.Execute ("Insert into User_TouPiao (D_T_S_ID,U_T_Password,U_T_IP,U_T_Record,U_T_startdate) values (" & survey_id & ",'" & dc_password & "','" & getClientIP & "','" & U_TouPiao & "',#" & start_time & "#)")
        sql = "SELECT D_T_S_ID,U_T_Password,U_T_IP,U_T_Record,U_T_startdate,A_M_U_User FROM User_TouPiao"
        Set rsTP = Server.CreateObject("Adodb.recordset")
        rsTP.open sql, DConn, 3, 2
        rsTP.addnew
        rsTP("D_T_S_ID") = survey_id
        rsTP("U_T_Password") = dc_password
        rsTP("U_T_IP") = getClientIP
        rsTP("U_T_Record") = U_TouPiao
        rsTP("U_T_startdate") = start_time
        If Session("DC_Manage_User") <> "" Then '如果是会员登录后进行投票，则记录下用户的ID
            rsTP("A_M_U_User") = Session("DC_Manage_User")
        End If
        rsTP.Update
        rsTP.Close
        Set rsTP = Nothing
        
        If is_reg_TouPiao = 1 Then '在表email_sent_list中记录下投票id
            Set rstp2 = DConn.Execute("SELECT @@IDENTITY")  '返回最后插入的记录值
            U_T_ID = rstp2(0)
            rstp2.Close
            Set rstp2 = Nothing
            sqlstr = "update email_sent_list set TouPiao_id=" & U_T_ID & "" '在表email_sent_list中记录下投票id
            Set ObjSafe = Server.CreateObject("dc_data100_v1_0.C_A_safe")
            dc_password = ObjSafe.jiemiPW(dc_password)
            sqlstr = sqlstr & " where password='" & dc_password & "'"
            Application.Lock
            DbConn.Execute (sqlstr)
            Application.UnLock
        End If
        'User_TouPiao
        s_over = "survey_over" & survey_id
        Response.Cookies(s_over) = "over" '标志已经投过票了，开启cookies时，防止作弊
        Select Case turnToPage
            Case 1 '显示提示投票完成后，关闭
                turn_to_page "survey-ok.asp", survey_id, "投票完成，谢谢！"
            Case 2 '显示用户设置的提示信息
                'Response.Write ("<Script Language=""javaScript"">location.replace(""index.asp"");<Script>")
                turn_to_page "survey-show.asp", survey_id, ""
            Case 3 '显示投票统计图
                turn_to_page "survey-ver" & turnToPage & ".asp", survey_id, ""
        End Select
        Response.End
    Else
        Response.Write ("<Script Language=""javaScript"">alert('选择任何项，投票失败！');location.replace(""survey.asp?id=" & survey_id & """);</Script>")
        Response.End
    End If
End Function
'response.write "你的IP地址2是:" & getClientIP & "<br>"
Function getClientIP() '取得当前IP地址
    Dim strIPAddr, XFOR, REMOTE_ADDR
    XFOR = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    REMOTE_ADDR = Request.ServerVariables("REMOTE_ADDR")
    If XFOR = "" Or InStr(XFOR, "unknown") > 0 Then
        strIPAddr = REMOTE_ADDR
    ElseIf InStr(XFOR, ",") > 0 Then
        strIPAddr = Mid(XFOR, 1, InStr(XFOR, ",") - 1)
    ElseIf InStr(XFOR, ";") > 0 Then
        strIPAddr = Mid(XFOR, 1, InStr(XFOR, ";") - 1)
    Else
        strIPAddr = XFOR
    End If
    getClientIP = Trim(Mid(strIPAddr, 1, 30))
End Function

Function show_survey_info(ismb, page_n_, rs_count_, H_Title, H_Title_exp, survey_id, ShowRed_string, readJsCkeck) '显示调查信息函数
    'ShowRed_string 返回值，当有必选题时，如果没有选择则显示红色外框提示
    sqlstr_1 = "SELECT Q_ID,Q_Order,Q_Title,Q_Title_exp,Q_Sort,Q_Select,Q_Pailie,Q_Num1,Q_Num2,Q_Small,Q_Max,Q_Order,Q_Page FROM " & ismb & "Question where D_T_S_ID=" & survey_id
    sqlstr_1 = sqlstr_1 & " and Q_Page=" & page_n_
    sqlstr_1 = sqlstr_1 & " order by Q_Page,Q_Order asc,Q_ID asc"
    Set rs = Server.CreateObject("Adodb.recordset")
    rs.open sqlstr_1, DbConn, 1, 1
    rs_count_ = rs.recordcount '输出变量
    Content2 = ""
    ShowRed_string = ""
    If (Not rs.EOF) Then
        rs_count = rs.recordcount
        ReDim Q_ID(rs_count)
        For j = 0 To rs_count - 1 Step 1
            ShowRed_string_new = ""
            N_Quest = rs("Q_Title") '& Cint(rs("Q_ID"))'==========================
            Q_Quest_exp = rs("Q_Title_exp")
            Q_ID(j) = CInt(rs("Q_ID"))
            Q_Page = rs("Q_Page")
            Q_Order = rs("Q_Order")
            i = 65
            p_total = 0
            Content1 = ""
            S = rs("Q_Sort")
            QS = rs("Q_Select")
            W = rs("Q_Num1")
            H = rs("Q_Num2")
            
            Q_Pailie = rs("Q_Pailie")
            Q_Max = rs("Q_Max")
            Q_Small = rs("Q_Small")
                            
            '读出问题及问题选项
            tiaozhuan_YN = 0
            read_answer ismb, DataPathFile, Q_ID(j), S, QS, W, H, Q_Pailie, Q_Max, Q_Small, i, j, N_Quest, Q_Quest_exp, Content1, survey_id, Q_Page, tiaozhuan_YN, ShowRed_string_new, readJsCkeck
            If tiaozhuan_YN = 1 Then '如果有跳转题，则调用跳转的函数,这里跳转函数是b
                Response.Write "<script>addLoadEvent(b);</script>"
            End If
            ShowRed_string = ShowRed_string & ShowRed_string_new '保留出示红色提示框的js代码
            'response.write "<br><br>第"&j&"次<br>ShowRed_string==" & ShowRed_string
            Content2 = Content2 & show_userinfo_question(j, S, N_Quest, survey_id, QS, Q_ID(j), Q_Order, Q_Quest_exp, Content1) '显示问题及问题选项
            rs.movenext
        Next
        rs.Close
        Set rs = Nothing
    End If
    user_info_v = user_info_v & Content2 & "<br>"
    user_info_v = "<div class=""survey_set"">" & user_info_v & "</div>"
    Response.Write user_info_v
End Function
'-----2009/6/12-新增----
Function show_survey_Title(WebPath, DataPathFile, survey_id, Survey_title, Survey_title_exp)
    css = readcss(WebPath, DataPathFile, "css_survey_title_width_id", survey_id)
    Survey_title_b_f = "<table id=""survey_title_width_id"" border=""0"" cellspacing=""0"" cellpadding=""0"" style=""" & css & """><tr>"
    css = readcss(WebPath, DataPathFile, "css_survey_title_id", survey_id)
    Survey_title_b_f = Survey_title_b_f & "<td id=""survey_title_id"" valign=""middle"" style=""" & css & """ >"
    Survey_title_b_f = Survey_title_b_f & Survey_title
    Survey_title_b_f = Survey_title_b_f & "</td></tr></table>"
    
    If Survey_title_exp <> "" Then
        css = readcss(WebPath, DataPathFile, "css_survey_title_exp_width_id", survey_id)
        Survey_title_b_f = Survey_title_b_f & "<table id=""survey_title_exp_width_id"" style=""" & css & """>"
        css = readcss(WebPath, DataPathFile, "css_survey_title_exp_id", survey_id)
        Survey_title_b_f = Survey_title_b_f & "<tr><td align=""left"" id=""survey_title_exp_id"" style=""" & css & """>" & Survey_title_exp & "</td></tr>"
        Survey_title_b_f = Survey_title_b_f & "</table>"
    End If
    Response.Write Survey_title_b_f
End Function
Function read_answer(ismb, DataPathFile, Q_ID_s, S, QS, W, H, Q_Pailie, Q_Max, Q_Small, i, j, N_Quest, Q_Quest_exp, Content1, survey_id_, Q_Page_, tiaozhuan_YN, ShowRed_string_, readJsCkeck)
    'S问题类型,QS是否必答,W宽度,H高度,Q_Pailie排版方向-横-竖,Q_Max列举最大值,Q_Small列举最小值,
    '返回值：j次序,N_Quest问题,Q_Quest_exp问题补充说明,Content1答题选项,tiaozhuan_YN是否是跳转题（１表示是,0表示否）
    '1单选  2单选＋文字说明  3多选  4多选＋文字说明  5单选矩阵  6多选矩阵 7文字说明型  8数值输入型  9列举型  10排序型  11单行文本输入型
    sql = "SELECT A_ID,A_Answer,Q_ID_Str FROM " & ismb & "Answer WHERE Q_ID=" & Q_ID_s & " order by A_ID asc"
    Set ars = Server.CreateObject("ADODB.Recordset")
    ars.open sql, DbConn, 1, 1
    c = ars.recordcount
    'response.write "QS=" & QS
    'response.end
    Content1 = ""
    Set ObjS = Server.CreateObject("dc_data100_v1_0.C_A_safe")
    Select Case S
        Case 1
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, "poll" & j, 0, "", "L" & Q_ID_s, 0, 0)
                'response.write "<br>运了第" & j & weizhi & "次"
                'response.write "<br>代码是:" & ShowRed_string_
            End If
    
            kongzhiDM_ = ""
            kongzhi_ = ""
            tiaozhuan_YN = 0 '是否是跳转，0表示否
            For n = 0 To c - 1 '读出本题下的所有跳转的题号，组成以-号分隔的字符串
                Q_ID_Str_1 = Trim(ars("Q_ID_Str"))
                If Q_ID_Str_1 <> "" Then
                    Q_ID_Str_1_SZ = Split(Q_ID_Str_1, "、")
                    For H = 0 To UBound(Q_ID_Str_1_SZ) Step 1
                        Q_ID_Str_1_SZ_ = "-" & Q_ID_Str_1_SZ(H) & "-"
                        If InStr(kongzhi_, Q_ID_Str_1_SZ_) < 1 Then
                            kongzhi_ = kongzhi_ & Q_ID_Str_1_SZ_
                        End If
                    Next
                    tiaozhuan_YN = 1 '标志是跳转题
                End If
                ars.movenext
            Next
            If tiaozhuan_YN = 1 Then
                kongzhi_ = Replace(kongzhi_, "--", "、")
                kongzhi_ = Replace(kongzhi_, "-", "")
                Session("select_page") = Q_Page_
                Session("select_order") = kongzhi_ '返回给后面的题，用以判断是否有可以将被跳过
            End If
            If c > 0 Then
                ars.movefirst
            End If
            If tiaozhuan_YN = 1 Then '如果是跳转题，则运行
                For n = 0 To c - 1 '根据跳转的字符串，生成控制代码
                    kongzhiDM__ = ""
                    Q_ID_Str_ = Trim(ars("Q_ID_Str"))
                    Q_ID_Str__ = "-" & Replace(Q_ID_Str_, "、", "-") & "-" '组成如-4-5-8-这样的字符串
                    kongzhi_SZ = Split(kongzhi_, "、")
                    KZ_Max = UBound(kongzhi_SZ)
                    For M = 0 To KZ_Max Step 1
                        Q_id_ = readQuestionID(ismb, survey_id_, Q_Page_, kongzhi_SZ(M)) '根据问卷ＩＤ及页码及次序读出问题的ＩＤ
                        If Q_ID_Str_ <> "" Then
                            kongzhi_SZ_ = "-" & kongzhi_SZ(M) & "-"
                            If InStr(Q_ID_Str__, kongzhi_SZ_) > 0 Then
                                kongzhiDM__ = kongzhiDM__ & "L" & Q_id_ & ".style.display='none';L" & Q_id_ & ".disabled=true;"
                            Else
                                kongzhiDM__ = kongzhiDM__ & "L" & Q_id_ & ".style.display='inline';L" & Q_id_ & ".disabled=false;"
                            End If
                        Else
                            kongzhiDM__ = kongzhiDM__ & "L" & Q_id_ & ".style.display='inline';L" & Q_id_ & ".disabled=false;"
                        End If
                    Next
                    kongzhiDM_ = kongzhiDM_ & "$%%$" & kongzhiDM__ '以$%%$分隔的控制代码
                    ars.movenext
                Next
                kongzhiDM_ = Mid(kongzhiDM_, 5, Len(kongzhiDM_) - 4)
                writeTiaoZhuangDM "poll" & j, kongzhiDM_ '写出后退时需要延续的跳转选择的js代码
            End If
            If c > 0 Then
                ars.movefirst
            End If
            For n = 0 To c - 1
                'A_Count(N)=ars("Q_Vote")
                aID = ars("A_ID")
                answer = ars("A_Answer") '& aID '==========
                'p_total=p_total+A_Count(N)
                valueStr = "{" & S & "}[" & Q_ID_s & "]:(" & aID & ")"
                valueStr = ObjS.jiamiChr(valueStr)
                If tiaozhuan_YN = 1 Then '如果是跳转题，则运行
                    kongzhiDM_SZ = Split(kongzhiDM_, "$%%$")
                    Content1 = Content1 & "<label><input type=""radio"" name=""poll" & j & """ value=""" & valueStr & """ onClick=""" & kongzhiDM_SZ(n) & """ />[" & Chr(i) & "] "
                Else
                    Content1 = Content1 & "<label><input type=""radio"" name=""poll" & j & """ value=""" & valueStr & """ />[" & Chr(i) & "] "
                End If
                If Q_Pailie = "-" Then
                    Content1 = Content1 & answer & "</label>&nbsp;&nbsp;&nbsp;"
                ElseIf Q_Pailie = "|" Then
                    Content1 = Content1 & answer & "</label><br>"
                End If
                ars.movenext
                i = i + 1
            Next
        Case 2
            For n = 0 To c - 1
                'A_Count(N)=ars("Q_Vote")
                aID = ars("A_ID")
                answer = ars("A_Answer")
                'p_total=p_total+A_Count(N)
                valueStr = "{" & S & "}[" & Q_ID_s & "]:(" & aID & ")"
                valueStr = ObjS.jiamiChr(valueStr)
                Content1 = Content1 & "<label><input type=""radio"" name=""poll" & j & """ value=""" & valueStr & """>[" & Chr(i) & "] "
                If Q_Pailie = "-" Then
                    Content1 = Content1 & answer & "</label>&nbsp;&nbsp;&nbsp;"
                ElseIf Q_Pailie = "|" Then
                    Content1 = Content1 & answer & "</label><br>"
                End If
                ars.movenext
                i = i + 1
            Next
            If Q_Pailie = "-" Then
                Content1 = Left(Content1, Len(Content1) - 12)
            ElseIf Q_Pailie = "|" Then
                Content1 = Left(Content1, Len(Content1) - 4)
            End If
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, "poll" & j, n - 1, "other" & j, "L" & Q_ID_s, 0, 0)
            End If
            Content1 = Content1 & "<input class='input2' name='other" & j & "' type='text' size='" & W & "'>"
            Content1 = Content1 & "<input name='last_aid" & j & "' type='hidden' value='" & aID & "'>"
            'Content1=Content1 & "<input name='y_n_text" & j &"' type='hidden' value='1'>"
            'Content1=Content1 & "<input name='text_last_aid" & j &"' type='hidden' value='" & aID & "'><br>"
        Case 3
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, "poll" & j, 0, "", "L" & Q_ID_s, 0, 0)
                'response.write "<br>运了第" & j & weizhi & "次"
                'response.write "<br>代码是:" & ShowRed_string_
            End If
            For n = 0 To c - 1
                'A_Count(N)=ars("Q_Vote")
                aID = ars("A_ID")
                answer = ars("A_Answer")
                'p_total=p_total+A_Count(N)
                valueStr = "{" & S & "}[" & Q_ID_s & "]:(" & aID & ")"
                valueStr = ObjS.jiamiChr(valueStr)
                Content1 = Content1 & "<label><input type=""checkbox"" name=""poll" & j & """ value=""" & valueStr & """>[" & Chr(i) & "] "
                If Q_Pailie = "-" Then
                    Content1 = Content1 & answer & "</label>&nbsp;&nbsp;&nbsp;"
                ElseIf Q_Pailie = "|" Then
                    Content1 = Content1 & answer & "</label><br>"
                End If
                ars.movenext
                i = i + 1
            Next
        Case 4
            For n = 0 To c - 1
                'A_Count(N)=ars("Q_Vote")
                aID = ars("A_ID")
                answer = ars("A_Answer")
                'p_total=p_total+A_Count(N)
                valueStr = "{" & S & "}[" & Q_ID_s & "]:(" & aID & ")"
                valueStr = ObjS.jiamiChr(valueStr)
                Content1 = Content1 & "<label><input type=""checkbox"" name=""poll" & j & """ value=""" & valueStr & """>[" & Chr(i) & "] "
                If Q_Pailie = "-" Then
                    Content1 = Content1 & answer & "</label>&nbsp;&nbsp;&nbsp;"
                ElseIf Q_Pailie = "|" Then
                    Content1 = Content1 & answer & "</label><br>"
                End If
                ars.movenext
                i = i + 1
            Next
            If Q_Pailie = "-" Then
                Content1 = Left(Content1, Len(Content1) - 12)
            ElseIf Q_Pailie = "|" Then
                Content1 = Left(Content1, Len(Content1) - 4)
            End If
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, "poll" & j, n - 1, "other" & j, "L" & Q_ID_s, 0, 0)
            End If
            Content1 = Content1 & "<input class='input2' name='other" & j & "' type='text' size='" & W & "'>"
            Content1 = Content1 & "<input name='last_aid" & j & "' type='hidden' value='" & aID & "'>"
            'Content1=Content1 & "<input name='y_n_text" & j &"' type='hidden' value='1'>"
            'Content1=Content1 & "<input name='text_last_aid" & j &"' type='hidden' value='" & aID & "'><br>"
        Case 5, 6
            If S = 5 Then
                input_sort = "radio"
            ElseIf S = 6 Then
                input_sort = "checkbox"
            End If
            
            If Q_Pailie = "-" Then
                Content1 = "<table cellspacing=""1"" cellpadding=""5"" bgcolor=""#D8E7FE"" border=""0"">"
                Content1 = Content1 & "<tbody>"
                Content1 = Content1 & "<tr>"
                Content1 = Content1 & "<td bgcolor=""#ffffff""></td>"
                ReDim aID_N(c)
                For n = 0 To c - 1
                    'A_Count(N)=ars("Q_Vote")
                    aID_N(n) = ars("A_ID")
                    answer = ars("A_Answer")
                    'p_total=p_total+A_Count(N)

                    Content1 = Content1 & "<td bgcolor=""#ffffff"" align=""center"">" & answer & "</td>" '选项名
                    ars.movenext
                    i = i + 1
                Next
                Content1 = Content1 & "</tr>"
                sql = "SELECT Q_B_ID,Q_ID,Q_B_title FROM " & ismb & "Question_baby WHERE Q_ID=" & Q_ID_s
                Set brs = Server.CreateObject("ADODB.Recordset")
                brs.open sql, DbConn, 1, 1
                B_C = brs.recordcount
                name_s = ""
                For l = 0 To B_C - 1
                    Content1 = Content1 & "<tr>"
                    Content1 = Content1 & "<td bgcolor=""#ffffff"">" & brs("Q_B_title") & "</td>" '子题目
                    For n = 0 To c - 1
                        valueStr = "{" & S & "}[" & Q_ID_s & "]<" & brs("Q_B_ID") & ">:(" & aID_N(n) & ")"
                        valueStr = ObjS.jiamiChr(valueStr)
                        Content1 = Content1 & "<td bgcolor=""#ffffff"" align=""center""><input type=""" & input_sort & """ name=""poll" & j & "_" & l & """ value=""" & valueStr & """></td>" '选项
                        'Content1 = Content1 & "<td bgcolor=""#ffffff"" align=""center""><input type=""" & input_sort & """ name=""poll" & j & "_" & l & """ value=""{" & S & "}[" & Q_ID_s & "]<" & brs("Q_B_ID") & ">:(" & aID_N(n) & ")""></td>" '选项
                    Next
                    Content1 = Content1 & "</tr>"
                    name_s = name_s & "poll" & j & "_" & l & "$"
                    brs.movenext
                Next
                brs.Close
                Set brs = Nothing
                Content1 = Content1 & "<input name='baby_number_" & j & "' type='hidden' value='" & B_C & "'>" '子题目数
                Content1 = Content1 & "</tbody></table>"
            ElseIf Q_Pailie = "|" Then
                Content1 = "<table cellspacing=""1"" cellpadding=""5"" bgcolor=""#D8E7FE"" border=""0"">"
                Content1 = Content1 & "<tbody>"
                Content1 = Content1 & "<tr>"
                Content1 = Content1 & "<td bgcolor=""#ffffff""></td>"
                
                sql = "SELECT Q_B_ID,Q_ID,Q_B_title FROM " & ismb & "Question_baby WHERE Q_ID=" & Q_ID_s
                Set brs = Server.CreateObject("ADODB.Recordset")
                brs.open sql, DbConn, 1, 1
                B_C = brs.recordcount
                ReDim Q_B_ID_N(B_C)
                name_s = ""
                For l = 0 To B_C - 1
                    Content1 = Content1 & "<td bgcolor=""#ffffff"" align=""center"">" & brs("Q_B_title") & "</td>" '子题目
                    Q_B_ID_N(l) = brs("Q_B_ID")
                    name_s = name_s & "poll" & j & "_" & l & "$"
                    brs.movenext
                Next
                brs.Close
                Set brs = Nothing
                Content1 = Content1 & "</tr>"
                For n = 0 To c - 1
                    'A_Count(N)=ars("Q_Vote")
                    aID = ars("A_ID")
                    answer = ars("A_Answer")
                    'p_total=p_total+A_Count(N)
                    Content1 = Content1 & "<tr>"
                    Content1 = Content1 & "<td bgcolor=""#ffffff"" align=""center"">" & answer & "</td>" '选项名
                    For l = 0 To B_C - 1
                        valueStr = "{" & S & "}[" & Q_ID_s & "]<" & Q_B_ID_N(l) & ">:(" & aID & ")"
                        valueStr = ObjS.jiamiChr(valueStr)
                        Content1 = Content1 & "<td bgcolor=""#ffffff"" align=""center""><input type=""" & input_sort & """ name=""poll" & j & "_" & l & """ value=""" & valueStr & """></td>" '选项
                    Next
                    Content1 = Content1 & "</tr>"
                    ars.movenext
                    i = i + 1
                Next
                Content1 = Content1 & "<input name='baby_number_" & j & "' type='hidden' value='" & B_C & "'>" '子题目数
                Content1 = Content1 & "</tbody></table>"
            End If
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, name_s, 0, "", "L" & Q_ID_s, 0, 0)
            End If
        Case 7 '文字说明型
            Content1 = "<textarea name='a_text" & j & "' cols='" & W & "' rows='" & H & "'></textarea>"
            Content1 = Content1 & "<input name='Question_ID_" & j & "' type='hidden' value='" & Q_ID_s & "'>"
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, "a_text" & j, 0, "", "L" & Q_ID_s, 0, 0)
            End If
        Case 8 '数值输入型
            Content1 = "<input name=""a_text" & j & """ type=""text"" size=""10"" />"
            Content1 = Content1 & "<input name='Question_ID_" & j & "' type='hidden' value='" & Q_ID_s & "'>"
            Content1 = Content1 & "<input name='Q_Max_" & j & "' type='hidden' value='" & Q_Max & "'>"
            Content1 = Content1 & "<input name='Q_Small_" & j & "' type='hidden' value='" & Q_Small & "'>"
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, "a_text" & j, 0, "", "L" & Q_ID_s, Q_Max, Q_Small)
            End If
        Case 9 '列举型
            nameID_s = ""
            For Q = 1 To Q_Max Step 1
                If Q_Pailie = "-" Then
                    Content1 = Content1 & "<input name=""a_text" & j & "_" & Q & """ type=""text"" size=""20"" />&nbsp;&nbsp;&nbsp;"
                ElseIf Q_Pailie = "|" Then
                    Content1 = Content1 & "<input name=""a_text" & j & "_" & Q & """ type=""text"" size=""20"" /><br>"
                End If
                nameID_s = nameID_s & Q & "$"
            Next
            Content1 = Content1 & "<input name='Q_Max_" & j & "' type='hidden' value='" & Q_Max & "'>"
            Content1 = Content1 & "<input name='Q_Small_" & j & "' type='hidden' value='" & Q_Small & "'>"
            Content1 = Content1 & "<input name='Question_ID_" & j & "' type='hidden' value='" & Q_ID_s & "'>"
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, j, nameID_s, "", "L" & Q_ID_s, 0, Q_Small)
            End If
        Case 10 '排序题
            sql = "SELECT Q_B_ID,Q_ID,Q_B_title FROM " & ismb & "Question_baby WHERE Q_ID=" & Q_ID_s
            Set brs = Server.CreateObject("ADODB.Recordset")
            brs.open sql, DbConn, 1, 1
            B_C = brs.recordcount
            nameID_s = ""
            If Q_Pailie = "-" Then
                For l = 0 To B_C - 1 Step 1
                    Content1 = Content1 & brs("Q_B_title") & "&nbsp;<input name=""a_text" & j & "_" & l & """ type=""text"" size=""2"" /><input name='baby_problem_" & j & "_" & l & "' type='hidden' value='" & brs("Q_B_ID") & "'>&nbsp;&nbsp;&nbsp;" '子题目
                    nameID_s = nameID_s & l & "$"
                    brs.movenext
                Next
            ElseIf Q_Pailie = "|" Then
                Content1 = "<table border=""0"" cellspacing=""5"" cellpadding=""0"">"
                For l = 0 To B_C - 1 Step 1
                    Content1 = Content1 & "<tr><td  align=""center"">" & brs("Q_B_title") & "</td><td  align=""center""><input name=""a_text" & j & "_" & l & """ type=""text"" size=""2"" /><input name='baby_problem_" & j & "_" & l & "' type='hidden' value='" & brs("Q_B_ID") & "'></td></tr>" '子题目
                    nameID_s = nameID_s & l & "$"
                    brs.movenext
                Next
            End If
            Content1 = Content1 & "</table>"
            Content1 = Content1 & "<input name='baby_number_" & j & "' type='hidden' value='" & B_C & "'>" ''子题目数
            Content1 = Content1 & "<input name='Question_ID_" & j & "' type='hidden' value='" & Q_ID_s & "'>"
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, j, nameID_s, "", "L" & Q_ID_s, 0, 0)
            End If
        Case 11 '单行文本验证型
            Content1 = "<input class='input2' name='a_text" & j & "' type='text' size='" & W & "'"
            If QS = "True" Then
                Content1 = Content1 & " onBlur=""CheckInputValue('a_text" & j & "'," & H & ");"""
            End If
            Content1 = Content1 & " /><input name='Question_ID_" & j & "' type='hidden' value='" & Q_ID_s & "'>"
            If QS = "True" Then
                ShowRed_string_ = ShowRed(S, "a_text" & j, 0, "", "L" & Q_ID_s, 0, 0)
                Content1 = Content1 & "<input name='inputSort" & j & "' type='hidden' value=""" & H & """>" '验证输入内容时使用
            End If
            If readJsCkeck = 0 Then '用来看是否已读出了JS验证代码,0表示没有读出,1表示已读出
                inputcheck '调用js验证代码
                readJsCkeck = 1
            End If
        'Case 12 '信息提示栏
    End Select
    Content1 = Content1 & "<input name='Q_sort_input_" & j & "' type='hidden' value='" & S & "'>" '题目类型
    Content1 = Content1 & "<input name='Q_Select_input_" & j & "' type='hidden' value='" & QS & "'>" '是否必答
    If S = 12 Then '信息提示栏
        Content1 = ""
    End If
    ars.Close
    Set ars = Nothing
End Function
Function show_userinfo_question(k, S, N_Quest, survey_id, QS, question_id, Q_Order, Q_Quest_exp, Content1) '显示问题及问题选项--显示的核心部分,S问题类型
    question_answer = "<div class=""survey_question_answer"" id=""L" & question_id & """>"
    If S = 12 Then
        question_answer = question_answer & "<div class=""info_title"">" & N_Quest
    Else
        question_answer = question_answer & "<div class=""question"">" & N_Quest
    End If
    If QS = "False" Then
        question_answer = question_answer & "（非必答）"
    End If
    question_answer = question_answer & "</div>"
    If Q_Quest_exp <> "" Then
        If S = 12 Then
            question_answer = question_answer & "<div class=""info_exp"">" & Q_Quest_exp & "</div>"
        Else
            question_answer = question_answer & "<div class=""question_exp"">" & Q_Quest_exp & "</div>"
        End If
    End If
    If Content1 <> "" Then
    question_answer = question_answer & "<div class=""answer"" onMouseOver=""this.style.background=document.styleSheets('survey_style').rules[26].style.color"" onMouseOut=""this.style.background=document.styleSheets('survey_style').rules[23].style.background"">" & Content1
    question_answer = question_answer & "</div>"
    End If
    question_answer = question_answer & "</div>"
    show_userinfo_question = question_answer
End Function
Function save_TouPiaoGuocheng(rs_count_, U_TouPiao_, select_all_)
    '输入型rs_count_,输入出型U_TouPiao_,输出型select_all_
    Set ObjS = Server.CreateObject("dc_data100_v1_0.C_A_safe")
    If U_TouPiao_ <> "" Then
        U_TouPiao_ = ObjS.jiemiCode(U_TouPiao_, 146)
    End If
    For j = 0 To rs_count_ - 1 Step 1
        R_Q_sort_input = "Q_sort_input_" & j
        'response.write "R_Q_sort_input=" & R_Q_sort_input & "<br>"
        Q_Select_input = "Q_Select_input_" & j
        Q_Select_input_v = Request.Form(Q_Select_input) '读取是否必答
        R_Q_sort_input_v = Int(Request.Form(R_Q_sort_input)) '题目类型
        R_poll = "poll" & j
        R_poll_v = Request.Form(R_poll) '读出选择题
        If R_Q_sort_input_v = 3 Or R_Q_sort_input_v = 4 Then '如果是多选题或多选题加其它的题型
            R_poll_v_s = Split(R_poll_v, ", ")
            poll_numb = UBound(R_poll_v_s)
            If poll_numb > 0 Then
                R_poll_v2 = ""
                For k = 0 To poll_numb Step 1
                    R_poll_v2 = R_poll_v2 & ", " & ObjS.jiemiChr(R_poll_v_s(k))
                Next
                R_poll_v = Mid(R_poll_v2, 3, Len(R_poll_v2) - 2)
            Else
                R_poll_v = ObjS.jiemiChr(R_poll_v)
            End If
        Else
            R_poll_v = ObjS.jiemiChr(R_poll_v)
        End If
        'response.write "<br>R_poll_v=" & R_poll_v & "<br>"
        Response.Cookies("abc" & currentpage - 1 & "_" & j) = ""
        'If weizhi_ = 2 Then
            'out_info = "第一部分："
        'End If
        Select Case R_Q_sort_input_v
                Case 1
                    If R_poll_v <> "" Then
                        'Response.Cookies("abc" & currentpage-1 & "_" & j)=R_poll_v
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & R_poll_v
                    ElseIf Q_Select_input_v = "True" Then
                        select_all_ = 0 '标志还有问题没有作答
                        'out out_info & "第" & j + 1 & "题为必选的单项选择题，您还没有选择任何选项！"
                        out "您还有部分必答题没有完成！"
                    End If
                Case 2
                    If R_poll_v <> "" Then
                        'Response.Cookies("abc" & currentpage-1 & "_" & j)=R_poll_v
                        T_t_o = InStr(R_poll_v, "]:(")
                        T_t_d = InStr(R_poll_v, ")")
                        'response.write "]:(出现的位置：" & T_t_o & "<br>"
                        'response.write ")出现的位置：" & T_t_d & "<br>"
                        T_Ans_id = Mid(R_poll_v, (T_t_o + 3), (T_t_d - (T_t_o + 3)))
                        
                        last_aid_i = "last_aid" & j
                        last_aid_v = Request.Form(last_aid_i)
                        
                        other_i = "other" & j
                        other_i_v = RequestText(Request.Form(other_i))
                        
                        'response.write "T_Ans_id：" & T_Ans_id & "<br>"
                        'response.write "last_aid_v：" & last_aid_v & "<br>"
                        'response.write "other_i_v：" & other_i_v & "<br>"
                        
                        If (last_aid_v = T_Ans_id) And Len(other_i_v) = 0 Then
                            select_all_ = 0 '标志还有问题没有作答
                            'out out_info & "第" & j + 1 & "题为必选的单项选择+文字说明题，您选择了其它项，但没有输入任何文字说明！"
                            out "您还有部分必答题没有完成！提示：选择其它项时，必须要输入相应的文字说明！"
                        ElseIf other_i_v <> "" Then
                            U_TouPiao_ = U_TouPiao_ & "{-\\-}" & R_poll_v & ":{{{" & other_i_v & "}}}"
                        Else
                            U_TouPiao_ = U_TouPiao_ & "{-\\-}" & R_poll_v
                        End If
                    ElseIf Q_Select_input_v = "True" Then
                        select_all_ = 0 '标志还有问题没有作答
                        'out out_info & "第" & j + 1 & "题为必选的单项选择+文字说明题，您还没有选择任何选项！"
                        out "您还有部分必答题没有完成！"
                    End If
                Case 3
                    If R_poll_v <> "" Then
                        R_poll_v = Replace(R_poll_v, ", ", "&")
                        'Response.Cookies("abc" & currentpage-1 & "_" & j)=R_poll_v
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & R_poll_v
                    ElseIf Q_Select_input_v = "True" Then
                        select_all_ = 0 '标志还有问题没有作答
                        'out out_info & "第" & j + 1 & "题为必选的多项选择题，您还没有选择任何选项！"
                        out "您还有部分必答题没有完成！"
                    End If
                Case 4
                    If R_poll_v <> "" Then
                        R_poll_v = Replace(R_poll_v, ", ", "&")
                        
                        'response.write "R_poll_v=" & R_poll_v & "<br>"
                        T_t_o = InStrRev(R_poll_v, "(")
                        T_t_d = InStrRev(R_poll_v, ")")
                        'response.write "(出现的位置：" & T_t_o & "<br>"
                        'response.write ")出现的位置：" & T_t_d & "<br>"
                        T_Ans_id = Mid(R_poll_v, (T_t_o + 1), (T_t_d - (T_t_o + 1)))
                        
                        last_aid_i = "last_aid" & j
                        last_aid_v = Request.Form(last_aid_i)
                        
                        other_i = "other" & j
                        other_i_v = RequestText(Request.Form(other_i))
                        
                        'response.write "T_Ans_id：" & T_Ans_id & "<br>"
                        'response.write "last_aid_v：" & last_aid_v & "<br>"
                        'response.write "other_i_v：" & other_i_v & "<br>"
                        
                        'Response.Cookies("abc" & currentpage-1 & "_" & j)=R_poll_v
                        If (last_aid_v = T_Ans_id) And Len(other_i_v) = 0 Then
                            select_all_ = 0 '标志还有问题没有作答
                            'out out_info & "第" & j + 1 & "题为必选的多项选择+文字说明题，您选择了其它项，但没有输入任何文字说明"
                            out "您还有部分必答题没有完成！提示：选择其它项时，必须要输入相应的文字说明！"
                        ElseIf other_i_v <> "" Then
                            U_TouPiao_ = U_TouPiao_ & "{-\\-}" & R_poll_v & ":{{{" & other_i_v & "}}}"
                        Else
                            U_TouPiao_ = U_TouPiao_ & "{-\\-}" & R_poll_v
                        End If
                    ElseIf Q_Select_input_v = "True" Then
                        select_all_ = 0 '标志还有问题没有作答
                        'out out_info & "第" & j + 1 & "题为必选的多项选择+文字说明题，您还没有选择任何选项！"
                        out "您还有部分必答题没有完成！"
                    End If
                Case 5, 6
                    R_baby_number = "baby_number_" & j
                    B_C = Request.Form(R_baby_number) '子题目数量
                    For l = 0 To B_C - 1
                        R_poll = "poll" & j & "_" & l
                        R_poll_v = Request.Form(R_poll)
                        'R_poll_v=ObjS.jiemiChr(R_poll_v)
                        If R_Q_sort_input_v = 6 Then '如果是多选矩阵题
                            R_poll_v_s = Split(R_poll_v, ", ")
                            poll_numb = UBound(R_poll_v_s)
                            If poll_numb > 0 Then
                                R_poll_v2 = ""
                                For k = 0 To poll_numb Step 1
                                    R_poll_v2 = R_poll_v2 & ", " & ObjS.jiemiChr(R_poll_v_s(k))
                                Next
                                R_poll_v = Mid(R_poll_v2, 3, Len(R_poll_v2) - 2)
                            Else
                                R_poll_v = ObjS.jiemiChr(R_poll_v)
                            End If
                        Else
                            R_poll_v = ObjS.jiemiChr(R_poll_v)
                        End If
                        If R_poll_v <> "" Then
                            R_poll_v = Replace(R_poll_v, ", ", "&")
                            Response.Cookies("abc" & currentpage - 1 & "_" & j) = Request.Cookies("abc" & currentpage - 1 & "_" & j) & "-" & R_poll_v
                            
                        ElseIf Q_Select_input_v = "True" Then
                            select_all_ = 0 '标志还有问题没有作答
                            'out out_info & "第" & j + 1 & "题为必选的矩阵题，有些选项您没有选择！"
                            out "您还有部分必答题没有完成！"
                        End If
                    Next
                    If Request.Cookies("abc" & currentpage - 1 & "_" & j) <> "" Then
                        Response.Cookies("abc" & currentpage - 1 & "_" & j) = Mid((Request.Cookies("abc" & currentpage - 1 & "_" & j)), 2, (Len(Request.Cookies("abc" & currentpage - 1 & "_" & j)) - 1)) '去掉第一个“-”
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & Request.Cookies("abc" & currentpage - 1 & "_" & j)
                    End If
                Case 7 '多行文字输入型
                    R_a_text = "a_text" & j
                    R_a_text_v = RequestText(Request.Form(R_a_text))
                    R_Question_ID = "Question_ID_" & j
                    R_Question_ID_v = Request.Form(R_Question_ID) '问题的ID号
                    If R_a_text_v <> "" Then
                        Response.Cookies("abc" & currentpage - 1 & "_" & j) = "{" & R_Q_sort_input_v & "}[" & R_Question_ID_v & "]:{{{" & R_a_text_v & "}}}"
                    ElseIf Q_Select_input_v = "True" Then
                        select_all_ = 0 '标志还有问题没有作答
                        'out out_info & "第" & j + 1 & "题为必填的文字题，您没有填写任何内容！"
                        out "您还有部分必答题没有完成！"
                    End If
                    If Request.Cookies("abc" & currentpage - 1 & "_" & j) <> "" Then
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & Request.Cookies("abc" & currentpage - 1 & "_" & j)
                    End If
                Case 8 '数值题
                    R_Q_Max = "Q_Max_" & j
                    R_Q_Max_v = Request.Form(R_Q_Max)
                    R_Q_Small = "Q_Small_" & j
                    R_Q_Small_v = Int(Request.Form(R_Q_Small))
                    
                    R_a_text = "a_text" & j
                    R_a_text_v = Request.Form(R_a_text)
                    R_Question_ID = "Question_ID_" & j
                    R_Question_ID_v = Request.Form(R_Question_ID) '问题的ID号
                    If IsNumeric(R_a_text_v) = True And R_a_text_v <> "" Then
                        If Int(R_a_text_v) <= Int(R_Q_Max_v) And Int(R_a_text_v) >= Int(R_Q_Small_v) Then '如果输入的值在范围内
                            Response.Cookies("abc" & currentpage - 1 & "_" & j) = "{" & R_Q_sort_input_v & "}[" & R_Question_ID_v & "]:{{{" & R_a_text_v & "}}}"
                        ElseIf Q_Select_input_v = "True" Then
                            select_all_ = 0 '标志还有问题没有作答
                            'out out_info & "第" & j + 1 & "题为必填的数值题，只能填写""(" & R_Q_Small_v & ")～(" & R_Q_Max_v & ")""的数值！"
                            out "您还有部分必答题没有完成！"
                        End If
                    Else
                        select_all_ = 0 '标志还有问题没有作答
                        'out out_info & "第" & j + 1 & "题为必填的数值题，您必须输入数值！"
                        out "您还有部分必答题没有完成！"
                    End If
                    If Request.Cookies("abc" & currentpage - 1 & "_" & j) <> "" Then
                        'Response.Cookies("abc" & currentpage-1 & "_" & j)=mid((request.Cookies("abc" & currentpage-1 & "_" & j)),2,(len(request.Cookies("abc" & currentpage-1 & "_" & j))-1))'去掉第个“-”
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & Request.Cookies("abc" & currentpage - 1 & "_" & j)
                    End If
                Case 9 '列举型
                    R_Q_Max = "Q_Max_" & j
                    R_Q_Max_v = Request.Form(R_Q_Max)
                    R_Q_Small = "Q_Small_" & j
                    R_Q_Small_v = Int(Request.Form(R_Q_Small))
                    R_Question_ID = "Question_ID_" & j
                    R_Question_ID_v = Request.Form(R_Question_ID) '问题的ID号
                    M = 0
                    For i = 1 To R_Q_Max_v Step 1
                        R_a_text = "a_text" & j & "_" & i
                        R_a_text_v = RequestText(Request.Form(R_a_text))
                        If R_a_text_v <> "" Then
                            Response.Cookies("abc" & currentpage - 1 & "_" & j) = Request.Cookies("abc" & currentpage - 1 & "_" & j) & "-{" & R_Q_sort_input_v & "}[" & R_Question_ID_v & "]:{{{" & R_a_text_v & "}}}"
                            M = M + 1
                        End If
                    Next
                    If M < R_Q_Small_v And Q_Select_input_v = "True" Then
                        select_all_ = 0 '标志还有问题没有作答
                        'out out_info & "第" & j + 1 & "题列举题最小列举数量为" & R_Q_Small_v & "项，您只例举了" & M & "项。"
                        out "您还有部分必答题没有完成！提示：最小列举数量为" & R_Q_Small_v & "项，您只例举了" & M & "项。"
                    End If
                    If Request.Cookies("abc" & currentpage - 1 & "_" & j) <> "" Then
                        Response.Cookies("abc" & currentpage - 1 & "_" & j) = Mid((Request.Cookies("abc" & currentpage - 1 & "_" & j)), 2, (Len(Request.Cookies("abc" & currentpage - 1 & "_" & j)) - 1)) '去掉第一个“-”
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & Request.Cookies("abc" & currentpage - 1 & "_" & j)
                    End If
                Case 10 '排序题
                    R_baby_number = "baby_number_" & j
                    R_baby_number_v = Request.Form(R_baby_number)
                    Response.Cookies("old_input_num" & j) = "" '用以临时保存输入的数值,以便判断是否有重复
                    R_Question_ID = "Question_ID_" & j
                    R_Question_ID_v = Request.Form(R_Question_ID) '问题的ID号
                    'response.write "<br>R_baby_number_v=" & R_baby_number_v & "<br>"
                    For i = 0 To R_baby_number_v - 1 Step 1
                        R_a_text = "a_text" & j & "_" & i
                        R_a_text_v = Request.Form(R_a_text)
                        baby_problem = "baby_problem_" & j & "_" & i
                        baby_problem_v = Request.Form(baby_problem)
                        If R_a_text_v <> "" And IsNumeric(R_a_text_v) Then
                            If Int(R_a_text_v) > Int(R_baby_number_v) Then
                                select_all_ = 0 '标志还有问题没有作答
                                'out out_info & "第" & j + 1 & "题排序题输入的数值不能大于" & R_baby_number_v & "！"
                                out out_info & "排序题输入的数值不能大于" & R_baby_number_v & "！"
                            ElseIf Int(R_a_text_v) < 1 Then

                                select_all_ = 0 '标志还有问题没有作答
                                'out out_info & "第" & j + 1 & "题排序题输入的数值应是大于0，小于" & R_baby_number_v & "的正整数！"
                                out out_info & "排序题输入的数值应是大于0，小于" & R_baby_number_v & "的正整数！"
                            ElseIf UBound(Split((Request.Cookies("old_input_num" & j)), "(" & R_a_text_v & ")")) > 0 Then
                                'old_input_num(i)=R_a_text_v
                                select_all_ = 0 '标志还有问题没有作答
                                'out out_info & "第" & j + 1 & "题排序题输入数值不能为相同！"
                                out out_info & "排序题输入数值不能为相同！"
                            ElseIf Int(R_a_text_v) <= Int(R_baby_number_v) And Int(R_a_text_v) >= 1 Then
                                'response.write "<br>R_a_text_v=" & R_a_text_v
                                'response.write "<br>R_baby_number_v=" & R_baby_number_v
                                Response.Cookies("old_input_num" & j) = Request.Cookies("old_input_num" & j) & "(" & R_a_text_v & ")"
                                baby_sql = "SELECT A_ID FROM Answer where Q_ID=" & R_Question_ID_v & " and A_Answer='" & R_a_text_v & "'"
                                Set baby_rs = DbConn.Execute(baby_sql)
                                Response.Cookies("abc" & currentpage - 1 & "_" & j) = Request.Cookies("abc" & currentpage - 1 & "_" & j) & "-{" & R_Q_sort_input_v & "}[" & R_Question_ID_v & "]<" & baby_problem_v & ">:(" & baby_rs("A_ID") & ")"
                                baby_rs.Close
                                Set baby_rs = Nothing
                            End If
                        ElseIf Q_Select_input_v = "True" Then
                            select_all_ = 0 '标志还有问题没有作答
                            'out out_info & "第" & j + 1 & "题排序题输入数值为大于0，小于" & R_baby_number_v & "的正整数！"
                            out out_info & "排序题输入数值应是大于0，小于" & R_baby_number_v & "的正整数！"
                        End If
                    Next
                    'Response.write "<br>cookies=" & request.Cookies("old_input_num" & j)
                    'response.end
                    If Request.Cookies("abc" & currentpage - 1 & "_" & j) <> "" Then
                        Response.Cookies("abc" & currentpage - 1 & "_" & j) = Mid((Request.Cookies("abc" & currentpage - 1 & "_" & j)), 2, (Len(Request.Cookies("abc" & currentpage - 1 & "_" & j)) - 1)) '去掉第一个“-”
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & Request.Cookies("abc" & currentpage - 1 & "_" & j)
                    End If
                Case 11 '填空题,单行文本输型
                    R_a_text = "a_text" & j
                    R_a_text_v = Request.Form(R_a_text)
                    R_Question_ID = "Question_ID_" & j
                    R_Question_ID_v = Request.Form(R_Question_ID) '问题的ID号
                    If R_a_text_v <> "" Then
                        U_TouPiao_ = U_TouPiao_ & "{-\\-}" & "{" & R_Q_sort_input_v & "}[" & R_Question_ID_v & "]:{{{" & R_a_text_v & "}}}"
                        If Q_Select_input_v = "True" Then
                            R_inputSort = "inputSort" & j
                            R_inputSort_v = Request.Form(R_inputSort)
                            If R_inputSort_v <> 0 Then
                                If checkInputText(R_a_text_v, R_inputSort_v) = 0 Then
                                    'out out_info & "第" & j + 1 & "题输入的内容不合法！"
                                    select_all_ = 0 '标志还有问题没有作答
                                    out out_info & "文本输入题型中的输入内容不合法！"
                                End If
                            End If
                        End If
                    ElseIf Q_Select_input_v = "True" Then
                        'out out_info & "第" & j + 1 & "题输入的内容为空！"
                        select_all_ = 0 '标志还有问题没有作答
                        out out_info & "文本输入题中没有输入任何内容！"
                    End If
                    
        End Select
        'response.write "abc" & currentpage-1 & "_" & j & "=" & request.Cookies("abc" & currentpage-1 & "_" & j) & "<br>"
    Next
    If U_TouPiao_ <> "" Then
        U_TouPiao_ = Mid(U_TouPiao_, 7, Len(U_TouPiao_) - 6)
    End If
    U_TouPiao_ = ObjS.jiamiCode(U_TouPiao_, 146)
    save_TouPiaoGuocheng = U_TouPiao_
End Function
Function readQuestionID(ismb, survey_id_, Q_Page_, Q_Order_)
    sql = "SELECT Q_ID FROM " & ismb & "Question WHERE D_T_S_ID=" & survey_id_ & " and Q_Page=" & Q_Page_ & " and Q_Order=" & Q_Order_
    Set ars2 = Server.CreateObject("ADODB.Recordset")
    ars2.open sql, DbConn, 1, 1
    If Not ars2.EOF Then
        readQuestionID = ars2("Q_ID")
    Else
        readQuestionID = 0
    End If
    ars2.Close
    Set ars2 = Nothing
End Function
Function writeTiaoZhuangDM(pollName, kongzhiDM2)
    Response.Write "<script>"
    'response.write "window.onload=function(){"
    Response.Write "function b(){"
        Response.Write "var item=document.getElementsByName(""" & pollName & """);"
        'response.write "for(var i=0;i<item.length;i++){"
            kongzhiDM2_SZ = Split(kongzhiDM2, "$%%$")
            Numb = UBound(kongzhiDM2_SZ)
            For Y = 0 To Numb Step 1
            Response.Write "if(item[" & Y & "].checked){" '&item[i].value==""{1}[569]:(2226)""
            '//document.getElementById('L6').style.backgroundColor='red';document.getElementById('L6').style.display='';
            Response.Write kongzhiDM2_SZ(Y)
            Response.Write "}"
            Next
        'response.write "}"
    Response.Write "}"
    Response.Write "</script>"
End Function
Function ShowRed(sort_, name_, nameID_, other_, ToLN_, Input_Max_, Input_Min_)
'sort_类型,name_控件名,nameID_控件的最后一个ＩＤ,other_其它输入框名,ToLN_问题的显示层名,Input_Max_输入数值的允许最大值,Input_Min_最小值
    Select Case sort_
        Case 1
        sRed = "aaa" & name_ & "=GetRadioValue(""" & name_ & """);" '单选题
        sRed = sRed & "if (aaa" & name_ & " == null){"
        sRed = sRed & "document.getElementById(""" & ToLN_ & """).style.border=""1px solid red"";}"
        Case 2
        sRed = "aaa" & name_ & "=GetRadioValue(""" & name_ & """);" '单选题
        sRed = sRed & "if (aaa" & name_ & " == null){"
        sRed = sRed & "document.getElementById(""" & ToLN_ & """).style.border=""1px solid red"";}"
        
        sRed = sRed & "if (document.dcform." & name_ & "[" & nameID_ & "].checked&&document.dcform." & other_ & ".value ==''){" '//单选＋其它文字说明
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        Case 3
        sRed = "bbb" & name_ & "=checkbox(""" & name_ & """);" '//复选框
        sRed = sRed & "if (bbb" & name_ & " ==null){"
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        Case 4
        sRed = "bbb" & name_ & "=checkbox(""" & name_ & """);" '//复选框
        'sRed=sRed & "if (bbb" & name_ & " ==null){"
        sRed = sRed & "if ((bbb" & name_ & " ==null)||(document.dcform." & name_ & "[" & nameID_ & "].checked&&document.dcform." & other_ & ".value =='')){" '//多选＋其它文字说明
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        
        'sRed=sRed & "bbb" & name_ & "=checkbox(""" & name_ & """);"'//复选框
        'sRed=sRed & "if (bbb" & name_ & " ==null){"
        'sRed=sRed & "document.getElementById('" & ToLN_ & "').style.backgroundColor='red';}"
        Case 5 '//单选矩阵题
        name_SZ = Split(name_, "$")
        sRed = ""
        sRedPang = ""
        For na = 0 To UBound(name_SZ) - 1 Step 1
            sRed = sRed & "ccc" & name_SZ(na) & "=GetRadioValue(""" & name_SZ(na) & """);"
            sRedPang = sRedPang & "ccc" & name_SZ(na) & " == null||"
        Next
        If sRedPang <> "" Then
            sRedPang = Mid(sRedPang, 1, Len(sRedPang) - 2)
        End If
        sRed = sRed & "if (" & sRedPang & "){"
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        Case 6
        name_SZ = Split(name_, "$")
        sRed = ""
        sRedPang = ""
        For na = 0 To UBound(name_SZ) - 1 Step 1
            sRed = sRed & "ccc" & name_SZ(na) & "=checkbox(""" & name_SZ(na) & """);"
            sRedPang = sRedPang & "ccc" & name_SZ(na) & " == null||"
        Next
        If sRedPang <> "" Then
            sRedPang = Mid(sRedPang, 1, Len(sRedPang) - 2)
        End If
        sRed = sRed & "if (" & sRedPang & "){"
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        Case 7 '多行文字输入型
        sRed = "if (document.dcform." & name_ & ".value ==''){"
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        Case 8 '//数值输入型
        sRed = "ccc" & name_ & "=document.dcform." & name_ & ".value;"
        sRed = sRed & "if ((" & Input_Max_ & "<ccc" & name_ & ")||(" & Input_Min_ & ">ccc" & name_ & ")||(ccc" & name_ & "=="""")||(IsNum(ccc" & name_ & ")==false)){"
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        Case 9 '列举型
        sRed = "var eee" & name_ & "=new Array();"
        nameID_SZ = Split(nameID_, "$")
        nameID_SZ_S = UBound(nameID_SZ) - 1
        For na = 0 To nameID_SZ_S Step 1
            sRed = sRed & "eee" & name_ & "[" & na & "]=document.dcform.a_text" & name_ & "_" & nameID_SZ(na) & ".value;"
        Next
        sRed = sRed & "Numb=0;"
        sRed = sRed & "for (i=0;i<" & nameID_SZ_S & ";i++){"
        sRed = sRed & "   if (eee" & name_ & "[i]==""""){Numb=Numb+1;}"
        sRed = sRed & "}"
        sRed = sRed & "if (Numb>" & nameID_SZ_S - Input_Min_ & "){"
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        Case 10 '//排序题
        sRed = "var ddd" & name_ & "=new Array();"
        nameID_SZ = Split(nameID_, "$")
        nameID_SZ_S = UBound(nameID_SZ) - 1
        For na = 0 To nameID_SZ_S Step 1
            sRed = sRed & "ddd" & name_ & "[" & na & "]=document.dcform.a_text" & name_ & "_" & nameID_SZ(na) & ".value;"
        Next
        'ddd16[1]=document.dcform.a_text16_10.value;
        'ddd16[2]=document.dcform.a_text16_20.value;
        sRed = sRed & "Err=0;"
        sRed = sRed & "dddMax=0;"
        sRed = sRed & "for (i=0;i<ddd" & name_ & ".length;i++){"
        sRed = sRed & "   if ((IsNumZ(ddd" & name_ & "[i])==false)||(ddd" & name_ & "[i]==0)){"
        sRed = sRed & "       Err=1;break;" '//alert("运行到了这里1！"+ddd16[i]);
        sRed = sRed & "   }else{"
        sRed = sRed & "       if (ddd" & name_ & "[i]>dddMax){"
        sRed = sRed & "       dddMax=ddd" & name_ & "[i];}"
        sRed = sRed & "   }"
        sRed = sRed & "   if (dddMax>ddd" & name_ & ".length){Err=1;break;}" '//alert("运行到了这里2！");
        sRed = sRed & "}"
        sRed = sRed & "if ((Err==1)||(ArrayYN(ddd" & name_ & ")==1)){"
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
  
        
        Case 11
        sRed = "if (document.dcform." & name_ & ".value ==''){" '//填空题
        sRed = sRed & "document.getElementById('" & ToLN_ & "').style.border=""1px solid red"";}"
        
    End Select
    
    ShowRed = sRed
End Function
Function show_noPublishedInfo()
        Response.Write "<style>"
        Response.Write "#noticeold_body{position:absolute;}"
        Response.Write "#noticeold_content{"
        Response.Write "position:absolute;"
        Response.Write "left:320px;"
        Response.Write "top:-8px;"
        Response.Write "width:216px;"
        Response.Write "height:26px;"
        Response.Write "z-index:1;"
        Response.Write "}"
        Response.Write "</style>"
        Response.Write "<div id=""noticeold_body"" >"
        Response.Write "<div id=""noticeold_content"">"
        Response.Write "<img src=""images/notice_noPublished.gif"" onclick=""click_notice()""/>"
        Response.Write "</div>"
        Response.Write "</div>"
        Response.Write "<script>"
        Response.Write "function click_notice(){"
        Response.Write "document.all.noticeold_body.style.display=""none"""
        'Response.Write "document.cookie=""noticemember=yes"""
        'Response.Write "var date=new Date();"
        'Response.Write "var expiresday=30;//设为30天后cookie消失"
        'Response.Write "date.setTime(date.getTime()+expiresday*3600*1000);"
        'Response.Write "document.cookie="noticemember=yes;expires="+date.toUTCString();"
        Response.Write "}"
        'Response.Write "window.load=loadpopup()"
        Response.Write "</script> "
End Function

Function inputcheck() '----------------第11类，单行文本输入框JS检测-------------------------
Response.Write "<script>" & Chr(10)
Response.Write "function isChinaPostCode(s){" '//邮编检测
Response.Write "var rs=/^[0-9]{6}$/;"
Response.Write "if(!rs.test(s)){return false;}"
Response.Write "return true;"
Response.Write "}" & Chr(10)
Response.Write "function isEmail(strEmail){" '//Email格式检测
Response.Write "if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)"
Response.Write "{return true;}"
Response.Write "else{return false;}}"
Response.Write Chr(10) & "String.prototype.Trim = function() {   "
Response.Write "var m = this.match(/^\s*(\S+(\s+\S+)*)\s*$/); "
Response.Write "return (m == null) ? """" : m[1];  } "
Response.Write Chr(10) & "String.prototype.isMobile = function() {   "
Response.Write "return (/^(?:13\d|15[89])-?\d{5}(\d{3}|\*{3})$/.test(this.Trim())); }"
Response.Write Chr(10) & "String.prototype.isTel = function(){  "
'//"兼容格式: 国家代码(2到3位)-区号(2到3位)-电话号码(7到8位)-分机号(3位)"
Response.Write "return (/^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/.test(this.Trim())); }"
Response.Write Chr(10) & "function  isEnglish(inputValue){" '//英文值检测
Response.Write Chr(10) & "var str=inputValue;"
Response.Write Chr(10) & "var Expression=/^[A-Za-z]+$/;"
Response.Write "var objExp=new RegExp(Expression);"
Response.Write "if(objExp.test(str)==true){return true;}"
Response.Write "else{return false;}}"
Response.Write Chr(10) & "function  isChinese(inputValue){" '//中文值检测
Response.Write "if(inputValue.length==0){return false;}"
Response.Write "for(i=0;i<inputValue.length;i++){"
Response.Write "if(inputValue.charCodeAt(i)>128){return true;}}"
Response.Write "return  false;}"
Response.Write Chr(10) & "function chkMobileTel(inputValue){" '//手机号码或电话号码检测
Response.Write "if(inputValue.length==0){return false;}"
Response.Write "if (inputValue.isMobile()||inputValue.isTel())"
Response.Write "{return true;}"
Response.Write "else{"
'//alert("请输入正确的手机号码或电话号码\n\n例如:13888888888或020-8888888");
'//MobileTel.focus();
Response.Write "return false;}}"
Response.Write Chr(10) & "function isURL(URL){" '//网址检测
Response.Write Chr(10) & "var str=URL;"
    '//在JavaScript中，正则表达式只能使用"/"开头和结束，不能使用双引号
    '//判断URL地址的正则表达式为:http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
    '//下面的代码中应用了转义字符"\"输出一个字符"/"
Response.Write Chr(10) & "var Expression=/^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?$/; "
Response.Write Chr(10) & "var objExp=new RegExp(Expression);"
Response.Write "if(objExp.test(str)==true){return true;}"
Response.Write "else{return false;}}"
Response.Write Chr(10) & "function isCidInfo(sId){" '//身份证检测
Response.Write Chr(10) & "var aCity={11:""北京"",12:""天津"",13:""河北"",14:""山西"",15:""内蒙古"",21:""辽宁"",22:""吉林"",23:""黑龙江"",31:""上海"",32:""江苏"",33:""浙江"",34:""安徽"",35:""福建"",36:""江西"",37:""山东"",41:""河南"",42:""湖北"",43:""湖南"",44:""广东"",45:""广西"",46:""海南"",50:""重庆"",51:""四川"",52:""贵州"",53:""云南"",54:""西藏 "",61:""陕西"",62:""甘肃"",63:""青海"",64:""宁夏"",65:""***"",71:""台湾"",81:""香港"",82:""澳门"",91:""国外""}"
Response.Write Chr(10) & "var iSum=0;"
Response.Write Chr(10) & "var info="""";"
Response.Write Chr(10) & "if(!/^\d{17}(\d|x)$/i.test(sId))return false;"
Response.Write Chr(10) & "sId=sId.replace(/x$/i,""a""); "
Response.Write Chr(10) & "if(aCity[parseInt(sId.substr(0,2))]==null){"
        '//return "Error:非法地区";
Response.Write "return false;}"
Response.Write Chr(10) & "sBirthday=sId.substr(6,4)+""-""+Number(sId.substr(10,2))+""-""+Number(sId.substr(12,2));"
Response.Write Chr(10) & "var d=new Date(sBirthday.replace(/-/g,""/""));"
    '//if(sBirthday!=(d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate())){
Response.Write "if(sBirthday!=(d.getFullYear()+""-""+(d.getMonth()+1)+""-""+d.getDate())){"
        '//return "Error:非法生日";
Response.Write "return false;}"
Response.Write "for(var i=17;i>=0;i--){iSum+=(Math.pow(2,i)%11)*parseInt(sId.charAt(17-i),11)}"
Response.Write "if(iSum%11!=1){"
        '//return "Error:非法证号";
Response.Write "return false;}"
    '//return aCity[parseInt(sId.substr(0,2))]+","+sBirthday+","+(sId.substr(16,1)%2?"男":"女")
Response.Write "return true;}"
Response.Write Chr(10) & "function isNumber(name){" '//数值检测
Response.Write "if(name.length==0)"
Response.Write "return false;"
Response.Write Chr(10) & "for(i=0;i<name.length;i++){"
Response.Write "if(name.charAt(i)<""0""||name.charAt(i)>""9"")"
Response.Write "return false;"
Response.Write Chr(10) & "} return true;}"
Response.Write Chr(10) & "function isDate(dateval){" '//日期检测
Response.Write "var arr = new Array();"
    '//alert("02/30/2008");
Response.Write "if(dateval.indexOf(""-"") != -1){"
Response.Write "arr = dateval.toString().split(""-"");"
Response.Write "}else if(dateval.indexOf(""/"") != -1){"
Response.Write "arr = dateval.toString().split(""/"");"
Response.Write "}else{"
Response.Write "return false;}"
    '//yyyy-mm-dd || yyyy/mm/dd
Response.Write "if(arr[0].length==4){"
Response.Write "var date = new Date(arr[0],arr[1]-1,arr[2]);"
Response.Write "if(date.getFullYear()==arr[0] && date.getMonth()==arr[1]-1 && date.getDate()==arr[2]){"
Response.Write "return true;"
Response.Write "}}return false;}"

Response.Write Chr(10) & "function  CheckInputValue(inputname,checkSort)"
Response.Write "{"
Response.Write "var InputN=document.getElementsByName(inputname)[0];"
Response.Write "switch (checkSort){"
Response.Write "case 1:"
Response.Write "{"
Response.Write "if(!isChinaPostCode(InputN.value)){ "
Response.Write "alert(""邮编输入不正确！"");"
Response.Write "InputN.focus();"
Response.Write "return  false;}}"
Response.Write "break;"
Response.Write "case 2:"
Response.Write "{"
Response.Write "if(!chkMobileTel(InputN.value)){  "
Response.Write "alert(""请输入正确的手机号码或电话号码\n\n例如:13888888888或020-8888888"");"
Response.Write "InputN.focus();"
Response.Write "return  false;"
Response.Write "}}break;"
Response.Write "case 3: {if (!isEmail(InputN.value)){alert(""输入的Email不正确！"");InputN.focus();return  false;}}break;"
Response.Write "case 4: {if (!isURL(InputN.value)){alert(""输入的网址不正确！"");InputN.focus();return  false;}}    break;"
Response.Write "case 5: {if(!isChinese(InputN.value)){alert(""只能输入中文字符！"");InputN.focus();return  false;}} break;"
Response.Write "case 6: {if(!isEnglish(InputN.value)){alert(""只能输入英文字符！"");InputN.focus();return  false;}}break;"
Response.Write "case 7: {if (!isCidInfo(InputN.value)){alert(""输入的身份证不正确！"");InputN.focus();return  false;}}break;"
Response.Write "case 8: {if (!isDate(InputN.value)){alert(""输入的日期不正确！"");InputN.focus();return  false;}}break;}"
Response.Write "}</script>"
End Function
'------------------------11类单行文本输入框的服务端检测相关函数---开始-----------------------------
Function checkInputText(inputtext, inputS) '返加值为0表示输入不合法，为1表示合法,inputtext为输入的文本内容,inputS为检测的类型
    Select Case inputS
        Case 1 '邮编
            If Len(inputtext) = 0 Or Len(inputtext) > 6 Or (Not IsNumeric(inputtext)) Or InStr(inputtext, ".") > 0 Then
                checkInputText = 0
            Else
                checkInputText = 1
            End If
        Case 2 '电话,手机号
            If CBool(checktel(inputtext)) Or CBool(checkmob(inputtext)) Then
                'response.Write("您输入的电话号码正确!")
                checkInputText = 1
            Else
                'response.Write("您输入的电话号码错误!")
                checkInputText = 0
            End If
        Case 3 '邮箱
            If CBool(checkEmail(inputtext)) Then
                'response.Write("您输入的邮箱正确!")
                checkInputText = 1
            Else
                'response.Write("您输入的邮箱错误!")
                checkInputText = 0
            End If
        Case 4 '网址
            If CBool(checkURL(inputtext)) Then
                'response.Write("您输入的网址正确!")
                checkInputText = 1
            Else
                'response.Write("您输入的网址错误!")
                checkInputText = 0
            End If
        Case 5 '中文字符
            If CBool(checkZW(inputtext)) Then
                'response.Write("您输入的中文字符正确!")
                checkInputText = 1
            Else
                'response.Write("您输入的中文字符错误!")
                checkInputText = 0
            End If
        Case 6 '英文字符
            If CBool(checkEn(inputtext)) Then
                'response.Write("您输入的英文字符正确!")
                checkInputText = 1
            Else
                'response.Write("您输入的英文字符错误!")
                checkInputText = 0
            End If
        Case 7 '身份证
            If checkIDCard(inputtext) = -1 Then
                'response.write "正确的身份证号码"
                checkInputText = 1
            Else
                'response.write "错误的身份证号码"
                checkInputText = 0
            End If
        Case 8 '日期
            If IsDate(inputtext) Then
                'response.write "正确的日期"
                checkInputText = 1
            Else
                'response.write "正确的日期错误"
                checkInputText = 0
            End If
    End Select
End Function
Public Function F_RegExp(Expression, IfStr)
    Dim RegExp1, Matches
    Set ObjExp = New RegExp '建立正则表达式
    ObjExp.Pattern = Expression '设置模式
    ObjExp.IgnoreCase = True '设置是否区分字符大小写
    ObjExp.Global = True '设置全局可用性
    Matches = ObjExp.Test(IfStr)
    F_RegExp = Matches
End Function
Function checktel(str) '电话验证
    checktel = F_RegExp("^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{1,3}))?$", Trim(str))
End Function
Function checkmob(str) '手机号码验证
    checkmob = F_RegExp("^(?:13\d|15[89])-?\d{5}(\d{3}|\*{3})$", Trim(str))
End Function
Function checkEmail(str) 'Email验证
    checkEmail = F_RegExp("^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", Trim(str))
End Function
Function checkURL(str) '网址验证
    checkURL = F_RegExp("^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?$", Trim(str))
End Function
Function checkZW(str) '中文验证[\u4E00-\u9FA5]
    checkZW = F_RegExp("^[\u4E00-\u9FA5]+$", Trim(str))
End Function
Function checkEn(str) '英文验证
    checkEn = F_RegExp("^[A-Za-z]+$", Trim(str))
End Function
'----身份证验证---
Function checkIDCard(idcard) '-1为正确的身份证，否则为非法身份证
  Dim Y, JYM
  Dim S, M
  Dim area
  area = "11,12,13,14,15,21,22,23,31,32,33,34,35,36,37,41,42,43,44,45,46,50,51,52,53,54,61,62,63,64,65,71,81,82,91"
  Dim ereg
  Set ereg = New RegExp
  '地区检验
  If InStr(1, area, Mid(idcard, 1, 2)) = 0 Then checkIDCard = 1: Exit Function
  '身份号码位数及格式检验
  Select Case Len(idcard)
  Case 15
    If ((CInt(Mid(idcard, 7, 2)) + 1900) Mod 4 = 0 Or ((CInt(Mid(idcard, 7, 2)) + 1900) Mod 100 = 0 And (CInt(Mid(idcard, 7, 2)) + 1900) Mod 4 = 0)) Then
    ereg.Pattern = "^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$" ';//测试出生日期的合法性
    Else
    ereg.Pattern = "^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$" ';//测试出生日期的合法性
    End If
    If (ereg.Test(idcard)) Then
      checkIDCard = -1
    Else
      checkIDCard = 2
    End If
  Case 18
    '//18位身份号码检测
    '//出生日期的合法性检查
    If ((CInt(Mid(idcard, 7, 2)) + 1900) Mod 4 = 0 Or ((CInt(Mid(idcard, 7, 2)) + 1900) Mod 100 = 0 And (CInt(Mid(idcard, 7, 2)) + 1900) Mod 4 = 0)) Then
      ereg.Pattern = "^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$" ';//闰年出生日期的合法性正则表达式
    Else
      ereg.Pattern = "^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$" ';//平年出生日期的合法性正则表达式
    End If
    If (ereg.Test(idcard)) Then
        '//计算校验位
        S = (CInt(Mid(idcard, 0 + 1, 1)) + CInt(Mid(idcard, 10 + 1, 1))) * 7 _
        + (CInt(Mid(idcard, 1 + 1, 1)) + CInt(Mid(idcard, 11 + 1, 1))) * 9 _
        + (CInt(Mid(idcard, 2 + 1, 1)) + CInt(Mid(idcard, 12 + 1, 1))) * 10 _
        + (CInt(Mid(idcard, 3 + 1, 1)) + CInt(Mid(idcard, 13 + 1, 1))) * 5 _
        + (CInt(Mid(idcard, 4 + 1, 1)) + CInt(Mid(idcard, 14 + 1, 1))) * 8 _
        + (CInt(Mid(idcard, 5 + 1, 1)) + CInt(Mid(idcard, 15 + 1, 1))) * 4 _
        + (CInt(Mid(idcard, 6 + 1, 1)) + CInt(Mid(idcard, 16 + 1, 1))) * 2 _
        + CInt(Mid(idcard, 7 + 1, 1)) * 1 _
        + CInt(Mid(idcard, 8 + 1, 1)) * 6 _
        + CInt(Mid(idcard, 9 + 1, 1)) * 3
        Y = S Mod 11
        M = "F"
        JYM = "10X98765432"
        M = Mid(JYM, Y + 1, 1)
        If (M = Mid(idcard, 17 + 1, 1)) Then
            checkIDCard = -1
        Else
            checkIDCard = 3
        End If
    Else
      checkIDCard = 4
    End If
  Case Else
    checkIDCard = Len(idcard)
  End Select
End Function
'------------------------11类单行文本输入框的服务端检测相关函数---结束-----------------------------


%>