<%
Dim ARX
FILEUPLOAD = True
ARX = "'jpg','gif','png','jpeg'"
'#######################################################################################
'파일업로드 TextBox형
'VARIABLE : 변수 명
'TEXT : 질문 TEXT
'MINLENGTH: 최소 입력 길이
'NFLAG : None 처리
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트
'#######################################################################################
Function QuestionTEXTBOXIMG(VARIABLE,TEXT,NFLAG,ByRef BODYSTR,ByRef JBODYSTR)

	Dim SBody,ITStr,V_COD,iCnt,V1,V2
	Dim JBody
	Dim QName,DSTR,ESTR
	Dim WidthV,HeightV,CTV
	Dim ML,MH

	HeightV = "30px"

	SBody = ""
	JBody = ""
	DSTR = ""
	ESTR = ""

	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
	SBody = SBody & "			<div class=""form-group"" id=""upload-thumbnail"">" & vbCRLF
	SBody = SBody & "				<div class=""col-md-offset-2 col-md-10"">" & vbCRLF
	SBody = SBody & "				<img src="""" alt="""" class=""img-thumbnail"" id=""preview"">" & vbCRLF
	SBody = SBody & "				</div>" & vbCRLF
	SBody = SBody & "			</div>" & vbCRLF
	SBody = SBody & "			<div class=""form-group"" id=""upload-name"">" & vbCRLF
	SBody = SBody & "			<label for="""&VARIABLE&""" class=""col-md-2 control-label"">"&LangQuestion(81)&" : </label>" & vbCRLF
	SBody = SBody & "				<div class=""col-md-10"">" & vbCRLF
	SBody = SBody & "				<input type=""TEXT"" class=""form-control"" iname=""" & VARIABLE & """ id=""" & VARIABLE & """ readonly>" & vbCRLF
	SBody = SBody & "				</div>" & vbCRLF
	SBody = SBody & "			</div>" & vbCRLF
	SBody = SBody & "			<div class=""form-group"" id=""upload-file"">" & vbCRLF
	SBody = SBody & "			<label for="""&VARIABLE&""" class=""col-md-2 control-label"">"&LangQuestion(82)&" : </label>" & vbCRLF
	SBody = SBody & "				<div class=""col-md-10"">" & vbCRLF
	SBody = SBody & "				<input type=""file"" class=""form-control"" name=""" & VARIABLE & "_FILE"" id=""" & VARIABLE & "_FILE""/>" & vbCRLF
	SBody = SBody & "				<br>(Image file formats are only allowed to be uploaded such as *.jpg/*.gif/*.png)" & vbCRLF
	SBody = SBody & "				</div>" & vbCRLF
	SBody = SBody & "			</div>" & vbCRLF

	VAR = VARIABLE & ","

	If NFlag Then
		SBody = SBody & "		<div class=""checkbox""><input type=""checkbox"" id="""&VARIABLE&"_NONE"" name="""&VARIABLE&"_NONE"" value=""1""/><a href=""javascript:setCheckBoxValue('"&VARIABLE&"_NONE');itemDisabledSetup('"&VARIABLE&"'.split(','),$('#"&VARIABLE&"_NONE').attr('checked'))"">"&NONSTR&"</a></div>" & vbCRLF
		Response.Write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
		Response.Write "<!--" & vbCrLF
		Response.Write "	$(document).ready(function(){" & vbCrLF
		Response.Write "		$(""#"&VARIABLE&"_NONE"").click(function(){" & vbCrLF
		Response.Write "			itemDisabledSetup("""&VARIABLE&""".split("",""),$(""#"&VARIABLE&"_NONE"").attr(""checked""));" & vbCrLF
		Response.Write "		})" & vbCrLf
		Response.Write "	});" & vbCrLf
		Response.Write "//-->" & vbCrLF
		Response.Write "</script>"

		VAR = VAR & VARIABLE & "_NONE,"
	End IF

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

	JBody = JBody & "	var xx;" & vbCRLF
	JBody = JBody & "	xx = $(""#" & VARIABLE & """).val().trim();" & vbCrLF

	If NFlag Then
		JBody = JBody & "	if ($("& Chr(34) & "#" & VARIABLE & "_NONE" & Chr(34) &").is("":checked"")==false){" & vbCrLF
	End If
	
	JBody = JBody & "	if ($(""#"&VARIABLE&"_FILE"").val().trim()=="""")" & vbCrLF
	JBody = JBody & "	{" & vbCrLF
	JBody = JBody & "		alert("""&LangQuestion(1)&""");" & vbCRLF
	JBody = JBody & "		$(""#" & VARIABLE & "_FILE"").focus();" & vbCRLF
	JBody = JBody & "		return;" & vbCRLF
	JBody = JBody & "	}" & vbCRLF

	JBody = JBody & "	if ($("& Chr(34) & "#" & VARIABLE & Chr(34) &").val().trim()=="""")" & vbCrLF
	JBody = JBody & "	{" & vbCrLF
	JBody = JBody & "		alert("""&LangQuestion(1)&""");" & vbCRLF
	JBody = JBody & "		$(" & Chr(34) & "#" & VARIABLE & Chr(34) & ").focus();" & vbCRLF
	JBody = JBody & "		return;" & vbCRLF
	JBody = JBody & "	}" & vbCRLF

	If NFlag Then
		JBody = JBody & "		}" & vbCrLF
	End If
	
	Response.Write "<script src=""//malsup.github.com/jquery.form.js""></script>" & vbCrLF
	Response.Write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
	Response.Write "<!--" & vbCrLF
	Response.Write "	$(document).ready(function(){" & vbCrLF
	Response.Write "		$(""#upload-thumbnail"").hide();" & vbCRLF
	Response.Write "		$(""#upload-name"").hide();" & vbCRLF
	Response.Write "		$(""form[name='Survey']"").addClass(""form-horizontal"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").attr(""action"",""Upload.asp"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").attr('enctype', 'multipart/form-data'); " & vbCrLF
	Response.Write "		$(""#Survey"").ajaxForm();" & vbCrLF
	Response.Write "		$(""input[type=TEXT]"").attr(""readonly"",true);" & vbCrLF
	Response.Write "		$(""input[type=TEXT]"").css(""background-color"",""#eee"");" & vbCrLF
	Response.Write "		$(""[data-des]"").attr(""readonly"",false);" & vbCrLF
	Response.Write "		$(""[data-des]"").css(""background-color"",""#fff"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").ajaxForm();" & vbCRLF
	Response.Write "		$(""#next"").hide();" & vbCRLF
	Response.Write "		$(""#upload"").click(function(){imgUpload()});" & vbCRLF
	Response.Write "		$(""#loading"").hide();" & vbCRLF

	Response.Write "	});" & vbCrLf
	Response.Write vbCRLF

	Response.Write "	function imgUpload() {" & vbCrLf
	Response.Write "		$(""#loading"").show();" & vbCrLf
	Response.Write "		wrapWindowByMask();" & vbCrLf
	Response.Write "		var ImgName,ImgPath,ImgExt;" & vbCrLf
	Response.Write "		var arx=["&ARX&"];" & vbCrLf
	Response.Write "		var img_flag=false;" & vbCrLf
	Response.Write vbCRLF
	Response.Write "		$(""form[name='Survey']"").ajaxSubmit({" & vbCrLf
    Response.Write "			statusCode: {" & vbCrLf
	Response.Write "			400: function() {" & vbCrLf
	Response.Write "				alert("""&LangQuestion(41)&""");" & vbCrLf
    Response.Write "			}," & vbCrLf
	Response.Write "			500: function(request,status,error) {" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				console.log(request.responseText);" & vbCrLf
	Response.Write "				console.log(error);" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "				$(""#upload"").show();" & vbCRLF
	Response.Write "				$(""#next"").hide();" & vbCRLF
	Response.Write "			}" & vbCrLf
    Response.Write "		}," & vbCrLf
	Response.Write "		beforeSubmit: function (data,form,option) {" & vbCrLf
	Response.Write "		//validation체크 " & vbCrLf
    Response.Write "		//막기위해서는 return false를 잡아주면됨" & vbCrLf
	Response.Write "			if ($(""#"&VARIABLE&"_FILE"").val().trim()=="""")" & vbCrLF
	Response.Write "			{" & vbCrLF
	Response.Write "				alert("""&LangQuestion(1)&""");" & vbCRLF
	Response.Write "				$(""#" & VARIABLE & "_FILE"").focus();" & vbCRLF
	Response.Write "				return false;" & vbCRLF
	Response.Write "			}" & vbCRLF
    Response.Write "			return true;" & vbCrLf
	Response.Write "		}," & vbCrLf
    Response.Write "		success: function(data) {" & vbCrLf
	Response.Write "			if (data!=""""){" & vbCrLf
	Response.Write "				$(""#"&VARIABLE&""").val(data);" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "				ImgExt = data.split(""."");" & vbCrLf
	Response.Write "				ImgName = ImgExt[1].toLowerCase();" & vbCrLf
	Response.Write "				alert("""&LangQuestion(43)&""");" & vbCrLf
	Response.Write "				$(""form[name='Survey']"").attr(""enctype"", ""application/x-www-form-urlencoded"");  " & vbCrLf
	Response.Write "				document.Survey.action=""Survey.asp"";" & vbCrLf
	Response.Write "				for (i=0;i<arx.length;i++)" & vbCrLF
	Response.Write "				{" & vbCrLF
	Response.Write "					if (ImgName==arx[i])" & vbCrLF
	Response.Write "					{" & vbCrLF
	Response.Write "						img_flag = true;" & vbCrLF
	Response.Write "						break;" & vbCrLF
	Response.Write "					}" & vbCrLF
	Response.Write "				}" & vbCrLF
	Response.Write vbCRLF
	Response.Write "				if (img_flag)" & vbCrLF
	Response.Write "				{" & vbCrLF
	Response.Write "					$(""#preview"").attr(""src"",""./Files/""+data);" & vbCrLF
	Response.Write "					$(""#upload-thumbnail"").show();" & vbCrLF
	Response.Write "				}" & vbCrLF
	Response.Write "				$(""#upload-name"").show();" & vbCrLF
	Response.Write "				$(""#upload"").hide();" & vbCrLF
	Response.Write "				$(""#next"").show();" & vbCrLF
	Response.Write "			}" & vbCrLf
	Response.Write "			else" & vbCrLf
	Response.Write "			{" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "			}" & vbCrLf
    Response.Write "		}," & vbCrLf
	Response.Write "		error: function(request,status,error){" & vbCrLf
	Response.Write "		//에러발생을 위한 code페이지" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				console.log(""code:""+request.status+""\n""+""message:""+request.responseText+""\n""+""error:""+error);" & vbCrLf
    Response.Write "		} " & vbCrLf
	Response.Write "		});" & vbCrLf
	Response.Write "	}" & vbCrLf
	Response.Write "//-->" & vbCrLF
	Response.Write "</script>"

	BODYSTR = SBody
	JBODYSTR = JBody

End Function

'#######################################################################################
'이미지를 여러개 업로드 가능한 Template
'VARIABLE : 변수 명
'ATTRIBUTE: 속성 정보
'TEXT : 질문 TEXT
'MAXLENGTH: 텍스트 입력 갯수
'ATTMAX : 최소 응답 해야 하는 갯수
'MINLENGTH: 최소 입력 길이
'NFLAG : None 처리
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트
'#######################################################################################
Function QuestionIMGATT(VARIABLE,ATTRIBUTE,TEXT,ATTMAX,NFLAG,ByRef BODYSTR,ByRef JBODYSTR)

	Dim SBody,ITStr,V_COD,iCnt,V1,V2
	Dim JBody
	Dim QName,DSTR,ESTR
	Dim WidthV,HeightV,CTV
	Dim AMX,ML,MH
	Dim XVAR
	
	
	If ATTMAX="" Or ATTMAX="0" Then 
		AMX=1
	Else
		AMX = ATTMAX
	End If
	
	HeightV = "30px"
	ITStr = Split(ATTRIBUTE,LABELSPLITTER)

	SBody = ""
	JBody = ""
	DSTR = ""
	ESTR = ""

	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	
	
		Dim VXFLAG
		V_COD = Split(ITStr(0),CODESPLITTER)
		V1 = V_COD(0)
		V2 = V_COD(1)
		If Trim(V2)="" Then
			VXFLAG = FALSE
		Else
			VXFLAG = TRUE
		End IF
		

		For iCnt=0 To UBound(ITStr)
			If VarType(ITStr)<>0 And VarType(ITSTR)<>1 Then
				V_COD = Split(ITStr(iCnt),CODESPLITTER)
				V1 = V_COD(0)
				V2 = V_COD(1)

				SBody = SBody & "			<div class=""form-group upload-thumbnail"" id=""thumbnail_"&iCnt+1&""">" & vbCRLF
				SBody = SBody & "				<div class=""col-md-offset-2 col-md-10 col-xs-12"">" & vbCRLF
				SBody = SBody & "				<img src="""" alt="""" class=""img-thumbnail"" id=""preview_" & VARIABLE & "_" & V1 &""">" & vbCRLF
				SBody = SBody & "				</div>" & vbCRLF
				SBody = SBody & "			</div>" & vbCRLF
				SBody = SBody & "			<div class=""form-group upload-name"" id=""filename_"&iCnt+1&""">" & vbCRLF
				SBody = SBody & "			<label for="""&VARIABLE&""" class=""col-md-2 control-label"">"&LangQuestion(81) &" " & iCnt+1 & " : </label>" & vbCRLF
				SBody = SBody & "				<div class=""col-md-10"">" & vbCRLF
				SBody = SBody & "				<input type=""TEXT"" class=""form-control"" name=""" & VARIABLE & "_" & V1 & """ id=""" & VARIABLE & "_" & V1 & """ readonly>" & vbCRLF
				SBody = SBody & "				</div>" & vbCRLF
				SBody = SBody & "			</div>" & vbCRLF
				SBody = SBody & "			<div class=""form-group upload-file"">" & vbCRLF
				SBody = SBody & "			<label for="""&VARIABLE&""" class=""col-md-2 control-label"">"&LangQuestion(82)&" " & iCnt+1 & " : </label>" & vbCRLF
				SBody = SBody & "				<div class=""col-md-10"">" & vbCRLF
				SBody = SBody & "				<input type=""file"" class=""form-control"" name=""" & VARIABLE & "_" & iCnt+1 & "_FILE"" id=""" & VARIABLE & "_" & iCnt+1 & "_FILE""/>" & vbCRLF
				SBody = SBody & "				(Image file formats are only allowed to be uploaded such as *.jpg/*.gif/*.png)" & vbCRLF
				SBody = SBody & "				</div>" & vbCRLF
				SBody = SBody & "			</div>" & vbCRLF

				VAR = VAR & VARIABLE & "_" & V1 & ","
				XVAR = XVAR & VARIABLE & "_" & V1 & ","
			End IF
		Next


	If NFlag Then
		SBody = SBody & "		<div class=""checkbox""><input type=""checkbox"" id="""&VARIABLE&"_NONE"" name="""&VARIABLE&"_NONE"" value=""1""/><a href=""javascript:setCheckBoxValue('"&VARIABLE&"_NONE');itemDisabledSetup('"&XVAR&"'.split(','),$('#"&VARIABLE&"_NONE').attr('checked'))"">"&NONSTR&"</a></div>" & vbCRLF
		Response.Write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
		Response.Write "<!--" & vbCrLF
		Response.Write "	$(document).ready(function(){" & vbCrLF
		Response.Write "		$(""#"&VARIABLE&"_NONE"").click(function(){" & vbCrLF
		Response.Write "			itemDisabledSetup("""&XVAR&""".split("",""),$(""#"&VARIABLE&"_NONE"").attr(""checked""));" & vbCrLF
		Response.Write "		})" & vbCrLf
		Response.Write "	});" & vbCrLf
		Response.Write "//-->" & vbCrLF
		Response.Write "</script>"

		VAR = VAR & VARIABLE & "_NONE,"
	End IF

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

	XVAR = Left(XVAR,Len(XVAR)-1)

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

	If NFlag Then
		JBody = JBody & "	if ($("& Chr(34) & "#" & VARIABLE & "_NONE" & Chr(34) &").is("":checked"")==false){" & vbCrLF
	End if

	For iCnt=0 To AMX-1
		If VarType(ITStr)<>0 And VarType(ITSTR)<>1 Then
			V_COD = Split(ITStr(iCnt),CODESPLITTER)
			V1 = V_COD(0)

			JBody = JBody & "	if ($("& Chr(34) & "#" & VARIABLE & "_" & V1 & Chr(34) &").val()=="""")" & vbCrLF
			JBody = JBody & "	{" & vbCrLF
			If iCnt=0 Then
				JBody = JBody & "		alert("""& LangQuestion(1) &""");" & vbCRLF
			Else
				JBody = JBody & "		alert(""(" & (iCnt+1) & ") "& LangQuestion(1) &""");" & vbCRLF
			End IF
			JBody = JBody & "		$(" & Chr(34) & "#" & VARIABLE  & "_" & V1 & Chr(34) & ").focus();" & vbCRLF
			JBody = JBody & "		return;" & vbCRLF
			JBody = JBody & "	}" & vbCRLF

		End IF
	Next
	
	If NFlag Then
		JBody = JBody & "	}" & vbCRLF
	End If
	
	
	Response.Write "<script src=""//malsup.github.com/jquery.form.js""></script>" & vbCrLF
	Response.Write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
	Response.Write "<!--" & vbCrLF
	Response.Write "	$(document).ready(function(){" & vbCrLF
	Response.Write "		$("".upload-thumbnail"").hide();" & vbCRLF
	Response.Write "		$("".upload-name"").hide();" & vbCRLF
	Response.Write "		$(""form[name='Survey']"").addClass(""form-horizontal"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").attr(""action"",""Upload.asp"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").attr('enctype', 'multipart/form-data'); " & vbCrLF
	Response.Write "		$(""#Survey"").ajaxForm();" & vbCrLF
	Response.Write "		$(""input[type=TEXT]"").attr(""readonly"",true);" & vbCrLF
	Response.Write "		$(""input[type=TEXT]"").css(""background-color"",""#eee"");" & vbCrLF
	Response.Write "		$(""[data-des]"").attr(""readonly"",false);" & vbCrLF
	Response.Write "		$(""[data-des]"").css(""background-color"",""#fff"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").ajaxForm();" & vbCRLF
	Response.Write "		$(""#next"").hide();" & vbCRLF
	Response.Write "		$(""#upload"").click(function(){imgUpload()});" & vbCRLF
	Response.Write "		$(""#loading"").hide();" & vbCRLF

	Response.Write "	});" & vbCrLf
	Response.Write vbCRLF

	Response.Write "	function imgUpload() {" & vbCrLf
	Response.Write "		$(""#loading"").show();" & vbCrLf
	Response.Write "		wrapWindowByMask();" & vbCrLf
	Response.Write "		var ImgName,ImgArr,ImgExt;" & vbCrLf
	Response.Write "		var arx=["&ARX&"];" & vbCrLf
	Response.Write "		var img_flag=false;" & vbCrLf
	Response.Write vbCRLF
	Response.Write "		$(""form[name='Survey']"").ajaxSubmit({" & vbCrLf
    Response.Write "			statusCode: {" & vbCrLf
	Response.Write "			400: function() {" & vbCrLf
	Response.Write "				alert("""&LangQuestion(41)&""");" & vbCrLf
    Response.Write "			}," & vbCrLf
	Response.Write "			500: function(request,status,error) {" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				console.log(request.responseText);" & vbCrLf
	Response.Write "				console.log(error);" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "				$(""#upload"").show();" & vbCRLF
	Response.Write "				$(""#next"").hide();" & vbCRLF
	Response.Write "			}" & vbCrLf
    Response.Write "		}," & vbCrLf
	Response.Write "		beforeSubmit: function (data,form,option) {" & vbCrLf
	Response.Write "		//validation체크 " & vbCrLf
    Response.Write "		//막기위해서는 return false를 잡아주면됨" & vbCrLf

	For iCnt=1 To AMX
	Response.Write "			if ($(""#"&VARIABLE&"_" & iCnt & "_FILE"").val().trim()=="""")" & vbCrLF
	Response.Write "			{" & vbCrLF
	Response.Write "				alert("""&LangQuestion(1)&""");" & vbCRLF
	Response.Write "				$(""#" & VARIABLE & "_" & iCnt &"_FILE"").focus();" & vbCRLF
	Response.Write "				return false;" & vbCRLF
	Response.Write "			}" & vbCRLF    
	Next
	Response.Write "			return true;" & vbCrLf

	Response.Write "		}," & vbCrLf
    Response.Write "		success: function(data) {" & vbCrLf
	Response.Write "			if (data!=""""){" & vbCrLf
	Response.Write "				$(""#"&VARIABLE&""").val(data);" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "				alert("""&LangQuestion(43)&""");" & vbCrLf
	Response.Write "				$(""form[name='Survey']"").attr(""enctype"", ""application/x-www-form-urlencoded"");  " & vbCrLf
	Response.Write "				document.Survey.action=""Survey.asp"";" & vbCrLf
	'요기서 반복 이미지 처리
	Response.Write "				if (data.indexOf(""@@"")>0)" & vbCrLF
	Response.Write "				{" & vbCrLF
	Response.Write "					ImgArr = data.split(""@@"");" & vbCrLF
	Response.Write "					for (i=0;i<ImgArr.length;i++){" & vbCrLF
	Response.Write "						if (ImgArr[i].trim()!=""""){" & vbCrLF
	Response.Write "						ImgExt = ImgArr[i].split(""."");" & vbCrLf
	Response.Write "						ImgName = ImgExt[1].toLowerCase();" & vbCrLf
	Response.Write "						for (j=0;j<arx.length;j++)" & vbCrLF
	Response.Write "						{" & vbCrLF
	Response.Write "							if (ImgName==arx[j])" & vbCrLF
	Response.Write "								{" & vbCrLF
	Response.Write "									img_flag = true;" & vbCrLF	
	Response.Write "									break;" & vbCrLF
	Response.Write "								}" & vbCrLF
	Response.Write "							}" & vbCrLF
	Response.Write vbCRLF
	Response.Write "						}" & vbCrLF
	Response.Write "						if (img_flag)" & vbCrLF
	Response.Write "						{" & vbCrLF
	Response.Write "							$(""#preview_"& VARIABLE & "_""+(i+1)).attr(""src"",""./Files/""+ImgArr[i]);" & vbCrLF
	Response.Write "							$(""#"&VARIABLE&"_""+(i+1)).val(ImgArr[i]);" & vbCrLf	
	Response.Write "							$(""#thumbnail_""+(i+1)).show();" & vbCrLf	
	Response.Write "							$(""#filename_""+(i+1)).show();" & vbCrLf	
	Response.Write "						}" & vbCrLF
	Response.Write "					}" & vbCrLF
	Response.Write "				}" & vbCrLF
	Response.Write "				else" & vbCrLF
	Response.Write "				{" & vbCrLF
	Response.Write "					ImgExt = data.split(""."");" & vbCrLf
	Response.Write "					ImgName = ImgExt[1].toLowerCase();" & vbCrLf
	Response.Write "					for (i=0;i<arx.length;i++)" & vbCrLF
	Response.Write "					{" & vbCrLF
	Response.Write "						if (ImgName==arx[i])" & vbCrLF
	Response.Write "						{" & vbCrLF
	Response.Write "							img_flag = true;" & vbCrLF
	Response.Write "							break;" & vbCrLF
	Response.Write "						}" & vbCrLF
	Response.Write "					}" & vbCrLF
	Response.Write vbCRLF
	Response.Write "					if (img_flag)" & vbCrLF
	Response.Write "					{" & vbCrLF
	Response.Write "						$(""#preview_"& VARIABLE & "_1"").attr(""src"",""./Files/""+data);" & vbCrLF
	Response.Write "						$(""#"&VARIABLE&"_1"").val(data);" & vbCrLf	
	Response.Write "						$(""#thumbnail_1"").show();" & vbCrLf	
	Response.Write "						$(""#filename_1"").show();" & vbCrLf	
	Response.Write "					}" & vbCrLF
	Response.Write "				}" & vbCrLF

	Response.Write "				$(""#upload"").hide();" & vbCrLF
	Response.Write "				$(""#next"").show();" & vbCrLF
	Response.Write "			}" & vbCrLf
	Response.Write "			else" & vbCrLf
	Response.Write "			{" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "			}" & vbCrLf
    Response.Write "		}," & vbCrLf
	Response.Write "		error: function(request,status,error){" & vbCrLf
	Response.Write "		//에러발생을 위한 code페이지" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				console.log(""code:""+request.status+""\n""+""message:""+request.responseText+""\n""+""error:""+error);" & vbCrLf
    Response.Write "		} " & vbCrLf
	Response.Write "		});" & vbCrLf
	Response.Write "	}" & vbCrLf
	Response.Write "//-->" & vbCrLF
	Response.Write "</script>"

	BODYSTR = SBody
	JBODYSTR = JBody

