<%

'function InputValue($strvalue) '변수필터
'function InputValue2($strvalue) '변수필터2
'Function InputValue3($CheckValue)'변수필터3
'function InputValue4($strvalue) '변수필터4
'function getTextmode($strvalue) '텍스트모드로 변환
'function mnai ($ssn) '나이구하는 함수
'function no_cache() '캐쉬제거
'function FolderCreate($strDir) '폴더검사후 없으면 생성
'function page($url) '페이지
'function page2(url) '페이지2
'function trmouseover(clr) '<tr>마우스오버시색상적용
'function title_str2(str,w,help) '타이틀2
'function popup_view() '팝업띄우기
'function remove_tags( str ) '태그삭제
'function StringToHTML( str, max, br ) '지정한 폭(max)만큼 문자열 조절 (한글을 2바이트로 인식)
'sub loding(st,strlink) '처리완료
'function isdir(strDirectory) '폴더 유무확인
'function wfile(filedname, maxMbyte, strDirectory) '업로드파일저장하기(dext버젼)
'function wfile2(filedname, maxMbyte, strDirectory, ext) '업로드파일저장하기(dext버젼) ->제한파일추가
'function cfile(filedname,strDirectory1,strDirectory) '파일복사
'function dfile(strpath) '파일삭제
'function get_lastdate(m_id) '마지막접속시간정보구하기
'function get_FileName1(filename) '파일확장자 이미지
'function get_name(m_id) '회원이름찾기
'sub input_type(iptype,ip_name,ip_value,size,maxlength,ip_aciton) 'input 관리
'function bbs_tablename_str(a_num) '게시판테이블명 알아내기
'function bbs_bbsname_str(a_num)    ' 게시판 명알아내기
'function countTotal2()'전체접속통계
'function countToday2() '오늘접속통계
'Function Back_back(message) 'history.go(-1)
'Function Back_back2(message, url) 'location.href
'Function Back_back3(message, url) 'top.location.href
'Function Sung_gong(message) 'message->window.close()
'Function Sung_gong2(message, url) 'message->location.href ->(opener.location.reload())
'Function Sung_gong3(message) 'message->window.close() ->(opener.location.reload())
'Function ChkValSelect(ByVal value1, ByVal value2) '셀렉트버튼
'Function ChkValChkBox(ByVal value1, ByVal value2) '체크박스
'Function ChkValChkBox2(ByVal value1, ByVal value2) '체크박스2
'Function sendMail(from_add, to_add, cc, bcc, subject, body) 메일보내기
'Function sendMail2(from_add, to_add, cc, bcc, subject, body) '메일보내기2
'function get_idx_add() 'idx 자동생성.
'Function GetImageSize(Virtual_Image_Path) '이미지크기 (전체)
'Function GetImageSize_w(Virtual_Image_Path) '이미지크기 (가로)
'Function GetImageSize_h(Virtual_Image_Path) '이미지크기 (세로)
'function ViewCreate() '통합게시판 view
'function TabIndex() '자동인덱스 
'function manager_leftmenu() '관리자 페이지 좌측메뉴


'**************  Information  ****************************************
'	Program Title	:	문자열처리구문1
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 03. 05
'	Update			:	  2008. 11
'*********************************************************************

