<!-- #include virtual = "/common/lib/dbcon.asp" -->
<!-- #include virtual = "/common/lib/func.asp" -->
<%
Dim bdm_idx, bdm_code, move
Dim sql, sql1, sql2


bdm_idx		= InputValue( request.queryString("bdm_idx") )		'//--일련번호
bdm_code	= InputValue( request.queryString("bdm_code") )		'//--정렬번호
move		= InputValue( request.queryString("move") )		'//--이동
prepage		= request.queryString("prepage")


if move = "up" then
	sql = "select top 1 bdm_idx, bdm_code from bd_menu_page where bdm_code < " & bdm_code & " order by bdm_code desc"

Elseif move = "down" then
	sql = "select top 1 bdm_idx, bdm_code from bd_menu_page where bdm_code > " & bdm_code & " order by bdm_code"

End if
	
Set rs = dbcon.execute( sql )

If Not( rs.bof Or rs.eof ) Then

	v_rsbdm_idx = rs("bdm_idx")		'//-- 대체할 디비번호
	v_rsbdm_code = rs("bdm_code")		'//-- 대체할 값


	sql1 = "update bd_menu_page set bdm_code = " & bdm_code & " where bdm_idx = " & v_rsbdm_idx
	sql2 = "update bd_menu_page set bdm_code = " & v_rsbdm_code & " where bdm_idx = " & bdm_idx
	
	dbcon.execute sql1
	dbcon.execute sql2


End if

dbcon.close
Set dbcon = nothing

If prepage = "" Then prepage = "buseo_list.asp"

%>
<script type="text/javascript">
//<![CDATA[
parent.document.getElementById("tree").src = "tree.asp";
location.href= "<%=prepage%>";
//]]>
</script>