End Function

'#######################################################################################
'이미지 여러개 업로드 가능 함 with Description
'VARIABLE : 변수 명
'ATTRIBUTE: 속성 정보
'TEXT : 질문 TEXT
'MAXLENGTH: 텍스트 입력 갯수
'ATTMAX : 최소 응답 해야 하는 갯수
'MINLENGTH: 최소 입력 길이
'NFLAG : None 처리
'BODYSTR : HTML 사용
'JBODYSTR : 자바스크립트
'#######################################################################################
Function QuestionIMGATT2(VARIABLE,ATTRIBUTE,TEXT,ATTMAX,NFLAG,ByRef BODYSTR,ByRef JBODYSTR)

	Dim SBody,ITStr,V_COD,iCnt,V1,V2
	Dim JBody
	Dim QName,DSTR,ESTR
	Dim WidthV,HeightV,CTV
	Dim AMX,ML,MH
	Dim XVAR
	
	If ATTMAX="" Or ATTMAX="0" Then 
		AMX=1
	Else
		AMX = ATTMAX
	End If
	
	HeightV = "30px"
	ITStr = Split(ATTRIBUTE,LABELSPLITTER)

	SBody = ""
	JBody = ""
	DSTR = ""
	ESTR = ""

	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	
	
	For iCnt=0 To UBound(ITStr)
		If VarType(ITStr)<>0 And VarType(ITSTR)<>1 Then
			V_COD = Split(ITStr(iCnt),CODESPLITTER)
			V1 = V_COD(0)
			V2 = V_COD(1)

			SBody = SBody & "			<div class=""form-group upload-thumbnail"" id=""thumbnail_"&iCnt+1&""">" & vbCRLF
			SBody = SBody & "				<div class=""col-md-offset-2 col-md-10 col-xs-12"">" & vbCRLF
			SBody = SBody & "				<img src="""" alt="""" class=""img-thumbnail"" id=""preview_" & VARIABLE & "_" & V1 &""">" & vbCRLF
			SBody = SBody & "				</div>" & vbCRLF
			SBody = SBody & "			</div>" & vbCRLF
			SBody = SBody & "			<div class=""form-group upload-name"" id=""filename_"&iCnt+1&""">" & vbCRLF
			SBody = SBody & "				<label for="""&VARIABLE&""" class=""col-md-2 control-label"">"&LangQuestion(81)&" " & iCnt+1 & " : </label>" & vbCRLF
			SBody = SBody & "				<div class=""col-md-10"">" & vbCRLF
			SBody = SBody & "				<input type=""TEXT"" class=""form-control readonly"" name=""" & VARIABLE & "_" & V1 & """ id=""" & VARIABLE & "_" & V1 & """ readonly>" & vbCRLF
			SBody = SBody & "				</div>" & vbCRLF
			SBody = SBody & "			</div>" & vbCRLF
			SBody = SBody & "			<div class=""form-group upload-file"">" & vbCRLF
			SBody = SBody & "				<label for="""&VARIABLE&""" class=""col-md-2 control-label"">"&LangQuestion(82)&" " & iCnt+1 & " : </label>" & vbCRLF
			SBody = SBody & "				<div class=""col-md-10"">" & vbCRLF
			SBody = SBody & "				<input type=""file"" class=""form-control"" name=""" & VARIABLE & "_" & iCnt+1 & "_FILE"" id=""" & VARIABLE & "_" & iCnt+1 & "_FILE""/>" & vbCRLF
			SBody = SBody & "				(Image file formats are only allowed to be uploaded such as *.jpg/*.gif/*.png)" & vbCRLF
			SBody = SBody & "				</div>" & vbCRLF
			SBody = SBody & "			</div>" & vbCRLF
			SBody = SBody & "			<div class=""form-group description"">" & vbCRLF
			SBody = SBody & "				<label for="""&VARIABLE&""" class=""col-md-2 control-label"">"&LangQuestion(83)&" " & iCnt+1 & " : </label>" & vbCRLF
			SBody = SBody & "				<div class=""col-md-10"">" & vbCRLF
			SBody = SBody & "				<input type=""text"" class=""form-control"" name=""" & VARIABLE & "_" & iCnt+1 & "_DES"" id=""" & VARIABLE & "_" & iCnt+1 & "_DES"" maxlength=""255""/>" & vbCRLF
			SBody = SBody & "				</div>" & vbCRLF
			SBody = SBody & "			</div>" & vbCRLF
			SBody = SBody & "			<br>" & vbCRLF

			VAR = VAR & VARIABLE & "_" & V1 & ","& VARIABLE & "_" & V1 & "_DES,"
			XVAR = XVAR & VARIABLE & "_" & V1 & ","& VARIABLE & "_" & V1 & "_DES,"
		End IF
	Next	

	If NFlag Then
		SBody = SBody & "		<div><input type=""checkbox"" id="""&VARIABLE&"_NONE"" name="""&VARIABLE&"_NONE"" value=""1""/><a href=""javascript:setCheckBoxValue('"&VARIABLE&"_NONE');itemDisabledSetup('"&XVAR&"'.split(','),$('#"&VARIABLE&"_NONE').attr('checked'))"">"&NONSTR&"</a></div>" & vbCRLF
		Response.Write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
		Response.Write "<!--" & vbCrLF
		Response.Write "	$(document).ready(function(){" & vbCrLF
		Response.Write "		$(""#"&VARIABLE&"_NONE"").click(function(){" & vbCrLF
		Response.Write "			itemDisabledSetup("""&XVAR&""".split("",""),$(""#"&VARIABLE&"_NONE"").attr(""checked""));" & vbCrLF
		Response.Write "		})" & vbCrLf
		Response.Write "	});" & vbCrLf
		Response.Write "//-->" & vbCrLF
		Response.Write "</script>"

		VAR = VAR & VARIABLE & "_NONE,"
	End IF

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

	XVAR = Left(XVAR,Len(XVAR)-1)

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

	If NFlag Then
	JBody = JBody & "	if ($("& Chr(34) & "#" & VARIABLE & "_NONE" & Chr(34) &").is("":checked"")==false){" & vbCrLF
	End if

	For iCnt=0 To AMX-1
		If VarType(ITStr)<>0 And VarType(ITSTR)<>1 Then
			V_COD = Split(ITStr(iCnt),CODESPLITTER)
			V1 = V_COD(0)

			JBody = JBody & "	if ($(""#" & VARIABLE & "_" & V1 & """).val()=="""")" & vbCrLF
			JBody = JBody & "	{" & vbCrLF
			If iCnt=0 Then
				JBody = JBody & "		alert("""& LangQuestion(1) &""");" & vbCRLF
			Else
				JBody = JBody & "		alert(""(" & (iCnt+1) & ") "& LangQuestion(1) &""");" & vbCRLF
			End IF
			JBody = JBody & "		$(""#" & VARIABLE  & "_" & V1 & """).focus();" & vbCRLF
			JBody = JBody & "		return;" & vbCRLF
			JBody = JBody & "	}" & vbCRLF

			JBody = JBody & "	if ($(""#" & VARIABLE & "_" & V1 & "_DES"").val()=="""")" & vbCrLF
			JBody = JBody & "	{" & vbCrLF
			If iCnt=0 Then
				JBody = JBody & "		alert("""& LangQuestion(1) &""");" & vbCRLF
			Else
				JBody = JBody & "		alert(""(" & (iCnt+1) & ") "& LangQuestion(1) &""");" & vbCRLF
			End IF
			JBody = JBody & "		$(""#" & VARIABLE  & "_" & V1 & "_DES"").focus();" & vbCRLF
			JBody = JBody & "		return;" & vbCRLF
			JBody = JBody & "	}" & vbCRLF

		End IF
	Next
	
	JBody = JBody & "	var xx;" & vbCRLF
	JBody = JBody & "	var xy;" & vbCRLF
	JBody = JBody & "	var TextFlag;" & vbCRLF
	V2 = ""


	If NFlag Then
		JBody = JBody & "	}" & vbCRLF
	End if

	Response.Write "<script src=""//malsup.github.com/jquery.form.js""></script>" & vbCrLF
	Response.Write "<script type=""text/javascript"" language=""javascript"">" & vbCrLF
	Response.Write "<!--" & vbCrLF
	Response.Write "	$(document).ready(function(){" & vbCrLF
	Response.Write "		$("".upload-thumbnail"").hide();" & vbCRLF
	Response.Write "		$("".upload-name"").hide();" & vbCRLF
	Response.Write "		$(""form[name='Survey']"").addClass(""form-horizontal"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").attr(""action"",""Upload.asp"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").attr('enctype', 'multipart/form-data'); " & vbCrLF
	Response.Write "		$(""#Survey"").ajaxForm();" & vbCrLF