function InputValue(strvalue)
		
		strvalue = trim(strvalue)
		strvalue = replace(strvalue, "&", "&amp;")
		strvalue = replace(strvalue, "<", "&lt;")
		strvalue = replace(strvalue, ">", "&gt;")
		strvalue = replace(strvalue, "'", "&#39;")
		strvalue = replace(strvalue, chr(34), "&#34;")
		strvalue = replace(strvalue, """", "&quot;")

		InputValue = strvalue

End function

'**************  Information  ****************************************
'	Program Title	:	문자열처리구문2
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 03. 05
'	Update			:	  2008. 11
'*********************************************************************
function InputValue2(strvalue)

'	strvalue = Replace(strvalue,"&nbsp;","")
	strvalue = Replace(strvalue,"'","''")
	strvalue = Replace(strvalue, "<title>", "")
	strvalue = Replace(strvalue, "</title>", "")

	InputValue2 = strvalue

End Function


Function InputValue3(CheckValue) 

	CheckValue = replace(CheckValue, "&" , "&amp;")
	CheckValue = replace(CheckValue, "<", "&lt;")
	CheckValue = replace(CheckValue, ">", "&gt;")
	CheckValue = replace(CheckValue, "'", "`")
	CheckValue = replace(CheckValue, "  ", "&nbsp;&nbsp;")

	InputValue3 = CheckValue

End Function




'**************  Information  ****************************************
'	Program Title	:	문자열처리구문4
'	Company		    :	
'	Creator		    :	  2006. 3. 14
'*********************************************************************
function InputValue4(strvalue) 
	
	strvalue = trim(strvalue)
	strvalue = Replace(strvalue,"'","''")

	InputValue4 = strvalue

End Function 


'**************  Information  ****************************************
'	Program Title	:	텍스트모드
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 03. 05
'*********************************************************************
function getTextmode(strvalue)
	
	if strvalue <> "" or not isnull(strvalue) then
		strvalue=Replace(strvalue, "<" , "&lt;")
		strvalue=Replace(strvalue, ">" , "&gt;")
		strvalue=Replace(strvalue,chr(13),"<br />")
		strvalue=Replace(strvalue,"  ","&nbsp;&nbsp;")
		strvalue=Replace(strvalue,"\t","&nbsp;&nbsp;&nbsp;")
	end If
	
	getTextmode = strvalue

end Function


function InputValue77(strvalue)

		strvalue = replace(strvalue, "&nbsp;", "")
		strvalue = replace(strvalue, "'", "")
		strvalue = replace(strvalue, "&lt;", "<")
		strvalue = replace(strvalue, "&gt;", ">")
		strvalue = replace(strvalue, "<title>", "")
		strvalue = replace(strvalue, "</title>", "")
		strvalue = replace(strvalue, "&quot;", """")

	InputValue77 = strvalue

End function


function InputValueXSS(strvalue)
	strvalue = remove_tags( strvalue )
	strvalue = replace(strvalue, "<script", "")
	strvalue = replace(strvalue, "/script>", "")
	strvalue = replace(strvalue, "<", "")
	strvalue = replace(strvalue, ">", "")
	strvalue = replace(strvalue, "alert(", "")
	strvalue = replace(strvalue, ");", "")
	strvalue = replace(strvalue, "&lt;", "")
	strvalue = replace(strvalue, "&gt;", "")
	strvalue = replace(strvalue, """", "&#34;")
	InputValueXSS = strvalue

End function

'**************  Information  ****************************************
'	Program Title	:	title_str2
'	Company		    :	
'	Creator		    :	
'*********************************************************************
function title_str2(str, w, help)

%>
<!-- Title 시작 -->
<table width="<%=w%>" cellspacing="0" cellpadding="0">

	<tr height="6">
		<td colspan="3"></td>
	</tr>
	<tr height="48">
		<td background="/ad_cms/image/ntit_left.gif" style="padding-right:25;padding-left:15;" nowrap><b><font color="000000" size="2" style="font-family:gulim;"><%=str%></font></b></td>
		<td background="/ad_cms/image/ntit_bg.gif" width="100%"><%=help%></td>
		<td background="/ad_cms/image/ntit_right.gif" width="5"><img width="5" height="0"></td>
	</tr>
	<tr height="15">
		<td colspan="3"></td>
	</tr>
</table>
<!-- Title 끝 -->
<%
End function



'**************  Information  ****************************************
'	Program Title	:	trmouseover
'	Company		    :	
'	Creator		    :	
'*********************************************************************
function trmouseover(clr)

	response.write "onMouseOver=this.style.backgroundColor='"&clr&"' onMouseOut=this.style.backgroundColor=''"

End Function




'**************  Information  ****************************************
'	Program Title	:	업로드파일저장하기(dext버젼)
'	Company		    :	나눔아이앤씨
'	Creator		    :	최 경 수  2007 
'*********************************************************************
function wfile2(filedname, maxMbyte, strDirectory, ext)	'필드명, 최대용량, 업로드경로, 허용파일(zip,gif,jpg...)
	Dim fileName,filePath,fileSize, loop_i, FSO
	Set FSO = Server.CreateObject("Scripting.FileSystemObject")

	if  Len(UploadForm(filedname)) > 0 then

		'strDirectory = server.MapPath("./")&"\data\"&a_tablename&"\"

		If FSO.FolderExists(strDirectory) = False Then '폴더가 없으면 새로 생성한다..
			FSO.CreateFolder(strDirectory)
		End if
		'--파일 정보추출
		fileName      =  UploadForm(filedname).FileName   '파일이름.. 
		filePath      =  UploadForm(filedname).FilePath   '절대경로.. 
		fileSize      =  UploadForm(filedname).FileLen    '파일사이즈..

		saveFileName = strDirectory & fileName      '실제 저장되 경로에 파일...

		'--확장장와 파일 이름 분리
		strfile = split(fileName,".")
		strName = strfile(0) '파일명
		strExt  = strfile(UBound(strfile)) '확장자
		
		If ext<>"" then
			ext		= Replace(ext, " ", "")
			ext_arr = Split(ext,",")
			ext_stat = false
			For loop_i = 0 To UBound( ext_arr )
				If LCase(strExt) = LCase(ext_arr(loop_i)) Then
					ext_stat = True
					Exit for
				End if
			Next
			If ext_stat = False Then Back_back "허용되지 않은 파일형식입니다.\n\n 허용파일("&ext&")"
		End If
		

		'-- 파일크기가 검사
		'1MByte = 1048576Byte

		if  Round(fileSize) >  Round(1048576 * maxMbyte) then
			Back_back "파일크기가"& maxMbyte &"MByte 이하여만 합니다."
		end if

		 '같은 파일 이 존재할경우 --> _1,_2 이런식으로 파일명 변경..ㅡㅡv
		bExist = True
		count= 0
		Do While bExist
			If (FSO.FileExists(saveFileName)) Then
				count = count  + 1
				FileName = strName & "_" & count & "." & strExt
				saveFileName = strDirectory & FileName
			Else
			
				Exit Do '없으며 빠져나간당..

			End If
		Loop

		'파일 저장 
		UploadForm(filedname).SaveAs saveFileName

	end if

	'Set UploadForm = nothing 
	Set FSO        = nothing
	wfile2 = FileName

end function


'**************  Information  ****************************************
'	Program Title	:	업로드파일저장하기(dext버젼) 파일명 자동생성
'	Company		    :	나눔아이앤씨
'	Creator		    :	최 경 수  2007 
'*********************************************************************
function wfile3(filedname, maxMbyte, strDirectory, ext)	'필드명, 최대용량, 업로드경로, 허용파일(zip,gif,jpg...)
	Dim fileName,filePath,fileSize, loop_i, FSO
	Set FSO = Server.CreateObject("Scripting.FileSystemObject")

	if  Len(UploadForm(filedname)) > 0 then

		'strDirectory = server.MapPath("./")&"\data\"&a_tablename&"\"

		If FSO.FolderExists(strDirectory) = False Then '폴더가 없으면 새로 생성한다..
			FSO.CreateFolder(strDirectory)
		End if
		'--파일 정보추출
		fileName      =  UploadForm(filedname).FileName   '파일이름.. 
		filePath      =  UploadForm(filedname).FilePath   '절대경로.. 
		fileSize      =  UploadForm(filedname).FileLen    '파일사이즈..

		saveFileName = strDirectory & fileName      '실제 저장되 경로에 파일...

		'--확장장와 파일 이름 분리
		strfile = split(fileName,".")
		strName = strfile(0) '파일명
		strExt  = strfile(UBound(strfile)) '확장자
		
		ext		= Replace(ext, " ", "")
		ext_arr = Split(ext,",")
		ext_stat = false
		For loop_i = 0 To UBound( ext_arr )
			If LCase(strExt) = LCase(ext_arr(loop_i)) Then
				ext_stat = True
				Exit for
			End if
		Next
		If ext_stat = False Then Back_back "허용되지 않은 파일형식입니다.\n\n 허용파일("&ext&")"
		'-- 파일크기가 검사
		'1MByte = 1048576Byte

		if  Round(fileSize) >  Round(1048576 * maxMbyte) then
			Back_back "파일크기가"& maxMbyte &"MByte 이하여만 합니다."
		end if

		If LCase(strExt) = "jpg" Or LCase(strExt) = "gif" Then
			FileName = Replace( Date(), "-" ,"" ) & Right( "0".Hour(now), 2) & Right( "0".minute(now), 2) & Right( "0".second(now), 2) & "." & strExt
			saveFileName = strDirectory & FileName
		else
			'같은 파일 이 존재할경우 --> _1,_2 이런식으로 파일명 변경..ㅡㅡv
			bExist = True
			count= 0
			Do While bExist
				If (FSO.FileExists(saveFileName)) Then
					count = count  + 1
					FileName = strName & "_" & count & "." & strExt
					saveFileName = strDirectory & FileName
				Else
				
					Exit Do '없으며 빠져나간당..

				End If
			Loop
		End If
		
		'파일 저장 
		UploadForm(filedname).SaveAs saveFileName

	end if

	'Set UploadForm = nothing 
	Set FSO        = nothing
	wfile3 = FileName

end function



'**************  Information  ****************************************
'	Program Title	:	dfile
'	Company		    :	
'	Creator		    :	
'*********************************************************************
function dfile( dir_path,  delfile)	''경로, 원본파일명

	Dim FSO
	Set FSO = Server.CreateObject("Scripting.FileSystemObject")

	If FSO.fileExists(dir_path&delfile) = true Then '파일이 있으면 지운다.
		'response.write dir_path&delfile
		'response.end
		FSO.DeleteFile(dir_path&delfile)
	End if

	Set FSO = Nothing
	
End Function 

Sub dfolder(strDirectory)
	Dim fso
	Set fso = Server.CreateObject("Scripting.FileSystemObject")
	
	If FSO.FolderExists(strDirectory) = True Then '파일저장 폴더가 존재한다면 제거한다. 
		FSO.DeleteFolder(strDirectory)
	End If
	
	Set FSO = Nothing
End Sub


'**************  Information  ****************************************
'	Program Title	:	
'	Company		    :	
'	Creator		    :	
'*********************************************************************
function cfile(filedname,strDirectory1,strDirectory)

	Set FSO        = Server.CreateObject("Scripting.FileSystemObject")
			
		If FSO.FolderExists(strDirectory) = False Then '폴더가 없으면 새로 생성한다..
		   FSO.CreateFolder(strDirectory)
		End if

		'--확장장와 파일 이름 분리
		strfile = split(filedname,".")
		strName = strfile(0) '파일명
		strExt  = strfile( UBound(strfile) ) '확장자


		 '같은 파일 이 존재할경우 --> _1,_2 이런식으로 파일명 변경..ㅡㅡv
		bExist = True
		count= 0
		
		org_file       = strDirectory1&filedname
		fwsaveFileName = strDirectory&filedname
		FileName       = filedname


		Do While bExist
			If (FSO.FileExists(fwsaveFileName)) Then
				count = count  + 1
				FileName = strName & "_" & count & "." & strExt
				fwsaveFileName = strDirectory & FileName
			Else
			
				Exit Do '없으며 빠져나간당..

			End If
		Loop

		'response.write org_file & "," & fwsaveFileName
		'파일 저장 
		If (FSO.FileExists(org_file)) Then
			FSO.CopyFile org_file,fwsaveFileName
		End if


  Set FSO        = nothing

  cfile = FileName

end function


'**************  Information  ****************************************
'	Program Title	:	loding
'	Company		    :	
'	Creator		    :	
'*********************************************************************
function loding( st, strlink)

	response.write "<META HTTP-EQUIV='refresh' CONTENT='"&st&"; url="&strlink&"'>"

End Function




'**************  Information  ****************************************
'	Program Title	:	페이징
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 05. 13
'*********************************************************************

function page(url)
	
	v_temp = int((v_page - 1) / v_block) * v_block + 1
	If v_temp = 1 then
		''response.write "[이전 "&v_block&"개]"
	else
		num = v_temp-v_block
		response.write "<a href='"&url&"?p_page="&num&"&amp;p_search="&v_search&"&amp;p_keyword="&v_keyword&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='pre'>이전</a>&nbsp;"
	End if
	v_loop = 1

	Do While (v_loop <= v_block and v_temp <= v_totalpage)

		If CInt(v_temp) = CInt(v_page) then
			response.write "<strong>"&v_temp&"</strong>&nbsp;"
		else
			response.write "<a href='"&url&"?p_page="&v_temp&"&amp;p_search="&v_search&"&amp;p_keyword="&v_keyword&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"'>"&v_temp&"</a>&nbsp;"
		End if
		v_temp = v_temp + 1
		v_loop = v_loop + 1

	loop


	If v_temp > v_totalpage then
		''response.write "[다음 "&v_block&"개]"
	else
		response.write "&nbsp;<a href='"&url&"?p_page="&v_temp&"&amp;p_search="&v_search&"&amp;p_keyword="&v_keyword&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='next'>다음</a>"
	End if

End Function

function pageStyle(url)
	Dim a_class
	Dim v_search_enc : v_search_enc = server.urlencode( v_search )
	Dim v_keyword_enc : v_keyword_enc = server.urlencode( v_keyword )
	v_temp = int((v_page - 1) / v_block) * v_block + 1
	If v_temp = 1 then
		''response.write "[이전 "&v_block&"개]"
	else
		num = v_temp-v_block
		response.write "<a href='"&url&"?p_page="&num&"&amp;p_search="&v_search_enc&"&amp;p_keyword="&v_keyword_enc&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='prev'>이전</a>&nbsp;"
	End if
	v_loop = 1

	Response.write "<ul>"

	Do While (v_loop <= v_block and v_temp <= v_totalpage)

		a_class = ""
		If CInt(v_temp) = CInt(v_page) Then
			a_class = "class='active'"
		End if
		response.write "<li><a href='"&url&"?p_page="&v_temp&"&amp;p_search="&v_search_enc&"&amp;p_keyword="&v_keyword_enc&"&amp;p_cate="&v_cate&"' " & a_class & ">"&v_temp&"</a></li>"

		v_temp = v_temp + 1
		v_loop = v_loop + 1

	loop

	Response.write "</ul>"

	If v_temp > v_totalpage then
		''response.write "[다음 "&v_block&"개]"
	else
		response.write "&nbsp;<a href='"&url&"?p_page="&v_temp&"&amp;p_search="&v_search_enc&"&amp;p_keyword="&v_keyword_enc&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='next'>다음</a>"
	End if

End Function

function pageStyle2(url)
	Dim a_class
	Dim v_search_enc : v_search_enc = server.urlencode( v_search )
	Dim v_keyword_enc : v_keyword_enc = server.urlencode( v_keyword )
	v_temp = int((v_page - 1) / v_block) * v_block + 1
	If v_temp = 1 then
		''response.write "[이전 "&v_block&"개]"
	else
		num = v_temp-v_block
		response.write "<a href='"&url&"&p_page="&num&"&amp;p_search="&v_search_enc&"&amp;p_keyword="&v_keyword_enc&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='prev'>이전</a>&nbsp;"
	End if
	v_loop = 1

	Response.write "<ul>"

	Do While (v_loop <= v_block and v_temp <= v_totalpage)

		a_class = ""
		If CInt(v_temp) = CInt(v_page) Then
			a_class = "class='active'"
		End if
		response.write "<li><a href='"&url&"&p_page="&v_temp&"&amp;p_search="&v_search_enc&"&amp;p_keyword="&v_keyword_enc&"&amp;p_cate="&v_cate&"' " & a_class & ">"&v_temp&"</a></li>"

		v_temp = v_temp + 1
		v_loop = v_loop + 1

	loop

	Response.write "</ul>"

	If v_temp > v_totalpage then
		''response.write "[다음 "&v_block&"개]"
	else
		response.write "&nbsp;<a href='"&url&"&p_page="&v_temp&"&amp;p_search="&v_search_enc&"&amp;p_keyword="&v_keyword_enc&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='next'>다음</a>"
	End if

End function



'**************  Information  ****************************************
'	Program Title	:	 페이지2
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 05. 13
'*********************************************************************
function page2(url)

	v_temp = int((v_page - 1) / v_block) * v_block + 1
	If v_temp = 1 then
		''response.write "[이전 "&v_block&"개]"
	else
		num = v_temp - v_block
		response.write "<a href='"&url&"&amp;p_page="&num&"&amp;p_search="&v_search&"&amp;p_keyword="&v_keyword&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='pre'>이전</a>&nbsp;"
	End if
	v_loop = 1

	Do While (v_loop <= v_block and v_temp <= v_totalpage)
		If CInt(v_temp) = CInt(v_page) then
			response.write "<strong>"&v_temp&"</strong>&nbsp;"
		else
			response.write "<a href='"&url&"&amp;p_page="&v_temp&"&amp;p_search="&v_search&"&amp;p_keyword="&v_keyword&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"'>"&v_temp&"</a>&nbsp;"
		End if
		v_temp = v_temp + 1
		v_loop = v_loop + 1

	loop

	If v_temp > v_totalpage then
		''response.write "[다음 "&v_block&"개]"
	else
		response.write "&nbsp;<a href='"&url&"&amp;p_page="&v_temp&"&amp;p_search="&v_search&"&amp;p_keyword="&v_keyword&"&amp;p_cate="&v_cate&"' tabindex='"&getTabIndex()&"' class='next'>다음</a>"
	End if
End function





'**************  Information  ****************************************
'	Program Title	:	 Back_back
'	Company		    :	
'	Creator		    :	윤 종 우  
'*********************************************************************
function Back_back(msg)
	response.write "<html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'><title>페이지이동</title></head><body>"
	response.write "<script type='text/javascript'>"
	response.write "alert('"&msg&"');"
	response.write "history.go(-1);"
	response.write "</script>"
	Response.write "</body></html>"
	response.end

End function


function Back_back2(msg, url)
	response.write "<html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'><title>페이지이동</title></head><body>"
	response.write "<script type='text/javascript'>"
	response.write "alert('"&msg&"');"
	response.write "location.href='" & url & "';"
	response.write "</script>"
	Response.write "</body></html>"
	response.end

End Function

function Back_back_close(msg)
	response.write "<html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'><title>페이지이동</title></head><body>"
	response.write "<script type='text/javascript'>"
	response.write "alert('"&msg&"');"
	response.write "window.opener = 'nothing';"
	response.write "window.open('','_parent','');"
	response.write "window.close();"
	response.write "</script>"
	Response.write "</body></html>"
	response.end
End Function

function goUrl(url)
	response.write "<html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'><title>페이지이동</title></head><body>"
	response.write "<script type='text/javascript'>"
	response.write "location.href='" & url & "';"
	response.write "</script>"
	Response.write "</body></html>"
	response.end
End function

Function goURL2(url,target)
	response.write "<html><head><meta http-equiv='Content-Type' content='text/html;charset=utf-8'><title>페이지이동</title></head><body>"
	Response.Write"<script type='text/javascript'>" &_
				  target&".location.href = '" + url + "';" &_
				  "</script>"
	Response.write "</body></html>"
	Response.End
End Function


'**************  Information  ****************************************
'	Program Title	:	 폴더검사후 없으면 생성
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 05. 13
'*********************************************************************
function FolderCreate(strDir)

	Dim FSO
	Set FSO = Server.CreateObject("Scripting.FileSystemObject")
	'response.write strDir
	'response.end
	If FSO.FolderExists(strDir) = False Then '폴더가 없으면 새로 생성한다..
		FSO.CreateFolder(strDir)
	End if

	set FSO = Nothing
	
End Function 


'**************  Information  ****************************************
'	Program Title	:   '
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 05
'*********************************************************************
function get_FileName1(filename)
	
	Dim filename1, fileend
	
	If trim(filename) = "" then
		filename1 = "default.gif"
	Else
		
		filename	= split( CStr(filename), "." )
		fileend		= lcase( trim( filename( ubound(filename) ) ) )

		Select Case fileend
			Case "asf"	: filename1 = "icon_asf.png"
			Case "asx"	: filename1 = "icon_asf.png"
			Case "doc"	: filename1 = "icon_doc.png"
			Case "mpg"	: filename1 = "icon_mpg.png"
			Case "mpeg" : filename1 = "icon_mpeg.png"
			Case "bat"	: filename1 = "icon_bat.png"
			Case "bmp"	: filename1 = "icon_bmp.png"
			Case "com"	: filename1 = "icon_com.png"
			Case "sys"	: filename1 = "icon_sys.png"
			Case "dll"	: filename1 = "icon_dll.png"
			Case "exe"	: filename1 = "icon_exe.png"
			Case "gif"	: filename1 = "icon_gif.png"
			Case "htm"	: filename1 = "icon_html.png"
			Case "html" : filename1 = "icon_html.png"
			Case "hwp"	: filename1 = "icon_hwp.png"
			Case "xls"	: filename1 = "icon_xls.png"
			Case "jpg"	: filename1 = "icon_jpg.png"
			Case "mp3"	: filename1 = "icon_mp3.png"
			Case "pcx"	: filename1 = "icon_pcx.png"
			Case "png"	: filename1 = "icon_png.png"
			Case "ppt"	: filename1 = "icon_ppt.png"
			Case "ra"	: filename1 = "icon_ra.png"
			Case "txt"	: filename1 = "icon_txt.png"
			Case "url"	: filename1 = "icon_url.png"
			Case "wav"	: filename1 = "icon_wav.png"
			Case "zip"	: filename1 = "icon_zip.png"
			Case "pdf"	: filename1 = "icon_pdf.png"
			Case Else	: filename1 = "icon_no.png"
		End Select


	End If

	get_FileName1 = filename1

End Function



'**************  Information  ****************************************
'	Program Title	:   'input관리
'	Company		    :	
'	Creator		    :	윤 종 우  2005-10-28
'*********************************************************************
function input_type (iptype, ip_name, ip_value, size, maxlength, ip_aciton)
	If maxlength <> "0" then
		maxlength_str = "maxlength='"&maxlength&"'"
	End if

	If iptype = "text" then
%>
	<input name="<%=ip_name%>" type="text" class="ipche_input" id="<%=ip_name%>" style="width:<%=size%>%;" value="<%=ip_value%>" <%=maxlength_str%> <%=ip_aciton%>>
<%
	ElseIf ipztype = "password" then
%>
	<input name="<%=ip_name%>" type="password" class="ipche_input" id="<%=ip_name%>" style="width:<%=size%>%;" value="<%=ip_value%>" <%=maxlength_str%> <%=ip_aciton%>>
<%
	ElseIf ipztype = "ipdate" then
%>
	<input name="<%=ip_name%>" type="text" class="ipche_input" id="<%=ip_name%>" style="width:<%=size%>%;" value="<%=ip_value%>" <%=maxlength_str%> <%=ip_aciton%>>
	<a href="javascript:calendarBtn(document.frm.<%=ip_name%>);">[날짜선택]</a>
<%
	ElseIf ipztype = "textarea" then
%>
	<textarea name="<%=ip_name%>" class="ipche_input" id="<%=ip_name%>" style="width:98%;height:<%=maxlength%>px"><%=ip_value%></textarea>
<%
	ElseIf ipztype = "file" then
%>
	<input name="<%=ip_name%>" type=file class='ipche_input' id="<%=ip_name%>"  style="width:<%=size%>%;" <%=maxlength_str%> <%=ip_aciton%>>
<%
	End If
	
End Function 



'**************  Information  ****************************************
'	Program Title	:   'idx 자동생성.
'	Company		    :	
'	Creator		    :	윤 종 우 2008-11-20
'*********************************************************************
function get_idx_add() 

	'Dim jw1, jw1, a_num

	Randomize()

	jw1 = Int((Rnd * 99) + 1)
	jw2 = Int((Rnd * 99999999) + 1) + Int(session.sessionId())
	jw2 = Right(CStr(jw2),6)

	a_num = trim(jw1) + trim(jw2)

	get_idx_add  = a_num

End Function


'**************  Information  ****************************************
'	Program Title	:	 셀렉트버튼 값체크
'	Company		    :	
'	Creator		    :	  2006. 08.
'*********************************************************************
Function chkSelect(value1, value2)
	If Not( IsNull(value1) Or IsNull(value2) ) Then
		If CStr(value1) = CStr(value2) Then
			chkSelect = "selected = 'selected'"
		End if
	End if
End Function

function chkSelectStatus( value1,  value2)
	chkSelectStatus = false

	If Not( IsNull(value1) Or IsNull(value2) ) Then
		If CStr(value1) = CStr(value2) Then
			chkSelectStatus = true
		End if
	End if

End function



'**************  Information  ****************************************
'	Program Title	:	 체크박스or라디오버튼 값체크
'	Company		    :	
'	Creator		    :	  2006. 08.
'*********************************************************************
function chkRadio(value1, value2)
	If Not( IsNull(value1) Or IsNull(value2) ) Then
		If trim(value1) = trim(value2) then
			chkRadio = "checked='checked'"
		else
			chkRadio = ""
		End If
	End if
End function

function chkRadio2(value1, value2)
	return_val = ""
	value1_arr = split(value1, ",")

	For i=0 To ubound(value1_arr)-1
		If trim(value1_arr(i)) = trim(value2) then
			return_val = "checked='checked'"
		End if
	next

	chkRadio2 = return_val
End function

function chkRadioStatus(value1, value2)
	If trim(value1) = trim(value2) then
		chkRadioStatus = true
	else
		chkRadioStatus = false
	End if
End function

function chkRadio2Status( value1, value2)
	return_val = false
	value1_arr = split(value1, ",")
	For i=0 To UBound(value1_arr)-1
		If trim(value1_arr(i)) = trim(value2) then
			return_val = true
		End if
	next
	chkRadio2Status = return_val
End function



'**************  Information  ****************************************
'	Program Title	:	 체크박스or라디오버튼 값체크
'	Company		    :	
'	Creator		    :	  2009-09-25
'*********************************************************************
function chkchkbox2(value1, value2)

	If instr(value1, value2)>0 Then
		chkchkbox2 = "checked='checked'"
	Else
		chkchkbox2 = ""	
	End if
End function






'**************  Information  ****************************************
'	Program Title	:	'new 아이콘 출력.(get_newimg)
'	Company			:	
'	Creator			:	윤 종 우 2005-07-27
'*********************************************************************
function get_newimg(vdate, a_new) 

	if isDate(vDate) Then
		if DateDiff("d", vDate, date()) <= CInt(a_new) Then	
			response.write "<img src='/img/main/notice_new.gif' width='13' height='10' alt='새글' />"
		End If
	End if

End Function


'**************  Information  ****************************************
'	Program Title	:	'new 아이콘 출력.(get_newimg)
'	Company			:	
'	Creator			:	윤 종 우 2005-07-27
'*********************************************************************

function get_newimg2(vdate, a_new) 

	if isDate(vDate) Then
		if DateDiff("d", vDate, date()) <= CInt(a_new) Then	
			response.write "<img src='/content/board/nninc_simple/img/icon_new.gif' alt='NEW(새글)' />"
		End If
	End if

End Function



function get_newimg_main(vdate, a_new) 

	if isDate(vDate) Then
		if DateDiff("d", vDate, date()) <= CInt(a_new) Then	
			get_newimg_main = "<img src=""/img/main/new.gif"" width=""13"" height=""9"" alt=""new""/>"
		End If
	End if

End Function

'**************  Information  ****************************************
'	Program Title	:	태그삭제 remove_tags( str )
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 09. 03
'*********************************************************************

function remove_tags( str )
	
	Dim i, tag, dest, temp, length
	
	If IsNull( str ) Then str = ""
	tag	= false
	dest = ""
	temp = str
	length = len(temp)

	For i=1 To length
		ch = mid(temp,i,1)
		If ch="<" then
			tag = true
		End if
		If ch=">" then
			tag = false
			ch = ""
		End If
		
		If ( Not tag and ch <> chr(13) and ch <> chr(10) and ch <> chr(9)) then
			dest = dest & ch
		End if
	next

	dest = replace(dest, "  ", "" )
	remove_tags = dest

End Function 



'**************  Information  ****************************************
'	Program Title	:	문자열 조절 StringToHTML
'	Company		    :	
'	Creator		    :	  2006. 07. 04
'*********************************************************************
 function StringToHTML( str, max, br )
  Dim i, length, buf, tmp, count, count2, ch, first

  first = false
  
  if ( isnull(str) ) then
   StringToHTML = "ㅋㅋㅋ"
   Exit Function
  end if
  
  if max>0 then
   buf = Trim( str )
   'buf = Replace( buf, CHR(9), "            " )
   'buf = Replace( buf, CHR(13), "" )
  
   length = len( buf )
   count = 1
   count2 = 0
   tmp  = ""
  
   for i=1 to length
    if count>max then
     if br=false then
      tmp = tmp & "..."
      exit for
     end if
     if i<length-1 then tmp = tmp & "<BR>"
     count = 1
     first = true
    end if
   
    ch  = mid( buf, i, 1 )
    
    if ch=CHR(10) then 
     if br=false then
      exit for
     end if
     tmp = tmp & "<BR>"
     count = 1
     first = true
    elseif count>1 AND ch=CHR(32) then 
     if not first then
      tmp = tmp & " "
     end if
    elseif count = 1 and ch = CHR(32) then
     tmp = tmp
    else
     tmp = tmp & ch
     first = false
    end if

    if asc(ch)<0 then    '한글이면
     count = count+2
     else      '영문이면
     count = count+1
    end if
   next
  else
   tmp = str
   tmp = Trim( tmp )
   tmp = Replace( tmp, "&", "&amp;" )
   tmp = Replace( tmp, "<", "&lt;" )
   tmp = Replace( tmp, ">", "&gt;" )
   'tmp = Replace( tmp, CHR(10), "<BR>" )
   'tmp = Replace( tmp, CHR(32), " " )
  end if
   
  StringToHTML = tmp
 end function


'**************  Information  ****************************************
'	Program Title	:	팝업띄우는 모듈 popup_view()
'	Company		    :	
'	Creator		    :	윤 종 우  2010-02-04
'*********************************************************************

function popup_view()

	table = "popup"
	getdate_str = Date()

	sql = " select * from "&table&" where w_chk  = 'Y' and edate >= '"&getdate_str&"' and sdate <= '"&getdate_str&"' order by sdate"
	Set rs = Dbcon.execute(sql)

	do while not rs.eof 

		idx			= trim(rs("idx"))
		w_width		= trim(rs("w_width"))
		w_height	= trim(rs("w_height"))
		w_top		= trim(rs("w_top"))
		w_left		= trim(rs("w_left"))
		ck_chk		= trim(rs("ck_chk"))
		ck_val		= trim(rs("ck_val"))
		scrollbars	= trim(rs("scrollbars"))
		toolbar		= trim(rs("toolbar"))
		menubar		= trim(rs("menubar"))
		locations	= trim(rs("locations"))

		If ck_val = "" Then
			ck_val = "1"
		End if
%>

		<SCRIPT language="JavaScript">
		<!--
<%
			if ck_chk = "Y" then
%>
				// 팝업창 띄우지 않게 하기 시작
				function ReadCookie(name){
					var nameOfCookie=name+"=";
								//alert(nameOfCookie);
					var x=0;
					while(x<=document.cookie.length)
					{
						var y=(x+nameOfCookie.length)
						if(document.cookie.substring(x,y)==nameOfCookie){
							if((endOfCookie=document.cookie.indexOf(";",y))==-1)
								endOfCookie=document.cookie.length;
							return unescape(document.cookie.substring(y,endOfCookie));
						}
						x=document.cookie.indexOf(" ",x) +1;
						if(x==0)
							break;
					}
					return "";
				}


				function bd_popup_win(){
					var ck = ReadCookie( "pop<%=idx%>" );
					if ( ck == "<%=ck_val%>" ){
						return;
					}else{
						window.open('/manager/content/04popup/view.asp?idx=<%=idx%>','bd_popup<%=idx%>','scrollbars=<%=scrollbars%>,toolbar=<%=toolbar%>,menubar=<%=menubar%>,location=<%=locations%>,width=<%=w_width%>,height=<%=w_height%>,left=<%=w_left%>, top=<%=w_top%>');
					}
				}

				bd_popup_win();

<%
			else
%>
				//쿠키사용을 하지 않는다면
				window.open('/manager/content/04popup/view.asp?idx=<%=idx%>','bd_popup<%=idx%>','scrollbars=<%=scrollbars%>,toolbar=<%=toolbar%>,menubar=<%=menubar%>,location=<%=locations%>,width=<%=w_width%>,height=<%=w_height%>,left=<%=w_left%>, top=<%=w_top%>');
<%
			end if
%>
		//-->
		</SCRIPT>
<%

		rs.movenext
	Loop
	
	Set rs = nothing
	


''*************************************************************************************************
	getdate_str = Date()
	
	sql = " select count(idx) as idx from "&table&" where w_chk  = 'T' and edate >= '"&getdate_str&"' and sdate <= '"&getdate_str&"'"
	'response.write sql
	Set rs = Dbcon.execute(sql)
	If rs.eof Then
		rs_t_pop_str = 0
	Else
		rs_t_pop_str = rs(0)
	End If
	Set rs = nothing

	If rs_t_pop_str <> 0 then
''-----------------------------------------------------------------------------------------------------------
%>
			<SCRIPT LANGUAGE="JavaScript">
			<!--
				// 팝업창 띄우지 않게 하기 시작
				function ReadCookie(name){
					var nameOfCookie=name+"=";
						//alert(nameOfCookie);
					var x=0;
					while(x<=document.cookie.length)
					{
						var y=(x+nameOfCookie.length)
						if(document.cookie.substring(x,y)==nameOfCookie){
							if((endOfCookie=document.cookie.indexOf(";",y))==-1)
								endOfCookie=document.cookie.length;
							return unescape(document.cookie.substring(y,endOfCookie));
						}
						x=document.cookie.indexOf(" ",x) +1;
						if(x==0)
							break;
					}
					return "";
				}



				function bd_popup_win(){
					var ck = ReadCookie( "pop1000" );

					if ( ck == "1" ){
						return;
					}else{
						window.open("/manager/content/04popup/list_view.asp","pop1000","scrollbars=no,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width=450,height=320'");	
					}

				}

				bd_popup_win();
							
							
			//-->
			</SCRIPT>

<%
	End if

End Function




'**************  Information  ****************************************
'	Program Title	:	자동증가 TabIndex
'	Company			:	
'	Creator			:	윤 종 우 2009-08-04
'*********************************************************************
function getTabIndex() 

	tabindex = tabindex + 1	
	getTabIndex = tabindex

End Function 




'**************  Information  ****************************************
'	Program Title	:	관리자 페이지 좌측메뉴
'	Company			:	
'	Creator			:	윤 종 우 2009-08-04
'*********************************************************************
function manager_leftmenu(ct_ref, skin) 

	R_Fields_L = "ct_idx, ct_name"

	sql = "Select "&R_Fields_L&" from manager_menu where ct_chk='Y' AND ct_ref = "&ct_ref&" AND ct_depth = '2'  order by ct_code ASC"
	
	Set rs = Dbcon.execute(sql)

	do while not rs.eof 

		mct_idx = rs("ct_idx")
		mct_name = rs("ct_name")
%>
	<ul>

		<li id="menu<%=mct_idx%>" class="<%=skin%>"><a tabindex="<%=getTabIndex()%>"><%=mct_name%></a>
			<ul>
				<%
					''관리메뉴 부분(대메뉴)

					R_Fields_L2 = "ct_idx, ct_name, ct_url"
					sql2 = "Select "&R_Fields_L2&" from manager_menu where ct_chk='Y' AND ct_ref = "&mct_idx&" AND ct_depth = '3'  order by ct_code ASC"
					'response.write sql2
					Set rs2 = Dbcon.execute(sql2)

					do while not rs2.eof 

						mct_idx2	= rs2("ct_idx")
						mct_name2	= rs2("ct_name")
						ct_url2	= rs2("ct_url")

						if ct_url2 = "" then
							ct_url2 = "#"
						End If
%>
						
						<li id="menu1-<%=mct_idx2%>"><a href="<%=ct_url2%>" <%if sec = "100" Then response.write "class='on'" %> tabindex="<%=getTabIndex()%>"><%=mct_name2%></a></li>

<%
						rs2.movenext
					Loop
					
					Set rs2=nothing
%>

				
			</ul>
		</li>
	</ul>


<%

		rs.movenext
	Loop
	
	Set rs = nothing

End Function 




function ViewCreate()

	Dim sql, i, qry, col

	''기존 뷰테이블 삭제
	'qry = "DROP VIEW board_total"
	'Dbcon.execute qry

	
	''뷰생성
	qry ="SELECT a_tablename, a_bbsname, a_num FROM board_config "
	Set col = Dbcon.execute(qry)

	i = 1
	do while not col.eof

		If i=1 then
			sql = " alter VIEW board_total AS "	
		Else
			sql = sql & " UNION ALL "
		End If
		
		sql = sql & " SELECT  '"&col("a_num")&"' as a_num, '"&col("a_bbsname")&"' as a_bbsname, b_num, b_type, b_id, b_name, b_pwd, b_subject, b_email, b_jumin, b_phone1, b_phone2, b_phone3, b_cate, b_catename, b_noticechk, b_content, b_ip, b_count, b_look, b_open, b_ref, b_step, b_level, b_regdate, b_chuchun, b_sbjclr, b_sdate, b_edate, b_temp1, b_temp2, b_temp3, b_temp4, b_temp5, b_temp6, b_temp7,  b_file1, b_file2, b_file3, b_file4, b_file5,b_c_count FROM  "&col("a_tablename")&" "

		i=i+1
		col.movenext

	Loop

	if sql <>"" Then
		Dbcon.execute sql
	End if
	
End function




function ViewCreateMember()
	
	''기존 뷰테이블 삭제
	qry = "DELETE FROM member_view"
	Dbcon.execute qry


	sql = "INSERT INTO member_view("
	sql = sql & "lvlname, g_manager, m_num, m_id, m_pwd, m_name, m_lastdate, m_level, m_date"
	sql = sql & ")"
	sql = sql & "SELECT g_menuname AS lvlname, g_manager, m_num, m_id, m_pwd, m_name, m_lastdate, m_level, m_date FROM member as a INNER JOIN member_group as b ON a.m_level = b.g_num"
	Dbcon.execute sql

End Function



function ViewCreateMenuChk()

	''기존 뷰테이블 삭제
	qry = "DELETE FROM manager_menu_chk_view"
	Dbcon.execute qry

	sql = "INSERT INTO manager_menu_chk_view("
	sql = sql & "g_num, ct_idx, ct_name, ct_chk, ct_depth, ct_codeno, ct_url, ct_code"
	sql = sql & ")"
	sql = sql & "SELECT a.g_num, b.ct_idx, b.ct_name, b.ct_chk, b.ct_depth, b.ct_codeno, b.ct_url, b.ct_code FROM manager_menu_access as a INNER JOIN manager_menu as b ON a.ct_idx = b.ct_idx"
	Dbcon.execute sql

End function



'**************  Information  ****************************************
'	Program Title	:	 폴더검사후 없으면 생성
'	Company		    :	
'	Creator		    :	윤 종 우  2004. 05. 13
'*********************************************************************
function Folderfilesize(strDir)

	Dim fso, ff
	Set fso = Server.CreateObject("Scripting.FileSystemObject")

	If fso.FileExists (strDir) Then		
		Set ff = fso.GetFile(strDir)		
		Folderfilesize = ff.size
		Set ff = nothing
	Else
		Folderfilesize = false
	End if	

	Set fso = nothing

End Function


'**************  Information  ****************************************
'	Program Title	:	 용량 자동 계산
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-12
'*********************************************************************
function byteConvert(bytes)
	Dim s, e, i, ss, t
	s = array("B", "Kb", "MB", "GB", "TB", "PB")
	e = int(log(bytes)/log(1024))

	For i=1 To e
		If i>1 Then ss = ss & "*"
		ss = ss & " 1024 "
	Next
	If ss<>"" Then
		execute("x = "&ss)
	End If
	
	t = bytes/x
	t = (int(t*100))/100&s(e)

	byteConvert = t
End function





'**************  Information  ****************************************
'	Program Title	:	 /디렉토리별 용량 자동계산
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-12
'*********************************************************************
function get_dirsize(dir) 

	Dim fso, ff
	Set fso = Server.CreateObject("Scripting.FileSystemObject")

	If fso.FolderExists (dir) Then
		Set ff = fso.GetFolder(dir)
		get_dirsize = ff.size
		Set ff = nothing
	Else
		get_dirsize = false
	End if	

	Set fso = Nothing

End function




'**************  Information  ****************************************
'	Program Title	:	 잔여일 자동계산
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-12
'*********************************************************************
function get_ssday(sc_hdate1, sc_hdate2)

	get_ssday = DateDiff("d",sc_hdate1, sc_hdate2)

End function




'**************  Information  ****************************************
'	Program Title	:	관리자 페이지 좌측메뉴
'	Company			:	
'	Creator			:	윤 종 우 2009-08-04
'*********************************************************************
function manager_leftmenu2(ct_ref, skin) 

	Dim sql, sql2, Rs, Rs2
	
	''관리메뉴 부분(대메뉴)

	R_Fields_L = "ct_idx, ct_name, ct_codeno"

	sql = "SELECT "&R_Fields_L&" FROM manager_menu WHERE ct_chk='Y' AND ct_ref = "&ct_ref&" AND ct_depth = '2'  order by ct_code ASC"
	Set Rs = Dbcon.execute(sql)

	Do While Not Rs.eof

		mct_idx = Rs("ct_idx")
		mct_name = Rs("ct_name")
		mct_codeno = Rs("ct_codeno")


		If get_menu_chk(mct_codeno, Session("ss_g_num")) <> 0 then
%>

	<ul>

		<li id="menu<%=mct_idx%>" class="<%=skin%>"><a tabindex="<%=getTabIndex()%>"><%=mct_name%></a>
			<ul>
<%
			''관리메뉴 부분(대메뉴)

			R_Fields_L2 = "ct_idx, ct_name, ct_url, ct_codeno"
			sql2 = "Select "&R_Fields_L2&" from manager_menu where ct_chk='Y' AND ct_ref = "&mct_idx&" AND ct_depth = '3'  order by ct_code ASC"
			Set Rs2 = Dbcon.execute(sql2)

			Do While Not Rs2.eof

				mct_idx2		= Rs2("ct_idx")
				mct_name2		= Rs2("ct_name")
				ct_url2			= Rs2("ct_url")
				mct_codeno2		= Rs2("ct_codeno")

				if ct_url2 = "" then
					ct_url2 = "#"
				End if

					If get_menu_chk(mct_codeno2, Session("ss_g_num")) <> 0 then

%>
				
						<li id="menu1-<%=mct_idx2%>"><a href="<%=ct_url2%>" <%if sec = "100" Then response.write "class='on'" End if %> tabindex="<%=getTabIndex()%>"><%=mct_name2%></a></li>

<%

					End if

				Rs2.movenext
			Loop
			
			Set Rs2 = nothing

%>

				
			</ul>
		</li>
	</ul>


<%
			End if


		Rs.movenext
	loop	

	Set Rs = nothing

End function




'**************  Information  ****************************************
'	Program Title	:	사용메뉴가능여부
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-18
'*********************************************************************
function get_menu_chk(mct_codeno,g_num)

	Dim sql, Rs
	
	sql = "select count(ct_idx)  from manager_menu_chk_view  where g_num = '"&g_num&"' and ct_codeno like '"&mct_codeno&"%'"
	Set Rs = Dbcon.execute(sql)
	mct_cnt = Rs(0)
	Set Rs = Nothing
	get_menu_chk = mct_cnt

End Function



'**************  Information  ****************************************
'	Program Title	:	사용메뉴가능여부
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-18
'*********************************************************************
function get_menu2_url(mct_codeno, g_num) 

	Dim sql, Rs
	
	If g_num = 1 then ''총관리자일경우
		sql = "select top 1 ct_codeno  from manager_menu  where ct_depth = '2' AND ct_chk = 'Y' and ct_codeno like '"&mct_codeno&"%' order by ct_code ASC"		
	else
		sql = "select top 1 ct_codeno  from manager_menu_chk_view  where g_num = '"&g_num&"' and ct_codeno like '"&mct_codeno&"%' order by ct_code ASC"
	End If
	Set Rs = Dbcon.execute(sql)

	If Not Rs.eof Then		
		ct_codeno = rs("ct_codeno")
	Else
		ct_codeno = "#"
	End If
	
	Set Rs = nothing
	
	get_menu2_url = ct_codeno

End Function


'**************  Information  ****************************************
'	Program Title	:	사용메뉴가능여부
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-18
'*********************************************************************
function get_menu3_url(mct_codeno, g_num) 

	Dim sql, Rs
	
	If g_num = 1 then ''총관리자일경우
		sql = "select top 1 ct_url  from manager_menu  where ct_depth = '3' and ct_codeno like '"&mct_codeno&"%' order by ct_code ASC"
	else
		sql = "select top 1 ct_url  from manager_menu_chk_view  where g_num = '"&g_num&"' and ct_codeno like '"&mct_codeno&"%' order by ct_code ASC"
	End if
	Set Rs = Dbcon.execute (sql)

	If Not Rs.eof Then
		ct_url = Rs("ct_url")
	Else
		ct_url = "#"
	End If
	Set Rs = Nothing

	get_menu3_url = ct_url

End function



'**************  Information  ****************************************
'	Program Title	:	에디터옵션
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-24
'*********************************************************************
function editor_opt1() 

%>
// Customize Link and FileUpload Dialog
			xq.ui_templates.basicLinkDialog= '<form id="linkDialog" class="xqFormDialog lightweight" action="#">\n	<h3>link</h3>\n	<div class="dialog-content">\n		<label class="link-target">링크 대상</label>\n		<input type="text" name="text" class="type-text" value="" />\n		<p class="explain">URL을 입력해주세요.</p>\n		<label class="link-name">표시할 이름</label>\n		<input type="text" name="url" class="type-text" value="http:''" />\n		<div class="dialog-buttons">\n			<a href="#" class="button-white cancel">취소</a>\n			<a href="#" class="button-gray submit">생성</a>\n		</div>\n	</div>\n<p class="option"><label><input type="checkbox" class="type-checkbox" name="newWindow"/>새 창으로 열립니다.</label></p>\n</form>'
			xq.ui_templates.basicFileUploadDialog='<form id="fileUploadDialog" class="xqFormDialog modal" method="post" enctype="multipart/form-data" target="uploadTarget" action="" >\n		<h3>파일 첨부</h3>\n		<div class="dialog-content">\n			<div class="attachment-section">\n				<label class="label" for="searchAttachFile">파일찾기</label><input type="file" class="type-text" id="searchAttachFile" name="tempFile" />\n			</div>\n			<div class="dialog-buttons">\n				<a href="#" class="button-white cancel">닫기</a>\n				<a href="#" class="button-gray submit">삽입</a>\n			</div>\n		</div>\n		<iframe id="uploadTarget" name="uploadTarget" src="" style="width:0;height:0;border:0px solid #fff;"></iframe>\n		<a href="#" class="cancel close-dialog"><img src="/common/xeditor/images/dialogs/icon_close.gif" alt="Close" /></a>\n<input type="hidden" name="accept" value="application/json" />	</form>';
			xq.ui_templates.basicMultiFileUploadDialog= '<form id="multiFileUploadDialog" class="xqFormDialog modal" method="post" enctype="multipart/form-data">\n		<h3>이미지 삽입</h3>\n		<div class="dialog-content">\n			<div id="fileUploadContainer" class="attachment-section">\n				<p>한 파일당 최대 <strong>20MB</strong>까지 올릴 수 있고,<br/>한 번에 여러 개의 파일을 첨부할 수 있습니다.</p>\n				<div class="dialog-buttons upload-buttons"><div id="MultiFileUploaderDiv"></div></div>\n			</div>\n			<div id="fileListContainer" class="attachment-section">\n			</div>\n			<div class="dialog-buttons">\n				<a href="#" class="button-white cancel">닫기</a>\n				<a href="#" class="button-gray submit">삽입</a>\n			</div>\n			<p class="noti">\n				정상적으로 동작하지 않을 경우에는 기존 방식으로 업로드 하시길 바랍니다.<span><a href="#" onclick="xed.handleFileUpload(true)">기존 방식으로 업로드 하기</a></span>\n			</p>\n		</div>\n		<a href="#" class="cancel close-dialog"><img src="/common/xeditor/images/dialogs/icon_close.gif" alt="Close" /></a>\n		<div id="MultiFileUploader"></div>\n	</form>';
			xq.ui_templates.basicTableDialog= '<form id="tableDialog" class="xqFormDialog modal" action="#">\n		<h3 id="tableDialogTitle">테이블 삽입</h3>\n		<input type="hidden" name="tableDialogType" value="" />\n		<div class="dialog-content">\n			<fieldset class="table-type">\n				<legend>table type</legend>\n				<ul>\n					<li><a href="#" id="tableTypeDefaultValue" class="selected" onclick="xq.RichTableController.changeType(this, \'\'); return false;"><img src="/common/xeditor/images/dialogs/iconTable_01.gif?1214533817" alt="제목 없는 표" /></a></li>\n					<li><a href="#" onclick="xq.RichTableController.changeType(this, \'t\'); return false;"><img src="/common/xeditor/images/dialogs/iconTable_02.gif?1214533817" alt="상단에 제목 칼럼" /></a></li>\n					<li><a href="#" onclick="xq.RichTableController.changeType(this, \'l\'); return false;"><img src="/common/xeditor/images/dialogs/iconTable_03.gif?1214533817" alt="좌측에 제목 칼럼" /></a></li>\n					<li class="last-child"><a href="#" onclick="xq.RichTableController.changeType(this, \'tl\'); return false;"><img src="/common/xeditor/images/dialogs/iconTable_04.gif?1214533817" alt="상단과 좌측에 제목 칼럼" /></a></li>\n				</ul>\n				<input id="tableTypeField" type="hidden" name="tableType" value="" />\n			</fieldset>\n			<fieldset class="table-size">\n				<legend id="tableSizeLabel" class="font-variation">크기</legend>\n				<div class="wrapper">\n					<ul>\n						<li class="new-only">\n							<label>행</label>\n							<span class="controller"><input type="text" onchange="xq.RichTableController.previewTable(); return false;" id="tableRowsField" name="tableRows" value="3" class="type-text" /><span class="buttons"><img src="/common/xeditor/images/dialogs/arrow_top.gif" alt="plus" class="plus rows" onclick="xq.RichTableController.changeSize(this); return false;" /><img src="/common/xeditor/images/dialogs/arrow_bottom.gif" alt="minus" class="minus rows" onclick="xq.RichTableController.changeSize(this); return false;" /></span></span>\n						</li>\n						<li class="new-only">\n							<label>열</label>\n							<span class="controller"><input type="text" onchange="xq.RichTableController.previewTable(); return false;" id="tableColsField" name="tableCols" value="3" class="type-text" /><span class="buttons"><img src="/common/xeditor/images/dialogs/arrow_top.gif" alt="plus" class="plus cols" onclick="xq.RichTableController.changeSize(this); return false;" /><img src="/common/xeditor/images/dialogs/arrow_bottom.gif" alt="minus" class="minus cols" onclick="xq.RichTableController.changeSize(this); return false;" /></span></span>\n						</li>\n						<li class="table-width">\n							<label>너비</label>\n							<select class="tableWidths" onchange="xq.RichTableController.changeStyle(this); return false;">\n								<option value="fullsize">페이지에 맞춤</option>\n								<option value="content">내용에 맞춤</option>\n								<option value="pixel">고정 사이즈(px)</option>\n								<option value="percentage">페이지 대비 비율(%)</option>\n							</select>			\n							<input type="text" name="tableWidth" id="tableWidthValue" class="type-text height-box" style="display:none;" />				\n							<input type="hidden" name="tableWidthUnit" value="" id="tableWidthValueUnit" />				\n							<!--input type="checkbox" name="tableFixed" class="type-checkbox" /><label class="none font-valiation">Same cell spacing</label-->\n						</li>\n						<li class="table-height">\n							<label>높이</label>\n							<select class="tableHeights" onchange="xq.RichTableController.changeStyle(this); return false;">\n								<option selected value="content">내용에 맞춤</option>\n								<option value="pixel">고정 사이즈(px)</option>\n							</select>							\n							<input type="text" name="tableHeight" id="tableHeightValue" class="type-text height-box" style="display:none;" />\n							<input type="hidden" name="tableHeightUnit" id="tableHeightValueUnit" />\n						</li>\n					</ul>\n					<div id="previewTable" class="new-only">\n						<table>\n							<tr>\n								<td></td>\n								<td></td>\n								<td></td>\n							</tr>\n							<tr>\n								<td></td>\n								<td></td>\n								<td></td>\n							</tr>\n							<tr>\n								<td></td>\n								<td></td>\n								<td></td>\n							</tr>\n						</table>\n					</div>\n				</div>\n			</fieldset>\n			<fieldset class="table-alignment">\n				<legend class="font-variation">정렬</legend>\n				<div class="wrapper">\n					<ul>\n						<li>\n							<label>가로</label>\n							<select name="tableHorizontalAlign">\n								<option value="left">왼쪽</option>\n								<option value="center">가운데</option>\n								<option value="right">오른쪽</option>\n							</select>\n						</li>\n						<li>\n							<label>세로</label>\n							<select name="tableVerticalAlign">\n								<option value="top">상단</option>\n								<option value="middle">중앙</option>\n								<option value="bottom">하단</option>\n							</select>\n						</li>\n					</ul>\n				</div>\n			</fieldset>\n			<fieldset class="table-border">\n				<legend class="font-variation">테두리</legend>\n				<div class="wrapper button-style03">\n					<ul>\n						<li class="weight-li">\n							<label>크기</label><span class="controller"><input type="text" name="tableBorderSize" value="0" class="type-text" /><span class="buttons"><img src="/common/xeditor/images/dialogs/arrow_top.gif" alt="" class="plus border" onclick="xq.RichTableController.changeSize(this); return false;" /><img src="/common/xeditor/images/dialogs/arrow_bottom.gif" alt="" class="minus border" onclick="xq.RichTableController.changeSize(this); return false;" /></span></span>\n						</li>\n						<li class="color-li">\n							<label>color</label>\n							<span class="color">\n								<a href="#" id="borderColorBoard" class="tableDialog border" onclick="xq.RichTableController.showColorPicker(this); return false;">&nbsp;</a>\n							</span>\n							<a href="#" class="tableDialog" onclick="xq.RichTableController.showColorPicker(this); return false;" title="search"><img src="/common/xeditor/images/dialogs/arrow06.gif" alt="search" class="search-color" /></a>\n							<input id="borderColorCode" type="hidden" name="tableBorderColor" value="#000000" />\n						</li>\n					</ul>\n				</div>\n			</fieldset>\n			<fieldset class="table-background">\n				<legend class="font-variation">배경</legend>\n				<div class="wrapper button-style03">\n					<ul>\n						<li>\n							<label>색상</label>\n							<span class="color">\n								<a href="#" id="backgroundColorBoard" class="tableDialog background" onclick="xq.RichTableController.showColorPicker(this); return false;">&nbsp;</a>\n							</span>\n							<a href="#" class="tableDialog" onclick="xq.RichTableController.showColorPicker(this); return false;" title="search"><img src="/common/xeditor/images/dialogs/arrow06.gif" alt="search" class="search-color" /></a>\n							<input id="backgroundColorCode" type="hidden" name="tableBackgroundColor" value="#ffffff" />\n						</li>\n					</ul>\n				</div>\n			</fieldset>\n			<div class="dialog-buttons">\n				<a href="#" class="button-white cancel">취소</a>\n				<a href="#" class="button-gray submit" id="tableDialogSubmit">삽입</a>\n			</div>\n		</div>\n		<a href="#" class="cancel close-dialog"><img src="/common/xeditor/images/dialogs/icon_close.gif" alt="close" /></a>\n	</form>';

			
<%

End function



'**************  Information  ****************************************
'	Program Title	:	페이지로딩
'	Company		    :	
'	Creator		    :	윤 종 우  2009-08-26
'*********************************************************************
function loading_layer() 
%>

<!-- 페이지로딩 -->
<div id="loading_layer" style="display:none; position:absolute; left:400px; top:240px; border:2px solid #C6C6C6; background-color:#ffffff; padding:25px; text-align:center; vertical-align:middle; z-index:1000; font-weight:bold; color:#313131; line-height:140%;">
	데이터를 전송하고 있습니다.<br />
	<span>잠시만 기다려주세요</span><br />
	<br />
	<img src="/manager/img/progress_bar.gif" width="250" height="26" alt="처리중입니다." />
</div>
<!-- ''페이지로딩 -->
<%
 
End function




'**************  Information  ****************************************
'	Program Title	:	썸네일
'	Company		    :	
'	Creator		    :	윤 종 우  2009-09-01
'function GD2_make_thumb($max_x,$max_y/*줄여줄 이미지의 가로세로 크기*/,$dst_name/*생성될 이미지파일이름*/,$src_file/*원본 파일이름*/) {
'*********************************************************************

sub GD2_make_thumb(width, height, pg_img, strDir, saveDir)	' ( 가로, 세로, 이미지파일명, 원본이미지 경로, 썸네일이미지 경로 )
	Dim objImage
	Dim strOpenFileName    '해당 원본 이미지 파일
	Dim strSaveFileName    '저장될 이미지 파일

	strOpenFileName = strDir & pg_img
	strSaveFileName = saveDir & pg_img

	Set objImage = Server.CreateObject("Nanumi.ImagePlus")
		
		'466생성
		objImage.OpenImageFile strOpenFileName

		objImage.OverWrite = True        '저장시 파일이름이 같을 경우 덮어쓰기 가능, 기본값 False(덮어쓰기 불가능)
		objImage.ImageFormat = "JPG"        '저장 이미지 포맷 설정, 기본값 JPG
		objImage.Quality = 75               'JPG압축률설정(1~100),JPG파일 저장시에만 적용됨, 기본값: 75
		objImage.AllowEnlarge = False        '확대가능여부(원본이미지보다 크게 할 경우 True), 기본값: False
		objImage.ChangeSize width, height         '썸네일 이미지 생성시 너비,높이

		objImage.SaveFile strSaveFileName
		'objImage.Dispose

	
	Set objImage = Nothing
end Sub




'**************  Information  ****************************************
'	Program Title	:	게시판 명
'	Company		    :	
'	Creator		    :	윤 종 우  2009-09-11
'*********************************************************************
function get_bbsname(a_num) 
	
	Dim sql, Rs
	
	sql = "select a_bbsname  from board_config  where a_num = '"&a_num&"'"
	Set Rs = Dbcon.Execute (sql)
	a_bbsname = Rs("a_bbsname")
	Set Rs = nothing
	get_bbsname = a_bbsname

End function


'**************  Information  ****************************************
'	Program Title	:	게시판 테이블 명
'	Company		    :	
'	Creator		    :	윤 종 우  2009-09-11
'*********************************************************************
function get_tablename(a_num) 
	
	Dim sql, Rs

	sql = "select a_tablename  from board_config  where a_num = '"&a_num&"'"
	Set Rs = Dbcon.Execute (sql)

	a_tablename=  Rs("a_tablename")

	Set Rs = Nothing
	
	get_tablename = a_tablename

End function



'**************  Information  ****************************************
'	Program Title	:	이북명
'	Company		    :	
'	Creator		    :	윤 종 우  2009-09-18
'*********************************************************************
function get_ebsubject(eb_pk) 
	
	Dim sql, Rs
	
	sql = "select eb_subject  from ebook  where eb_pk = '"&eb_pk&"'"
	Set Rs = Dbcon.Execute (sql)
	eb_subject = rs("eb_subject")
	Set Rs = nothing

	get_ebsubject = eb_subject

End function



'**************  Information  ****************************************
'	Program Title	:	설문조사명
'	Company		    :	
'	Creator		    :	윤 종 우  2009-09-22
'*********************************************************************
function get_pollsubject(po_pk) 
	
	Dim sql, Rs
	
	sql = "select po_subject  from poll  where po_pk = '"&po_pk&"'"
	Set Rs = Dbcon.Execute (sql)
	po_subject = rs("po_subject")
	Set Rs = Nothing
	
	get_pollsubject = po_subject

End function


'**************  Information  ****************************************
'	Program Title	:	수강인원
'	Company		    :	
'	Creator		    :	윤 종 우  2009-09-22
'*********************************************************************
function get_edusat_reqeust_cnt(po_idx, es_temp) 

	Dim sql, Rs
	
	sql = "select count(es_idx) as cnt  from edusat_request  where po_idx = '"&po_idx&"' AND es_temp='"&es_temp&"'"
	Set Rs = Dbcon.Execute (sql)
	cnt = rs(0)
	Set Rs = nothing

	get_edusat_reqeust_cnt = cnt

End function


'**************  Information  ****************************************
'	Program Title	:	수강인원
'	Company		    :	
'	Creator		    :	윤 종 우  2009-09-22
'*********************************************************************
function get_edusat_cnt(po_idx, temp_str) 
	
	Dim sql, Rs
	
	sql = "select "&temp_str&"   from edusat  where po_idx = '"&po_idx&"'"
	Set Rs = Dbcon.Execute (sql)

	rev = rs(0)
	Set Rs = nothing
	get_edusat_cnt = rev

End function




'**************  Information  ****************************************
'	Program Title	:	게시글 뽑아오기
'	Company		    :	
'	Creator		    :	윤 종 우  2009-10-15
'*********************************************************************
function get_main_board(bbs_name, a_num, cnt) 
	
	Dim sql, Rs, i

	sql = "select top "&cnt&" b_num, b_name,  b_subject, b_regdate from "&bbs_name&" where  b_open = 'Y'and b_look = 'Y' and b_type='N'  order by b_regdate desc "
	Set Rs = Dbcon.Execute (sql)

	i=0
	Do While Not Rs.eof

		b_num			= Rs("b_num")
		b_name			= Rs("b_name")
		b_subject		= Rs("b_subject")
		b_regdate		= Rs("b_regdate")

		b_subject		= Rs("b_subject")
		b_subject_str	= remove_tags(b_subject)
		b_subject_str	= StringToHTML(b_subject_str, 36, false )
		b_regdate		= mid(Rs("b_regdate"),0,10)
		b_regdate2		= mid(Rs("b_regdate"),5,5)
%>

	<li><a href="/content/board/view.asp?a_num=<%=a_num%>&amp;b_num=<%=b_num%>" title="<%=b_subject%>"><%=b_subject_str%></a><%=get_newimg(b_regdate, 1)%><span>[<%=str_replace("-", ".", b_regdate2)%>]</span></li>
<%

		i=i+1
		Rs.movenext

	Loop
	
	Set Rs = nothing


End function


'**************  Information  ****************************************
'	Program Title	:	전체방문자수
'	Company		    :	
'	Creator		    :	윤 종 우  2009-11-04
'*********************************************************************
function countTotal2() 
	
	Dim sql, Rs

	sql ="select count(vNum) as vCount from visit_counter"
	Set Rs = Dbcon.Execute (sql)
	countTotal = Rs(0)
	Set Rs = Nothing
	
	countTotal2 = countTotal

End Function


'**************  Information  ****************************************
'	Program Title	:	전체방문자수
'	Company		    :	
'	Creator		    :	윤 종 우 2009-11-04
'*********************************************************************
function countToday2() 

	Dim sql, Rs

	sql ="select count(vNum) as TCount from visit_counter where vYY = "&Year(now)&" and vMM = "&Month(now)&" and vDD = "&Day(now)
	Set Rs = Dbcon.Execute (sql)
	countToday = Rs(0)
	Set Rs = Nothing

	countToday2 = countToday

End Function

'**************  Information  ****************************************
'	Program Title	:	전체방문자수
'	Company		    :	
'	Creator		    :	윤 종 우 2009-11-04
'*********************************************************************
function countYesterday2() 

	Dim sql, Rs
	Dim Yesterday

	Yesterday = DateAdd("d",-1,now)

	sql ="select count(vNum) as YCount from visit_counter where vYY="&Year(yesterday)&" and vMM = "&month(yesterday)&" and vDD = "&day(yesterday)
	Set Rs = Dbcon.Execute (sql)

	countYesterday = Rs(0)

	Set Rs = Nothing
	countYesterday2 = countYesterday

End Function



'' 날짜 포맷
Function getDateFm(vDate, vKey)
	Dim y, m, d, h, mi, ss, pm
	if Not isDate(vDate) then
		getDateFm = False
		Exit Function
	End if

	pm = "오전"
	y = Year(vDate)
	m = Month(vDate)
	d = Day(vDate)
	h = Hour(vDate)
	mi = Minute(vDate)
	ss = Second(vDate)

	if len(m) = 1 then		m = "0" & m
	if len(d) = 1 then		d = "0" & d
	if h > 11 And (vKey = 1) then
		pm = "오후"
		if h > 12 then		h = h Mod 12
	end if
	if len(h) = 1 then		h = "0" & h
	if len(mi) = 1 then		mi = "0" & mi
	if len(ss) = 1 then		ss = "0" & ss


	Select Case vKey
		Case 0 : getDateFm = y & "년 " & m & "월 " & d & "일"
		Case 1 : getDateFm = pm & "/" & h & "시/" & mi & "분"
		Case 3 : getDateFm = Y & "-"& m &"-"& d &" "& h & ":" & mi & ":" & ss
		Case 4 : getDateFm = Y & "-"& m &"-"& d
		Case 5 : getDateFm = Y & "."& m &"."& d
		Case 6 : getDateFm = Y & m
	End Select
End Function





'//페이지 이동 및 메세지 출력
sub goMessage_board(msg, prepage, ok, no, a_num)
	Dim querystring
	'//$msg = mb_convert_encoding($msg, "UTF-8", "EUC-KR");
	querystring = "msg=" & server.urlencode(msg)
	querystring = querystring & "&prepage=" & server.urlencode(prepage)
	querystring = querystring & "&ok=" & server.urlencode(ok)
	querystring = querystring & "&no=" & server.urlencode(no)
	querystring = querystring & "&a_num=" & server.urlencode(a_num)
	
	response.redirect "/content/board/message.asp?" & querystring
	response.end
End Sub

'//페이지 이동 및 메세지 출력
sub goMessage_board2(msg, prepage, ok, no, a_num)
	Dim querystring
	'//$msg = mb_convert_encoding($msg, "UTF-8", "EUC-KR");
	querystring = "msg=" & server.urlencode(msg)
	querystring = querystring & "&prepage=" & server.urlencode(prepage)
	querystring = querystring & "&ok=" & server.urlencode(ok)
	querystring = querystring & "&no=" & server.urlencode(no)
	querystring = querystring & "&a_num=" & server.urlencode(a_num)
	
	response.redirect "http://" & Replace(Request.ServerVariables("HTTP_HOST"),"real","www") & "/content/board/message.asp?" & querystring
	response.end
End Sub

'//페이지 이동 및 메세지 출력
sub goMessage_Login(msg, prepage, ok, no, a_num)
	Dim querystring
	'//$msg = mb_convert_encoding($msg, "UTF-8", "EUC-KR");
	querystring = "msg=" & server.urlencode(msg)
	querystring = querystring & "&prepage=" & server.urlencode( "/content/06guide/12_01.asp?prepage=" & server.urlencode(prepage) )
	querystring = querystring & "&ok=" & server.urlencode(ok)
	querystring = querystring & "&no=" & server.urlencode(no)
	querystring = querystring & "&a_num=" & server.urlencode(a_num)
	
	response.redirect "/content/board/message.asp?" & querystring
	response.end
End Sub




'//페이지 이동 및 메세지 출력
sub locationhref( prepage )
'	Dim querystring
	'querystring .= "&prepage=" & server.urlencode( prepage )

	response.redirect prepage
	response.end
End sub




'**************  Information  ****************************************
'	Program Title	:	 관리자페이지 체크
'	Company		    :	나눔아이앤씨
'	Creator		    :	윤 종 우  2004. 05. 13
'*********************************************************************
function no_cache()

	Response.Expires = -1
    Response.Expiresabsolute = Now() - 1
    Response.AddHeader "Pragma", "no_cache"
    Response.AddHeader "cache-control", "no-cache"
    Response.CacheControl = "no-cache" 

end Function




'**************  Information  ****************************************
'	Program Title	:	 SMS 발송
'*********************************************************************
function sendSms(tran_phone, msg, rtn_url, alert)
%>
<html>
<head>
<title>sms발송</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<%
	If alert <> "" then
%>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
		alert("<%=alert%>")
	//-->
	</SCRIPT>
<%
	End if
%>
</head>
<body>
<form name="frm" method="post" action="http://sms.dgnbe.go.kr/hostsms.asp">
	<input type="hidden" name="m_id" value="dgnbe_home">
	<input type="hidden" name="Msg" value="<%=escape(msg)%>">
	<input type="hidden" name="tran_callback" value="0536502114">
	<input type="hidden" name="tran_phone" value="<%=tran_phone%>">
	<input type="hidden" name="rtn_url" value="<%=rtn_url%>">
</form>
</body>
</html>
<SCRIPT LANGUAGE="JavaScript">
<!--
	document.frm.submit()
//-->
</SCRIPT>
<%
	response.end
End Function




'**************  Information  ****************************************
'	Program Title	:	 메일 발송
'*********************************************************************
Function sendMail(from_add, to_add, cc, bcc, subject, body)

	Dim objMail
	Set objMail = Server.CreateObject ("CDO.Message")

	Set iConf = objMail.Configuration                   'SendUsing 속성을 지정하기 위한 개체 생성
		With iConf.Fields
			.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1	  
								 '1일 경우 로컬(SMTP), 2일 경우 외부(SMTP)로 메일전송
			.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")    = 25                   
								 ' 포트번호
			.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "local" 
								' 외부일 경우 ip,도메인명
			.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
			.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\Inetpub\mailroot\Pickup"
			.Update
		End With

			'.To = sMailTo '받는 사람 이메일 주소
			'.From = sMailFrom '보내는 사람 이메일 주소
			'.Cc = sMailCc '참조 이메일 주소
			'.Bcc = sMailBcc '숨은 참조 이메일 주소
			'.Subject = sMailSubject '제목

	objMail.From = from_add
	'objMail.ReplyTo = "sp1000je@naver.com"
	objMail.cc = cc
	objMail.bcc = bcc
	objMail.Subject = subject
	objMail.HTMLBody = body
	objMail.to = to_add
	objMail.Send

	set objMail = nothing
end Function




'작업로그 저장

Sub managerJob(mj_id, mj_name, mj_job)
	Dim sql, mj_date, mj_ip

	mj_date = Date() & " " & Right("0" & hour(now), 2) & ":" & Right("0" & minute(now), 2)
	'mj_ip = request.ServerVariables("REMOTE_ADDR")
	mj_ip = remoteIP()

	sql = "insert into manager_job_log(mj_id, mj_name, mj_job, mj_YY, mj_MM, mj_DD, mj_date, mj_ip)"
	sql = sql & "values('" & mj_id & "', '" & mj_name & "', '" & mj_job & "', '" & year(now) & "','" & month(now) & "','" & day(now) & "','" & mj_date & "', '" & mj_ip & "')"

	dbcon.execute sql
End Sub



'부서메뉴트리
Sub getBuseoMenuTree( start_bdm_ref )

	Dim sql, tree_data, i, fields, count
	Dim bdm_idx, bdm_depth, bdm_ref, bdm_menuname, bdm_chk
	Dim style

	fields = "bdm_idx, bdm_depth, bdm_ref, bdm_menuname, bdm_chk"
	sql = "select " & fields & " from bd_menu_page where bdm_ref = '" & start_bdm_ref &"' order by bdm_code asc"
	Set rs = dbcon.execute( sql )

	If rs.bof Or rs.eof Then
		tree_data = null
	Else
		tree_data = rs.getrows
	End if

	Set rs = Nothing

	If Not( isnull( tree_data ) ) then
		For i = 0 To Ubound(tree_data, 2)
			count		= 0
			bdm_idx		= tree_data(0, i)
			bdm_depth	= tree_data(1, i)
			bdm_ref		= tree_data(2, i)
			bdm_menuname= tree_data(3, i)
			bdm_chk		= tree_data(4, i)

			'하위 메뉴가 있는지 확인
			sql = "select count(*) from bd_menu_page where bdm_ref = '" & bdm_idx & "'"
			Set rs = dbcon.execute( sql )
			count = rs(0)
			Set rs = nothing

			If Trim(bdm_chk) = "N" Then bdm_menuname = bdm_menuname & "(중지)"


			If count = 0 Then
				If bdm_depth = 2 Then
					Response.write "<div class='doc'><a href='#this' style='"&style&"'>" & bdm_menuname & "</a></div>" & vbcrlf
				else
					Response.write "<div class='doc'><a href='buseo_list.asp?bdm_idx="&bdm_idx&"&amp;title_bdm_menuname="&server.urlencode(bdm_menuname)&"' target='buseo_list'  style='"&style&"'>" & bdm_menuname & "</a></div>" & vbcrlf
				End if
			Else
				Response.write "<div class='folder'><a href='buseo_list.asp?bdm_idx="&bdm_idx&"&amp;title_bdm_menuname="&server.urlencode(bdm_menuname)&"' target='buseo_list'  style='"&style&"'>" & bdm_menuname & "</a>" & vbcrlf

				Call getBuseoMenuTree( bdm_idx )

				Response.write "</div>" & vbcrlf
			End if
		next
	End if

End sub



'*********************************************************************
'	클린콜 쪽 함수
function get_name(m_id)


	if m_id <> "" then
		
		m_id = replace(m_id,",","")

		sql = "select m_name from member where m_id = '"&m_id&"'"
		set rs_view = DbCon.Execute(sql)
		
		if rs_view.eof then

		get_name      = m_id

		else

		get_name      = rs_view(0)

		end if

		Set rs_view = nothing

	end if
	   
end Function


function res_true(idx,rq_idx,rr_wid)
	SQL="select rr_choice from research_result2 where idx="&idx&" and rq_idx="&rq_idx&" and rr_wid='"&rr_wid&"'"
	Set Rsx = Dbcon.Execute(SQL)
		If not Rsx.eof then
		res_true = Rsx(0)
		End if

	Set Rsx = Nothing

end Function

'*********************************************************************


Function remoteIP()
    Dim clientIP
    
    ' 1. X-Forwarded-For 헤더 확인 (프록시 환경에서 가장 우선)
    clientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    
    If clientIP <> "" Then
        ' 여러 프록시를 거친 경우 쉼표로 구분되므로 첫 번째 IP 추출
        If InStr(clientIP, ",") > 0 Then
            clientIP = Trim(Split(clientIP, ",")(0))
        End If
        remoteIP = clientIP
        Exit Function
    End If
    
    ' 2. X-Real-IP 헤더 확인 (Nginx 등에서 사용)
    clientIP = Request.ServerVariables("HTTP_X_REAL_IP")
    If clientIP <> "" Then
        remoteIP = clientIP
        Exit Function
    End If
    
    ' 3. CF-Connecting-IP 헤더 확인 (Cloudflare 사용시)
    clientIP = Request.ServerVariables("HTTP_CF_CONNECTING_IP")
    If clientIP <> "" Then
        remoteIP = clientIP
        Exit Function
    End If
    
    ' 4. HTTP_CLIENT_IP 확인
    clientIP = Request.ServerVariables("HTTP_CLIENT_IP")
    If clientIP <> "" Then
        remoteIP = clientIP
        Exit Function
    End If
    
    ' 5. 기본 REMOTE_ADDR 사용
    clientIP = Request.ServerVariables("REMOTE_ADDR")
    remoteIP = clientIP
End Function

%>