<!--#include virtual="/common/lib/dbcon.asp"-->
<!-- #Include virtual = "/common/lib/func.asp" -->
<%
Dim bdm_idx, info_url, bdm_depth, bdm_code, bdm_ref, bdm_menuname, bdm_t_clr, bdm_ro_clr, bdm_chk, bdm_type, bdm_target, bdm_bbs, bdm_editor, bdm_url, bdm_wdate, bdm_id, bdm_color
Dim r_fields

r_fields = "bdm_idx, info_url, bdm_depth, bdm_code, bdm_ref, bdm_menuname, bdm_t_clr, bdm_ro_clr, bdm_chk, bdm_type, bdm_target, bdm_bbs, bdm_editor, bdm_url, bdm_wdate, bdm_id, bdm_color"
Call requestAll(r_fields, "request.form")

prepage = InputValue( request.form("prepage") )

If bdm_idx = "" Then
	
	sql = "select max(bdm_code) from bd_address"
	Set rs = dbcon.execute( sql )
	If rs.bof Or rs.eof Then
		bdm_code_max = 1
	Else
		bdm_code_max = rs(0) + 1
	End If
	
	Set rs = nothing

	bdm_depth		= 1
	bdm_code		= bdm_code_max
	bdm_ref			= 0
	bdm_t_clr		= "#ffffff"
	bdm_ro_clr		= "#f4f4f4"
	bdm_wdate		= Date() & " " & Right("0" & hour(now), 2) & ":" & Right("0" & minute(now), 2)
	bdm_id			= session("ss_m_id")

	r_fields_s = "bdm_depth, bdm_code, bdm_ref, bdm_menuname, bdm_t_clr, bdm_ro_clr, bdm_wdate, bdm_id, bdm_color"
	Call InsertQuery(r_fields_s, "bd_address")

	msg = "주소록 그룹이 등록되었습니다."

Else

	r_fields_u = "bdm_menuname, bdm_color"
	Call UpdateQuery(r_fields_u, "bd_address", "where bdm_idx = '" & bdm_idx & "'")

	msg = "주소록 그룹이 수정되었습니다."


End if


If prepage = "" Then prepage = "./addr_grp_write.asp"
Call Back_back2(msg, prepage)


%>