<%
dim m_dim,m_num
m_num=-1

function msort_true(tvar)
  msort_true=true
  dim si
  for si=0 to m_num
    if tvar=m_dim(0,si) or tvar=m_dim(1,si) or tvar=m_dim(2,si) then exit function
  next
  msort_true=false
end function

sub msort_start(mss)
  select case var_null(application(joekoe_cms.web_cookies&"_msort_true"))
  case "kong"
    exit sub
  case "yes"
    m_dim=application(joekoe_cms.web_cookies&"_msort")
    m_num=ubound(m_dim,2)
    exit sub
  end select
  sql="select m_nsort,m_index_url,m_data_name,m_tit_fir,m_mname from admin_menu where m_is_master=1"
  select case mss
  case 1
    sql=sql&" and m_is_nsort=1"
  case 2
    sql=sql&" and m_is_review=1"
  case 3
    sql=sql&" and m_is_nsort=1 and m_is_review=1"
  end select
  sql=sql&" order by m_id"
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    application.lock
    application(joekoe_cms.web_cookies&"_msort_true")="kong"
    application.unlock
  else
    application.lock
    application(joekoe_cms.web_cookies&"_msort_true")="yes"
    application(joekoe_cms.web_cookies&"_msort")=rs.getrows()
    application.unlock
  end if
  rs.close
  m_dim=application(joekoe_cms.web_cookies&"_msort")
  m_num=0
  if isarray(m_dim) then m_num=ubound(m_dim,2)
end sub

sub msort_end()
  if isarray(m_dim) then erase m_dim
end sub
%>