<%
dim n_sort,cid,sid,cname,sname
cid=0
sid=0

sub cid_sid_sql(csst,csstt)
  dim temp
  temp=csstt
  if cid>0 then
    sqladd=sqladd&" and c_id="&cid
    pageurl=pageurl&"c_id="&cid&"&"
    if sid>0 then
      sqladd=sqladd&" and s_id="&sid
      pageurl=pageurl&"s_id="&sid&"&"
    end if
  end if
  if csst=1 or csst=2 then
    if len(keyword)>0 then
      sqladd=sqladd&" and "&temp&" like '%"&keyword&"%'"
      pageurl=pageurl&"keyword="&server.urlencode(keyword)&"&"
      if csst=2 then pageurl=pageurl&"sea_type="&sea_type&"&"
    end if
  end if
end sub

sub cid_sid()
  cid=trim(request.querystring("c_id"))
  sid=trim(request.querystring("s_id"))
  if not(isnumeric(cid)) then
    if len(cid)>0 and instr(cid,"&s_id=")>0 then
      cid=replace(cid,"&s_id=",",")
      sid=mid(cid,instr(cid,",")+1,len(cid))
      cid=mid(cid,1,instr(cid,",")-1)
    else
      cid=0
    end if
  end if
  if not(isnumeric(cid)) or len(cid)>5 then cid=0
  if not(isnumeric(sid)) or len(sid)>5 then sid=0
  cid=cint(cid)
  sid=cint(sid)
end sub

function sel_mod_num(n1,n2)
  sel_mod_num=false
  dim nn1
  nn1=n2/n1
  if instr(nn1,".")=0 then
    sel_mod_num=true
  end if
end function

function sort_type(turl,t1,t2)
  dim sn,i,j,ddim,dnum,ndim,temp1,ncid
  dim col_num
  col_num=7
  temp1="<table border=0 cellspacing=0 cellpadding=0 align=left>"
  sn=ubound(sort_dim)
  for i= 0 to sn
    ncid=0
    ddim=split(sort_dim(i),"|")
    dnum=ubound(ddim)
    for j=0 to dnum
      ndim=split(ddim(j),":")
      if j=0 then
        ncid=ndim(1)
        temp1=temp1&vbcrlf&"<tr valign=top><td><table border=0><tr><td>|&nbsp;<a href='"&turl&"c_id="&ncid&"'"
        if int(cid)=int(ncid) then
          temp1=temp1&" class=red"
          cname=ndim(0)
        end if
        temp1=temp1&">"&ndim(0)&"</a>&nbsp;|</td></tr></table></td><td><table border=0><tr>"
      else
        temp1=temp1&vbcrlf&"<td><a href='"&turl&"c_id="&ncid&"&s_id="&ndim(1)&"'"
        if int(sid)=int(ndim(1)) then
          temp1=temp1&" class=red"
          sname=ndim(0)
        end if
        temp1=temp1&">"&ndim(0)&"</a>&nbsp;</td>"
      end if
      if j>0 and sel_mod_num(col_num,j) then temp1=temp1&"</tr><tr>"
      if j=dnum then temp1=temp1&vbcrlf&"</tr></table></td></tr>"
    next
  next
  temp1=temp1&vbcrlf&"</table>"
  sort_type=temp1
end function

function select_type(t_tit,t1,t2)
  dim sn,i,j,ddim,dnum,ndim,temp1,ncid
  temp1=temp1&vbcrlf&"<select name=c_id size=1>" & _
              vbcrlf&"<option value=''>ÇëÑ¡Ôñ"&t_tit&"ÀàÐÍ</option>"
  sn=ubound(sort_dim)
  for i=0 to sn
    ncid=0
    ddim=split(sort_dim(i),"|")
    dnum=ubound(ddim)
    for j=0 to dnum
      ndim=split(ddim(j),":")
      if j=0 then
        ncid=ndim(1)
        temp1=temp1&vbcrlf&"<option class=bg_td value='"&ncid&"'"
        if int(cid)=int(ncid) then
          temp1=temp1&" selected"
          cname=ndim(0)
        end if
        temp1=temp1&">"&ndim(0)&"</option>"
      else
        temp1=temp1&vbcrlf&"<option value='"&ncid&"&s_id="&ndim(1)&"'"
        if int(sid)=int(ndim(1)) then
          temp1=temp1&" selected"
          sname=ndim(0)
        end if
        temp1=temp1&">¡¡"&ndim(0)&"</option>"
      end if
    next
  next
  temp1=temp1&vbcrlf&"</select>"
  select_type=temp1
end function

function nsort_left_type(lt_url,lt_type)
  dim temp1,tmpimg,tmpcss,dim1,dim2,ncid,nlist,ntmp,ni,nj
  for ni=0 to ubound(sort_dim)
    dim1=split(sort_dim(ni),"|")
    ncid=0
    nlist=0
    ntmp="©À"
    for nj=0 to ubound(dim1)
      tmpcss=""
      dim2=split(dim1(nj),":")
      if nj=(ubound(dim2)-1) then ntmp="©¸"
      if ncid=0 then
        tmpimg="sort_c1"
        ncid=dim2(1)
        if int(cid)=int(dim2(1)) then
          tmpimg="sort_c2"
          tmpcss=" class=blue"
          nlist=1
          cname=dim2(0)
        end if
        temp1=temp1&vbcrlf&"<tr><td>"&img_skin(tmpimg)&"<a href='"&lt_url&"c_id="&dim2(1)&"'"&tmpcss&">"&dim2(0)&"</a></td></tr>"
      else
        if (lt_type=0 and nlist=1) or lt_type=1 then
          tmpimg="sort_s1"
          if int(sid)=int(dim2(1)) then
            tmpcss=" class=red"
            tmpimg="sort_s2"
            sname=dim2(0)
          end if
          temp1=temp1&vbcrlf&"<tr><td>¡¡"&img_skin(tmpimg)&"<a href='"&lt_url&"c_id="&ncid&"&s_id="&dim2(1)&"'"&tmpcss&">"&dim2(0)&"</a></td></tr>"
        end if
      end if
    next
  next
  if isarray(dim1) then erase dim1
  if isarray(dim2) then erase dim2
  nsort_left_type=vbcrlf&"<table border=0 cellspacing=0 cellpadding=2 width='70%'>"&temp1&vbcrlf&"</table>"
end function
%>