<%
'#######################################################################################
'속성형태 라디오 - 가로보기
'VARIABLE : 변수 명
'CODES : 코드 라벨
'ATTRIBUTE: 속성
'TEXT : 질문 TEXT
'STEPFLAG : 스텝여부
'MCNT : 속성을 동일하게 응답하는 갯수 확인용
'SUBTITLE : 서브 타이틀
'P_VIEW : 점수 보여주기 여부
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트 
'#######################################################################################
Function QuestionSingleMATRIX(VARIABLE,CODES,ATTRIBUTE,TEXT,STEPFLAG,MCNT,SUBTITLE,P_VIEW,ByRef BODYSTR,ByRef JBODYSTR)


    Dim SBody,ITStr,V_COD,iCnt,cCnt,V1,V2
    Dim ATStr,A_COD,A1,A2
    Dim JBody
    Dim QName
    Dim DSTR,ESTR,OSTR,COL
    Dim WidthV,HeightV,CTV,LTV
    Dim XVX
    Dim HDStr,CODStr
    Dim ATCnt


    HeightV = "45px"
    OSTR = ""
    ATCnt = MCNT


    ITStr = Split(CODES,LABELSPLITTER)
    ATStr = Split(ATTRIBUTE,LABELSPLITTER)
    COL = UBound(ITStr)
    CTV = Col


    Select Case COL
        Case 0
            XVX = 20
        Case 1
            XVX = 20
        Case 2
            XVX = 40
        Case 3
            XVX = 40
        Case 4
            XVX = 40
        Case 5
            XVX = 60
        Case 6
            XVX = 50
        Case 7
            XVX = 50
        Case 8
            XVX = 60
        Case 9
            XVX = 60
        Case 10
            XVX = 70
        Case Else
            XVX = 70
    End Select  


    WidthV = FormatNumber(CDbl(XVX/COL),2)


    SBody = ""
    JBody = ""


    SBody = SBody & "   <div class='panel panel-default'>" & vbCRLF
    SBody = SBody & "       <div class='panel-heading'><h4 style='line-height:150%;'>" & TEXT & "</h4></div>" & vbCRLF


    SBody = SBody & "       <div class='panel-body'>" & vbCRLF


    DSTR = ""   
    HDSTR = ""



    For cCnt=0 To UBound(ATStr)


        If VarType(ATStr(cCnt))<>0 And VarType(ATStr(cCnt))<>1 And ATStr(cCnt)<>"" Then
            A_COD = Split(ATStr(cCnt),CODESPLITTER)
            A1 = A_COD(0)
            A2 = A_COD(1)


            'Header TR 라인 생성
            If cCnt=0 Then
                HDSTR = "                   <TR id=""HCOL" & VARIABLE & "_" & A1 & """>" & vbCRLF
                HDSTR = HDSTR & "                       <TH class=""hidden-xs hidden-sm"">"& SUBTITLE &"</TH>" & vbCRLF
            End If


            If ((cCnt+1) Mod 2)=0 Then
                CODStr = " striped"
            Else
                CODStr = ""
            End IF


            If cCnt>0 And STEPFLAG Then
                DSTR = DSTR & "                 <TR id=""MCOL" & VARIABLE & "_" & A1 & """ class=""hidden-md hidden-lg"&CODStr&""" style=""display:none;"">" & vbCRLF
                If InStr(A2,"*OTHER")>0 Then
                    DSTR = DSTR & "                     <td colspan="""&UBound(ITStr)+2&"""><h5>"& Replace(Replace(A2,"*OTHER",""),"*NONE","") &"" & vbCRLF
                    DSTR = DSTR & "<input type=""text"" name=""T" & VARIABLE & "_" & A1 & """ id=""T" & VARIABLE & "_" & A1 & "_1"" value="""" maxlength=""50"" style='vertical-align: top;width:200px;'/>&nbsp;"
                    DSTR = DSTR & vbtab&vbtab&vbtab&vbtab&vbtab&vbtab & "<input type=""button"" name=""RE" & VARIABLE & "_" & A1 & """ id=""RE" & VARIABLE & "_" & A1 & """ value="""&LangQuestion(11)&""" onclick=""ResetETCRadio('T" & VARIABLE & "_" & A1 & "_1','" & VARIABLE & "_" & A1 & "')"" style=""cursor:pointer;""/></h5></td>"
                Else
                    DSTR = DSTR & "                     <td colspan="""&UBound(ITStr)+2&"""><h5>"& Replace(Replace(A2,"*OTHER",""),"*NONE","") &"</h5></td>" & vbCRLF
                End if
                DSTR = DSTR & "                 </TR>" & vbCRLF
                DSTR = DSTR & "                 <TR id=""COL" & VARIABLE & "_" & A1 & """ class="""&CODStr&""" style=""display:none;"">" & vbCRLF
            Else
                DSTR = DSTR & "                 <TR id=""MCOL" & VARIABLE & "_" & A1 & """ class=""hidden-md hidden-lg"&CODStr&""">" & vbCRLF
                If InStr(A2,"*OTHER")>0 Then
                    DSTR = DSTR & "                     <td colspan="""&UBound(ITStr)+2&"""><h5>"& Replace(Replace(A2,"*OTHER",""),"*NONE","") &"" & vbCRLF
                    DSTR = DSTR & "<input type=""text"" name=""T" & VARIABLE & "_" & A1 & """ id=""T" & VARIABLE & "_" & A1 & "_1"" value="""" maxlength=""50"" style='vertical-align: top;width:200px;'/>&nbsp;"
                    DSTR = DSTR & vbtab&vbtab&vbtab&vbtab&vbtab&vbtab & "<input type=""button"" name=""RE" & VARIABLE & "_" & A1 & """ id=""RE" & VARIABLE & "_" & A1 & """ value="""&LangQuestion(11)&""" onclick=""ResetETCRadio('T" & VARIABLE & "_" & A1 & "_1','" & VARIABLE & "_" & A1 & "')"" style=""cursor:pointer;""/></h5></td>"
                Else
                    DSTR = DSTR & "                     <td colspan="""&UBound(ITStr)+2&"""><h5>"& Replace(Replace(A2,"*OTHER",""),"*NONE","") &"</h5></td>" & vbCRLF
                End if
                DSTR = DSTR & "                 </TR>" & vbCRLF
                DSTR = DSTR & "                 <TR id=""COL" & VARIABLE & "_" & A1 & """ class="""&CODStr&""" >" & vbCRLF
            End If


            If InStr(A2,"*OTHER")>0 Then
                DSTR = DSTR & "                     <TD class=""ATTHeader hidden-xs hidden-sm""><div class=""radio""><label id=""L" & VARIABLE & "_" & A1 & """>" & Replace(Replace(A2,"*OTHER",""),"*NONE","") & "</label></div>&nbsp;"
                DSTR = DSTR & "<input type=""text"" name=""T" & VARIABLE & "_" & A1 & """ id=""T" & VARIABLE & "_" & A1 & "_2"" value="""" maxlength=""50"" style='vertical-align: top;width:200px;'/>&nbsp;"
                DSTR = DSTR & vbtab&vbtab&vbtab&vbtab&vbtab&vbtab & "<input type=""button"" name=""RE" & VARIABLE & "_" & A1 & """ id=""RE" & VARIABLE & "_" & A1 & """ value="""&LangQuestion(11)&""" onclick=""ResetETCRadio('T" & VARIABLE & "_" & A1 & "_2','" & VARIABLE & "_" & A1 & "')"" style=""cursor:pointer;""/>"
                DSTR = DSTR & vbtab&vbtab&vbtab&vbtab&vbtab&vbtab &"</TD>" & vbCrLF
            Else
                DSTR = DSTR & "                     <TD class=""ATTHeader hidden-xs hidden-sm""><h5><span id=""L" & VARIABLE & "_" & A1 & """>" & Replace(Replace(A2,"*OTHER",""),"*NONE","") & "</span></h5></TD>" & vbCrLF
            End IF


            For iCnt=0 To UBound(ITStr)
                If VarType(ITStr(iCnt))<>0 And VarType(ITStr(iCnt))<>1 Then
                    V_COD = Split(ITStr(iCnt),CODESPLITTER)
                    V1 = V_COD(0)
                    V2 = V_COD(1)
                    DSTR = DSTR & "                     <TD style=""text-align:center;vertical-align:middle;"">"
                    DSTR = DSTR & "<input type=" & CHR(34) & "radio" & CHR(34) & " name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """ class=""input-sm"" value=" & Chr(34) & V1 & Chr(34) & "/></TD>" & vbCRLF


                    If cCnt=0 Then
                        If P_VIEW<>"" Then
                            HDSTR = HDSTR & "                       <TH class=""text-center""><h5><strong>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "<br>(" & V1 & ")" & "</strong></h5></TH>" & vbCrLF
                        Else
                            HDSTR = HDSTR & "                       <TH class=""text-center""><h5><strong>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "</strong></h5></TH>" & vbCrLF
                        End If
                    End If
                End IF
            Next


            If cCnt=0 Then
                HDSTR = HDSTR & "                   </TR>" & VBCRLF
            End If


            DSTR = DSTR & "                 </TR>"
            DSTR = DSTR & "" & LABELSPLITTER
            VAR = VAR & VARIABLE & "_" & A1 & ","


            If InStr(A2,"*OTHER")>0 Then
                VAR = VAR & "T" & VARIABLE & "_" & A1 & ","


                JBody = JBody & "   if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==undefined)" & vbCrLF
                JBody = JBody & "   {" & vbCrLF
                JBody = JBody & "       if ($(""#T" & VARIABLE & "_" & A1 & "_1"").val().trim()!="""" || $(""#T" & VARIABLE & "_" & A1 & "_2"").val().trim()!="""")"& vbCrLF
                JBody = JBody & "       {" & vbCrLF
                JBody = JBody & "           alert(" & Chr(34) & "[""+$(""#L" &  VARIABLE & "_" & A1 & """).text().trim()+""]" & " " & LangQuestion(1) & Chr(34) & ");" & vbCrLF
                JBody = JBody & "           $(""#T" & VARIABLE & "_" & A1 & "_1"").focus();" & vbCrLF
                JBody = JBody & "           return;" & vbCRLF
                JBody = JBody & "       }" & vbCrLF
                JBody = JBody & "   }" & vbCRLF 
                JBody = JBody & "   else" & vbCRLF 
                JBody = JBody & "   {" & vbCRLF 
                JBody = JBody & "       if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")!=""0""){" & vbCrLF
                JBody = JBody & "         if ($(""#T" & VARIABLE & "_" & A1 & "_1"").val().trim()=="""" && $(""#T" & VARIABLE & "_" & A1 & "_2"").val().trim()=="""")"& vbCrLF
                JBody = JBody & "         {" & vbCrLF
                JBody = JBody & "             alert(" & Chr(34) & "[""+$(""#L" &  VARIABLE & "_" & A1 & """).text().trim()+""]" & " " & LangQuestion(1) & Chr(34) & ");" & vbCrLF
                JBody = JBody & "             $(""#T" & VARIABLE & "_" & A1 & "_1"").focus();" & vbCrLF
                JBody = JBody & "             return;" & vbCRLF
                JBody = JBody & "         }" & vbCrLF
                JBody = JBody & "       }" & vbCrLF
                JBody = JBody & "   }" & vbCRLF & vbCRLF



                '기타 특수문자
                JBody = JBody & "   if ($(""#T" & VARIABLE & "_" & A1 & "_1"").val().trim()!="""")"
                JBody = JBody & "   {" & vbCrLF
                JBody = JBody & "       if (containsChars($(""#T" & VARIABLE & "_" & A1 & "_1"").val().trim()," & ERRORSTR & "))" & vbCrLF
                JBody = JBody & "       {" & vbCrLF
                JBody = JBody & "           alert("""&LangQuestion(3)&""");" & vbCrLF
                JBody = JBody & "           $(""#T" & VARIABLE & "_" & A1 & "_1"").focus();" & vbCrLF
                JBody = JBody & "           return;" & vbCRLF
                JBody = JBody & "       }" & vbCrLF
                JBody = JBody & "   }" & vbCrLF
                JBody = JBody & "   if ($(""#T" & VARIABLE & "_" & A1 & "_2"").val().trim()!="""")"
                JBody = JBody & "   {" & vbCrLF
                JBody = JBody & "       if (containsChars($(""#T" & VARIABLE & "_" & A1 & "_2"").val().trim()," & ERRORSTR & "))" & vbCrLF
                JBody = JBody & "       {" & vbCrLF
                JBody = JBody & "           alert("""&LangQuestion(3)&""");" & vbCrLF
                JBody = JBody & "           $(""#T" & VARIABLE & "_" & A1 & "_2"").focus();" & vbCrLF
                JBody = JBody & "           return;" & vbCRLF
                JBody = JBody & "       }" & vbCrLF
                JBody = JBody & "   }" & vbCrLF


            Else
                JBody = JBody & "   if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==undefined)" & vbCrLF
                JBody = JBody & "   {" & vbCrLF
                JBody = JBody & "       alert(" & Chr(34) & "[""+$(""#L" &  VARIABLE & "_" & A1 & """).text()+""]" & " " & LangQuestion(1) & Chr(34) & ");" & vbCRLF
                JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
                JBody = JBody & "       return;" & vbCRLF
                JBody = JBody & "   }" & vbCRLF & vbCRLF
            End If
            
        End IF
    Next


    If ATCnt>0 Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    var " & VARIABLE & "Flag;" & vbCrLf
        Response.Write "    " & VARIABLE & "Flag=false;" & vbCrLf
        Response.Write "//-->" & vbCRLF
        Response.Write "</script>" & vbCrLF


        JBody = JBody & "   if ((" & VARIABLE & "Flag==false) && (RadioArrayCnt(""" & Left(VAR,Len(VAR)-1) & ""","&ATCnt&")))" & vbCrLF
        JBody = JBody & "   {" & vbCrLF
        JBody = JBody & "       alert(" & Chr(34) & LangQuestion(4) & Chr(34) & ");" & vbCRLF
        JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
        JBody = JBody & "       " & VARIABLE & "Flag=true;" & vbCrLF
        JBody = JBody & "       return;" & vbCRLF
        JBody = JBody & "   }" & vbCRLF & vbCRLF
    End IF


    SBody = SBody & "               <table id='" & VARIABLE & "_table' class='table table-bordered table-responsive table-condensed table-st' cellpadding='0' cellspacing='0' border='0'>" & vbCRLF
    SBody = SBody & "                   <colgroup>" & vbCRLF
    SBody = SBody & "                       <col class=""hidden-xs hidden-sm"" width=""*""/>" & vbCRLF
    For iCnt=0 To Col
        SBody = SBody & "                       <col width=" & Chr(34) & WidthV & "%" & Chr(34) &"/>" & vbCRLF
    Next    
    SBody = SBody & "                   </colgroup>" & vbCRLF
    SBody = SBody & HDSTR
    ESTR = Split(DSTR,LABELSPLITTER)


    For iCnt=0 To UBound(ESTR)
        If VarType(ESTR(iCnt))<>0 And VarType(ESTR(iCnt))<>1 Then
            SBody = SBody & ESTR(iCnt) & vbCRLF
        End If
    Next


    If iCnt>11 Then
        SBody = SBody & HDSTR
    End IF
    SBody = SBody & "               </table>" & vbCRLF


    SBody = SBody & "       </div>" & vbCRLF
    SBody = SBody & "   </div>" & vbCRLF


    '자바스크립트 처리 부분
    
    If STEPFLAG Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    $(document).ready(function(){" & vbCrLf


        Response.Write vbCrLF
        For iCnt=0 To UBound(ATStr)
            If VarType(ATStr(iCnt))<>0 And VarType(ATStr(iCnt))<>1 Then     
                A_COD = Split(ATStr(iCnt),CODESPLITTER)
                A1 = A_COD(0)
                A2 = A_COD(1)
                Response.Write "        $(""input[name=" & VARIABLE & "_" & A1 & "]"").click(function(){" & vbCrLF
                Response.Write "            console.log($(this).parents(""tr"").html());" & vbCrLF
                Response.Write "            $(this).parents(""tr"").next().show();" & vbCrLF
                Response.Write "            $(this).parents(""tr"").next().next().show();" & vbCrLF
                'Response.Write "           $(""#" & VARIABLE & "_table tr:nth-child(" & iCnt+4 & ")"").show();" & vbCrLF
                'Response.Write "           $(""#" & VARIABLE & "_table tr:nth-child(" & iCnt+5 & ")"").show();" & vbCrLF
                Response.Write "        });" & vbCrLF
            End If
        Next
'       Response.Write "        $("".table-st"").addClass(""table-striped"");" & vbCrLF


        Response.Write "    });" & vbCrLF
        Response.Write "//-->" & vbCrLF
        Response.Write "</script>" & vbCrLF


    End If


    BODYSTR = SBody
    JBODYSTR = JBody


End Function


'#######################################################################################
'속성형태 라디오 - 가로보기 (그룹)
'VARIABLE : 변수 명
'CODES : 코드 라벨
'ATTRIBUTE: 속성
'TEXT : 질문 TEXT
'MCNT : 속성을 동일하게 응답하는 갯수 확인용
'P_VIEW : 점수 보여주기 여부
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트 
'#######################################################################################
Function QuestionSingleMATRIXGROUP(VARIABLE,CODES,ATTRIBUTE,TEXT,MCnt,P_VIEW,ByRef BODYSTR,ByRef JBODYSTR)


    Dim SBody,ITStr,V_COD,iCnt,cCnt,V1,V2
    Dim ATStr,A_COD,A1,A2
    Dim JBody
    Dim QName
    Dim DSTR,ESTR,OSTR,COL
    Dim GTStr,TTStr,xCnt
    Dim WidthV,HeightV,CTV,LTV
    Dim XVX,GWD
    Dim HDStr
    Dim ATCnt


    GWD = 12 '그룹 타이틀 영역
    HeightV = "45px"
    OSTR = ""
    ATCnt = MCnt


    


    ITStr = Split(CODES,LABELSPLITTER)
    GTSTr = Split(ATTRIBUTE,GROUPSPLITTER)
    COL = UBound(ITStr)
    CTV = Col


    Select Case COL
        Case 0
            XVX = 40-GWD
        Case 1
            XVX = 40-GWD
        Case 2
            XVX = 40-GWD
        Case 3
            XVX = 40-GWD
        Case 4
            XVX = 60-GWD
        Case 5
            XVX = 40-GWD
        Case 6
            XVX = 50-GWD
        Case 7
            XVX = 50-GWD
        Case 8
            XVX = 60-GWD
        Case 9
            XVX = 60-GWD
        Case 10
            XVX = 70-GWD
        Case Else
            XVX = 70-GWD
    End Select
    


    WidthV = FormatNumber(CDbl(XVX/COL),2)


    SBody = ""
    JBody = ""


    SBody = SBody & "   <div class='panel panel-default'>" & vbCRLF
    SBody = SBody & "       <div class='panel-heading'><h4 style='line-height:150%;'>" & TEXT & "</h4></div>" & vbCRLF


    SBody = SBody & "       <div class='panel-body'>" & vbCRLF
    DSTR = ""   
    HDSTR = ""


    For xCnt=0 To UBound(GTStr)


    If VarType(GTStr)<>0 And VarType(GTStr)<>1 Then
        TTStr = Split(GTStr(xCnt),GCODESPLITTER)
        ATStr = Split(TTSTR(1),LABELSPLITTER)
        For cCnt=0 To UBound(ATStr)


            If VarType(ATStr(cCnt))<>0 And VarType(ATStr(cCnt))<>1 And ATStr(cCnt)<>"" Then
                A_COD = Split(ATStr(cCnt),CODESPLITTER)
                A1 = A_COD(0)
                A2 = A_COD(1)


                'Header TR 라인 생성
                If xCnt=0 Then
                    HDSTR = "                   <TR id=""HCOL" & VARIABLE & "_" & A1 & """>" & vbCRLF
                    HDSTR = HDSTR & "                       <TH Colspan=""2"">&nbsp;</TH>" & vbCRLF
                End If



                DSTR = DSTR & "                 <TR id=""COL" & VARIABLE & "_" & A1 & """>" & vbCRLF


                If cCnt=0 Then
                DSTR = DSTR & "                     <TD style=""vertical-align:middle;"" class=""ATTHeader info text-center"" rowspan="""&UBound(ATStr)+1&""">" & TTStr(0) & "</TD>" & vbCrLF   
                End If
                
                DSTR = DSTR & "                     <TD class=""ATTHeader""><span id=""L" & VARIABLE & "_" & A1 & """><h5>" & Replace(Replace(A2,"*OTHER",""),"*NONE","") & "</h5></span></TD>" & vbCrLF


                For iCnt=0 To UBound(ITStr)
                    If VarType(ITStr(iCnt))<>0 And VarType(ITStr(iCnt))<>1 Then
                        V_COD = Split(ITStr(iCnt),CODESPLITTER)
                        V1 = V_COD(0)
                        V2 = V_COD(1)
                        DSTR = DSTR & "                     <TD style=""text-align:center;vertical-align:middle;"">"
                        DSTR = DSTR & "<input type=" & CHR(34) & "radio" & CHR(34) & " name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """ class=""input-sm"" value=" & Chr(34) & V1 & Chr(34) & "/></TD>" & vbCRLF


                        If xCnt=0 Then
                            If P_VIEW<>"" Then
                                HDSTR = HDSTR & "                       <TH class=""text-center""><h5><strong>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "<br>(" & V1 & ")" & "</strong></h5></TH>" & vbCrLF
                            Else
                                HDSTR = HDSTR & "                       <TH class=""text-center""><h5><strong>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "</strong></h5></TH>" & vbCrLF
                            End If
                        End If
                    End IF
                Next


                If xCnt=0 Then
                    HDSTR = HDSTR & "                   </TR>" & VBCRLF
                End If


                DSTR = DSTR & "                 </TR>"
                DSTR = DSTR & "" & LABELSPLITTER
                VAR = VAR & VARIABLE & "_" & A1 & ","


                JBody = JBody & "   if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==undefined)" & vbCrLF
                JBody = JBody & "   {" & vbCrLF
                JBody = JBody & "       alert(" & Chr(34) & "[""+$(""#L" &  VARIABLE & "_" & A1 & """).text()+""]" & " " & LangQuestion(1) & Chr(34) & ");" & vbCRLF
                JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
                JBody = JBody & "       return;" & vbCRLF
                JBody = JBody & "   }" & vbCRLF & vbCRLF


            End IF
        Next
    End If
    
    Next


    If ATCnt>0 Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    var " & VARIABLE & "Flag;" & vbCrLf
        Response.Write "    " & VARIABLE & "Flag=false;" & vbCrLf
        Response.Write "//-->" & vbCRLF
        Response.Write "</script>" & vbCrLF


        JBody = JBody & "   if ((" & VARIABLE & "Flag==false) && (RadioArrayCnt(""" & Left(VAR,Len(VAR)-1) & ""","&ATCnt&")))" & vbCrLF
        JBody = JBody & "   {" & vbCrLF
        JBody = JBody & "       alert(" & Chr(34) & LangQuestion(4) & Chr(34) & ");" & vbCRLF
        JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
        JBody = JBody & "       " & VARIABLE & "Flag=true;" & vbCrLF
        JBody = JBody & "       return;" & vbCRLF
        JBody = JBody & "   }" & vbCRLF & vbCRLF
    End IF


    SBody = SBody & "               <table id='" & VARIABLE & "_table' class='table table-bordered table-striped table-condensed table-responsive' cellpadding='0' cellspacing='0' border='0'>" & vbCRLF
    SBody = SBody & "                   <colgroup>" & vbCRLF
    SBody = SBody & "                       <col width="""&GWD&"%""/>" & vbCRLF
    SBody = SBody & "                       <col width=""*""/>" & vbCRLF
    For iCnt=0 To Col
        SBody = SBody & "                       <col width=" & Chr(34) & WidthV & "%" & Chr(34) &"/>" & vbCRLF
    Next    
    SBody = SBody & "                   </colgroup>" & vbCRLF
    SBody = SBody & HDSTR
    ESTR = Split(DSTR,LABELSPLITTER)


    For iCnt=0 To UBound(ESTR)
        If VarType(ESTR(iCnt))<>0 And VarType(ESTR(iCnt))<>1 Then
            SBody = SBody & ESTR(iCnt) & vbCRLF
        End If
    Next


    If iCnt>10 Then
        SBody = SBody & HDSTR
    End IF
    SBody = SBody & "               </table>" & vbCRLF


    SBody = SBody & "       </div>" & vbCRLF
    SBody = SBody & "   </div>" & vbCRLF


    BODYSTR = SBody
    JBODYSTR = JBody