'	Response.Write "		$(""input[type=TEXT]"").attr(""readonly"",true);" & vbCrLF
'	Response.Write "		$(""input[type=TEXT]"").css(""background-color"",""#eee"");" & vbCrLF
	Response.Write "		$("".readonly"").attr(""readonly"",true);" & vbCrLF
	Response.Write "		$("".readonly"").css(""background-color"",""#eee"");" & vbCrLF
	
	Response.Write "		$(""[data-des]"").attr(""readonly"",false);" & vbCrLF
	Response.Write "		$(""[data-des]"").css(""background-color"",""#fff"");" & vbCrLF
	Response.Write "		$(""form[name='Survey']"").ajaxForm();" & vbCRLF
	Response.Write "		$(""#next"").hide();" & vbCRLF
	Response.Write "		$(""#upload"").click(function(){imgUpload()});" & vbCRLF
	Response.Write "		$(""#loading"").hide();" & vbCRLF

	Response.Write "	});" & vbCrLf
	Response.Write vbCRLF

	Response.Write "	function imgUpload() {" & vbCrLf
	Response.Write "		$(""#loading"").show();" & vbCrLf
	Response.Write "		wrapWindowByMask();" & vbCrLf
	Response.Write "		var ImgName,ImgArr,ImgExt;" & vbCrLf
	Response.Write "		var arx=["&ARX&"];" & vbCrLf
	Response.Write "		var img_flag=false;" & vbCrLf
	Response.Write vbCRLF
	Response.Write "		$(""form[name='Survey']"").ajaxSubmit({" & vbCrLf
    Response.Write "			statusCode: {" & vbCrLf
	Response.Write "			400: function() {" & vbCrLf
	Response.Write "				alert("""&LangQuestion(41)&""");" & vbCrLf
    Response.Write "			}," & vbCrLf
	Response.Write "			500: function(request,status,error) {" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				console.log(request.responseText);" & vbCrLf
	Response.Write "				console.log(error);" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "				$(""#upload"").show();" & vbCRLF
	Response.Write "				$(""#next"").hide();" & vbCRLF
	Response.Write "			}" & vbCrLf
    Response.Write "		}," & vbCrLf
	Response.Write "		beforeSubmit: function (data,form,option) {" & vbCrLf
	Response.Write "		//validation체크 " & vbCrLf
    Response.Write "		//막기위해서는 return false를 잡아주면됨" & vbCrLf

	For iCnt=1 To AMX
	Response.Write "			if ($(""#"&VARIABLE&"_" & iCnt & "_FILE"").val().trim()=="""")" & vbCrLF
	Response.Write "			{" & vbCrLF
	Response.Write "				alert("""&LangQuestion(1)&""");" & vbCRLF
	Response.Write "				$(""#" & VARIABLE & "_" & iCnt &"_FILE"").focus();" & vbCRLF
	Response.Write "				return false;" & vbCRLF
	Response.Write "			}" & vbCRLF    
	Next
	Response.Write "			return true;" & vbCrLf

	Response.Write "		}," & vbCrLf
    Response.Write "		success: function(data) {" & vbCrLf
	Response.Write "			if (data!=""""){" & vbCrLf
	Response.Write "				$(""#"&VARIABLE&""").val(data);" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "				alert("""&LangQuestion(43)&""");" & vbCrLf
	Response.Write "				$(""form[name='Survey']"").attr(""enctype"", ""application/x-www-form-urlencoded"");  " & vbCrLf
	Response.Write "				document.Survey.action=""Survey.asp"";" & vbCrLf
	'요기서 반복 이미지 처리
	Response.Write "				if (data.indexOf(""@@"")>0)" & vbCrLF
	Response.Write "				{" & vbCrLF
	Response.Write "					ImgArr = data.split(""@@"");" & vbCrLF
	Response.Write "					for (i=0;i<ImgArr.length;i++){" & vbCrLF
	Response.Write "						if (ImgArr[i].trim()!=""""){" & vbCrLF
	Response.Write "						ImgExt = ImgArr[i].split(""."");" & vbCrLf
	Response.Write "						ImgName = ImgExt[1].toLowerCase();" & vbCrLf
	Response.Write "						for (j=0;j<arx.length;j++)" & vbCrLF
	Response.Write "						{" & vbCrLF
	Response.Write "							if (ImgName==arx[j])" & vbCrLF
	Response.Write "								{" & vbCrLF
	Response.Write "									img_flag = true;" & vbCrLF	
	Response.Write "									break;" & vbCrLF
	Response.Write "								}" & vbCrLF
	Response.Write "							}" & vbCrLF
	Response.Write vbCRLF
	Response.Write "						}" & vbCrLF
	Response.Write "						if (img_flag)" & vbCrLF
	Response.Write "						{" & vbCrLF
	Response.Write "							$(""#preview_"& VARIABLE & "_""+(i+1)).attr(""src"",""./Files/""+ImgArr[i]);" & vbCrLF
	Response.Write "							$(""#"&VARIABLE&"_""+(i+1)).val(ImgArr[i]);" & vbCrLf	
	Response.Write "							$(""#thumbnail_""+(i+1)).show();" & vbCrLf	
	Response.Write "							$(""#filename_""+(i+1)).show();" & vbCrLf	
	Response.Write "						}" & vbCrLF
	Response.Write "					}" & vbCrLF
	Response.Write "				}" & vbCrLF
	Response.Write "				else" & vbCrLF
	Response.Write "				{" & vbCrLF
	Response.Write "					ImgExt = data.split(""."");" & vbCrLf
	Response.Write "					ImgName = ImgExt[1].toLowerCase();" & vbCrLf
	Response.Write "					for (i=0;i<arx.length;i++)" & vbCrLF
	Response.Write "					{" & vbCrLF
	Response.Write "						if (ImgName==arx[i])" & vbCrLF
	Response.Write "						{" & vbCrLF
	Response.Write "							img_flag = true;" & vbCrLF
	Response.Write "							break;" & vbCrLF
	Response.Write "						}" & vbCrLF
	Response.Write "					}" & vbCrLF
	Response.Write vbCRLF
	Response.Write "					if (img_flag)" & vbCrLF
	Response.Write "					{" & vbCrLF
	Response.Write "						$(""#preview_"& VARIABLE & "_1"").attr(""src"",""./Files/""+data);" & vbCrLF
	Response.Write "						$(""#"&VARIABLE&"_1"").val(data);" & vbCrLf	
	Response.Write "						$(""#thumbnail_1"").show();" & vbCrLf	
	Response.Write "						$(""#filename_1"").show();" & vbCrLf	
	Response.Write "					}" & vbCrLF
	Response.Write "				}" & vbCrLF

	Response.Write "				$(""#upload"").hide();" & vbCrLF
	Response.Write "				$(""#next"").show();" & vbCrLF
	Response.Write "			}" & vbCrLf
	Response.Write "			else" & vbCrLf
	Response.Write "			{" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				$(""#loading"").hide();" & vbCrLf
	Response.Write "			}" & vbCrLf
    Response.Write "		}," & vbCrLf
	Response.Write "		error: function(request,status,error){" & vbCrLf
	Response.Write "		//에러발생을 위한 code페이지" & vbCrLf
	Response.Write "				alert("""&LangQuestion(42)&""");" & vbCrLf
	Response.Write "				console.log(""code:""+request.status+""\n""+""message:""+request.responseText+""\n""+""error:""+error);" & vbCrLf
    Response.Write "		} " & vbCrLf
	Response.Write "		});" & vbCrLf
	Response.Write "	}" & vbCrLf
	Response.Write "//-->" & vbCrLF
	Response.Write "</script>"

	BODYSTR = SBody
	JBODYSTR = JBody

End Function
%>