End Function


'#######################################################################################
'속성형태 라디오 - 세로보기
'VARIABLE : 변수 명
'CODES : 코드 라벨
'ATTRIBUTE: 속성
'TEXT : 질문 TEXT
'STEPFLAG : 스텝여부
'MCNT : 속성을 동일하게 응답하는 갯수 확인용
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트 
'#######################################################################################
Function QuestionSingleMATRIX2(VARIABLE,CODES,ATTRIBUTE,TEXT,STEPFLAG,MCnt,ByRef BODYSTR,ByRef JBODYSTR)


    Dim SBody,ITStr,V_COD,iCnt,cCnt,V1,V2
    Dim ATStr,A_COD,A1,A2
    Dim JBody
    Dim QName
    Dim DSTR,ESTR,OSTR,COL
    Dim WidthV,HeightV,CTV,LTV
    Dim XVX
    Dim HDStr
    Dim ATCnt


    HeightV = "45px"
    OSTR = ""
    ATCnt = MCnt


    


    ITStr = Split(CODES,LABELSPLITTER)
    ATStr = Split(ATTRIBUTE,LABELSPLITTER)
    COL = UBound(ATStr)
    CTV = Col


    Select Case COL
        Case 0
            WidthV = 20
        Case 1
            WidthV = 20
        Case 2
            WidthV = 20
        Case 3
            WidthV = 20
        Case 4
            WidthV = 12
        Case 5
            WidthV = 10
        Case 6
            WidthV = 13
        Case 7
            WidthV = 11.5
        Case 8
            WidthV = 10
        Case 9
            WidthV = 9
        Case 10
            WidthV = 8
        Case Else
            WidthV = FormatNumber(CDbl(80/COL),2)
    End Select


    SBody = ""
    JBody = ""


    SBody = SBody & "   <div class='panel panel-default'>" & vbCRLF
    SBody = SBody & "       <div class='panel-heading'><h4 style='line-height:150%;'>" & TEXT & "</h4></div>" & vbCRLF


    SBody = SBody & "       <div class='panel-body'>" & vbCRLF


    DSTR = ""   
    HDSTR = ""
    
    Dim TVAR
    TVAR = ""


    For cCnt=0 To UBound(ITStr)


        If VarType(ITStr(cCnt))<>0 And VarType(ITStr(cCnt))<>1 And ITStr(cCnt)<>"" Then
            V_COD = Split(ITStr(cCnt),CODESPLITTER)
            V1 = V_COD(0)
            V2 = V_COD(1)


            'Header TR 라인 생성
            If cCnt=0 Then
                HDSTR = "                   <TR id=""HCOL" & VARIABLE & "_" & A1 & """>" & vbCRLF
                HDSTR = HDSTR & "                       <TH>&nbsp;</TH>" & vbCRLF
            End If


            DSTR = DSTR & "                 <TR id=""COL" & VARIABLE & "_" & V1 & """>" & vbCRLF
            If InStr(ITStr(cCnt),"*OTHER")>0 Then
                OSTR = V1
                TVAR = TVAR & "T" & VARIABLE & "_" & V1 & ","
                DSTR = DSTR & "                     <TD class=""ATTHeader""><h5 style=""float:left;"">" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "</h5>&nbsp;<input type='text' class=""form-control other-text"" name=" & CHR(34) & "T" & VARIABLE & "_" & V1 & CHR(34) & " id=""" & "T" & VARIABLE & "_" & V1  & CHR(34) & " maxlength=" & Chr(34) & "255" & Chr(34) & " style=""width:30%;float:left;padding-left:5px;""></TD>" & vbCrLF                      
            Else
                DSTR = DSTR & "                     <TD class=""ATTHeader""><h5>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "</h5></TD>" & vbCrLF
            End IF


            For iCnt=0 To UBound(ATStr)
                If VarType(ATStr(iCnt))<>0 And VarType(ATStr(iCnt))<>1 Then
                    A_COD = Split(ATStr(iCnt),CODESPLITTER)
                    A1 = A_COD(0)
                    A2 = A_COD(1)
                    DSTR = DSTR & "                     <TD style=""text-align:center;vertical-align:middle;"">"


                    If InStr(ITStr(cCnt),"*OTHER")>0 Then
                        


'                       DSTR = DSTR & "<input type=" & CHR(34) & "radio" & CHR(34) & " name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """ class=""input-sm"" value=" & Chr(34) & V1 & Chr(34) & "/><input type='text' class=""input-sm"" name=" & CHR(34) & "T" & VARIABLE & "_" & A1 & "_" & V1 & CHR(34) & " id=""" & "T" & VARIABLE & "_" & A1  & CHR(34) & " maxlength=" & Chr(34) & "255" & Chr(34) & " style=""width:95%""></TD>" & vbCRLF
                        DSTR = DSTR & "<input type=" & CHR(34) & "radio" & CHR(34) & " name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """ class=""input-sm"" value=" & Chr(34) & V1 & Chr(34) & "/></TD>" & vbCRLF                      
                    Else
                        DSTR = DSTR & "<input type=" & CHR(34) & "radio" & CHR(34) & " name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """ class=" & CHR(34) & "radio1" & CHR(34) & " value=" & Chr(34) & V1 & Chr(34) & "/></TD>" & vbCRLF
                    End if


                    If cCnt=0 Then
                        HDSTR = HDSTR & "                       <TH class=""text-center""><span id=""L" & VARIABLE & "_" & A1 & """><h5><strong>" & Replace(Replace(A2,"*OTHER",""),"*NONE","") & "</strong></h5></span></TH>" & vbCrLF
                    End If
                End If
                
                If cCnt=0 Then
                    JBody = JBody & "   if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==undefined)" & vbCrLF
                    JBody = JBody & "   {" & vbCrLF
                    JBody = JBody & "       alert(" & Chr(34) & "[""+$(""#L" &  VARIABLE & "_" & A1 & """).text()+""]" & " " & LangQuestion(1) & Chr(34) & ");" & vbCRLF
                    JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
                    JBody = JBody & "       return;" & vbCRLF
                    JBody = JBody & "   }" & vbCRLF & vbCRLF


                    VAR = VAR & VARIABLE & "_" & A1 & ","               
                End if


                If InStr(ITStr(cCnt),"*OTHER")>0 Then


                    JBody = JBody & "   if ((getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==" & Chr(34) & OSTR & Chr(34) &") && ($('input[name=T" & VARIABLE & "_" & OSTR & "]').val().trim()==" & Chr(34) & Chr(34) & "))" & vbCrLF
                    JBody = JBody & "   {" & vbCrLF
                    JBody = JBody & "       alert(""[""+$(""#L" &  VARIABLE & "_" & A1 & """).text()+""] 기타에 "& LangQuestion(5) &""");" & vbCRLF
                    JBody = JBody & "       return;" & vbCRLF
                    JBody = JBody & "   }" & vbCRLF


                    JBody = JBody & "   if ((getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")!=" & Chr(34) & OSTR & Chr(34) &") && ($('input[name=T" & VARIABLE & "_" & OSTR & "]').val().trim()!=" & Chr(34) & Chr(34) & ") && ($('input[name=T" & VARIABLE & "_" & OSTR & "]').attr(""readonly"")==false))" & vbCrLF
                    JBody = JBody & "   {" & vbCrLF
                    JBody = JBody & "       alert(""[""+$(""#L" &  VARIABLE & "_" & A1 & """).text()+""]  기타 응답을 확인해 주십시오."");" & vbCRLF
                    JBody = JBody & "       $('input[name=T" & VARIABLE & "_" & OSTR & "]').focus();" & vbCrLF
                    JBody = JBody & "       return;" & vbCRLF
                    JBody = JBody & "   }" & vbCRLF


                    '기타 특수문자
                    JBody = JBody & "   if ($('input[name=T" & VARIABLE & "_" & OSTR & "]').val().trim()!="""")"
                    JBody = JBody & "   {" & vbCrLF
                    JBody = JBody & "       if (containsChars($('input[name=T" & VARIABLE & "_" & OSTR & "]').val().trim()," & ERRORSTR & "))" & vbCrLF
                    JBody = JBody & "       {" & vbCrLF
                    JBody = JBody & "           alert("""&LangQuestion(3)&""");" & vbCrLF
                    JBody = JBody & "           $('input[name=T" & VARIABLE & "_" & OSTR & "]').focus();" & vbCrLF
                    JBody = JBody & "           return;" & vbCRLF
                    JBody = JBody & "       }" & vbCrLF
                    JBody = JBody & "   }" & vbCrLF


                End if
            Next


            If cCnt=0 Then
                HDSTR = HDSTR & "                   </TR>" & VBCRLF
            End If


            DSTR = DSTR & "                 </TR>"
            DSTR = DSTR & "" & LABELSPLITTER            


        End IF
    Next


    SBody = SBody & "               <table id='" & VARIABLE & "_table' class='table table-bordered table-striped table-condensed table-responsive' cellpadding='0' cellspacing='0' border='0'>" & vbCRLF
    SBody = SBody & "                   <colgroup>" & vbCRLF
    SBody = SBody & "                       <col width=""*""/>" & vbCRLF
    For iCnt=0 To Col
        SBody = SBody & "                       <col width=" & Chr(34) & WidthV & "%" & Chr(34) &"/>" & vbCRLF
    Next    
    SBody = SBody & "                   </colgroup>" & vbCRLF
    SBody = SBody & HDSTR
    ESTR = Split(DSTR,LABELSPLITTER)


    For iCnt=0 To UBound(ESTR)
        If VarType(ESTR(iCnt))<>0 And VarType(ESTR(iCnt))<>1 Then
            SBody = SBody & ESTR(iCnt) & vbCRLF
        End If
    Next


    If iCnt>10 Then
        'SBody = SBody & HDSTR
    End IF
    SBody = SBody & "               </table>" & vbCRLF


    SBody = SBody & "       </div>" & vbCRLF
    SBody = SBody & "   </div>" & vbCRLF
    
    '동일 질문인 경우 처리하기
    If ATCnt>0 Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    var " & VARIABLE & "Flag;" & vbCrLf
        Response.Write "    " & VARIABLE & "Flag=false;" & vbCrLf
        Response.Write "//-->" & vbCRLF
        Response.Write "</script>" & vbCrLF


        JBody = JBody & "   if ((" & VARIABLE & "Flag==false) && (RadioArrayCnt(""" & Left(VAR,Len(VAR)-1) & ""","&ATCnt&")))" & vbCrLF
        JBody = JBody & "   {" & vbCrLF
        JBody = JBody & "       alert(" & Chr(34) & LangQuestion(4) & Chr(34) & ");" & vbCRLF
        JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
        JBody = JBody & "       " & VARIABLE & "Flag=true;" & vbCrLF
        JBody = JBody & "       return;" & vbCRLF
        JBody = JBody & "   }" & vbCRLF & vbCRLF
    End If
    
    '자바스크립트 처리 부분
    'Step 처리
    
    If STEPFLAG Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    $(document).ready(function(){" & vbCrLf


        For iCnt=1 To UBound(ATStr)
            If VarType(ATStr(iCnt))<>0 And VarType(ATStr(iCnt))<>1 Then     
                Response.Write "        $(""#" & VARIABLE & "_table td:nth-child(" & iCnt+2 & ")"").hide(); " & vbCrLF
            End If
        Next
        Response.Write vbCrLF
        For iCnt=0 To UBound(ATStr)
            If VarType(ATStr(iCnt))<>0 And VarType(ATStr(iCnt))<>1 Then     
                A_COD = Split(ATStr(iCnt),CODESPLITTER)
                A1 = A_COD(0)
                A2 = A_COD(1)
                Response.Write "        $(""input[name=" & VARIABLE & "_" & A1 & "]"").click(function(){" & vbCrLF
                Response.Write "            $(""#" & VARIABLE & "_table td:nth-child(" & iCnt+3 & ")"").show();" & vbCrLF
                Response.Write "        });" & vbCrLF
            End If
        Next


        Response.Write "    });" & vbCrLF
        Response.Write "//-->" & vbCrLF
        Response.Write "</script>" & vbCrLF


    End If


    If TVAR<>"" Then
        VAR = VAR & TVAR
    End if


    BODYSTR = SBody
    JBODYSTR = JBody


End Function


'#######################################################################################
'속성형태 라디오, 코드가 속성 갯수만큼 나타남
'VARIABLE : 변수 명
'CODES : 코드 라벨
'ATTRIBUTE: 속성
'TEXT : 질문 TEXT
'MCNT : 속성을 동일하게 응답하는 갯수 확인용
'OPT : 옆에 보일지 위에 보일지 결정
'P_VIEW : 점수 보여주기 여부
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트 
'#######################################################################################
Function QuestionSingleMATRIXCODE(VARIABLE,CODES,ATTRIBUTE,TEXT,MCNT,OPT,P_VIEW,ByRef BODYSTR,ByRef JBODYSTR)


    Dim SBody,ITStr,V_COD,iCnt,cCnt,V1,V2,TTStr
    Dim ATStr,A_COD,A1,A2
    Dim JBody
    Dim QName
    Dim DSTR,ESTR,OSTR,COL
    Dim WidthV,HeightV,CTV,LTV
    Dim XVX
    Dim HDStr,XSTR
    Dim ATCnt


    HeightV = "45px"
    OSTR = ""
    ATCnt = MCNT


    ITStr = Split(CODES,ARRAYSPLITTER)
    ATStr = Split(ATTRIBUTE,LABELSPLITTER)
    COL = UBound(ITStr)
    


'   Response.Write COL & "<BR>"


    SBody = ""
    JBody = ""


    SBody = SBody & "   <div class='panel panel-default'>" & vbCRLF
    SBody = SBody & "       <div class='panel-heading'><h4 style='line-height:150%;'>" & TEXT & "</h4></div>" & vbCRLF


    SBody = SBody & "       <div class='panel-body'>" & vbCRLF


    DSTR = ""   
    HDSTR = ""


    For cCnt=0 To UBound(ATStr)


        If VarType(ATStr(cCnt))<>0 And VarType(ATStr(cCnt))<>1 Then
            A_COD = Split(ATStr(cCnt),CODESPLITTER)
            A1 = A_COD(0)
            A2 = A_COD(1)
            TTStr = Split(ITStr(cCnt),LABELSPLITTER)
            CTV = UBound(TTStr)


            'Header TR 라인 생성


            If OPT=False Then
                HDSTR = "                   <TR id=""HCOL" & VARIABLE & "_" & A1 & """>" & vbCRLF
                HDSTR = HDSTR & "                   <TH>&nbsp;</TH>" & vbCRLF
                XSTR = "                    <TR id=""COL" & VARIABLE & "_" & A1 & """>" & vbCRLF
                XSTR = XSTR & "                     <TD class=""ATTHeader""><label id=""L" & VARIABLE & "_" & A1 & """><h5>" & Replace(Replace(A2,"*OTHER",""),"*NONE","") & "</h5></label></TD>" & vbCrLF
            Else
                HDSTR = "                   <TR id=""HHCOL" & VARIABLE & "_" & A1 & """>" & vbCRLF
                HDSTR = HDSTR & "                       <TD class=""ATTHeader"" colspan="""&UBound(TTStr)+1&"""><label id=""L" & VARIABLE & "_" & A1 & """><h5>" & Replace(Replace(A2,"*OTHER",""),"*NONE","") & "</h5></label></TD>" & vbCrLF              
                HDSTR = HDSTR & "                   </TR>" & vbCRLF
                HDSTR = HDSTR & "               <TR id=""HCOL" & VARIABLE & "_" & A1 & """>" & vbCRLF
                XSTR = "                    <TR id=""COL" & VARIABLE & "_" & A1 & """>" & vbCRLF
            End If
            
            If cCnt=0 Then


                COL = UBound(TTStr)


                Select Case COL
                    Case 1
                        XVX = 50
                    Case 2
                        XVX = 50
                    Case 3
                        XVX = 60
                    Case 4
                        XVX = 60
                    Case 5
                        XVX = 50
                    Case 6
                        XVX = 40
                    Case 7
                        XVX = 60
                    Case 8
                        XVX = 60
                    Case 9
                        XVX = 70
                    Case 10
                        XVX = 70
                    Case Else
                        XVX = 80
                End Select


                If OPT=False then
                    WidthV = FormatNumber(CDbl(XVX/COL),2)
                Else
                    WidthV = FormatNumber(CDbl(100/(CTV+3)),2)
                End If


            End If


            For iCnt=0 To UBound(TTStr)
                If VarType(TTStr(iCnt))<>0 And VarType(TTStr(iCnt))<>1 Then
                    V_COD = Split(TTStr(iCnt),CODESPLITTER)
                    V1 = V_COD(0)
                    V2 = V_COD(1)
                    XSTR = XSTR & "                     <TD style=""text-align:center;vertical-align:middle;"">"
                    XSTR = XSTR & "<input type=" & CHR(34) & "radio" & CHR(34) & " class=""input-sm"" name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """  value=" & Chr(34) & V1 & Chr(34) & "/></TD>" & vbCRLF


                    'HDSTR = HDSTR & "                      <TH>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "<br>(" & V1 & ")" & "</TH>" & vbCrLF
                    If P_VIEW<>"" Then
                        HDSTR = HDSTR & "                       <TH class=""text-center""><h5><strong>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "<br>(" & V1 & ")" & "</strong></h5></TH>" & vbCrLF
                    Else
                        HDSTR = HDSTR & "                       <TH class=""text-center""><h5><strong>" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "</strong></h5></TH>" & vbCrLF
                    End If
                End IF
            Next            


            HDSTR = HDSTR & "                   </TR>" & VBCRLF
            XSTR = XSTR & "                 </TR>"
            
            DSTR = DSTR & HDSTR & LABELSPLITTER & XSTR & LABELSPLITTER
            VAR = VAR & VARIABLE & "_" & A1 & ","


            JBody = JBody & "   if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==undefined)" & vbCrLF
            JBody = JBody & "   {" & vbCrLF
            JBody = JBody & "       alert(" & Chr(34) & "[""+$(""#L" &  VARIABLE & "_" & A1 & """).text()+""]" & " " & LangQuestion(1) & Chr(34) & ");" & vbCRLF
            JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
            JBody = JBody & "       return;" & vbCRLF
            JBody = JBody & "   }" & vbCRLF & vbCRLF


        End IF
    Next


    '동일 질문인 경우 처리하기
    If ATCnt>0 Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    var " & VARIABLE & "Flag;" & vbCrLf
        Response.Write "    " & VARIABLE & "Flag=false;" & vbCrLf
        Response.Write "//-->" & vbCRLF
        Response.Write "</script>" & vbCrLF


        JBody = JBody & "   if ((" & VARIABLE & "Flag==false) && (RadioArrayCnt(""" & Left(VAR,Len(VAR)-1) & ""","&ATCNT&")))" & vbCrLF
        JBody = JBody & "   {" & vbCrLF
        JBody = JBody & "       alert(" & Chr(34) & LangQuestion(4) & Chr(34) & ");" & vbCRLF
        JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
        JBody = JBody & "       " & VARIABLE & "Flag=true;" & vbCrLF
        JBody = JBody & "       return;" & vbCRLF
        JBody = JBody & "   }" & vbCRLF & vbCRLF
    End If
    
    SBody = SBody & "               <table id='" & VARIABLE & "_table' class='table table-bordered table-striped table-condensed table-responsive' cellpadding='0' cellspacing='0' border='0'>" & vbCRLF
    SBody = SBody & "                   <colgroup>" & vbCRLF
    If OPT=False Then
    SBody = SBody & "                       <col width=""*""/>" & vbCRLF
    End IF
    For iCnt=0 To Col
        SBody = SBody & "                       <col width=" & Chr(34) & WidthV & "%" & Chr(34) &"/>" & vbCRLF
    Next    
    SBody = SBody & "                   </colgroup>" & vbCRLF


    ESTR = Split(DSTR,LABELSPLITTER)
    For iCnt=0 To UBound(ESTR)


        If VarType(ESTR(iCnt))<>0 And VarType(ESTR(iCnt))<>1 Then
            SBody = SBody & ESTR(iCnt) & vbCRLF
        End If


    Next
    SBody = SBody & "               </table>" & vbCRLF


    SBody = SBody & "       </div>" & vbCRLF
    SBody = SBody & "   </div>" & vbCRLF


    '자바스크립트 처리 부분


    BODYSTR = SBody
    JBODYSTR = JBody


End Function


'#######################################################################################
'속성형태 라디오, 코드가 속성 갯수만큼 나타남
'VARIABLE : 변수 명
'CODES : 코드 라벨
'ATTRIBUTE: 속성
'COL : 컬럼 갯수
'MAXCOL : 텍스트 박스 최대 입력갯수
'STEPFLAG : 순서대로 나타나기
'TEXT : 질문 TEXT
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트 
'#######################################################################################
Function QuestionSingleMATRIXOTHER(VARIABLE,CODES,ATTRIBUTE,COL,MAXCOL,STEPFLAG,TEXT,MCNT,ByRef BODYSTR,ByRef JBODYSTR)


    Dim SBody,ITStr,V_COD,iCnt,cCnt,V1,V2,TTStr
    Dim ATStr,A_COD,A1,A2,tCnt
    Dim JBody
    Dim QName
    Dim DSTR,ESTR,OSTR
    Dim WidthV,HeightV,CTV,LTV
    Dim XVX
    Dim HDStr,XSTR
    Dim HL
    Dim ATCnt


    HeightV = "45px"
    OSTR = ""
    ATCnt = MCNT


    If MAXCOL="" Or MAXCOL="0" Then 
        HL=30
    Else
        HL = MAXCOL
    End If


    


    ITStr = Split(CODES,ARRAYSPLITTER)
    ATStr = Split(ATTRIBUTE,LABELSPLITTER)


    SBody = ""
    JBody = ""


    SBody = SBody & "   <div class='panel panel-default'>" & vbCRLF
    SBody = SBody & "       <div class='panel-heading'><h4 style='line-height:150%;'>" & TEXT & "</h4></div>" & vbCRLF


    SBody = SBody & "       <div class='panel-body'>" & vbCRLF
    DSTR = ""   
    HDSTR = ""


    For cCnt=0 To UBound(ATStr)


        If VarType(ATStr(cCnt))<>0 And VarType(ATStr(cCnt))<>1 Then
            A_COD = Split(ATStr(cCnt),CODESPLITTER)
            A1 = A_COD(0)
            A2 = A_COD(1)


            'Header TR 라인 생성
            HDSTR = "                   <TR id=""HCOL" & VARIABLE & "_" & A1 & """>" & vbCRLF
            HDSTR = HDSTR & "                       <TH>&nbsp;</TH>" & vbCRLF



            XSTR = "                    <TR id=""COL" & VARIABLE & "_" & A1 & """>" & vbCRLF
            XSTR = XSTR & "                     <TD class=""ATTHeader""><span id=""L" & VARIABLE & "_" & A1 & """>" & Replace(Replace(A2,"*OTHER",""),"*NONE","") & "</span></TD>" & vbCrLF
            TTStr = Split(ITStr(cCnt),LABELSPLITTER)
            
            If cCnt=0 Then
            WidthV = FormatNumber(CDbl(100/COL),2)
            End If


            XSTR = XSTR & "                     <TD class=""text-center"" style=""padding:0;margin:0;"">" & vbCrLF
            XSTR = XSTR & "                     <table class=""table table-hover table-bordered notopbottomtable"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""padding:0;margin:0;"">" & vbCRLF
            XSTR = XSTR & "                     <colgroup>" & vbCRLF
            For iCnt=0 To Col-1
                XSTR = XSTR & "                     <col width=" & Chr(34) & WidthV & "%" & Chr(34) &"/>" & vbCRLF
            Next
            XSTR = XSTR & "                     </colgroup>" & vbCRLF


            tCnt=0


            JBody = JBody & "   if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==undefined)" & vbCrLF
            JBody = JBody & "   {" & vbCrLF
            JBody = JBody & "       alert(" & Chr(34) & "[""+$(""#L" &  VARIABLE & "_" & A1 & """).text()+""]" & " " & LangQuestion(1) & Chr(34) & ");" & vbCRLF
            JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
            JBody = JBody & "       return false;" & vbCRLF
            JBody = JBody & "   }" & vbCRLF & vbCRLF


            VAR = VAR & VARIABLE & "_" & A1 & ","
            For iCnt=0 To UBound(TTStr)
                If VarType(TTStr(iCnt))<>0 And VarType(TTStr(iCnt))<>1 Then
                    If iCnt=0 Then
                        XSTR = XSTR & "                     <tr>" & vbCRLF
                    ElseIf tCnt>=COL Then
                        XSTR = XSTR & "                     </tr>" & vbCRLF
                        XSTR = XSTR & "                     <tr>" & vbCRLF
                        tCnt=0
                    End If


                    V_COD = Split(TTStr(iCnt),CODESPLITTER)
                    V1 = V_COD(0)
                    V2 = V_COD(1)
                    XSTR = XSTR & "                             <td style=""text-align:center;vertical-align:middle;"">"
                    XSTR = XSTR & "<label><input type=" & CHR(34) & "radio" & CHR(34) & " name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """  class=""input-sm""  value=" & Chr(34) & V1 & Chr(34) & "/>&nbsp;<h5>"
                    XSTR = XSTR & Replace(V2,"*OTHER","") &"</h5></label>"
                    If InStr(TTStr(iCnt),"*OTHER")>0 Then
                        OSTR = OSTR & ";" & V1
                        XSTR = XSTR & "&nbsp;<input type=" & Chr(34) & "text" & Chr(34) &" name=" & Chr(34) & "T" & VARIABLE & "_" & A1  &"_" & V1 & Chr(34) & " id=" & Chr(34) & VARIABLE & "_" & A1 &  "_" & V1 & Chr(34) & " value=" & Chr(34) & Chr(34) &" maxlength=" & Chr(34) & HL & Chr(34) & "  class=""input-sm""  style='vertical-align: top;width:200px;'/>"
                        VAR = VAR & "T" & VARIABLE & "_" & A1 & "_" & V1 & ","
                    End IF
                    XSTR = XSTR & "</td>" & vbCRLF
                    tCnt=tCnt+1


                    If InStr(TTStr(iCnt),"*OTHER")>0 Then
                        JBody = JBody & "   if ((getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==" & Chr(34) & V1 & Chr(34) &")"
                        JBody = JBody & " && ($('input[name=T" & VARIABLE & "_" & A1 & "_" & V1 & "]').val().trim()==" & Chr(34) & Chr(34) & "))" & vbCrLF
                        JBody = JBody & "   {" & vbCrLF
                        JBody = JBody & "       alert(""[" & A2 & "] " & """+$(""#L" & VARIABLE & "_" & A1 & "_" & V1 & """).text().trim()+"" "& LangQuestion(1) &""");" & vbCRLF
                        JBody = JBody & "       $('input[name=T" & VARIABLE & "_" & A1 & "_" & V1 & "]').focus();" & vbCRLF
                        JBody = JBody & "       return false;" & vbCRLF
                        JBody = JBody & "   }" & vbCRLF


                        JBody = JBody & "   if ((getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")!=" & Chr(34) & V1 & Chr(34) &")"
                        JBody = JBody & " && ($('input[name=T" & VARIABLE & "_" & A1 & "_" &V1 & "]').val().trim()!=" & Chr(34) & Chr(34) & "))" & vbCrLF
                        JBody = JBody & "   {" & vbCrLF
                        JBody = JBody & "       alert(""[" & A2 & "] " & """+$(""#L" & VARIABLE & "_" & A1 & "_" & V1 & """).text().trim()+"" "& LangQuestion(5) &""");" & vbCRLF
                        JBody = JBody & "       $('input[name=T" & VARIABLE & "_" & A1 & "_" & V1 & "]').focus();" & vbCRLF
                        JBody = JBody & "       return false;" & vbCRLF
                        JBody = JBody & "   }" & vbCRLF


                        '기타 특수문자
                        JBody = JBody & "   if ($('input[name=T" & VARIABLE & "_" & A1 & "_" &V1 & "]').val().trim()!="""")"
                        JBody = JBody & "   {" & vbCrLF
                        JBody = JBody & "       if (containsChars($('input[name=T" & VARIABLE & "_" & A1 & "_" &V1 & "]').val().trim()," & ERRORSTR & "))" & vbCrLF
                        JBody = JBody & "       {" & vbCrLF
                        JBody = JBody & "           alert("""&LangQuestion(3)&""");" & vbCrLF
                        JBody = JBody & "           $('input[name=T" & VARIABLE & "_" & A1 & "_" & V1 & "]').focus();" & vbCRLF
                        JBody = JBody & "           return;" & vbCRLF
                        JBody = JBody & "       }" & vbCrLF
                        JBody = JBody & "   }" & vbCrLF
                    End IF


                End IF
            Next
            XSTR = XSTR & "                     </tr>" & vbCrLF
            XSTR = XSTR & "                     </table>"
            XSTR = XSTR & " </TD>"&vbCrLF
            XSTR = XSTR & "                 </TR>" & vbCRLF


            DSTR = DSTR & LABELSPLITTER & XSTR & LABELSPLITTER


        End IF
    Next    
    
    SBody = SBody & "               <table id='" & VARIABLE & "_table' class='table table-bordered table-condensed table-responsive' cellpadding='0' cellspacing='0' border='0'>" & vbCRLF
    SBody = SBody & "                   <colgroup>" & vbCRLF
    SBody = SBody & "                       <col width=""*""/>" & vbCRLF
    SBody = SBody & "                       <col width=""65%""/>" & vbCRLF
    SBody = SBody & "                   </colgroup>" & vbCRLF


    ESTR = Split(DSTR,LABELSPLITTER)
    For iCnt=0 To UBound(ESTR)


        If VarType(ESTR(iCnt))<>0 And VarType(ESTR(iCnt))<>1 Then
            SBody = SBody & ESTR(iCnt) & vbCRLF
        End If


    Next
    SBody = SBody & "               </table>" & vbCRLF


    SBody = SBody & "       </div>" & vbCRLF
    SBody = SBody & "   </div>" & vbCRLF


    '자바스크립트 처리 부분


    BODYSTR = SBody
    JBODYSTR = JBody


End Function


'#######################################################################################
'속성형태 라디오 - 맨앞과 맨뒷 라벨만 좌우로 보여짐
'VARIABLE : 변수 명
'CODES : 코드 라벨
'ATTRIBUTE: 속성
'TEXT : 질문 TEXT
'STEPFLAG : 스텝여부
'MCNT : 속성을 동일하게 응답하는 갯수 확인용
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트 
'#######################################################################################
Function QuestionSideSingleMATRIX(VARIABLE,CODES,ATTRIBUTE,TEXT,STEPFLAG,MCNT,ByRef BODYSTR,ByRef JBODYSTR)


    Dim SBody,ITStr,V_COD,iCnt,cCnt,V1,V2
    Dim ATStr,A_COD,A1,A2,A3,T_LAB
    Dim JBody
    Dim QName
    Dim DSTR,ESTR,OSTR,COL
    Dim WidthV,HeightV,CTV,LTV
    Dim XVX,YVX
    Dim HDStr
    Dim ATCnt
    HeightV = "45px"
    OSTR = ""


    ATCnt = MCnt


'   QName = getNumberButton()


    ITStr = Split(CODES,LABELSPLITTER)
    ATStr = Split(ATTRIBUTE,LABELSPLITTER)
    COL = UBound(ITStr)
    CTV = Col


    Select Case COL
        Case 0
            XVX = 25
            YVX = 25
        Case 1
            XVX = 25
            YVX = 25
        Case 2
            XVX = 40
            YVX = 30
        Case 3
            XVX = 40
            YVX = 30
        Case 4
            XVX = 60
            YVX = 20
        Case 5
            XVX = 40
            YVX = 30
        Case 6
            XVX = 50
            YVX = 25
        Case 7
            XVX = 50
            YVX = 25
        Case 8
            XVX = 60
            YVX = 20
        Case 9
            XVX = 60
            YVX = 20
        Case 10
            XVX = 70
            YVX = 15
        Case Else
            XVX = 70
            YVX = 15
    End Select
    
    WidthV = FormatNumber(CDbl(XVX/COL),2)


    SBody = ""
    JBody = ""


    SBody = SBody & "   <div class='panel panel-default'>" & vbCRLF
    SBody = SBody & "       <div class='panel-heading'><h4 style='line-height:150%;'>" & TEXT & "</h4></div>" & vbCRLF


    SBody = SBody & "       <div class='panel-body'>" & vbCRLF
    DSTR = ""   
    HDSTR = ""


    For cCnt=0 To UBound(ATStr)


        If VarType(ATStr(cCnt))<>0 And VarType(ATStr(cCnt))<>1 And ATStr(cCnt)<>"" Then
            A_COD = Split(ATStr(cCnt),CODESPLITTER)
            A1 = A_COD(0)
            A2 = A_COD(1)
            T_LAB = Split(A2,ARRAYSPLITTER)


            'Header TR 라인 생성
            If cCnt=0 Then
                HDSTR = "                   <TR id=""HCOL" & VARIABLE & "_" & 0 & """>" & vbCRLF
                HDSTR = HDSTR & "                       <TH>&nbsp;</TH>" & vbCRLF
            End If


            If cCnt>0 Then
                DSTR = DSTR & "                 <TR id=""COL" & VARIABLE & "_" & A1 & """ style=""display:none;"">" & vbCRLF
            Else
                DSTR = DSTR & "                 <TR id=""COL" & VARIABLE & "_" & A1 & """>" & vbCRLF
            End IF
            
            DSTR = DSTR & "                     <TD class=""ATTHeader""><h5>" & Replace(Replace(T_LAB(0),"*OTHER",""),"*NONE","") & "</h5></TD>" & vbCrLF


            For iCnt=0 To UBound(ITStr)
                If VarType(ITStr(iCnt))<>0 And VarType(ITStr(iCnt))<>1 Then
                    V_COD = Split(ITStr(iCnt),CODESPLITTER)
                    V1 = V_COD(0)
                    V2 = V_COD(1)
                    DSTR = DSTR & "                     <TD style=""text-align:center;"">"
                    DSTR = DSTR & "<input type=" & CHR(34) & "radio" & CHR(34) & " name=" & CHR(34) & VARIABLE & "_" & A1 & CHR(34) & " id=""" & VARIABLE & "_" & A1 & "_" & V1 & """ class=""input-sm"" value=" & Chr(34) & V1 & Chr(34) & "/></TD>" & vbCRLF


                    If cCnt=0 Then
                        'HDSTR = HDSTR & "                      <TH class=""text-center"">" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "<br>(" & V1 & ")" & "</TH>" & vbCrLF
                        HDSTR = HDSTR & "                       <TH class=""text-center"" style=""vertical-align:bottom;"">" & Replace(Replace(V2,"*OTHER",""),"*NONE","") & "" & "</TH>" & vbCrLF
                    End If
                End IF
            Next


            DSTR = DSTR & "                     <TD class=""ATTHeader""><h5>" & Replace(Replace(T_LAB(1),"*OTHER",""),"*NONE","") & "</h5></TD>" & vbCrLF


            If cCnt=0 Then
                HDSTR = HDSTR & "                       <TH>&nbsp;</TH>" & vbCRLF
                HDSTR = HDSTR & "                   </TR>" & VBCRLF
            End If


            DSTR = DSTR & "                 </TR>"
            DSTR = DSTR & "" & LABELSPLITTER
            VAR = VAR & VARIABLE & "_" & A1 & ","


            JBody = JBody & "   if (getRadioValue("& Chr(34) & VARIABLE & "_" & A1 & Chr(34) &")==undefined)" & vbCrLF
            JBody = JBody & "   {" & vbCrLF
            JBody = JBody & "       alert(" & Chr(34) & "[" & cCnt+1 & " ]" & LangQuestion(1) & Chr(34) & ");" & vbCRLF
            JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
            JBody = JBody & "       return;" & vbCRLF
            JBody = JBody & "   }" & vbCRLF & vbCRLF


        End IF
    Next


    If ATCnt>0 Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    var " & VARIABLE & "Flag;" & vbCrLf
        Response.Write "    " & VARIABLE & "Flag=false;" & vbCrLf
        Response.Write "//-->" & vbCRLF
        Response.Write "</script>" & vbCrLF


        JBody = JBody & "   if ((" & VARIABLE & "Flag==false) && (RadioArrayCnt(""" & Left(VAR,Len(VAR)-1) & ""","&ATCnt&")))" & vbCrLF
        JBody = JBody & "   {" & vbCrLF
        JBody = JBody & "       alert(" & Chr(34) & LangQuestion(4) & Chr(34) & ");" & vbCRLF
        JBody = JBody & "       $(" & Chr(34) & "input[name=" & VARIABLE & "_" & A1 &"]:eq(0)" & Chr(34) & ").focus();" & vbCRLF
        JBody = JBody & "       " & VARIABLE & "Flag=true;" & vbCrLF
        JBody = JBody & "       return;" & vbCRLF
        JBody = JBody & "   }" & vbCRLF & vbCRLF
    End IF


    SBody = SBody & "               <table id='" & VARIABLE & "_table' class='table table-bordered table-striped table-condensed table-responsive' cellpadding='0' cellspacing='0' border='0'>" & vbCRLF
    SBody = SBody & "                   <colgroup>" & vbCRLF
    SBody = SBody & "                       <col width=""*""/>" & vbCRLF
    For iCnt=0 To Col
        SBody = SBody & "                       <col width=" & Chr(34) & WidthV & "%" & Chr(34) &"/>" & vbCRLF
    Next
    SBody = SBody & "                       <col width=""*""/>" & vbCRLF
    SBody = SBody & "                   </colgroup>" & vbCRLF
    SBody = SBody & HDSTR
    ESTR = Split(DSTR,LABELSPLITTER)


    For iCnt=0 To UBound(ESTR)
        If VarType(ESTR(iCnt))<>0 And VarType(ESTR(iCnt))<>1 Then
            SBody = SBody & ESTR(iCnt) & vbCRLF
        End If
    Next


    If iCnt>10 Then
        SBody = SBody & HDSTR
    End IF
    SBody = SBody & "               </table>" & vbCRLF


    SBody = SBody & "       </div>" & vbCRLF
    SBody = SBody & "   </div>" & vbCRLF


    '자바스크립트 처리 부분
    
    If STEPFLAG Then
        Response.Write vbCrLF
        Response.write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
        Response.Write "<!--" & vbCRLF
        Response.Write "    $(document).ready(function(){" & vbCrLf


        Response.Write vbCrLF
        For iCnt=0 To UBound(ATStr)
            If VarType(ATStr(iCnt))<>0 And VarType(ATStr(iCnt))<>1 Then     
                A_COD = Split(ATStr(iCnt),CODESPLITTER)
                A1 = A_COD(0)
                A2 = A_COD(1)
                Response.Write "        $(""input[name=" & VARIABLE & "_" & A1 & "]"").click(function(){" & vbCrLF
                Response.Write "            $(""#" & VARIABLE & "_table tr:nth-child(" & iCnt+3 & ")"").show();" & vbCrLF
                Response.Write "        });" & vbCrLF
            End If
        Next


        Response.Write "    });" & vbCrLF
        Response.Write "//-->" & vbCrLF
        Response.Write "</script>" & vbCrLF


    End If


    BODYSTR = SBody
    JBODYSTR = JBody


End Function
%>


