<!--#include file="Admin_Common.asp"-->
<!--#include file="../Include/PowerEasy.FSO.asp"-->
<!--#include file="../Include/PowerEasy.SendMail.asp"-->
<!--#include file="../Include/PowerEasy.Common.Job.asp"-->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

Const NeedCheckComeUrl = True   '是否需要检查外部访问

Const PurviewLevel = 2      '0--不检查，1--超级管理员，2--普通管理员
Const PurviewLevel_Channel = 3   '0--不检查，1--频道管理员，2--栏目总编，3--栏目管理员
Const PurviewLevel_Others = ""   '其他权限

Dim Status
Dim ClassID, SpecialID, OnTop, IsElite, IsHot, Created

Dim tClass, ClassName, RootID, ParentID, Depth, ParentPath, Child, arrChildID, ParentDir, ClassDir, ClassPurview

Dim PositionID
PositionID = Trim(Request("PositionID"))

If Action = "" Then
    Action = "Position"
End If
If Status = "" Then
    Status = Session("Status")
End If
Session("Status") = Status
If IsValidID(PositionID) = False Then
    PositionID = ""
End If

FileName = "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=" & Action
strFileName = FileName


Dim ManageName

Select Case Action
Case "Position", "AddPosition", "ModifyPosition", "SaveAddPosition", "SaveModifyPosition", "Preview"
    ManageName = "职位"
Case "JobCategory", "AddJobCategory", "ModifyJobCategory", "JobCategoryOrder", "SaveAddJobCategory", "SaveModifyJobCategory", "JSRefreshJobCategory"
    ManageName = "工作类别"
Case "WorkPlace", "AddWorkPlace", "ModifyWorkPlace", "WorkPlaceOrder", "SaveAddWorkPlace", "SaveModifyWorkPlace", "JSRefreshWorkPlace"
    ManageName = "工作地点"
Case "SubCompany", "AddSubCompany", "ModifySubCompany", "SubCompanyOrder", "SaveAddSubCompany", "SaveModifySubCompany", "JSRefreshSubCompany"
    ManageName = "用人单位"
Case "Resume", "ResumePreview", "ModifyResume"
    ManageName = "人才"
End Select


Response.Write "<html><head><title>企业招聘管理</title>" & vbCrLf
Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
Response.Write "<link href='Admin_Style.css' rel='stylesheet' type='text/css'>" & vbCrLf
Response.Write "</head>" & vbCrLf
Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>" & vbCrLf
If Action <> "ResumePrint" Then
    Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Dim strTitle
    strTitle = "企业招聘管理----"
    Select Case Action
    Case "Position", "JobCategory", "WorkPlace", "SubCompany", "Preview"
        strTitle = strTitle & ManageName & "管理页"
    Case "AddPosition", "AddJobCategory", "AddWorkPlace", "AddSubCompany", "Preview"
        strTitle = strTitle & "添加" & ManageName
    Case "ModifyPosition", "ModifyJobCategory", "ModifyWorkPlace", "ModifySubCompany"
        strTitle = strTitle & "修改" & ManageName
    Case "JobCategoryOrder", "WorkPlaceOrder", "SubCompanyOrder"
        strTitle = strTitle & ManageName & "排序"
    Case "SaveAddPosition", "SaveModifyPosition", "SaveJobCategory", "SaveWorkPlace", "SaveSubCompany"
        strTitle = strTitle & "保存" & ManageName
    Case "Resume"
        strTitle = strTitle & ManageName & "管理页"
    Case "Preview"
        strTitle = strTitle & "职位预览"
    Case "ResumePreview"
        strTitle = strTitle & "查看简历"
    Case "ModifyResume"
        strTitle = strTitle & "修改简历"
    Case "JSRefreshJobCategory", "JSRefreshWorkPlace", "JSRefreshSubCompany"
        strTitle = strTitle & "刷新JS"
    End Select
    Call ShowPageTitle(strTitle, 10181)

    Response.Write "  <tr class='tdbg'>"
    Response.Write "    <td width='70' height='30' ><strong>管理导航：</strong></td><td colspan='5'>"

    Select Case Action
    Case "Position", "AddPosition", "ModifyPosition", "SaveAddPosition", "SaveModifyPosition", "Preview"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position&Status=PositionManage'>" & ManageName
    Case "JobCategory", "AddJobCategory", "ModifyJobCategory", "JobCategoryOrder", "SaveAddJobCategory", "SaveModifyJobCategory", "JSRefreshJobCategory"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JobCategory&Status=JobCategoryManage'>" & ManageName
    Case "WorkPlace", "AddWorkPlace", "ModifyWorkPlace", "WorkPlaceOrder", "SaveAddWorkPlace", "SaveModifyWorkPlace", "JSRefreshWorkPlace"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=WorkPlace&Status=WorkPlaceManage'>" & ManageName
    Case "SubCompany", "AddSubCompany", "ModifySubCompany", "SubCompanyOrder", "SaveAddSubCompany", "SaveModifySubCompany", "JSRefreshWorkPlace"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=SubCompany&Status=SubCompanyManage'>" & ManageName
    Case "Resume", "ResumePreview", "ModifyResume"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume&Status=ResumeManage'>" & ManageName
    End Select
    Response.Write "管理首页</a>&nbsp;|&nbsp;"

    Select Case Action
    Case "Position", "AddPosition", "ModifyPosition", "SaveAddPosition", "SaveModifyPosition", "Preview"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=AddPosition'>添加" & ManageName & "</a>&nbsp;|&nbsp;"
    Case "JobCategory", "AddJobCategory", "ModifyJobCategory", "JobCategoryOrder", "SaveAddJobCategory", "SaveModifyJobCategory", "JSRefreshJobCategory"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=AddJobCategory'>添加" & ManageName & "</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JSRefreshJobCategory&Type=JobCategory'>刷新JS</a>&nbsp;|&nbsp;"
    Case "WorkPlace", "AddWorkPlace", "ModifyWorkPlace", "WorkPlaceOrder", "SaveAddWorkPlace", "SaveModifyWorkPlace", "JSRefreshWorkPlace"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=AddWorkPlace'>添加" & ManageName & "</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JSRefreshWorkPlace&Type=WorkPlace'>刷新JS</a>&nbsp;|&nbsp;"
    Case "SubCompany", "AddSubCompany", "ModifySubCompany", "SubCompanyOrder", "SaveAddSubCompany", "SaveModifySubCompany", "JSRefreshSubCompany"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=AddSubCompany'>添加" & ManageName & "</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JSRefreshSubCompany&Type=SubCompany'>刷新JS</a>&nbsp;|&nbsp;"
    End Select

    Select Case Action
    Case "Position", "AddPosition", "ModifyPosition", "SaveAddPosition", "SaveModifyPosition", "Preview"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position&PStatus=validPosition'>正在招聘中职位</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position&PStatus=invalidPosition'>已停止招聘职位</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position&PStatus=urgent'>紧急招聘职位</a>&nbsp;|&nbsp;"
    Case "Resume", "ResumePreview", "ModifyResume"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume&ViewStatus=WaitingResume'>还未查看</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume&ViewStatus=ReadResume'>选为初试</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume&ViewStatus=FirstPassResume'>通过复试一</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume&ViewStatus=SecondPassResume'>通过复试二</a>&nbsp;|&nbsp;"
        Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume&ViewStatus=PassResume'>已经录用</a>&nbsp;|&nbsp;"
    End Select

    Response.Write "</td></tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
End If


Select Case Action
Case "Position"
    Call mainPosition
Case "AddPosition"
    Call AddPosition
Case "ModifyPosition"
    Call ModifyPosition
Case "SaveAddPosition", "SaveModifyPosition"
    Call SavePosition
Case "DeletePosition", "DelPosition", "DelAllPosition"
    Call DeletePosition
Case "JobCategory"
    Call MainJobCategory
Case "AddJobCategory"
    Call AddJobCategory
Case "ModifyJobCategory"
    Call ModifyJobCategory
Case "JobCategoryOrder"
    Call JobCategoryOrder
Case "SaveAddJobCategory", "SaveModifyJobCategory"
    Call SaveJobCategory
Case "WorkPlace"
    Call MainWorkPlace
Case "AddWorkPlace"
    Call AddWorkPlace
Case "ModifyWorkPlace"
    Call ModifyWorkPlace
Case "WorkPlaceOrder"
    Call WorkPlaceOrder
Case "SaveAddWorkPlace", "SaveModifyWorkPlace"
    Call SaveWorkPlace
Case "SubCompany"
    Call mainSubCompany
Case "AddSubCompany"
    Call AddSubCompany
Case "ModifySubCompany"
    Call ModifySubCompany
Case "DeleteSubCompany", "DelSubCompany", "DelAllSubCompany"
    Call DeleteSubCompany
Case "SubCompanyOrder"
    Call SubCompanyOrder
Case "SaveAddSubCompany", "SaveModifySubCompany"
    Call SaveSubCompany
Case "DeleteWorkPlace", "DelWorkPlace", "DelAllWorkPlace"
    Call DeleteWorkPlace
Case "DeleteJobCategory", "DelJobCategory", "DelAllJobCategory"
    Call DeleteJobCategory
Case "JSRefreshJobCategory", "JSRefreshWorkPlace", "JSRefreshSubCompany"
    Call JSRefresh
Case "Resume"
    Call mainResume
Case "ModifyResume"
    Call ModifyResume
Case "SaveModifyResume"
    Call SaveModifyResume
Case "DeleteResume", "DelResume", "DelAllResume", "DelResumeAndPositionSupply"
    Call DeleteResume
Case "SetCheckStatus"
    Call SetCheckStatus
Case "SetUrgent", "CancelUrgent"
    Call DealUrgent
Case "Preview"
    Call Preview
Case "ResumePreview", "ResumePrint"
    Call ResumePreview
Case "Manage"
    Call mainPosition
End Select
If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Response.Write "</body></html>"
Call CloseConn


Sub mainPosition()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Dim rsPositionList, sql, Querysql
    Dim PStatus
    Dim Num
    Num = 0
    PStatus = ReplaceBadChar(Trim(Request("PStatus")))

    Call ShowJS_Job
    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "</table>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>"
    Response.Write "    <form name='myform' method='Post' action='Admin_Job.asp' onsubmit='return ConfirmDel();'>"
    Response.Write "     <td><table class='border' border='0' cellspacing='1' width='100%' cellpadding='0'>"
    Response.Write "          <tr class='title' height='22'> "
    Response.Write "            <td height='22' width='60' align='center'><strong>选中</strong></td>"
    Response.Write "            <td width='55' align='center'><strong>ID</strong></td>"
    Response.Write "            <td width='150' align='center'><strong>职位名称</strong></td>"
    Response.Write "            <td width='150' align='center'><strong>所属单位</strong></td>"
    Response.Write "            <td width='120' align='center'><strong>发布日期</strong></td>"
    Response.Write "            <td width='120' align='center'><strong>职位状态</strong></td>"
    Response.Write "            <td width='120' align='center' ><strong>常规管理操作</strong></td>"
    Response.Write "          </tr>"
    sql = "select top " & MaxPerPage & " PositionID,JobCategoryID,SubCompanyID,WorkPlaceID,ReleaseDate,PositionName,PositionNum,ValidDate,PositionKeyword,PositionStatus,SubCompanyName,Urgent from PE_Position"
    If Keyword <> "" Then
        Select Case strField
        Case "PositionName"
             Querysql = Querysql & " where PositionName like '%" & Keyword & "%' "
        Case "SubCompanyName"
             Querysql = Querysql & " where SubCompanyName like '%" & Keyword & "%' "
        Case "ReleaseDate"
            If IsDate(Keyword) = False Then
                 Querysql = Querysql
            Else
                Querysql = Querysql & " where ReleaseDate = " & PE_Date_Search & Keyword & PE_Date_Search
            End If
        Case "PositionDescription"
             Querysql = Querysql & " where PositionDescription like '%" & Keyword & "%' "
        Case "DutyRequest"
             Querysql = Querysql & " where DutyRequest like '%" & Keyword & "%' "
        Case Else
             Querysql = Querysql & " where PositionName like '%" & Keyword & "%' "
        End Select

        Select Case PStatus
        Case "validPosition"
             Querysql = Querysql & " and PositionStatus=0"
        Case "invalidPosition"
             Querysql = Querysql & " and PositionStatus=1"
        Case "urgent"
             Querysql = Querysql & " and Urgent=0"
        End Select
    Else
        Select Case PStatus
        Case "validPosition"
             Querysql = Querysql & " where PositionStatus=0"
        Case "invalidPosition"
             Querysql = Querysql & " where PositionStatus=1"
        Case "urgent"
             Querysql = Querysql & " where Urgent=0"
        End Select
    End If
    totalPut = PE_CLng(Conn.Execute("select Count(*) from PE_Position " & Querysql)(0))
    If CurrentPage < 1 Then
        CurrentPage = 1
    End If
    If (CurrentPage - 1) * MaxPerPage > totalPut Then
        If (totalPut Mod MaxPerPage) = 0 Then
            CurrentPage = totalPut \ MaxPerPage
        Else
            CurrentPage = totalPut \ MaxPerPage + 1
        End If
    End If
    If Keyword = "" Then
        If CurrentPage > 1 Then
            Querysql = Querysql & " where PositionID < (select min(PositionID) from  (select top " & ((CurrentPage - 1) * MaxPerPage) & " PositionID from PE_Position " & Querysql & " order by PositionID desc) as QueryPosition) "
        End If
    Else
        If CurrentPage > 1 Then
            Querysql = Querysql & " and PositionID < (select min(PositionID) from  (select top " & ((CurrentPage - 1) * MaxPerPage) & " PositionID from PE_Position " & Querysql & " order by PositionID desc) as QueryPosition) "
        End If
    End If
    sql = sql & Querysql & " order by PositionID desc"

    Set rsPositionList = Server.CreateObject("ADODB.Recordset")
    rsPositionList.Open sql, Conn, 1, 1
    If rsPositionList.BOF And rsPositionList.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg'><td colspan='20' align='center'><br>没有任何职位信息！<br></td></tr>"
    Else
        Do While Not rsPositionList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#BFDFFF'"">"
            Response.Write "        <td width='60' align='center'><input name='PositionID' type='checkbox' onclick='unselectall()' id='PositionID' value='" & rsPositionList("PositionID") & "'></td>"
            Response.Write "        <td width='55' align='center'>" & rsPositionList("PositionID") & "</td>"
            Response.Write "        <td width='150' align='center'><a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Preview&PositionID=" & rsPositionList("PositionID") & "'>" & rsPositionList("PositionName") & " </a></td>"
            Response.Write "      <td width='150' align='center'>" & rsPositionList("SubCompanyName") & "</td>"
            Response.Write "      <td width='120' align='center'>" & rsPositionList("ReleaseDate") & "</td>"
            Response.Write "      <td width='120' align='center'>" & GetPositionStatus(rsPositionList("PositionStatus"), rsPositionList("ReleaseDate"), rsPositionList("ValidDate")) & "</td>"
            Response.Write "    <td width='120' align='center'>&nbsp;"
            Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ModifyPosition&PositionID=" & rsPositionList("PositionID") & "'>修改</a>&nbsp;"
            If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
                Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=DeletePosition&PositionID=" & rsPositionList("PositionID") & "' onclick=""return confirm('确定要删除此职位吗？删除后将无法恢复。');"">删除</a>&nbsp;"
            End If
            If rsPositionList("Urgent") = 1 Then
                Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=SetUrgent&PositionID=" & rsPositionList("PositionID") & "'><font color='green'>设为紧急</font></a>"
            Else
                Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=CancelUrgent&PositionID=" & rsPositionList("PositionID") & "'><font color='blue'>取消紧急</font></a>"
            End If
            Response.Write "     </td>"
            Response.Write "</tr>"
            rsPositionList.MoveNext
            Num = Num + 1
            If Num >= MaxPerPage Then Exit Do
        Loop
    End If
    rsPositionList.Close
    Set rsPositionList = Nothing

    Response.Write "</table>"
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
        Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
        Response.Write "  <tr>"
        Response.Write "    <td width='200' height='30'>"
        Response.Write "    <input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>选中本页显示的所有职位</td><td>"
        Response.Write "<input name='submit1' type='submit' value='删除选定的职位' onClick=""document.myform.Action.value='DelPosition'"" "
        Response.Write ">"
        Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='Submit3' value='删除所有职位' onClick=""document.myform.Action.value='DelAllPosition'"">"
        Response.Write "<input name='Action' type='hidden' id='Action' value='DelPosition'>"
        Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
        Response.Write "  </td></tr>"
        Response.Write "</table>"
    End If

    Response.Write "</td>"
    Response.Write "</form></tr></table>"

    '分页时传递关键字等搜索条件
    If strField <> "" Then
        strFileName = strFileName & "&Field=" & strField
    End If
    If Keyword <> "" Then
        strFileName = strFileName & "&keyword=" & Keyword
    End If

    If totalPut > 0 Then
        Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, ChannelItemUnit & ChannelShortName & "", True)
    End If
    Response.Write "<br>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0' class='border'>"
    Response.Write "<form method='Get' name='SearchForm' action='" & FileName & "'>"
    Response.Write "  <tr class='tdbg'>"
    Response.Write "   <td width='80' align='right'><strong>职位搜索：</strong></td>"
    Response.Write "   <td>"
    Response.Write "<select name='Field' size='1'>"
    Response.Write "<option value='PositionName' selected>职位名称</option>"
    Response.Write "<option value='SubCompanyName'>所属用人单位</option>"
    Response.Write "<option value='ReleaseDate'>发布日期</option>"
    Response.Write "<option value='PositionDescription'>职位描述</option>"
    Response.Write "<option value='DutyRequest'>任职要求</option>"
    Response.Write "</select>"
    Response.Write "<input type='text' name='keyword'  size='20' value='关键字' maxlength='50' onFocus='this.select();'>"
    Response.Write "<input type='submit' name='Submit'  value='搜索'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "<input name='Action' type='hidden' id='Action' value='Position'>"
    Response.Write "</td></tr></form></table>"
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
        Response.Write "<br><b><font color=red>注意：</font></b><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>在删除某个职位的信息时，所申请的该职位的人才信息也将一起被删除掉！</font><br><br>"
    End If
End Sub

Sub DealUrgent()
    Dim PositionID, sql
    PositionID = PE_CLng(Trim(Request("PositionID")))
    If PositionID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>未找到所需要的参数</li>"
    End If
    If Action = "SetUrgent" Then
        sql = "update PE_Position set Urgent=0"
    Else
        sql = "update PE_Position set Urgent=1"
    End If
    sql = sql & " where PositionID=" & PositionID
    Conn.Execute (sql)
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position"
End Sub

Function GetPositionStatus(PositionStatus, ReleaseDate, ValidDate)
    Dim MyPositionStatus, strPositionStatus
    Dim CurrentDate, MyReleaseDate, MyValidDate

    MyPositionStatus = PE_CLng(PositionStatus)
    MyReleaseDate = ReleaseDate
    MyValidDate = PE_CLng(ValidDate)
    If MyReleaseDate <> "" And IsDate(MyReleaseDate) = True Then
        MyReleaseDate = CDate(MyReleaseDate)
    Else
        MyReleaseDate = PE_Now
    End If
    CurrentDate = DateAdd("d", 0, Date)
    If DateDiff("d", MyReleaseDate, CurrentDate) <= ValidDate Then
        If MyPositionStatus = 0 Then
            strPositionStatus = "正在招聘中"
        ElseIf MyPositionStatus = 1 Then
            strPositionStatus = "已停止招聘"
        End If
    Else
        strPositionStatus = "已过有效期"
    End If
    GetPositionStatus = strPositionStatus
End Function

Sub ShowJS_Job()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function unselectall()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.chkAll.Checked){" & vbCrLf
    Response.Write "     document.myform.chkAll.Checked=document.myform.chkAll.Checked&0;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckAll(form){" & vbCrLf
    Response.Write "  for (var i=0;i<form.elements.length;i++){" & vbCrLf
    Response.Write "    var e = form.elements[i];" & vbCrLf
    Response.Write "    if (e.Name != 'chkAll'&&e.disabled==false)" & vbCrLf
    Response.Write "       e.checked = form.chkAll.checked;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function ConfirmDel(){" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelPosition'){"
    Response.Write "     if (confirm('确定要删除所选中的职位信息吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelAllPosition'){"
    Response.Write "     if (confirm('确定要删除所有的职位信息吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.JobCategoryID.value==''){" & vbCrLf
    Response.Write "    alert('工作类别不能为空！');" & vbCrLf
    Response.Write "    document.myform.JobCategoryID.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.SubCompanyID.value==''){" & vbCrLf
    Response.Write "    alert('招聘单位不能为空！');" & vbCrLf
    Response.Write "    document.myform.SubCompanyID.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.WorkPlaceID.value==''){" & vbCrLf
    Response.Write "     alert('工作地点不能为空');" & vbCrLf
    Response.Write "     document.myform.WorkPlaceID.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.ReleaseDate.value==''){" & vbCrLf
    Response.Write "    alert('发布日期不能为空！');" & vbCrLf
    Response.Write "    document.myform.ReleaseDate.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.PositionName.value==''){" & vbCrLf
    Response.Write "    alert('职位名称不能为空！');" & vbCrLf
    Response.Write "    document.myform.PositionName.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.PositionNum.value==''){" & vbCrLf
    Response.Write "     alert('招聘人数不能为空');" & vbCrLf
    Response.Write "     document.myform.PositionNum.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.ValidDate.value==''){" & vbCrLf
    Response.Write "     alert('有效期不能为空！');" & vbCrLf
    Response.Write "     document.myform.ValidDate.value.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.PositionKeyword.value==''){" & vbCrLf
    Response.Write "     alert('关键字不能为空！');" & vbCrLf
    Response.Write "     document.myform.PositionKeyword.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  var CurrentMode=editor.CurrentMode;" & vbCrLf
    Response.Write "  if (CurrentMode==0){" & vbCrLf
    Response.Write "    document.myform.PositionDescription.value=editor.HtmlEdit.document.body.innerHTML; " & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else if(CurrentMode==1){" & vbCrLf
    Response.Write "    document.myform.PositionDescription.value=editor.HtmlEdit.document.body.innerText;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.PositionDescription.value==''){" & vbCrLf
    Response.Write "     alert('职位描述不能为空！');" & vbCrLf
    Response.Write "     editor.HtmlEdit.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  var CurrentMode=editor2.CurrentMode;" & vbCrLf
    Response.Write "  if (CurrentMode==0){" & vbCrLf
    Response.Write "    document.myform.DutyRequest.value=editor2.HtmlEdit.document.body.innerHTML; " & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else if(CurrentMode==1){" & vbCrLf
    Response.Write "    document.myform.DutyRequest.value=editor2.HtmlEdit.document.body.innerText;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.DutyRequest.value==''){" & vbCrLf
    Response.Write "     alert('任职要求不能为空！');" & vbCrLf
    Response.Write "     editor2.HtmlEdit.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub



Sub AddPosition()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_Job

    Response.Write "<form method='POST' name='myform' onSubmit='return CheckForm();' action='Admin_Job.asp' target='_self'>"
    Response.Write "<table width='100%' border='0' align='center' cellpadding='5' cellspacing='0' class='border'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' align='center'><b>添加职位</b></td>"
    Response.Write "    </tr>"
    Response.Write "  <tr align='center'>"
    Response.Write "    <td class='tdbg' height='200' valign='top'>"
    Response.Write "      <table width='98%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>工作类型：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <select name='JobCategoryID' style=width:162px>" & GetJobCategory_Option(1) & "</select>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>所属单位：</strong></td>"
    Response.Write "            <td><select name='SubCompanyID' id='SubCompanyID' style=width:162px>" & GetSubCompany_Option(1) & "</select></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>工作地点：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <select name='WorkPlaceID'  style=width:162px>" & GetWorkPlace_Option(1) & "</select>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>发布日期：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='ReleaseDate' type='text' value='" & FormatDateTime(Now(), 2) & "' size='25' maxlength='255'> <font color='#0000FF'>格式如：（2005-11-8）</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>职位名称：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='PositionName' type='text' value='' size='25' maxlength='255'>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>招聘人数：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='PositionNum' type='text' value='' size='25' maxlength='255'> <font color='green'>人</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>有效期：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='ValidDate' type='text' value='' size='25' maxlength='255'> <font color='green'>天</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>关键字：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='PositionKeyword' type='text' id='PositionKeyword' value='' size='50' maxlength='255'> <font color='#FF0000'>*</font> "
    Response.Write "              <br><font color='#0000FF'>用来查找相关职位，可输入多个关键字，中间用<font color='#FF0000'>“|”</font>隔开。不能出现&quot;'&?;:()等字符。</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='middle' class='tdbg5'><strong>职位描述：</strong></td>"
    Response.Write "            <td><textarea name='PositionDescription' cols='80' rows='10' id='PositionDescription' style='display:none'></textarea>"
    Response.Write "                <iframe ID='editor' src='../editor.asp?tContentid=PositionDescription&ShowType=3&ChannelID=" & ChannelID & "' frameborder='1' scrolling='no' width='680' height='200' ></iframe>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='middle' class='tdbg5'><strong>任职要求：</strong></td>"
    Response.Write "            <td><textarea name='DutyRequest' cols='80' rows='10' id='DutyRequest' style='display:none'></textarea>"
    Response.Write "                <iframe ID='editor2' src='../editor.asp?tContentid=DutyRequest&ShowType=3&ChannelID=" & ChannelID & "' frameborder='1' scrolling='no' width='680' height='200' ></iframe>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>紧急招聘：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='Urgent' type='checkbox' id='Urgent' value='0' checked> 是<font color='#0000FF'>（如果选中的话将设置成紧急招聘，否则为普通的招聘。）</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "  <p align='center'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "   <input name='Action' type='hidden' id='Action' value='SaveAddPosition'>"
    Response.Write "   <input name='add' type='submit'  id='Add' value=' 添 加 ' style='cursor:hand;'>&nbsp; "
    Response.Write "   <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position';"" style='cursor:hand;'>"
    Response.Write "  </p><br>"
    Response.Write "</form>"
End Sub


Sub ModifyPosition()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_Job
    Dim rsPosition, sqlPosition
    Dim PositionID
    PositionID = Trim(Request("PositionID"))
    
    If PositionID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的职位ID</li>"
        Exit Sub
    Else
        PositionID = PE_CLng(PositionID)
    End If
    sqlPosition = "select * from PE_Position where PositionID=" & PositionID & ""
    Set rsPosition = Conn.Execute(sqlPosition)
    If rsPosition.BOF And rsPosition.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到职位！</li>"
    End If
    If FoundErr = True Then
        rsPosition.Close
        Set rsPosition = Nothing
        Exit Sub
    End If
    Response.Write "<form method='POST' name='myform' onSubmit='return CheckForm();' action='Admin_Job.asp' target='_self'>"
    Response.Write "<table width='100%' border='0' align='center' cellpadding='5' cellspacing='0' class='border'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' align='center'><b>修改职位</b></td>"
    Response.Write "    </tr>"
    Response.Write "  <tr align='center'>"
    Response.Write "    <td class='tdbg' height='200' valign='top'>"
    Response.Write "      <table width='98%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>工作类型：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <select name='JobCategoryID' style=width:162px>" & GetJobCategory_Option(rsPosition("JobCategoryID")) & "</select>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>所属单位：</strong></td>"
    Response.Write "            <td><select name='SubCompanyID' id='SubCompanyID' style=width:162px>" & GetSubCompany_Option(rsPosition("SubCompanyID")) & "</select></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>工作地点：</strong></td>"
    Response.Write "            <td><select name='WorkPlaceID' id='WorkPlaceID' style=width:162px>" & GetWorkPlace_Option(rsPosition("WorkPlaceID")) & "</select></td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>发布日期：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='ReleaseDate' type='text' value='" & PE_HTMLEncode(rsPosition("ReleaseDate")) & "' size='25' maxlength='255'> <font color='#0000FF'>格式如：（2005-11-8）</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>职位名称：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='PositionName' type='text' value='" & PE_HTMLEncode(rsPosition("PositionName")) & "' size='25' maxlength='255'>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>招聘人数：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='PositionNum' type='text' value='" & PE_HTMLEncode(rsPosition("PositionNum")) & "' size='25' maxlength='255'> <font color='green'>人</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>有效期：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='ValidDate' type='text' value='" & PE_HTMLEncode(rsPosition("ValidDate")) & "' size='25' maxlength='255'> <font color='#FF0000'>天</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>关键字：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='PositionKeyword' type='text' id='PositionKeyword' value='" & PE_HTMLEncode(rsPosition("PositionKeyword")) & "' size='50' maxlength='255'>"
    Response.Write "              <br><font color='#0000FF'>用来查找相关职位，可输入多个关键字，中间用<font color='#FF0000'>“|”</font>隔开。不能出现&quot;'&?;:()等字符。</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='middle' class='tdbg5'><strong>职位描述：</strong></td>"
    Response.Write "            <td><textarea name='PositionDescription' cols='80' rows='10' id='PositionDescription' style='display:none'>" & Server.HTMLEncode(rsPosition("PositionDescription")) & "</textarea>"
    Response.Write "                <iframe ID='editor' src='../editor.asp?tContentid=PositionDescription&ShowType=3&ChannelID=" & ChannelID & "' frameborder='1' scrolling='no' width='680' height='200' ></iframe>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' valign='middle' class='tdbg5'><strong>任职要求：</strong></td>"
    Response.Write "            <td><textarea name='DutyRequest' cols='80' rows='10' id='DutyRequest' style='display:none'>" & Server.HTMLEncode(rsPosition("DutyRequest")) & "</textarea>"
    Response.Write "                <iframe ID='editor2' src='../editor.asp?tContentid=DutyRequest&ShowType=3&ChannelID=" & ChannelID & "' frameborder='1' scrolling='no' width='680' height='200' ></iframe>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>紧急招聘：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <input name='Urgent' type='checkbox' id='Urgent' value='0' checked> 是<font color='#0000FF'>（如果选中的话将设置成紧急招聘，否则为普通的招聘。）</font>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'><strong>职位状态：</strong></td>"
    Response.Write "            <td>"
    Response.Write "              <select name='PositionStatus' id='PositionStatus'>" & GetPositionStatus_Option(rsPosition("PositionStatus")) & "</select>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "  <p align='center'>"
    Response.Write "   <input name='ChannelID' type='hidden' id='Action' value='" & ChannelID & "'>"
    Response.Write "   <input name='PositionID' type='hidden' id='Action' value='" & rsPosition("PositionID") & "'>"
    Response.Write "   <input name='Action' type='hidden' id='Action' value='SaveModifyPosition'>"
    Response.Write "   <input name='Modify' type='submit'  id='Modify' value=' 保存修改 ' style='cursor:hand;'>"
    Response.Write "   <input name='Preview' type='button'  id='Preview' value=' 预 览 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Preview&PositionID=" & PositionID & "';"" style='cursor:hand;'>"
    Response.Write "   <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position';"" style='cursor:hand;'>"
    Response.Write "  </p><br>"
    Response.Write "</form>"
End Sub




Sub Preview()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Dim rs, sql
    Dim PositionID, WorkPlaceID, SubCompanyID
    PositionID = Trim(Request("PositionID"))
    
    If PositionID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要所需的职位ID</li>"
        Exit Sub
    Else
        PositionID = PE_CLng(PositionID)
    End If
    sql = "select P.PositionID,P.PositionName,W.WorkPlaceName,P.PositionNum,P.ReleaseDate,P.PositionStatus,P.ValidDate,S.SubCompanyID,S.SubCompanyName,S.Contacter,S.Telephone,S.Address,S.E_mail,P.PositionDescription,P.DutyRequest from (PE_Position P left join PE_WorkPlace W on P.WorkPlaceID=W.WorkPlaceID) left join PE_SubCompany S on P.SubCompanyID=S.SubCompanyID where P.PositionID=" & PositionID & ""
    Set rs = Conn.Execute(sql)
    If rs.BOF And rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到职位！</li>"
    End If
    If FoundErr = True Then
        rs.Close
        Set rs = Nothing
        Exit Sub
    End If
    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='5' cellspacing='0' class='border'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' align='center'><b>职位信息</b></td>"
    Response.Write "    </tr>"
    Response.Write "  <tr align='center'>"
    Response.Write "    <td class='tdbg' height='200' valign='top'>"
    Response.Write "      <table width='98%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'><strong>职位名称：</strong></td>"
    Response.Write "            <td>" & rs("PositionName")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'>工作地点：</td>"
    Response.Write "            <td>" & rs("WorkPlaceName")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'>招聘人数：</td>"
    Response.Write "            <td>" & rs("PositionNum")
    Response.Write "</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'>发布日期：</td>"
    Response.Write "            <td>" & rs("ReleaseDate")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'><strong>用人单位：</strong></td>"
    Response.Write "            <td>" & rs("SubCompanyName")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'>联系人：</td>"
    Response.Write "            <td>" & rs("Contacter")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'>联系电话：</td>"
    Response.Write "            <td>" & rs("Telephone")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'>联系地址：</td>"
    Response.Write "            <td>" & rs("Address")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'>联系邮箱：</td>"
    Response.Write "            <td>" & rs("E_mail")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'><strong>职位描述：</strong></td>"
    Response.Write "            <td>" & rs("PositionDescription")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right' class='tdbg5'><strong>任职要求：</strong></td>"
    Response.Write "            <td>" & rs("DutyRequest")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='240' align='right'class='tdbg5'><strong>职位状态：</strong></td>"
    Response.Write "            <td>" & GetPositionStatus(rs("PositionStatus"), rs("ReleaseDate"), rs("ValidDate"))
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    Response.Write "  <p align='center'>"
    Response.Write "   <input name='Preview' type='button'  id='Preview' value=' 修改 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ModifyPosition&PositionID=" & rs("PositionID") & "';"" style='cursor:hand;'>&nbsp;&nbsp"
    Response.Write "   <input name='Preview' type='button'  id='Preview' value=' 返回 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position';"" style='cursor:hand;'></p>"
End Sub





'保存添加与修改的职位信息
Sub SavePosition()
    Dim rsPosition, sqlPosition
    Dim rsPositionSupplyInfo, sqlPositionSupplyInfo
    Dim PositionID, JobCategoryID, SubCompanyID, WorkPlaceID, ReleaseDate, PositionName, PositionNum, ValidDate, PositionKeyword, PositionDescription, DutyRequest, PositionStatus, SubCompanyName, Urgent

    PositionID = PE_CLng(Trim(Request.Form("PositionID")))
    JobCategoryID = PE_CLng(Trim(Request.Form("JobCategoryID")))
    SubCompanyID = PE_CLng(Trim(Request.Form("SubCompanyID")))
    WorkPlaceID = PE_CLng(Trim(Request.Form("WorkPlaceID")))
    ReleaseDate = Trim(Request.Form("ReleaseDate"))
    PositionName = Trim(Request.Form("PositionName"))
    PositionNum = Trim(Request.Form("PositionNum"))
    ValidDate = Trim(Request.Form("ValidDate"))
    PositionKeyword = Trim(Request.Form("PositionKeyword"))
    PositionDescription = Trim(Request.Form("PositionDescription"))
    DutyRequest = Trim(Request.Form("DutyRequest"))
    PositionStatus = Trim(Request.Form("PositionStatus"))
    Urgent = Trim(Request.Form("Urgent"))
    

    If PositionName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>职位名称不能为空</li>"
    End If
    PositionKeyword = ReplaceBadChar(PositionKeyword)
    If PositionKeyword = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入职位关键字</li>"
    End If
    If JobCategoryID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>工作类别不能为空</li>"
    End If
    If SubCompanyID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>所属单位不能为空</li>"
    Else
        Dim rs, sql
        sql = "select SubCompanyName from PE_SubCompany where SubCompanyID =" & SubCompanyID
        Set rs = Conn.Execute(sql)
        If rs.BOF And rs.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>所属单位不存在或已经被删除</li>"
        Else
            SubCompanyName = rs("SubCompanyName")
        End If
        rs.Close
        Set rs = Nothing
    End If
    If WorkPlaceID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>工作地点不能为空</li>"
    End If
    If ReleaseDate = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>发布日期不能为空</li>"
    End If
    If PositionNum = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>招聘人数不能为空</li>"
    Else
        PositionNum = PE_CLng(PositionNum)
    End If
    If ValidDate = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>有效期不能为空</li>"
    Else
        ValidDate = PE_CLng(ValidDate)
    End If
    If PositionDescription = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>职位描述不能为空</li>"
    End If
    If DutyRequest = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>任职要求不能为空</li>"
    End If

    If IsDate(ReleaseDate) = False Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请输入正确的日期格式！</li>"
        Exit Sub
    End If
    If ReleaseDate <> "" And IsDate(ReleaseDate) = True Then
        ReleaseDate = CDate(ReleaseDate)
    Else
        ReleaseDate = PE_Now
    End If

    If PositionStatus = "" Then
        PositionStatus = 0
    Else
        PositionStatus = PE_CLng(PositionStatus)
    End If

    If Urgent = "" Then
        Urgent = 1
    Else
        Urgent = PE_CLng(Urgent)
    End If

    PositionName = PE_HTMLEncode(PositionName)
    PositionKeyword = "|" & PositionKeyword & "|"
    PositionDescription = ReplaceBadUrl(PositionDescription)
    DutyRequest = ReplaceBadUrl(DutyRequest)

    Set rsPosition = Server.CreateObject("adodb.recordset")
    If Action = "SaveAddPosition" Then
        Dim mrs
        Set mrs = Conn.Execute("select max(PositionID) from PE_Position")
        If IsNull(mrs(0)) Then
            PositionID = 1
        Else
            PositionID = mrs(0) + 1
        End If
        Set mrs = Nothing

        sqlPosition = "select top 1 * from PE_Position"
        rsPosition.Open sqlPosition, Conn, 1, 3
        rsPosition.addnew
        rsPosition("PositionID") = PositionID
        rsPosition("JobCategoryID") = JobCategoryID
        rsPosition("SubCompanyID") = SubCompanyID
        rsPosition("WorkPlaceID") = WorkPlaceID
        rsPosition("ReleaseDate") = ReleaseDate
        rsPosition("PositionName") = PositionName
        rsPosition("PositionNum") = PositionNum
        rsPosition("ValidDate") = ValidDate
        rsPosition("PositionKeyword") = PositionKeyword
        rsPosition("PositionDescription") = PositionDescription
        rsPosition("DutyRequest") = DutyRequest
        rsPosition("PositionStatus") = PositionStatus
        rsPosition("SubCompanyName") = SubCompanyName
        rsPosition("Urgent") = Urgent
        rsPosition.Update
        rsPosition.Close
        Set rsPosition = Nothing
    ElseIf Action = "SaveModifyPosition" Then
            If PositionID = 0 Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>不能确定职位ID的值</li>"
            Else
                PositionID = PE_CLng(PositionID)
                sqlPosition = "select * from PE_Position where PositionID=" & PositionID
                rsPosition.Open sqlPosition, Conn, 1, 3
                If rsPosition.BOF And rsPosition.EOF Then
                    FoundErr = True
                    ErrMsg = ErrMsg & "<li>找不到此职位，可能已经被其他人删除。</li>"
                Else
                    rsPosition("JobCategoryID") = JobCategoryID
                    rsPosition("SubCompanyID") = SubCompanyID
                    rsPosition("WorkPlaceID") = WorkPlaceID
                    rsPosition("ReleaseDate") = ReleaseDate
                    rsPosition("PositionName") = PositionName
                    rsPosition("PositionNum") = PositionNum
                    rsPosition("ValidDate") = ValidDate
                    rsPosition("PositionKeyword") = PositionKeyword
                    rsPosition("PositionDescription") = PositionDescription
                    rsPosition("DutyRequest") = DutyRequest
                    rsPosition("PositionStatus") = PositionStatus
                    rsPosition("SubCompanyName") = SubCompanyName
                    rsPosition("Urgent") = Urgent
                    rsPosition.Update
                    rsPosition.Close
                End If
                Set rsPositionSupplyInfo = Server.CreateObject("adodb.recordset")
                sqlPositionSupplyInfo = "select SubCompanyID,WorkPlaceID from PE_PositionSupplyInfo where PositionID=" & PositionID
                rsPositionSupplyInfo.Open sqlPositionSupplyInfo, Conn, 1, 3
                Do While Not rsPositionSupplyInfo.EOF
                    rsPositionSupplyInfo("SubCompanyID") = SubCompanyID
                    rsPositionSupplyInfo("WorkPlaceID") = WorkPlaceID
                    rsPositionSupplyInfo.Update
                    rsPositionSupplyInfo.MoveNext
                Loop
                rsPositionSupplyInfo.Close
                Set rsPositionSupplyInfo = Nothing
            End If
    End If
    Set rsPosition = Nothing
    
    Response.Write "<br><br>"
    Response.Write "<table class='border' align=center width='400' border='0' cellpadding='0' cellspacing='0' bordercolor='#999999'>"
    Response.Write "  <tr align=center> "
    Response.Write "    <td  height='22' align='center' class='title'> "
    If Action = "SaveAddPosition" Then
        Response.Write "<b>添加职位信息成功</b>"
    Else
        Response.Write "<b>修改职位信息成功</b>"
    End If
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td><table width='100%' border='0' cellpadding='2' cellspacing='1'>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='100' align='right' ><strong>职位名称：</strong></td>"
    Response.Write "          <td>" & PositionName & "</td>"
    Response.Write "        </tr>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='100' align='right'><strong>所属单位：</strong></td>"
    Response.Write "          <td>" & SubCompanyName & "</td>"
    Response.Write "        </tr>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='100' align='right'><strong>招聘人数：</strong></td>"
    Response.Write "          <td>" & PositionNum & "</td>"
    Response.Write "        </tr>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='100' align='right'><strong>有效期：</strong></td>"
    Response.Write "          <td>" & ValidDate & "</td>"
    Response.Write "        </tr>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td width='100' align='right'><strong>关 键 字：</strong></td>"
    Response.Write "          <td>" & Mid(PositionKeyword, 2, Len(PositionKeyword) - 2) & "</td>"
    Response.Write "        </tr>"
    Response.Write "      </table></td>"
    Response.Write "  </tr>"
    Response.Write "  <tr class='tdbg'>"
    Response.Write "    <td height='30' align='center'>"
    Response.Write "【<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ModifyPosition&PositionID=" & PositionID & "'>修改此职位</a>】&nbsp;"
    Response.Write "【<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=AddPosition'>继续添加职位</a>】&nbsp;"
    Response.Write "【<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position'>职位管理</a>】&nbsp;"
    Response.Write "【<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Preview&PositionID=" & PositionID & "'>预览职位内容</a>】"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "</table>" & vbCrLf
End Sub


Sub DeletePosition()
    If Action = "DelPosition" Or Action = "DeletePosition" Then
        Dim PositionID, rs, sql, rsPositionSupplyInfo, sqlPositionSupplyInfo
        PositionID = Trim(Request("PositionID"))
        If IsValidID(PositionID) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>未找到所需要的参数</li>"
            Exit Sub
        End If

        sql = "select PositionID from PE_Position where PositionID"
        If InStr(PositionID, ",") > 0 Then
            sql = sql & " in (" & PositionID & ") order by PositionID"
        Else
            sql = sql & " = " & PositionID
        End If
        Set rs = Server.CreateObject("ADODB.RecordSet")
        rs.Open sql, Conn, 1, 3
        Do While Not rs.EOF
            '删除申请职位表PE_PositionSupplyInfo里的申请该职位的信息
            sqlPositionSupplyInfo = "select PositionSupplyInfoID from PE_PositionSupplyInfo where PositionID=" & rs("PositionID")
            Set rsPositionSupplyInfo = Server.CreateObject("ADODB.RecordSet")
            rsPositionSupplyInfo.Open sqlPositionSupplyInfo, Conn, 1, 3
            Do While Not rsPositionSupplyInfo.EOF
                Conn.Execute ("delete from PE_PositionSupplyInfo Where PositionSupplyInfoID=" & rsPositionSupplyInfo("PositionSupplyInfoID") & "")
                rsPositionSupplyInfo.MoveNext
            Loop
            Conn.Execute ("delete from PE_Position Where PositionID=" & rs("PositionID") & "")
            rs.MoveNext
        Loop
        rsPositionSupplyInfo.Close
        Set rsPositionSupplyInfo = Nothing
        rs.Close
        Set rs = Nothing
    Else
        If Action = "DelAllPosition" Then
            Conn.Execute ("delete from PE_PositionSupplyInfo")
            Conn.Execute ("delete from PE_Position")
        End If
    End If
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Position"
End Sub


'参数： JobCategoryID -------默认值的设置
Function GetJobCategory_Option(JobCategoryID)
    Dim sqlJobCategory, rsJobCategory, strJobCategory
    If IsNull(JobCategoryID) Then JobCategoryID = 1

    strJobCategory = ""
    sqlJobCategory = "select * from PE_JobCategory order by OrderID"
    Set rsJobCategory = Conn.Execute(sqlJobCategory)
    If rsJobCategory.BOF And rsJobCategory.EOF Then
        strJobCategory = strJobCategory & "<option value=''>-- 请先添加工作类别 --</option>"
    Else
        Do While Not rsJobCategory.EOF
            strJobCategory = strJobCategory & "<option value='" & rsJobCategory("JobCategoryID") & "'"
            If rsJobCategory("JobCategoryID") = JobCategoryID Then
                strJobCategory = strJobCategory & " selected"
            End If
            strJobCategory = strJobCategory & ">" & rsJobCategory("JobCategoryName")
            strJobCategory = strJobCategory & "</option>"
            rsJobCategory.MoveNext
        Loop
    End If
    rsJobCategory.Close
    Set rsJobCategory = Nothing
    GetJobCategory_Option = strJobCategory
End Function


Function GetSubCompany_Option(SubCompanyID)
    Dim sqlSubCompany, rsSubCompany, strSubCompany
    If IsNull(SubCompanyID) Then SubCompanyID = 1

    strSubCompany = ""
    sqlSubCompany = "select * from PE_SubCompany order by OrderID"
    Set rsSubCompany = Conn.Execute(sqlSubCompany)
    If rsSubCompany.BOF And rsSubCompany.EOF Then
        strSubCompany = strSubCompany & "<option value=''>--- 请先添加用人单位 ---</option>"
    Else
        Do While Not rsSubCompany.EOF
            strSubCompany = strSubCompany & "<option value='" & rsSubCompany("SubCompanyID") & "'"
            If rsSubCompany("SubCompanyID") = SubCompanyID Then
                strSubCompany = strSubCompany & " selected"
            End If
            strSubCompany = strSubCompany & ">" & rsSubCompany("SubCompanyName")
            strSubCompany = strSubCompany & "</option>"
            rsSubCompany.MoveNext
        Loop
    End If
    rsSubCompany.Close
    Set rsSubCompany = Nothing
    GetSubCompany_Option = strSubCompany
End Function


Function GetWorkPlace_Option(WorkPlaceID)
    Dim sqlWorkPlace, rsWorkPlace, strWorkPlace
    If IsNull(WorkPlaceID) Then WorkPlaceID = 1

    strWorkPlace = ""
    sqlWorkPlace = "select * from PE_WorkPlace Order by OrderID"
    Set rsWorkPlace = Conn.Execute(sqlWorkPlace)
    If rsWorkPlace.BOF And rsWorkPlace.EOF Then
        strWorkPlace = strWorkPlace & "<option value=''>-- 请先添加工作地点 --</option>"
    Else
        Do While Not rsWorkPlace.EOF
            strWorkPlace = strWorkPlace & "<option value='" & rsWorkPlace("WorkPlaceID") & "'"
            If rsWorkPlace("WorkPlaceID") = WorkPlaceID Then
                strWorkPlace = strWorkPlace & " selected"
            End If
            strWorkPlace = strWorkPlace & ">" & rsWorkPlace("WorkPlaceName")
            strWorkPlace = strWorkPlace & "</option>"
            rsWorkPlace.MoveNext
        Loop
    End If
    rsWorkPlace.Close
    Set rsWorkPlace = Nothing
    GetWorkPlace_Option = strWorkPlace
End Function


Function GetPositionStatus_Option(PositionStatus)
    Dim strPositionStatus, MyPositionStatus
    If PositionStatus = "" Then
        MyPositionStatus = 0
    Else
        MyPositionStatus = PE_CLng(PositionStatus)
    End If
    strPositionStatus = "<option value='0'"
    If MyPositionStatus = 0 Then
        strPositionStatus = strPositionStatus & " selected"
    End If
    strPositionStatus = strPositionStatus & ">正在招聘中</option><option value='1'"
    If MyPositionStatus = 1 Then
        strPositionStatus = strPositionStatus & " selected"
    End If
    strPositionStatus = strPositionStatus & ">已停止招聘</option>"
    GetPositionStatus_Option = strPositionStatus
End Function


Function GetPosition_Option(PositionID)
    Dim sqlPosition, rsPosition, strPosition
    If IsNull(PositionID) Then PositionID = 1

    strPosition = ""
    sqlPosition = "select * from PE_Position"
    Set rsPosition = Conn.Execute(sqlPosition)
    If rsPosition.BOF And rsPosition.EOF Then
        strPosition = strPosition & "<option value=''>请先添加职位</option>"
    Else
        Do While Not rsPosition.EOF
            strPosition = strPosition & "<option value='" & rsPosition("PositionID") & "'"
            If rsPosition("PositionID") = PositionID Then
                strPosition = strPosition & " selected"
            End If
            strPosition = strPosition & ">" & rsPosition("PositionName")
            strPosition = strPosition & "</option>"
            rsPosition.MoveNext
        Loop
    End If
    rsPosition.Close
    Set rsPosition = Nothing
    GetPosition_Option = strPosition
End Function


Sub MainJobCategory()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Dim rsJobCategory, sqlJobCategory

    sqlJobCategory = "select * from PE_JobCategory  order by OrderID"
    Set rsJobCategory = Conn.Execute(sqlJobCategory)
    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td height='22' width='15%' align='center'><strong>工作类别ID</strong></td>"
    Response.Write "    <td width='45%' align='center'><strong>类别名称</strong></td>"
    Response.Write "    <td width='20%' height='22' align='center'><strong>常规操作</strong></td>"
    Response.Write "    <td width='20%' height='22' align='center'><strong>排序操作</strong></td>"
    Response.Write "  </tr>"
    If rsJobCategory.BOF And rsJobCategory.EOF Then
        Response.Write "<tr class='tdbg'><td colspan='20' align='center'><br>还没有工作类别！<br></td></tr>"
    Else
        Do While Not rsJobCategory.EOF
            Response.Write "  <tr class='tdbg' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#BFDFFF'"">"
            Response.Write "    <td align='center'>" & rsJobCategory("JobCategoryID") & "</td>"
            Response.Write "    <td align='center'><a href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=ModifyJobCategory&JobCategoryID=" & rsJobCategory("JobCategoryID") & "'>" & rsJobCategory("JobCategoryName") & "</a></td>"
            Response.Write "    <td align='center'>"
            Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=ModifyJobCategory&JobCategoryID=" & rsJobCategory("JobCategoryID") & "'>修改</a>&nbsp;&nbsp;"
            If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
                Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=DeleteJobCategory&JobCategoryID=" & rsJobCategory("JobCategoryID") & "' onClick=""return confirm('确定要删除此工作类别吗？删除后将无法恢复！');"">删除</a>&nbsp;&nbsp;"
            End If
            Response.Write "</td>"
            Response.Write "<form name='orderform' method='post' action='Admin_Job.asp'>"
            Response.Write "    <td align='center'>"
            Response.Write "    <input name='OrderID' type='text' id='OrderID' value='" & rsJobCategory("OrderID") & "' size='4' maxlength='4' style='text-align:center '>"
            Response.Write "      <input name='JobCategoryID' type='hidden' id='JobCategoryID' value='" & rsJobCategory("JobCategoryID") & "'>"
            Response.Write "    <input type='submit' name='Submit' value='修改'>"
            Response.Write "    <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
            Response.Write "    <input name='Action' type='hidden' id='Action' value='JobCategoryOrder'>"
            Response.Write "    </td></form>"
            Response.Write "</tr>"
            rsJobCategory.MoveNext
        Loop
    End If
    Response.Write "     </table>"
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
        Response.Write "<br><b><font color=red>注意：</font></b><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>在删除某个工作类别的信息时，该工作类别下的职位信息和申请了这些职位的人才信息也将一起被删除掉！</font><br><br>"
    End If
    rsJobCategory.Close
    Set rsJobCategory = Nothing
End Sub


Sub ShowJS_JobCategory()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function unselectall()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.chkAll.Checked){" & vbCrLf
    Response.Write "     document.myform.chkAll.Checked=document.myform.chkAll.Checked&0;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckAll(form){" & vbCrLf
    Response.Write "  for (var i=0;i<form.elements.length;i++){" & vbCrLf
    Response.Write "    var e = form.elements[i];" & vbCrLf
    Response.Write "    if (e.Name != 'chkAll'&&e.disabled==false)" & vbCrLf
    Response.Write "       e.checked = form.chkAll.checked;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function ConfirmDel(){" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelJobCategory'){"
    Response.Write "     if (confirm('确定要删除所选中的工作类别吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelAllJobCategory'){"
    Response.Write "     if (confirm('确定要删除所有的工作类别吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.JobCategoryName.value==''){" & vbCrLf
    Response.Write "    alert('工作类别名称不能为空！');" & vbCrLf
    Response.Write "    document.myform.JobCategoryName.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub


Sub AddJobCategory()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_JobCategory

    Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border' >"
    Response.Write "    <form method='post' action='Admin_Job.asp' name='myform' onSubmit='return CheckForm();'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' colspan='2'> <div align='center'><strong>添加工作类别 </strong></div></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='350' class='tdbg5' align=right valign='middle'><strong>工作类别名称：</strong></td>"
    Response.Write "      <td class='tdbg'><input name='JobCategoryName' type='text' id='JobCategoryName' size='49' maxlength='30'>&nbsp;</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td colspan='2' align='center' class='tdbg'>"
    Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveAddJobCategory'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "        <input  type='submit' name='Submit' value=' 添 加 '>&nbsp;&nbsp;"
    Response.Write "        <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=JobCategory'""  style='cursor:hand;'></td>"
    Response.Write "    </tr>"
    Response.Write "    </form>"
    Response.Write "  </table>"
End Sub


Sub ModifyJobCategory()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_JobCategory

    Dim JobCategoryID, rsJobCategory, sqlJobCategory
    JobCategoryID = PE_CLng(Trim(Request("JobCategoryID")))
    If JobCategoryID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的工作类别ID！</li>"
        Exit Sub
    End If
    sqlJobCategory = "Select * from PE_JobCategory Where JobCategoryID=" & JobCategoryID
    Set rsJobCategory = Server.CreateObject("Adodb.RecordSet")
    rsJobCategory.Open sqlJobCategory, Conn, 1, 3
    If rsJobCategory.BOF And rsJobCategory.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的工作类别，可能已经被删除！</li>"
    Else
        Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border' >"
        Response.Write "<form method='post' action='Admin_Job.asp' name='myform' onSubmit='return CheckForm();'>"
        Response.Write "    <tr class='title'>"
        Response.Write "      <td height='22' colspan='2'> <div align='center'><strong>修改工作类别 </strong></div></td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td width='350' class='tdbg5' align=right><strong>工作类别名称：</strong></td>"
        Response.Write "      <td class='tdbg'><input name='JobCategoryName' type='text' id='JobCategoryName' size='49' maxlength='30' value='" & PE_HTMLEncode(rsJobCategory("JobCategoryName")) & "'>&nbsp;</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td colspan='2' align='center' class='tdbg'>"
        Response.Write "      <input name='JobCategoryID' type='hidden' id='JobCategoryID' value='" & rsJobCategory("JobCategoryID") & "'>"
        Response.Write "      <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
        Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveModifyJobCategory'>"
        Response.Write "        <input  type='submit' name='Submit' value=' 保存修改结果 '>&nbsp;&nbsp;"
        Response.Write "        <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=JobCategory'""  style='cursor:hand;'></td>"
        Response.Write "    </tr>"
        Response.Write "</form>"
        Response.Write "  </table>"
    End If
    rsJobCategory.Close
    Set rsJobCategory = Nothing
End Sub


Sub JobCategoryOrder()
    Dim JobCategoryID, OrderID
    JobCategoryID = Trim(Request("JobCategoryID"))
    OrderID = Trim(Request("OrderID"))
    If JobCategoryID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定工作类别ID</li>"
    Else
        JobCategoryID = PE_CLng(JobCategoryID)
    End If
    If OrderID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定OrderID</li>"
    Else
        OrderID = PE_CLng(OrderID)
    End If
    If FoundErr = True Then Exit Sub
    Conn.Execute ("update PE_JobCategory set OrderID=" & OrderID & " where JobCategoryID=" & JobCategoryID & "")
    Call JobCategory_OptionJS
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JobCategory"
End Sub


Sub SaveJobCategory()
    Dim JobCategoryID, JobCategoryName, OrderID, mrs, MaxOrderID
    Dim rsJobCategory, sqlJobCategory
    JobCategoryID = PE_CLng(Request.Form("JobCategoryID"))
    JobCategoryName = Trim(Request.Form("JobCategoryName"))
    If JobCategoryName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>类别名称不能为空！</li>"
    End If
    If FoundErr = True Then
        Exit Sub
    End If

    JobCategoryName = PE_HTMLEncode(JobCategoryName)

    Set rsJobCategory = Server.CreateObject("Adodb.RecordSet")
    If Action = "SaveAddJobCategory" Then
        Set mrs = Conn.Execute("select max(OrderID) from PE_JobCategory")
        If IsNull(mrs(0)) Then
            MaxOrderID = 0
        Else
            MaxOrderID = mrs(0)
        End If
        
        Dim intMaxID
        Set mrs = Conn.Execute("select max(JobCategoryID) from PE_JobCategory")
        If IsNull(mrs(0)) Then
            intMaxID = 0
        Else
            intMaxID = mrs(0)
        End If
        Set mrs = Nothing
        sqlJobCategory = "select Top 1 * from PE_JobCategory"
        rsJobCategory.Open sqlJobCategory, Conn, 1, 3
        rsJobCategory.addnew
        rsJobCategory("JobCategoryID") = intMaxID + 1
        rsJobCategory("JobCategoryName") = JobCategoryName
        rsJobCategory("OrderID") = MaxOrderID + 1
        rsJobCategory.Update
        rsJobCategory.Close
        Set rsJobCategory = Nothing
        Call JobCategory_OptionJS
        Call CloseConn
        Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&action=JobCategory"
    ElseIf Action = "SaveModifyJobCategory" Then
            If JobCategoryID = 0 Then
               FoundErr = True
               ErrMsg = ErrMsg & "<li>请指定要修改的类别ID！</li>"
               Exit Sub
            End If
            sqlJobCategory = "Select * from PE_JobCategory Where JobCategoryID=" & JobCategoryID
            Set rsJobCategory = Server.CreateObject("Adodb.RecordSet")
            rsJobCategory.Open sqlJobCategory, Conn, 1, 3
            If rsJobCategory.BOF And rsJobCategory.EOF Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>找不到指定的工作类别，可能已经被删除！</li>"
                rsJobCategory.Close
                Set rsJobCategory = Nothing
            Else
                rsJobCategory("JobCategoryName") = JobCategoryName
                rsJobCategory.Update
                rsJobCategory.Close
                Set rsJobCategory = Nothing
                Call JobCategory_OptionJS
                Call CloseConn
                Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JobCategory"
            End If
    End If
End Sub



Sub DeleteJobCategory()
    If Action = "DelJobCategory" Or Action = "DeleteJobCategory" Then
        Dim JobCategoryID, rsPosition, sqlPosition, rsPositionSupplyInfo, sqlPositionSupplyInfo
        JobCategoryID = PE_CLng(Trim(Request("JobCategoryID")))
        If JobCategoryID = "" Or JobCategoryID = 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>未找到所需要的参数</li>"
            Exit Sub
        End If
        '删除该工作类别下的职位信息与申请该职位的人才相关信息
        sqlPosition = "select PositionID from PE_Position where JobCategoryID =" & JobCategoryID
        Set rsPosition = Server.CreateObject("ADODB.RecordSet")
        rsPosition.Open sqlPosition, Conn, 1, 3
        Do While Not rsPosition.EOF
            sqlPositionSupplyInfo = "select PositionSupplyInfoID from PE_PositionSupplyInfo where PositionID=" & rsPosition("PositionID")
            Set rsPositionSupplyInfo = Server.CreateObject("ADODB.RecordSet")
            rsPositionSupplyInfo.Open sqlPositionSupplyInfo, Conn, 1, 3
            Do While Not rsPositionSupplyInfo.EOF
                Conn.Execute ("delete from PE_PositionSupplyInfo Where PositionSupplyInfoID=" & rsPositionSupplyInfo("PositionSupplyInfoID") & "")
                rsPositionSupplyInfo.MoveNext
            Loop
            rsPositionSupplyInfo.Close
            Set rsPositionSupplyInfo = Nothing

            Conn.Execute ("delete from PE_Position Where PositionID=" & rsPosition("PositionID") & "")
            rsPosition.MoveNext
        Loop
        rsPosition.Close
        Set rsPosition = Nothing
        Conn.Execute ("delete from PE_JobCategory Where JobCategoryID=" & JobCategoryID & "")
    End If
    Call JobCategory_OptionJS
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JobCategory"
End Sub


Sub MainWorkPlace()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Dim rsWorkPlace, sqlWorkPlace
    sqlWorkPlace = "select * from PE_WorkPlace  order by OrderID"
    Set rsWorkPlace = Conn.Execute(sqlWorkPlace)

    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "  <tr class='title'>"
    Response.Write "    <td width='15%' align='center'><strong>工作地点ID</strong></td>"
    Response.Write "    <td width='45%' align='center'><strong>工作地点名称</strong></td>"
    Response.Write "    <td width='20%' height='22' align='center'><strong>常规操作</strong></td>"
    Response.Write "    <td width='20%' height='22' align='center'><strong>排序操作</strong></td>"
    Response.Write "  </tr>"
    If rsWorkPlace.BOF And rsWorkPlace.EOF Then
        Response.Write "<tr class='tdbg'><td colspan='20' align='center'><br>还没有工作地点！<br></td></tr>"
    Else
        Do While Not rsWorkPlace.EOF
            Response.Write "  <tr class='tdbg' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#BFDFFF'"">"
            Response.Write "    <td align='center'>" & rsWorkPlace("WorkPlaceID") & "</td>"
            Response.Write "    <td align='center'><a href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=ModifyWorkPlace&WorkPlaceID=" & rsWorkPlace("WorkPlaceID") & "'>" & rsWorkPlace("WorkPlaceName") & "</a></td>"
            Response.Write "    <td align='center'>"
            Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=ModifyWorkPlace&WorkPlaceID=" & rsWorkPlace("WorkPlaceID") & "'>修改</a>&nbsp;&nbsp;"
            If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
                Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=DeleteWorkPlace&WorkPlaceID=" & rsWorkPlace("WorkPlaceID") & "' onClick=""return confirm('确定要删除此工作地点吗？删除后将无法恢复！');"">删除</a>&nbsp;&nbsp;"
            End If
            Response.Write "</td>"
            Response.Write "<form name='orderform' method='post' action='Admin_Job.asp'>"
            Response.Write "    <td align='center'>"
            Response.Write "    <input name='OrderID' type='text' id='OrderID' value='" & rsWorkPlace("OrderID") & "' size='4' maxlength='4' style='text-align:center '>"
            Response.Write "      <input name='WorkPlaceID' type='hidden' id='WorkPlaceID' value='" & rsWorkPlace("WorkPlaceID") & "'>"
            Response.Write "    <input type='submit' name='Submit' value='修改'>"
            Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
            Response.Write "    <input name='Action' type='hidden' id='Action' value='WorkPlaceOrder'>"
            Response.Write "    </td></form>"
            Response.Write "</tr>"
            rsWorkPlace.MoveNext
        Loop
    End If
    Response.Write "    </table>"
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
        Response.Write "<br><b><font color=red>注意：</font></b><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>在删除某个工作地点的信息时，与该工作地点的相关职位信息和所申请的该职位的人才信息也将一起被删除掉！</font><br><br>"
    End If
    rsWorkPlace.Close
    Set rsWorkPlace = Nothing
End Sub


Sub ShowJS_WorkPlace()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function unselectall()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.chkAll.Checked){" & vbCrLf
    Response.Write "     document.myform.chkAll.Checked=document.myform.chkAll.Checked&0;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckAll(form){" & vbCrLf
    Response.Write "  for (var i=0;i<form.elements.length;i++){" & vbCrLf
    Response.Write "    var e = form.elements[i];" & vbCrLf
    Response.Write "    if (e.Name != 'chkAll'&&e.disabled==false)" & vbCrLf
    Response.Write "       e.checked = form.chkAll.checked;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function ConfirmDel(){" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelWorkPlace'){"
    Response.Write "     if (confirm('确定要删除所选中的工作地点吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelAllWorkPlace'){"
    Response.Write "     if (confirm('确定要删除所有的工作地点吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.WorkPlaceName.value==''){" & vbCrLf
    Response.Write "    alert('工作地点称不能为空！');" & vbCrLf
    Response.Write "    document.myform.ReleaseDate.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub



Sub AddWorkPlace()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_WorkPlace

    Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border' >"
    Response.Write "<form method='post' action='Admin_Job.asp' name='myform' onSubmit='return CheckForm();'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' colspan='2'> <div align='center'><strong>添加工作地点 </strong></div></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='350' class='tdbg5' align=right><strong>工作地点名称：</strong></td>"
    Response.Write "      <td class='tdbg'><input name='WorkPlaceName' type='text' id='WorkPlaceName' size='49' maxlength='30'>&nbsp;</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td colspan='2' align='center' class='tdbg'>"
    Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveAddWorkPlace'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "        <input  type='submit' name='Submit' value=' 添 加 '>&nbsp;&nbsp;"
    Response.Write "        <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=WorkPlace'""  style='cursor:hand;'></td>"
    Response.Write "    </tr>"
    Response.Write "</form>"
    Response.Write "  </table>"
End Sub

Sub ModifyWorkPlace()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_WorkPlace

    Dim WorkPlaceID, rsWorkPlace, sqlWorkPlace
    WorkPlaceID = PE_CLng(Trim(Request("WorkPlaceID")))
    If WorkPlaceID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的工作地点ID！</li>"
        Exit Sub
    End If
    sqlWorkPlace = "Select * from PE_WorkPlace Where WorkPlaceID=" & WorkPlaceID
    Set rsWorkPlace = Server.CreateObject("Adodb.RecordSet")
    rsWorkPlace.Open sqlWorkPlace, Conn, 1, 3
    If rsWorkPlace.BOF And rsWorkPlace.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的工作地点，可能已经被删除！</li>"
    Else
        Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border' >"
        Response.Write "<form method='post' action='Admin_Job.asp' name='myform' onSubmit='return CheckForm();'>"
        Response.Write "    <tr class='title'>"
        Response.Write "      <td height='22' colspan='2'> <div align='center'><strong>修改工作地点 </strong></div></td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td width='350' class='tdbg5' align=right><strong>工作地点名称：</strong></td>"
        Response.Write "      <td class='tdbg'><input name='WorkPlaceName' type='text' id='WorkPlaceName' size='49' maxlength='30' value='" & PE_HTMLEncode(rsWorkPlace("WorkPlaceName")) & "'>&nbsp;</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td colspan='2' align='center' class='tdbg'>"
        Response.Write "      <input name='WorkPlaceID' type='hidden' id='WorkPlaceID' value='" & rsWorkPlace("WorkPlaceID") & "'>"
        Response.Write "      <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
        Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveModifyWorkPlace'>"
        Response.Write "        <input  type='submit' name='Submit' value=' 保存修改结果 '>&nbsp;&nbsp;"
        Response.Write "        <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=WorkPlace'""  style='cursor:hand;'></td>"
        Response.Write "    </tr>"
        Response.Write "</form>"
        Response.Write "  </table>"
    End If
    rsWorkPlace.Close
    Set rsWorkPlace = Nothing
End Sub


Sub WorkPlaceOrder()
    Dim WorkPlaceID, OrderID
    WorkPlaceID = Trim(Request("WorkPlaceID"))
    OrderID = Trim(Request("OrderID"))
    If WorkPlaceID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定工作地点ID</li>"
    Else
        WorkPlaceID = PE_CLng(WorkPlaceID)
    End If
    If OrderID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定OrderID</li>"
    Else
        OrderID = PE_CLng(OrderID)
    End If
    If FoundErr = True Then Exit Sub
        Conn.Execute ("update PE_WorkPlace set OrderID=" & OrderID & " where WorkPlaceID=" & WorkPlaceID & "")
    Call WorkPlace_OptionJS
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=WorkPlace"
End Sub



Sub SaveWorkPlace()
    Dim WorkPlaceID, WorkPlaceName, OrderID, mrs, MaxOrderID
    Dim rsWorkPlace, sqlWorkPlace
    WorkPlaceID = PE_CLng(Request.Form("WorkPlaceID"))
    WorkPlaceName = Trim(Request.Form("WorkPlaceName"))
    If WorkPlaceName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>工作地点名称不能为空！</li>"
    End If
    If FoundErr = True Then
        Exit Sub
    End If

    WorkPlaceName = PE_HTMLEncode(WorkPlaceName)

    Set rsWorkPlace = Server.CreateObject("Adodb.RecordSet")
    If Action = "SaveAddWorkPlace" Then
        Set mrs = Conn.Execute("select max(OrderID) from PE_WorkPlace")
        If IsNull(mrs(0)) Then
            MaxOrderID = 0
        Else
            MaxOrderID = mrs(0)
        End If
        
        Dim intMaxID
        Set mrs = Conn.Execute("select max(WorkPlaceID) from PE_WorkPlace")
        If IsNull(mrs(0)) Then
            intMaxID = 0
        Else
            intMaxID = mrs(0)
        End If
        Set mrs = Nothing
        sqlWorkPlace = "select Top 1 * from PE_WorkPlace"
        rsWorkPlace.Open sqlWorkPlace, Conn, 1, 3
        rsWorkPlace.addnew
        rsWorkPlace("WorkPlaceID") = intMaxID + 1
        rsWorkPlace("WorkPlaceName") = WorkPlaceName
        rsWorkPlace("OrderID") = MaxOrderID + 1
        rsWorkPlace.Update
        rsWorkPlace.Close
        Set rsWorkPlace = Nothing
        Call WorkPlace_OptionJS
        Call CloseConn
        Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&action=WorkPlace"
    ElseIf Action = "SaveModifyWorkPlace" Then
            If WorkPlaceID = 0 Then
               FoundErr = True
               ErrMsg = ErrMsg & "<li>请指定要修改的工作地点ID！</li>"
               Exit Sub
            End If
            sqlWorkPlace = "Select * from PE_WorkPlace Where WorkPlaceID=" & WorkPlaceID
            Set rsWorkPlace = Server.CreateObject("Adodb.RecordSet")
            rsWorkPlace.Open sqlWorkPlace, Conn, 1, 3
            If rsWorkPlace.BOF And rsWorkPlace.EOF Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>找不到指定的工作地点，可能已经被删除！</li>"
                rsWorkPlace.Close
                Set rsWorkPlace = Nothing
            Else
                rsWorkPlace("WorkPlaceName") = WorkPlaceName
                rsWorkPlace.Update
                rsWorkPlace.Close
                Set rsWorkPlace = Nothing
                Call WorkPlace_OptionJS
                Call CloseConn
                Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=WorkPlace"
            End If
    End If
End Sub

Sub DeleteWorkPlace()
    If Action = "DelWorkPlace" Or Action = "DeleteWorkPlace" Then
        Dim WorkPlaceID, rsPosition, sqlPosition, rsPositionSupplyInfo, sqlPositionSupplyInfo
        WorkPlaceID = PE_CLng(Trim(Request("WorkPlaceID")))
        If WorkPlaceID = "" Or WorkPlaceID = 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>未找到所需要的参数</li>"
            Exit Sub
        End If
        '删除该工作地点相关的职位信息与申请该职位的人才相关信息
        sqlPosition = "select PositionID from PE_Position where WorkPlaceID =" & WorkPlaceID
        Set rsPosition = Server.CreateObject("ADODB.RecordSet")
        rsPosition.Open sqlPosition, Conn, 1, 3
        Do While Not rsPosition.EOF
            sqlPositionSupplyInfo = "select PositionSupplyInfoID from PE_PositionSupplyInfo where PositionID=" & rsPosition("PositionID")
            Set rsPositionSupplyInfo = Server.CreateObject("ADODB.RecordSet")
            rsPositionSupplyInfo.Open sqlPositionSupplyInfo, Conn, 1, 3
            Do While Not rsPositionSupplyInfo.EOF
                Conn.Execute ("delete from PE_PositionSupplyInfo Where PositionSupplyInfoID=" & rsPositionSupplyInfo("PositionSupplyInfoID") & "")
                rsPositionSupplyInfo.MoveNext
            Loop
            rsPositionSupplyInfo.Close
            Set rsPositionSupplyInfo = Nothing

            Conn.Execute ("delete from PE_Position Where PositionID=" & rsPosition("PositionID") & "")
            rsPosition.MoveNext
        Loop
        rsPosition.Close
        Set rsPosition = Nothing
        Conn.Execute ("delete from PE_WorkPlace Where WorkPlaceID=" & WorkPlaceID & "")
    End If
    Call WorkPlace_OptionJS
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=WorkPlace"
End Sub



Sub mainSubCompany()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_SubCompany

    Dim rsSubCompanyList, sql, Querysql
    Dim ChannelItemUnit, ChannelShortName
    Dim Num
    Num = 0
    ChannelItemUnit = "个"
    ChannelShortName = "单位"

    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "</table>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>"
    Response.Write "     <td><table class='border' border='0' cellspacing='1' width='100%' cellpadding='0'>"
    Response.Write "          <tr class='title' height='22'> "
    Response.Write "            <td width='10%' align='center'><strong>ID</strong></td>"
    Response.Write "            <td width='30%' align='center'><strong>单位名称</strong></td>"
    Response.Write "            <td width='20%' align='center'><strong>联系人</strong></td>"
    Response.Write "            <td width='15%' align='center' ><strong>常规操作</strong></td>"
    Response.Write "            <td width='15%' align='center' ><strong>排序操作</strong></td>"
    Response.Write "          </tr>"

    sql = "select top " & MaxPerPage & " SubCompanyID,SubCompanyName,Contacter,Telephone,Address,OrderID from PE_SubCompany"
    
    If Keyword <> "" Then
        Select Case strField
        Case "SubCompanyName"
            Querysql = Querysql & " where SubCompanyName like '%" & Keyword & "%' "
        Case "Contacter"
            Querysql = Querysql & " where Contacter like '%" & Keyword & "%' "
        Case "Address"
            Querysql = Querysql & " where Address like '%" & Keyword & "%' "
        Case Else
            Querysql = Querysql & " where SubCompanyName like '%" & Keyword & "%' "
        End Select
    End If
    totalPut = PE_CLng(Conn.Execute("select Count(*) from PE_SubCompany " & Querysql)(0))
    If CurrentPage < 1 Then
        CurrentPage = 1
    End If
    If (CurrentPage - 1) * MaxPerPage > totalPut Then
        If (totalPut Mod MaxPerPage) = 0 Then
            CurrentPage = totalPut \ MaxPerPage
        Else
            CurrentPage = totalPut \ MaxPerPage + 1
        End If
    End If
    If Keyword = "" Then
        If CurrentPage > 1 Then
            Querysql = Querysql & " where SubCompanyID < (select min(SubCompanyID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " SubCompanyID from PE_SubCompany " & Querysql & " order by SubCompanyID desc) as QuerySubCompany) "
        End If
    Else
        If CurrentPage > 1 Then
            Querysql = Querysql & " and SubCompanyID < (select min(SubCompanyID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " SubCompanyID from PE_SubCompany " & Querysql & " order by SubCompanyID desc) as QuerySubCompany) "
        End If
    End If
    sql = sql & Querysql & " order by SubCompanyID desc"
    Set rsSubCompanyList = Server.CreateObject("ADODB.Recordset")
    rsSubCompanyList.Open sql, Conn, 1, 1
    If rsSubCompanyList.BOF And rsSubCompanyList.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg'><td colspan='20' align='center'><br>没有任何用人单位！<br></td></tr>"
    Else
        Do While Not rsSubCompanyList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#BFDFFF'"">"
            Response.Write "        <td align='center'>" & rsSubCompanyList("SubCompanyID") & "</td>"
            Response.Write "        <td align='center'><a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ModifySubCompany&SubCompanyID=" & rsSubCompanyList("SubCompanyID") & "'>" & rsSubCompanyList("SubCompanyName") & "</a></td>"
            Response.Write "      <td align='center'>" & rsSubCompanyList("Contacter") & "</td>"
            Response.Write "    <td align='center'>&nbsp;"
            Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ModifySubCompany&SubCompanyID=" & rsSubCompanyList("SubCompanyID") & "'>修改</a>&nbsp;"
            If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
                Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=DeleteSubCompany&SubCompanyID=" & rsSubCompanyList("SubCompanyID") & "' onclick=""return confirm('确定要删除此单位吗？删除后将无法恢复。');"">删除</a>&nbsp;"
            End If
            Response.Write "     </td>"
            Response.Write "<form name='orderform' method='post' action='Admin_Job.asp'>"
            Response.Write "    <td align='center'>      <input name='OrderID' type='text' id='OrderID' value='" & rsSubCompanyList("OrderID") & "' size='4' maxlength='4' style='text-align:center '>"
            Response.Write "      <input name='SubCompanyID' type='hidden' id='SubCompanyID' value='" & rsSubCompanyList("SubCompanyID") & "'>"
            Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
            Response.Write "    <input type='submit' name='Submit' value='修改'>"
            Response.Write "    <input name='Action' type='hidden' id='Action' value='SubCompanyOrder'>"
            Response.Write "    </td></form>"
            Response.Write "</tr>"

            Num = Num + 1
            If Num >= MaxPerPage Then Exit Do
            rsSubCompanyList.MoveNext
        Loop
    End If
    rsSubCompanyList.Close
    Set rsSubCompanyList = Nothing
    Response.Write "</table>"
    Response.Write "</td>"
    Response.Write "</tr></table>"

    '分页时传递关键字等搜索条件
    If strField <> "" Then
        strFileName = strFileName & "&Field=" & strField
    End If
    If Keyword <> "" Then
        strFileName = strFileName & "&keyword=" & Keyword
    End If

    If totalPut > 0 Then
        Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, ChannelItemUnit & ChannelShortName & "", True)
    End If
    Response.Write "<br>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0' class='border'>"
    Response.Write "<form method='Get' name='SearchForm' action='" & FileName & "'>"
    Response.Write "  <tr class='tdbg'>"
    Response.Write "   <td width='100' align='right'><strong>用人单位搜索：</strong></td>"
    Response.Write "   <td>"
    Response.Write "<select name='Field' size='1'>"
    Response.Write "<option value='SubCompanyName' selected>用人单位名称</option>"
    Response.Write "<option value='Contacter'>联系人</option>"
    Response.Write "<option value='Address'>联系地址</option>"
    Response.Write "</select>"
    Response.Write "<input type='text' name='keyword'  size='20' value='关键字' maxlength='50' onFocus='this.select();'>"
    Response.Write "<input type='submit' name='Submit'  value='搜索'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "<input name='Action' type='hidden' id='Action' value='SubCompany'>"
    Response.Write "</td></tr></form></table>"
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Then
        Response.Write "<br><b><font color=red>注意：</font></b><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>在删除某个用人单位的信息时，与该用人单位相关的职位信息和所申请的该职位的人才信息也将一起被删除掉！</font><br><br>"
    End If
End Sub



Sub ShowJS_SubCompany()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function unselectall()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.chkAll.Checked){" & vbCrLf
    Response.Write "     document.myform.chkAll.Checked=document.myform.chkAll.Checked&0;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckAll(form){" & vbCrLf
    Response.Write "  for (var i=0;i<form.elements.length;i++){" & vbCrLf
    Response.Write "    var e = form.elements[i];" & vbCrLf
    Response.Write "    if (e.Name != 'chkAll'&&e.disabled==false)" & vbCrLf
    Response.Write "       e.checked = form.chkAll.checked;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function ConfirmDel(){" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelSubCompany'){"
    Response.Write "     if (confirm('确定要删除所选中的单位吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelAllSubCompany'){"
    Response.Write "     if (confirm('确定要删除所有的单位吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.SubCompanyName.value==''){" & vbCrLf
    Response.Write "    alert('用人单位名称不能为空！');" & vbCrLf
    Response.Write "    document.myform.SubCompanyName.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Contacter.value==''){" & vbCrLf
    Response.Write "    alert('联系人不能为空！');" & vbCrLf
    Response.Write "    document.myform.Contacter.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Telephone.value==''){" & vbCrLf
    Response.Write "     alert('联系电话不能为空');" & vbCrLf
    Response.Write "     document.myform.Telephone.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Address.value==''){" & vbCrLf
    Response.Write "     alert('联系地址不能为空！');" & vbCrLf
    Response.Write "     document.myform.Address.value.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.E_mail.value==''){" & vbCrLf
    Response.Write "     alert('联系邮箱不能为空！');" & vbCrLf
    Response.Write "     document.myform.E_mail.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub




Sub AddSubCompany()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_SubCompany

    Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border' >"
    Response.Write "<form method='post' action='Admin_Job.asp' name='myform' onSubmit='return CheckForm();'>"
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' colspan='2'> <div align='center'><strong>添加用人单位 </strong></div></td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='350' class='tdbg5' align=right><strong>用人单位名称：</strong></td>"
    Response.Write "      <td class='tdbg'><input name='SubCompanyName' type='text' id='SubCompanyName' size='49' maxlength='30'>&nbsp;</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系人：</strong></td>"
    Response.Write "      <td class='tdbg'><input name='Contacter' type='text' id='Contacter' size='49' maxlength='30'>&nbsp;</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系电话：</strong></td>"
    Response.Write "      <td class='tdbg'><input name='Telephone' type='text' id='Telephone' size='49' maxlength='30'>&nbsp;</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系地址：</strong></td>"
    Response.Write "      <td class='tdbg'><input name='Address' type='text' id='Address' size='49' maxlength='30'>&nbsp;</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系邮箱：</strong></td>"
    Response.Write "      <td class='tdbg'><input name='E_mail' type='text' id='E_mail' size='49' maxlength='30'>&nbsp;</td>"
    Response.Write "    </tr>"
    Response.Write "    <tr class='tdbg'>"
    Response.Write "      <td colspan='2' align='center' class='tdbg'>"
    Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveAddSubCompany'>"
    Response.Write "      <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "      <input  type='submit' name='Submit' value=' 添 加 '>&nbsp;&nbsp;"
    Response.Write "        <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=SubCompany'""  style='cursor:hand;'></td>"
    Response.Write "    </tr>"
    Response.Write "</form>"
    Response.Write "  </table>"
End Sub



Sub ModifySubCompany()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_SubCompany

    Dim SubCompanyID, rsSubCompany, sqlSubCompany
    SubCompanyID = PE_CLng(Trim(Request("SubCompanyID")))
    If SubCompanyID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的用人单位ID！</li>"
        Exit Sub
    End If
    sqlSubCompany = "Select * from PE_SubCompany Where SubCompanyID=" & SubCompanyID
    Set rsSubCompany = Server.CreateObject("Adodb.RecordSet")
    rsSubCompany.Open sqlSubCompany, Conn, 1, 3
    If rsSubCompany.BOF And rsSubCompany.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的工作地点，可能已经被删除！</li>"
    Else
        Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border' >"
        Response.Write "<form method='post' action='Admin_Job.asp' name='myform' onSubmit='return CheckForm();'>"
        Response.Write "    <tr class='title'>"
        Response.Write "      <td height='22' colspan='2'> <div align='center'><strong>修改用人单位 </strong></div></td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td width='350' class='tdbg5' align=right><strong>用人单位名称：</strong></td>"
        Response.Write "      <td class='tdbg'><input name='SubCompanyName' type='text' id='SubCompanyName' size='49' maxlength='30' value='" & PE_HTMLEncode(rsSubCompany("SubCompanyName")) & "'>&nbsp;</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系人：</strong></td>"
        Response.Write "      <td class='tdbg'><input name='Contacter' type='text' id='Contacter' size='49' maxlength='30' value='" & PE_HTMLEncode(rsSubCompany("Contacter")) & "'>&nbsp;</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系电话：</strong></td>"
        Response.Write "      <td class='tdbg'><input name='Telephone' type='text' id='Telephone' size='49' maxlength='30' value='" & PE_HTMLEncode(rsSubCompany("Telephone")) & "'>&nbsp;</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系地址：</strong></td>"
        Response.Write "      <td class='tdbg'><input name='Address' type='text' id='Address' size='49' maxlength='30' value='" & PE_HTMLEncode(rsSubCompany("Address")) & "'>&nbsp;</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td width='350' class='tdbg5' align=right><strong>联系邮箱：</strong></td>"
        Response.Write "      <td class='tdbg'><input name='E_mail' type='text' id='E_mail' size='49' maxlength='30' value='" & PE_HTMLEncode(rsSubCompany("E_mail")) & "'>&nbsp;</td>"
        Response.Write "    </tr>"
        Response.Write "    <tr class='tdbg'>"
        Response.Write "      <td colspan='2' align='center' class='tdbg'>"
        Response.Write "      <input name='SubCompanyID' type='hidden' id='SubCompanyID' value='" & rsSubCompany("SubCompanyID") & "'>"
        Response.Write "      <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
        Response.Write "      <input name='Action' type='hidden' id='Action' value='SaveModifySubCompany'>"
        Response.Write "        <input  type='submit' name='Submit' value=' 保存修改结果 '>&nbsp;&nbsp;"
        Response.Write "        <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&action=SubCompany'""  style='cursor:hand;'></td>"
        Response.Write "    </tr>"
        Response.Write "</form>"
        Response.Write "  </table>"
    End If
    rsSubCompany.Close
    Set rsSubCompany = Nothing
End Sub




Sub SubCompanyOrder()
    Dim SubCompanyID, OrderID
    SubCompanyID = Trim(Request("SubCompanyID"))
    OrderID = Trim(Request("OrderID"))
    If SubCompanyID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定用人单位ID</li>"
    Else
        SubCompanyID = PE_CLng(SubCompanyID)
    End If
    If OrderID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定OrderID</li>"
    Else
        OrderID = PE_CLng(OrderID)
    End If
    If FoundErr = True Then Exit Sub
    Conn.Execute ("update PE_SubCompany set OrderID=" & OrderID & " where SubCompanyID=" & SubCompanyID & "")
    Call SubCompany_OptionJS
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=SubCompany"
End Sub


Sub SaveSubCompany()
    Dim SubCompanyID, SubCompanyName, OrderID, mrs, MaxOrderID
    Dim Contacter, Telephone, Address, E_mail
    Dim rsSubCompany, sqlSubCompany
    Dim rsPosition, sqlPosition
    SubCompanyID = PE_CLng(Request.Form("SubCompanyID"))
    SubCompanyName = Trim(Request.Form("SubCompanyName"))
    Contacter = Trim(Request.Form("Contacter"))
    Telephone = Trim(Request.Form("Telephone"))
    Address = Trim(Request.Form("Address"))
    E_mail = Trim(Request.Form("E_mail"))
    If SubCompanyName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>用人单位名称不能为空！</li>"
    End If
    If Contacter = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>联系人不能为空！</li>"
    End If
    If Telephone = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>联系电话不能为空！</li>"
    End If
    If Address = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>联系地址不能为空！</li>"
    End If
    If E_mail <> "" Then
        If IsValidEmail(E_mail) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请输入正确的联系邮箱地址！</li>"
        End If
    End If
    If FoundErr = True Then
        Exit Sub
    End If

    SubCompanyName = PE_HTMLEncode(SubCompanyName)
    Contacter = PE_HTMLEncode(Contacter)
    Telephone = PE_HTMLEncode(Telephone)
    Address = PE_HTMLEncode(Address)

    Set rsSubCompany = Server.CreateObject("Adodb.RecordSet")
    If Action = "SaveAddSubCompany" Then
        Set mrs = Conn.Execute("select max(OrderID) from PE_SubCompany")
        If IsNull(mrs(0)) Then
            MaxOrderID = 0
        Else
            MaxOrderID = mrs(0)
        End If
        
        Dim intMaxID
        Set mrs = Conn.Execute("select max(SubCompanyID) from PE_SubCompany")
        If IsNull(mrs(0)) Then
            intMaxID = 0
        Else
            intMaxID = mrs(0)
        End If
        Set mrs = Nothing
        sqlSubCompany = "select Top 1 * from PE_SubCompany"
        rsSubCompany.Open sqlSubCompany, Conn, 1, 3
        rsSubCompany.addnew
        rsSubCompany("SubCompanyID") = intMaxID + 1
        rsSubCompany("SubCompanyName") = SubCompanyName
        rsSubCompany("Contacter") = Contacter
        rsSubCompany("Telephone") = Telephone
        rsSubCompany("Address") = Address
        rsSubCompany("E_mail") = E_mail
        rsSubCompany("OrderID") = MaxOrderID + 1
        rsSubCompany.Update
        rsSubCompany.Close
        Set rsSubCompany = Nothing
        Call SubCompany_OptionJS
        Call CloseConn
        Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&action=SubCompany"
    ElseIf Action = "SaveModifySubCompany" Then
            If SubCompanyID = 0 Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>请指定要修改的用人单位ID！</li>"
                Exit Sub
            End If
            sqlSubCompany = "Select * from PE_SubCompany Where SubCompanyID=" & SubCompanyID
            Set rsSubCompany = Server.CreateObject("Adodb.RecordSet")
            rsSubCompany.Open sqlSubCompany, Conn, 1, 3
            If rsSubCompany.BOF And rsSubCompany.EOF Then
                FoundErr = True
                ErrMsg = ErrMsg & "<li>找不到指定的用人单位，可能已经被删除！</li>"
                rsSubCompany.Close
                Set rsSubCompany = Nothing
            Else
                rsSubCompany("SubCompanyName") = SubCompanyName
                rsSubCompany("Contacter") = Contacter
                rsSubCompany("Telephone") = Telephone
                rsSubCompany("Address") = Address
                rsSubCompany("E_mail") = E_mail
                rsSubCompany("OrderID") = MaxOrderID + 1
                rsSubCompany.Update
                rsSubCompany.Close
                Set rsSubCompany = Nothing

                Set rsPosition = Server.CreateObject("Adodb.RecordSet")
                sqlPosition = "Select SubCompanyName from PE_Position where SubCompanyID=" & SubCompanyID
                rsPosition.Open sqlPosition, Conn, 1, 3
                If rsPosition.BOF And rsPosition.EOF Then
                    FoundErr = True
                    ErrMsg = ErrMsg & "<li>找不到指定的用人单位，可能已经被删除！</li>"
                Else
                    Do While Not rsPosition.EOF
                        rsPosition("SubCompanyName") = SubCompanyName
                        rsPosition.MoveNext
                    Loop
                End If
                rsPosition.Close
                Set rsPosition = Nothing
                Call SubCompany_OptionJS
                Call CloseConn
                Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=SubCompany"
            End If
    End If
End Sub


Sub DeleteSubCompany()
    If Action = "DelSubCompany" Or Action = "DeleteSubCompany" Then
        Dim SubCompanyID, rsPosition, sqlPosition, rsPositionSupplyInfo, sqlPositionSupplyInfo
        SubCompanyID = PE_CLng(Trim(Request("SubCompanyID")))
        If SubCompanyID = "" Or SubCompanyID = 0 Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>未找到所需要的参数</li>"
            Exit Sub
        End If
        '删除与该用人单位相关的职位信息与申请该职位的人才相关信息
        sqlPosition = "select PositionID from PE_Position where SubCompanyID =" & SubCompanyID
        Set rsPosition = Server.CreateObject("ADODB.RecordSet")
        rsPosition.Open sqlPosition, Conn, 1, 3
        Do While Not rsPosition.EOF
            sqlPositionSupplyInfo = "select PositionSupplyInfoID from PE_PositionSupplyInfo where PositionID=" & rsPosition("PositionID")
            Set rsPositionSupplyInfo = Server.CreateObject("ADODB.RecordSet")
            rsPositionSupplyInfo.Open sqlPositionSupplyInfo, Conn, 1, 3
            Do While Not rsPositionSupplyInfo.EOF
                Conn.Execute ("delete from PE_PositionSupplyInfo Where PositionSupplyInfoID=" & rsPositionSupplyInfo("PositionSupplyInfoID") & "")
                rsPositionSupplyInfo.MoveNext
            Loop
            rsPositionSupplyInfo.Close
            Set rsPositionSupplyInfo = Nothing

            Conn.Execute ("delete from PE_Position Where PositionID=" & rsPosition("PositionID") & "")
            rsPosition.MoveNext
        Loop
        rsPosition.Close
        Set rsPosition = Nothing
        Conn.Execute ("delete from PE_SubCompany Where SubCompanyID=" & SubCompanyID & "")
    End If
    Call SubCompany_OptionJS
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=SubCompany"
End Sub


Sub JSRefresh()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel <= 2 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Dim JSType, JSName, JSUrl, JSUrl_Use
    JSType = ReplaceBadChar(Request("Type"))
    Select Case JSType
    Case "JobCategory"
        JSName = "工作类别"
        JSUrl = "Admin/Admin_Job.asp?ChannelID=" & ChannelID & "&Action=JobCategory"
        JSUrl_Use = "职位搜索下拉选项（\Job\Search.asp）---工作类别JS调用代码：<br><textarea name='textarea' cols='50' rows='5'><script language='javascript' src='" & InstallDir & ChannelDir & "/JS/JobCategory_Option.js'></script></textarea>"
        Call JobCategory_OptionJS
    Case "SubCompany"
        JSName = "用人单位"
        JSUrl = "Admin/Admin_Job.asp?ChannelID=" & ChannelID & "&Action=SubCompany"
        JSUrl_Use = "职位搜索下拉选项（\Job\Search.asp）---用人单位JS调用代码：<br><textarea name='textarea' cols='50' rows='5'><script language='javascript' src='" & InstallDir & ChannelDir & "/JS/SubCompany_Option.js'></script></textarea>"
        Call SubCompany_OptionJS
    Case "WorkPlace"
        JSName = "工作地点"
        JSUrl = "Admin/Admin_Job.asp?ChannelID=" & ChannelID & "&Action=WorkPlace"
        JSUrl_Use = "职位搜索下拉选项（\Job\Search.asp）---工作地点JS调用代码：<br><textarea name='textarea' cols='50' rows='5'><script language='javascript' src='" & InstallDir & ChannelDir & "/JS/WorkPlace_Option.js'></script></textarea>"
        Call WorkPlace_OptionJS
    End Select

    Response.Write "<html>"
    Response.Write "<head>"
    Response.Write "<title>刷新JS</title>"
    Response.Write "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"
    Response.Write "</head>"
    Response.Write "<body>"
    Response.Write "<br><br>"
    Response.Write "<table class='border' align=center width='380' border='0' cellpadding='0' cellspacing='0' bordercolor='#999999'>"
    Response.Write "  <tr align=center> "
    Response.Write "    <td  height='22' align='center' class='title'><font color=#ff0000>" & JSName & "JS文件已经更新！</font> "
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "  <tr>"
    Response.Write "    <td><table width='100%' border='0' cellpadding='2' cellspacing='1'>"
    Response.Write "        <tr class='tdbg'>"
    Response.Write "          <td height=100>" & JSUrl_Use
    Response.Write "          </td>"
    Response.Write "        </tr>"
    Response.Write "      </table></td>"
    Response.Write "  </tr>"
    Response.Write "  <tr class='tdbg'>"
    Response.Write "    <td height='30' align='center'>"
    Response.Write "【<a href='" & InstallDir & JSUrl & "'>返回</a>】&nbsp;&nbsp;"
    Response.Write "    </td>"
    Response.Write "  </tr>"
    Response.Write "</table>" & vbCrLf
    Response.Write "</body>"
    Response.Write "</html>"

    Call CloseConn
End Sub


Sub JobCategory_OptionJS()
    Dim JobCategoryJS, JobCategory_FileName
    Dim sqlJobCategory, rsJobCategory, strJobCategory
    sqlJobCategory = "select * from PE_JobCategory order by OrderID"
    Set rsJobCategory = Conn.Execute(sqlJobCategory)
    If rsJobCategory.BOF And rsJobCategory.EOF Then
        strJobCategory = strJobCategory & "<option value=''>-- 没有工作类别 --</option>"
    Else
        strJobCategory = strJobCategory & "<option value=''>-- 请选择工作类别 --</option>"
        Do While Not rsJobCategory.EOF
            strJobCategory = strJobCategory & "<option value='" & rsJobCategory("JobCategoryID") & "'"
            strJobCategory = strJobCategory & ">"
            If Len(rsJobCategory("JobCategoryName")) > 10 Then
                strJobCategory = strJobCategory & Left(rsJobCategory("JobCategoryName"), 10)
            Else
                strJobCategory = strJobCategory & rsJobCategory("JobCategoryName")
            End If
            strJobCategory = strJobCategory & "</option>"
            rsJobCategory.MoveNext
        Loop
    End If
    rsJobCategory.Close
    Set rsJobCategory = Nothing
    strJobCategory = "document.write(""" & strJobCategory & """);"
    JobCategory_FileName = InstallDir & "Job/JS/JobCategory_Option.js"
    Call WriteToFile(JobCategory_FileName, strJobCategory)
End Sub



Sub SubCompany_OptionJS()
    Dim SubCompanyJS, SubCompany_FileName
    Dim sqlSubCompany, rsSubCompany, strSubCompany
    sqlSubCompany = "select * from PE_SubCompany order by OrderID"
    Set rsSubCompany = Conn.Execute(sqlSubCompany)
    If rsSubCompany.BOF And rsSubCompany.EOF Then
        strSubCompany = strSubCompany & "<option value=''>-- 没有用人单位 --</option>"
    Else
        strSubCompany = strSubCompany & "<option value=''>-- 请选择用人单位 --</option>"
        Do While Not rsSubCompany.EOF
            strSubCompany = strSubCompany & "<option value='" & rsSubCompany("SubCompanyID") & "'"
            strSubCompany = strSubCompany & ">"
            If Len(rsSubCompany("SubCompanyName")) > 10 Then
                strSubCompany = strSubCompany & rsSubCompany("SubCompanyName")
            Else
                strSubCompany = strSubCompany & rsSubCompany("SubCompanyName")
            End If
            strSubCompany = strSubCompany & "</option>"
            rsSubCompany.MoveNext
        Loop
    End If
    rsSubCompany.Close
    Set rsSubCompany = Nothing
    strSubCompany = "document.write(""" & strSubCompany & """);"
    SubCompany_FileName = InstallDir & "Job/JS/SubCompany_Option.js"
    Call WriteToFile(SubCompany_FileName, strSubCompany)
End Sub



Sub WorkPlace_OptionJS()
    Dim WorkPlaceJS, WorkPlace_FileName
    Dim sqlWorkPlace, rsWorkPlace, strWorkPlace
    sqlWorkPlace = "select * from PE_WorkPlace order by OrderID"
    Set rsWorkPlace = Conn.Execute(sqlWorkPlace)
    If rsWorkPlace.BOF And rsWorkPlace.EOF Then
        strWorkPlace = strWorkPlace & "<option value=''>-- 没有工作地点 --</option>"
    Else
        strWorkPlace = strWorkPlace & "<option value=''>-- 请选择工作地点 --</option>"
        Do While Not rsWorkPlace.EOF
            strWorkPlace = strWorkPlace & "<option value='" & rsWorkPlace("WorkPlaceID") & "'"
            strWorkPlace = strWorkPlace & ">"
            If Len(rsWorkPlace("WorkPlaceName")) > 10 Then
                strWorkPlace = strWorkPlace & Left(rsWorkPlace("WorkPlaceName"), 10)
            Else
                strWorkPlace = strWorkPlace & rsWorkPlace("WorkPlaceName")
            End If
            strWorkPlace = strWorkPlace & "</option>"
            rsWorkPlace.MoveNext
        Loop
    End If
    rsWorkPlace.Close
    Set rsWorkPlace = Nothing
    strWorkPlace = "document.write(""" & strWorkPlace & """);"
    WorkPlace_FileName = InstallDir & "Job/JS/WorkPlace_Option.js"
    Call WriteToFile(WorkPlace_FileName, strWorkPlace)
End Sub


Sub mainResume()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Or AdminPurview_Channel = 3 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_Resume

    Dim rsResumeList, sql, Querysql, sqltotalPut
    Dim PositionID, SubCompanyID, ViewStatus, Education, CheckStatus
    Dim ChannelItemUnit, ChannelShortName
    Dim Num
    Num = 0
    ChannelItemUnit = "份"
    ChannelShortName = "简历"
    PositionID = PE_CLng(Trim(Request("PositionID")))
    SubCompanyID = PE_CLng(Trim(Request("SubCompanyID")))
    ViewStatus = ReplaceBadChar(Trim(Request("ViewStatus")))
    Education = PE_CLng(Trim(Request("Education")))

    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "</table>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr>"
    Response.Write "    <form name='myform' method='Post' action='Admin_Job.asp' onsubmit='return ConfirmDel();'>"
    Response.Write "     <td><table class='border' border='0' cellspacing='1' width='100%' cellpadding='0'>"
    Response.Write "          <tr class='title' height='22'> "
    Response.Write "            <td height='22' width='40' align='center'><strong>选中</strong></td>"
    Response.Write "            <td width='60' align='center'><strong>应聘者ID</strong></td>"
    Response.Write "            <td width='110' align='center'><strong>应聘者姓名</strong></td>"
    Response.Write "            <td width='125' align='center'><strong>应聘职位名称</strong></td>"
    Response.Write "            <td width='80' align='center'><strong>审核状态</strong></td>"
    Response.Write "            <td width='120' align='center' ><strong>常规管理操作</strong></td>"
    Response.Write "          </tr>"
    sql = "select R.ResumeID,R.IntervieweeName,R.Education,R.Profession,PS.PositionSupplyInfoID,PS.PositionID,PS.CheckStatus from PE_PositionSupplyInfo PS left join PE_Resume R on PS.UserName=R.UserName "
    If ViewStatus <> "" Then
        Select Case ViewStatus
        Case "WaitingResume"
            CheckStatus = 0
        Case "ReadResume"
            CheckStatus = 1
        Case "FirstPassResume"
            CheckStatus = 2
        Case "SecondPassResume"
            CheckStatus = 3
        Case "PassResume"
            CheckStatus = 4
        Case Else
            CheckStatus = 5
        End Select
        sql = sql & " where PS.CheckStatus = " & CheckStatus
        If Keyword <> "" Then
            If PositionID > 0 Then
                Querysql = Querysql & " and PS.PositionID= " & PositionID
            End If
            If SubCompanyID > 0 Then
                Querysql = Querysql & " and PS.SubCompanyID= " & SubCompanyID
            End If
            If Education > 0 Then
                Querysql = Querysql & " and R.Education= " & Education
            End If
            Querysql = Querysql & " and "
        End If
    Else
        If Keyword <> "" Then
            If PositionID = 0 Then
                If SubCompanyID = 0 Then
                    If Education = 0 Then
                        Querysql = Querysql & " where "
                    Else
                        Querysql = Querysql & "where R.Education= " & Education
                        Querysql = Querysql & " and "
                    End If
                Else
                    Querysql = Querysql & " where PS.SubCompanyID= " & SubCompanyID
                    If Education > 0 Then
                        Querysql = Querysql & " and R.Education= " & Education
                    End If
                    Querysql = Querysql & " and "
                End If
            Else
                Querysql = Querysql & " where PS.PositionID= " & PositionID
                If SubCompanyID > 0 Then
                    Querysql = Querysql & " and PS.SubCompanyID= " & SubCompanyID
                End If
                If Education > 0 Then
                    Querysql = Querysql & " and R.Education= " & Education
                End If
                Querysql = Querysql & " and "
            End If
        End If
    End If
    
    If Keyword <> "" Then
        Select Case strField
        Case "IntervieweeName"
            Querysql = Querysql & " R.IntervieweeName like '%" & Keyword & "%' "
        Case "Profession"
            Querysql = Querysql & " R.Profession like '%" & Keyword & "%' "
        Case Else
            Querysql = Querysql & " R.IntervieweeName like '%" & Keyword & "%' "
        End Select
    End If

    If ViewStatus <> "" Then
        sqltotalPut = "select Count(PS.PositionSupplyInfoID) from PE_PositionSupplyInfo PS left join PE_Resume R on PS.UserName=R.UserName where PS.CheckStatus = " & CheckStatus & Querysql
    Else
        sqltotalPut = "select Count(PS.PositionSupplyInfoID) from PE_PositionSupplyInfo PS left join PE_Resume R on PS.UserName=R.UserName " & Querysql
    End If
    totalPut = PE_CLng(Conn.Execute(sqltotalPut)(0))
    If CurrentPage < 1 Then
        CurrentPage = 1
    End If
    If (CurrentPage - 1) * MaxPerPage > totalPut Then
        If (totalPut Mod MaxPerPage) = 0 Then
            CurrentPage = totalPut \ MaxPerPage
        Else
            CurrentPage = totalPut \ MaxPerPage + 1
        End If
    End If
    If CurrentPage > 1 Then
        If ViewStatus <> "" Then
            If Keyword = "" Then
                Querysql = Querysql & " and PS.PositionSupplyInfoID < (select min(PositionSupplyInfoID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " PS.PositionSupplyInfoID from PE_PositionSupplyInfo PS left join PE_Resume R on PS.UserName=R.UserName  where PS.CheckStatus=" & CheckStatus & Querysql & " order by PS.PositionSupplyInfoID desc) as QueryResume) "
            Else
                Querysql = Querysql & " and PS.PositionSupplyInfoID < (select min(PositionSupplyInfoID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " PS.PositionSupplyInfoID from PE_PositionSupplyInfo  PS left join PE_Resume R on PS.UserName=R.UserName " & Querysql & " order by PS.PositionSupplyInfoID desc) as QueryResume) "
            End If
        Else
            If Keyword = "" Then
                Querysql = Querysql & " where PS.PositionSupplyInfoID < (select min(PositionSupplyInfoID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " PS.PositionSupplyInfoID from PE_PositionSupplyInfo  PS left join PE_Resume R on PS.UserName=R.UserName " & Querysql & " order by PS.PositionSupplyInfoID desc) as QueryResume) "
            Else
                Querysql = Querysql & " and PS.PositionSupplyInfoID < (select min(PositionSupplyInfoID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " PS.PositionSupplyInfoID from PE_PositionSupplyInfo  PS left join PE_Resume R on PS.UserName=R.UserName " & Querysql & " order by PS.PositionSupplyInfoID desc) as QueryResume) "
            End If
        End If
    End If

    sql = sql & Querysql & " order by PS.PositionSupplyInfoID desc"
    Set rsResumeList = Server.CreateObject("ADODB.Recordset")
    rsResumeList.Open sql, Conn, 1, 1
    If rsResumeList.BOF And rsResumeList.EOF Then
        totalPut = 0
        Response.Write "<tr class='tdbg'><td colspan='20' align='center'><br>没有任何求职信息！<br></td></tr>"
    Else
        Do While Not rsResumeList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.style.backgroundColor=''"" onmouseover=""this.style.backgroundColor='#BFDFFF'"">"
            Response.Write "        <td width='40' align='center'><input name='PositionSupplyInfoID' type='checkbox' onclick='unselectall()' id='PositionSupplyInfoID' value='" & rsResumeList("PositionSupplyInfoID") & "'></td>"
            Response.Write "        <td width='60' align='center'>" & rsResumeList("PositionSupplyInfoID") & "</td>"
            Response.Write "        <td width='110' align='center'><a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ResumePreview&PositionSupplyInfoID=" & rsResumeList("PositionSupplyInfoID") & "'>" & rsResumeList("IntervieweeName") & "</a></td>"
            Response.Write "      <td width='125' align='center'>" & GetPositionName(rsResumeList("PositionID")) & "</td>"
            Response.Write "      <td width='80' align='center'>" & GetCheckStatus(rsResumeList("CheckStatus")) & "</td>"
            Response.Write "    <td width='120' align='center'>&nbsp;"
            Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ResumePreview&PositionSupplyInfoID=" & rsResumeList("PositionSupplyInfoID") & "'>查看简历</a>&nbsp;"
            Response.Write "<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ModifyResume&PositionSupplyInfoID=" & rsResumeList("PositionSupplyInfoID") & "'>修改简历</a>&nbsp;"
            Response.Write "     </td>"
            Response.Write "</tr>"
            Num = Num + 1
            If Num >= MaxPerPage Then Exit Do
            rsResumeList.MoveNext
        Loop
    End If
    rsResumeList.Close
    Set rsResumeList = Nothing
    Response.Write "</table>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    Response.Write "  <tr>"
    Response.Write "    <td width='200' height='30'><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>选中本页显示的所有人才信息</td><td>"
    Response.Write "<input name='submit1' type='submit' value='删除选定的简历' onClick=""document.myform.Action.value='DelResume'"" "
    Response.Write ">"
    Response.Write "&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='Submit3' value='清空所有的简历' onClick=""document.myform.Action.value='DelAllResume'"">"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "<input name='Action' type='hidden' id='Action' value='Resume'>"
    Response.Write "  </td></tr>"
    Response.Write "</table>"
    Response.Write "</td>"
    Response.Write "</form></tr></table>"
    '分页时传递审核状态和关键字等搜索条件
    If PositionID <> 0 Then
        strFileName = strFileName & "&PositionID=" & PositionID
    End If
    If SubCompanyID <> 0 Then
        strFileName = strFileName & "&SubCompanyID=" & SubCompanyID
    End If
    If Education <> 0 Then
        strFileName = strFileName & "&Education=" & Education
    End If
    If strField <> "" Then
        strFileName = strFileName & "&Field=" & strField
    End If
    If Keyword <> "" Then
        strFileName = strFileName & "&keyword=" & Keyword
    End If
    If ViewStatus <> "" Then
        strFileName = strFileName & "&ViewStatus=" & ViewStatus
    End If
    If totalPut > 0 Then
        Response.Write ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, ChannelItemUnit & ChannelShortName & "", True)
    End If
    Response.Write "<br>"
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0' class='border'>"
    Response.Write "<form method='Get' name='SearchForm' action='" & FileName & "'>"
    Response.Write "  <tr class='tdbg'>"
    Response.Write "   <td width='80' align='right'><strong>人才搜索：</strong></td>"
    Response.Write "   <td>"
    Response.Write "<select name='PositionID'><option value='' >选择应聘职位</option>" & GetPosition_Option(1) & "</select>&nbsp;&nbsp;"
    Response.Write "<select name='SubCompanyID'><option value='' >选择应聘单位</option>" & GetSubCompany_Option(1) & "</select>&nbsp;&nbsp;"
    Response.Write "<select name='Education' size='1'>"
    Response.Write "<option value='0' selected>选择学历</option>"
    Response.Write "<option value='1'>小学</option>"
    Response.Write "<option value='2'>初中</option>"
    Response.Write "<option value='3' >高中</option>"
    Response.Write "<option value='4'>中专</option>"
    Response.Write "<option value='5'>大专</option>"
    Response.Write "<option value='6' >本科</option>"
    Response.Write "<option value='7'>硕士</option>"
    Response.Write "<option value='8'>博士</option>"
    Response.Write "<option value='9'>博士后</option>"
    Response.Write "<option value='10'>其它</option>"
    Response.Write "</select>&nbsp;&nbsp;"
    Response.Write "<select name='Field' size='1'>"
    Response.Write "<option value='IntervieweeName' selected>按应聘者名称</option>"
    Response.Write "<option value='Profession'>按所学专业</option>"
    Response.Write "</select>"
    Response.Write "<input type='text' name='keyword'  size='20' value='关键字' maxlength='50' onFocus='this.select();'>"
    Response.Write "<input type='submit' name='Submit'  value='开始搜索'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "<input name='Action' type='hidden' id='Action' value='Resume'>"
    Response.Write "</td></tr></form></table>"
    Response.Write "<br><b>说明：</b><br>&nbsp;&nbsp;&nbsp;&nbsp;在搜索中，除关键字外其它均为可选项，你选择的项越多查询结果就会越快和越准确！<br><br>"
End Sub




Sub ResumePreview()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Or AdminPurview_Channel = 3 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_Resume

    Dim rsResume, sqlResume
    Dim PositionSupplyInfoID, MyPhoto
    PositionSupplyInfoID = Request("PositionSupplyInfoID")

    If PositionSupplyInfoID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要所需的简历ID</li>"
        Exit Sub
    Else
        PositionSupplyInfoID = PE_CLng(PositionSupplyInfoID)
    End If

    sqlResume = "select PS.PositionSupplyInfoID,PS.UserName,PS.CheckStatus,PS.CheckDate,PS.SupplyDate,R.IntervieweeName,R.Nationality,R.PoliticalFeature,R.Age,R.Height,R.Weight,R.Sex,R.Photo,R.Marital,R.Health,R.BirthPlace,R.CurrentAddress,R.QQ,R.Telephone,R.MobilePhone,R.Address,R.E_mail as R_E_mail,R.GraduateSchool,R.Education,R.Profession,R.AvailableDate,R.WorkExperience,R.ProfessionalAbility,R.ForeignLanguageKind,R.ForeignLanguageLeval,R.MotherLanguageLeval,R.OtherLanguageLeval,S.SubCompanyName,S.Contacter,S.E_mail,P.PositionID,P.PositionName from ((PE_PositionSupplyInfo PS left join PE_Resume R on PS.UserName=R.UserName) left join PE_SubCompany S on PS.SubCompanyID=S.SubCompanyID) left join PE_Position P on PS.PositionID=P.PositionID where PositionSupplyInfoID=" & PositionSupplyInfoID & ""
    Set rsResume = Conn.Execute(sqlResume)
    If rsResume.BOF And rsResume.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>没有任何简历信息！</li>"
    End If
    If FoundErr = True Then
        rsResume.Close
        Set rsResume = Nothing
        Exit Sub
    End If

    If rsResume("Photo") <> "" Then
        MyPhoto = rsResume("Photo")
    Else
        MyPhoto = "UploadPhotos/j_no_photo.gif"
    End If

    If Action <> "ResumePrint" Then
        Response.Write "<br><table width='100%' border='0' align='center' cellpadding='5' cellspacing='1' class='border'>"
    Else
        Response.Write "<table width='98%' border='0' align='center' cellpadding='5' cellspacing='1' >"
        Response.Write "    <tr>"
        Response.Write "      <td height='10' align='right' colspan='2'><A href=""javascript:window.print()"">【打印简历】</A>&nbsp;&nbsp;<A href=""javascript:window.close()"">【关闭窗口】</A></td>"
        Response.Write "    </tr>"
    End If
    Response.Write "    <tr class='title'>"
    Response.Write "      <td height='22' align='center' colspan='2'><b>个 人 简 历</b></td>"
    Response.Write "    </tr>"
    Response.Write "  <tr align='center'>"
    Response.Write "    <td class='tdbg' height='100' valign='top'>"
    Response.Write "      <table width='100%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>姓名：</td>"
    Response.Write "            <td width='120'>" & rsResume("IntervieweeName")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>学历：</td>"
    Response.Write "            <td width='120'>" & GetEducation(rsResume("Education"))
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>政治面貌：</td>"
    Response.Write "            <td width='120'>" & rsResume("PoliticalFeature")
    Response.Write "</td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>年龄：</td>"
    Response.Write "            <td width='120'>" & rsResume("Age")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>身高：</td>"
    Response.Write "            <td>" & rsResume("Height")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>体重：</td>"
    Response.Write "            <td>" & rsResume("Weight")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>民族：</td>"
    Response.Write "            <td>" & rsResume("Nationality")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>婚姻状况：</td>"
    Response.Write "            <td>" & GetMarital(rsResume("Marital"))
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>健康状况：</td>"
    Response.Write "            <td>" & rsResume("Health")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right' class='tdbg5'>性别：</td>"
    Response.Write "            <td>" & GetSex(rsResume("Sex"))
    Response.Write "            <td width='120' align='right' class='tdbg5'>户口所在地：</td>"
    Response.Write "            <td>" & rsResume("BirthPlace")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right' class='tdbg5' >目前所在地：</td>"
    Response.Write "            <td>" & rsResume("CurrentAddress")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>所学专业：</td>"
    Response.Write "            <td colspan='1'>" & rsResume("Profession")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>毕业院校：</td>"
    Response.Write "            <td colspan='3'>" & rsResume("GraduateSchool")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "      <td class='tdbg'   valign='top'>"
    Response.Write "        <table width='98%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td  align='center' width='120' height='120'>"
    Response.Write "              <img id='showphoto' src='" & InstallDir & "Job/" & MyPhoto & "' width='100' height='120'>"
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "    <tr>"
    Response.Write "      <td class='tdbg' height='100' valign='top' colspan='2'>"
    Response.Write "        <table width='100%' border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>QQ号码：</td>"
    Response.Write "            <td width='180'>" & rsResume("QQ")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>手机号码：</td>"
    Response.Write "            <td width='180'>" & rsResume("MobilePhone")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>联系电话：</td>"
    Response.Write "            <td>" & rsResume("Telephone")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>E_mail：</td>"
    Response.Write "            <td>" & rsResume("R_E_mail")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>联系地址：</td>"
    Response.Write "            <td colspan='3'>" & rsResume("Address")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>所应聘职位：</td>"
    Response.Write "            <td width='120'>" & rsResume("PositionName")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>所应聘单位：</td>"
    Response.Write "            <td width='120'>" & rsResume("SubCompanyName")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>可到职时间：</td>"
    Response.Write "            <td width='120'>" & rsResume("AvailableDate")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>" & GetForeignLanguageKind(rsResume("ForeignLanguageKind")) & "：</td>"
    Response.Write "            <td >" & rsResume("ForeignLanguageLeval")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>国语：</td>"
    Response.Write "            <td>" & rsResume("MotherLanguageLeval")
    Response.Write "            </td>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>其它语言：</td>"
    Response.Write "            <td>" & rsResume("OtherLanguageLeval")
    Response.Write "            </td>"
    Response.Write "          </tr>"
    If Action <> "ResumePrint" Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td width='120' align='right'class='tdbg5'>审核状态：</td>"
        Response.Write "            <td >" & GetCheckStatus(rsResume("CheckStatus"))
        Response.Write "            </td>"
        Response.Write "            <td width='120' align='right'class='tdbg5'>审核日期：</td>"
        Response.Write "            <td>" & rsResume("CheckDate")
        Response.Write "            </td>"
        Response.Write "            <td width='120' align='right'class='tdbg5'>申请时间：</td>"
        Response.Write "            <td>" & rsResume("SupplyDate")
        Response.Write "            </td>"
        Response.Write "          </tr>"
    End If
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>工作经历|教育情况：</td>"
    Response.Write "            <td colspan='5'>" & FilterJS(rsResume("WorkExperience"))
    Response.Write "            </td>"
    Response.Write "          </tr>"
    Response.Write "          <tr class='tdbg'>"
    Response.Write "            <td width='120' align='right'class='tdbg5'>能力特长：</td>"
    Response.Write "            <td colspan='5'>" & FilterJS(rsResume("ProfessionalAbility"))
    Response.Write "            </td>"
    Response.Write "          </tr>"
    If Action <> "ResumePrint" Then
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td colspan='6' height='22'>"
        Response.Write "            </td>"
        Response.Write "          </tr>"
        Response.Write "          <tr class='tdbg'>"
        Response.Write "            <td colspan='6'>"
        Response.Write "             <form name='myform' method='post' action='Admin_Job.asp'>"
        Response.Write "                <table>"
        Response.Write "                    </tr>"
        Response.Write "                        <td width='240' class='tdbg5'><strong>审核操作：</strong></td>"
        Response.Write "                        <td>"
        Select Case rsResume("CheckStatus")
        Case 0
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='5'>已经收到&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='1'>选为初试&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='2'>通过复试一&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='3'>通过复试二&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='4'>决定录用&nbsp;&nbsp;&nbsp;"
        Case 1
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='6'>取消初试&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='2'>通过复试一&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='3'>通过复试二&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='4'>决定录用&nbsp;&nbsp;&nbsp;"
        Case 2
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='7'>取消复试一&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='3'>通过复试二&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='4'>决定录用&nbsp;&nbsp;&nbsp;"
        Case 3
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='8'>取消复试二&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='4'>决定录用&nbsp;&nbsp;&nbsp;"
        Case 5
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='1'>选为初试&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='2'>通过复试一&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='3'>通过复试二&nbsp;&nbsp;&nbsp;"
            Response.Write "   <input name='ResumeCheckStatus' type='radio'  value='4'>决定录用&nbsp;&nbsp;&nbsp;"
        End Select
        Response.Write "                        </td>"
        Response.Write "                    </tr>"
        Response.Write "                    <tr>"
        Response.Write "                        <td width='240'  class='tdbg5'><strong>发送面试通知选项：</strong></td>" & vbCrLf
        Response.Write "                        <td>" & vbCrLf
        Response.Write "   <input name='SendType' type='radio'  value='1'>短消息通知&nbsp;&nbsp;&nbsp;"
        Response.Write "   <input name='SendType' type='radio'  value='2'>E_mail通知&nbsp;&nbsp;&nbsp;"
        Response.Write "   <input name='SendType' type='radio'  value='3'>两者同时&nbsp;&nbsp;&nbsp;"
        Response.Write "                        </td>" & vbCrLf
        Response.Write "                    </tr>"
        Response.Write "                    <tr>"
        Response.Write "                        <td width='240'  class='tdbg5'><strong>站内短信|Email通知内容：</strong>&nbsp;&nbsp;<br>不支持HTML代码,若为空时则不发送短信|E_mail通知。</td>" & vbCrLf
        Response.Write "                        <td><textarea name='EmailOfReject' cols='66' rows='4'></textarea></td>" & vbCrLf
        Response.Write "                    </tr>"

        Response.Write "                    <tr>"
        Response.Write "                        <td align='center' colspan='6'>"
        Response.Write "                    <input name='PositionSupplyInfoID' type='hidden'  id='PositionSupplyInfoID' value='" & rsResume("PositionSupplyInfoID") & "'>"
        Response.Write "                    <input name='SubCompanyName' type='hidden'  id='SubCompanyName' value='" & rsResume("SubCompanyName") & "'>"
        Response.Write "                    <input name='Contacter' type='hidden'  id='Contacter' value='" & rsResume("Contacter") & "'>"
        Response.Write "                    <input name='UserName' type='hidden'  id='UserName' value='" & rsResume("UserName") & "'>"
        Response.Write "                    <input name='R_E_mail' type='hidden'  id='R_E_mail' value='" & rsResume("R_E_mail") & "'>"
        Response.Write "                    <input name='E_mail' type='hidden'  id='E_mail' value='" & rsResume("E_mail") & "'>"
        Response.Write "                    <input name='Action' type='hidden'  id='Action' value='SetCheckStatus'>"
        Response.Write "                    <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
        Response.Write "                    <input name='send' type='submit'  id='send' value=' 确定 ' style='cursor:hand;'>&nbsp;&nbsp;"
        Response.Write "                        </td>" & vbCrLf
        Response.Write "                    </tr>"
        Response.Write "                </table>"
        Response.Write "             </form>"
        Response.Write "            </td>"
        Response.Write "          </tr>"
    End If
    Response.Write "        </table>"
    Response.Write "      </td>"
    Response.Write "    </tr>"
    Response.Write "  </table>"
    If Action <> "ResumePrint" Then
        Response.Write "  <p align='center'>"
        Response.Write "<form method='POST' name='form1' onSubmit='return ConfirmDel();' action='Admin_Job.asp' target='_self'>"
        Response.Write "   <input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
        Response.Write "   <input name='Action' type='hidden'  id='Action' value='DeleteResume'>"
        Response.Write "   <input name='PositionSupplyInfoID' type='hidden'  id='PositionSupplyInfoID' value=" & rsResume("PositionSupplyInfoID") & ">"
        Response.Write "   <input name='UserName' type='hidden'  id='UserName' value=" & rsResume("UserName") & ">"
        Response.Write "<input name='DeleteResume' type='submit' value='删除该简历' onClick=""document.form1.Action.value='DeleteResume'"" "
        Response.Write ">&nbsp;&nbsp;"
        Response.Write "<input name='DelResumeAndPositionSupply' type='submit' value='删除该应聘者' onClick=""document.form1.Action.value='DelResumeAndPositionSupply'"" "
        Response.Write ">&nbsp;&nbsp;"
        Response.Write "   <input name='ResumePreview' type='button'  id='ResumePreview' value=' 返回 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume';"" style='cursor:hand;'>"
        Response.Write "&nbsp;&nbsp;<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ResumePrint&PositionSupplyInfoID=" & rsResume("PositionSupplyInfoID") & "' target='_blank'> <font color='blue'>【打印】</font></a>"
        Response.Write "</form>"
        Response.Write "</p>"
        Response.Write "<br><b><font color=red>注意：</font></b><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>删除该简历---只是删除所申请的该职位的信息，应聘者的个人信息并没有被删除掉！</font><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=red>删除该应聘者---除了删除所申请的该职位的信息外，还会删除该应聘者的个人信息及所申请的其它职位信息！</font><br><br>"
    End If
End Sub


Sub ShowJS_Resume()
    Response.Write "<script language = 'JavaScript'>" & vbCrLf
    Response.Write "function unselectall()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.chkAll.Checked){" & vbCrLf
    Response.Write "     document.myform.chkAll.Checked=document.myform.chkAll.Checked&0;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckAll(form){" & vbCrLf
    Response.Write "  for (var i=0;i<form.elements.length;i++){" & vbCrLf
    Response.Write "    var e = form.elements[i];" & vbCrLf
    Response.Write "    if (e.Name != 'chkAll'&&e.disabled==false)" & vbCrLf
    Response.Write "       e.checked = form.chkAll.checked;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function ConfirmDel(){" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelResume'){"
    Response.Write "     if (confirm('确定要删除所选中的简历吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.Action.value=='DelAllResume'){"
    Response.Write "     if (confirm('确定要删除所有的简历吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.form1.Action.value=='DeleteResume'){"
    Response.Write "     if (confirm('确定要删除该简历吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.form1.Action.value=='DelResumeAndPositionSupply'){"
    Response.Write "     if (confirm('确定要删除该应聘者吗？'))" & vbCrLf
    Response.Write "         return true;" & vbCrLf
    Response.Write "     else" & vbCrLf
    Response.Write "          return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function CheckForm()" & vbCrLf
    Response.Write "{" & vbCrLf
    Response.Write "  if (document.myform.IntervieweeName.value==''){" & vbCrLf
    Response.Write "    alert('姓名不能为空！');" & vbCrLf
    Response.Write "     ShowTabs(0);" & vbCrLf
    Response.Write "    document.myform.IntervieweeName.focus();" & vbCrLf
    Response.Write "    return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  var CurrentMode=editorWorkExperience.CurrentMode;" & vbCrLf
    Response.Write "  if (CurrentMode==0){" & vbCrLf
    Response.Write "    document.myform.WorkExperience.value=editorWorkExperience.HtmlEdit.document.body.innerHTML; " & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else if(CurrentMode==1){" & vbCrLf
    Response.Write "    document.myform.WorkExperience.value=editorWorkExperience.HtmlEdit.document.body.innerText;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.WorkExperience.value==''){" & vbCrLf
    Response.Write "     alert('工作经历不能为空！');" & vbCrLf
    Response.Write "     ShowTabs(1);" & vbCrLf
    Response.Write "     editorWorkExperience.HtmlEdit.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  var CurrentMode=editorProfessionalAbility.CurrentMode;" & vbCrLf
    Response.Write "  if (CurrentMode==0){" & vbCrLf
    Response.Write "    document.myform.ProfessionalAbility.value=editorProfessionalAbility.HtmlEdit.document.body.innerHTML; " & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  else if(CurrentMode==1){" & vbCrLf
    Response.Write "    document.myform.ProfessionalAbility.value=editorProfessionalAbility.HtmlEdit.document.body.innerText;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  if (document.myform.ProfessionalAbility.value==''){" & vbCrLf
    Response.Write "     alert('能力特长不能为空！');" & vbCrLf
    Response.Write "     ShowTabs(1);" & vbCrLf
    Response.Write "     editorProfessionalAbility.HtmlEdit.focus();" & vbCrLf
    Response.Write "     return false;" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "  return true;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf
End Sub


Sub ModifyResume()
    '检查管理员操作权限
    If AdminPurview = 1 Or AdminPurview_Channel = 1 Or AdminPurview_Channel = 3 Then
        PurviewPassed = True
    Else
        PurviewPassed = False
    End If
    If PurviewPassed = False Then
        ErrMsg = "<br><p align='center'><font color='red'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        FoundErr = True
        Exit Sub
    End If

    Call ShowJS_Resume
    Dim rsResume, sqlResume
    Dim PositionSupplyInfoID
    PositionSupplyInfoID = Trim(Request("PositionSupplyInfoID"))
    
    If PositionSupplyInfoID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要所需的简历ID</li>"
        Exit Sub
    Else
        PositionSupplyInfoID = PE_CLng(PositionSupplyInfoID)
    End If

    sqlResume = "select PS.PositionSupplyInfoID,PS.PositionID,PS.SubCompanyID,PS.CheckStatus,PS.CheckDate,PS.SupplyDate,R.IntervieweeName,R.Nationality,R.PoliticalFeature,R.Age,R.Height,R.Weight,R.Sex,R.Photo,R.Marital,R.Health,R.BirthPlace,R.CurrentAddress,R.QQ,R.Telephone,R.MobilePhone,R.Address,R.E_mail,R.GraduateSchool,R.Education,R.Profession,R.AvailableDate,R.WorkExperience,R.ProfessionalAbility,R.ForeignLanguageKind,R.ForeignLanguageLeval,R.MotherLanguageLeval,R.OtherLanguageLeval,S.SubCompanyName,P.PositionName from ((PE_PositionSupplyInfo PS left join PE_Resume R on PS.UserName=R.UserName) left join PE_SubCompany S on PS.SubCompanyID=S.SubCompanyID) left join PE_Position P on PS.PositionID=P.PositionID where PositionSupplyInfoID=" & PositionSupplyInfoID & ""
    Set rsResume = Conn.Execute(sqlResume)
    If rsResume.BOF And rsResume.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>没有任何简历信息！</li>"
    End If
    If FoundErr = True Then
        rsResume.Close
        Set rsResume = Nothing
        Exit Sub
    End If
    Response.Write "<script language='javascript'>" & vbCrLf
    Response.Write "var tID=0;" & vbCrLf
    Response.Write "function ShowTabs(ID){" & vbCrLf
    Response.Write "  if(ID!=tID){" & vbCrLf
    Response.Write "    TabTitle[tID].className='title5';" & vbCrLf
    Response.Write "    TabTitle[ID].className='title6';" & vbCrLf
    Response.Write "    Tabs[tID].style.display='none';" & vbCrLf
    Response.Write "    Tabs[ID].style.display='';" & vbCrLf
    Response.Write "    tID=ID;" & vbCrLf
    Response.Write "    if(ID==1){" & vbCrLf
    Response.Write "      editorWorkExperience.yToolbarsCss();" & vbCrLf
    Response.Write "      editorProfessionalAbility.yToolbarsCss();" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "  }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "</script>" & vbCrLf

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume'>人才管理</a>&nbsp;&gt;&gt;&nbsp;修改简历</td></tr></table>"
    Response.Write "<form method='post' action='Admin_Job.asp' name='myform' onSubmit='return CheckForm();'>"
    Response.Write "<table width='100%'  border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
    Response.Write "        <tr align='center'>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title6' onclick='ShowTabs(0)'>基本信息</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(1)'>经验能力</td>" & vbCrLf
    Response.Write "            <td id='TabTitle' class='title5' onclick='ShowTabs(2)'>联系信息</td>" & vbCrLf
    Response.Write "            <td>&nbsp;</td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf

    Response.Write "<table width='100%'  border='0' align='center' cellpadding='5' cellspacing='1' class='border'><tr class='tdbg'><td height='100' valign='top'>" & vbCrLf
    Response.Write "  <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>" & vbCrLf
    Response.Write "  <tbody id='Tabs' style='display:'>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>姓    名：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='IntervieweeName' id='IntervieweeName' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("IntervieweeName")) & "'> <font color='#FF0000'>*</font></td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>学    历：</td>" & vbCrLf
    Response.Write "        <td width='38%'>" & vbCrLf
    Response.Write "            <select name='Education' size='1'>" & vbCrLf
    Response.Write "               <option value='" & rsResume("Education") & "' selected>" & GetEducation(rsResume("Education")) & "</option>" & vbCrLf
    Response.Write "               <option value='1'>----  小学 ---</option>" & vbCrLf
    Response.Write "               <option value='2'>----  初中 ---</option>" & vbCrLf
    Response.Write "               <option value='3' >----  高中 ---</option>" & vbCrLf
    Response.Write "               <option value='4'>----  中专 ---</option>" & vbCrLf
    Response.Write "               <option value='5'>----  大专 ---</option>" & vbCrLf
    Response.Write "               <option value='6' >----  本科 ---</option>" & vbCrLf
    Response.Write "               <option value='7'>----  硕士 ---</option>" & vbCrLf
    Response.Write "               <option value='8'>----  博士 ---</option>" & vbCrLf
    Response.Write "               <option value='9'>----  博士后 ---</option>" & vbCrLf
    Response.Write "               <option value='10'>----  其它 ---</option>" & vbCrLf
    Response.Write "            </select>" & vbCrLf
    Response.Write "        </td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>民    族：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='Nationality' id='Nationality' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("Nationality")) & "'></td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>政治面貌：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='PoliticalFeature' id='PoliticalFeature' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("PoliticalFeature")) & "'></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>年    龄：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='Age' id='Age' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("Age")) & "'></td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>性    别：</td>" & vbCrLf
    Response.Write "        <td width='38%'>" & vbCrLf
    Response.Write "            <select name='Sex' size='1'>"
    Response.Write "               <option value='" & rsResume("Sex") & "' selected>" & GetSex(rsResume("Sex")) & "</option>" & vbCrLf
    Response.Write "               <option value='1'>----    男  -----</option>" & vbCrLf
    Response.Write "               <option value='2'>----   女  -----</option>" & vbCrLf
    Response.Write "               <option value='3' >----   保密  -----</option>" & vbCrLf
    Response.Write "             </select>" & vbCrLf
    Response.Write "        </td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>身    高：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='Height' id='Height' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("Height")) & "'></td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>体    重：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='Weight' id='Weight' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("Weight")) & "'></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>婚姻状况：</td>" & vbCrLf
    Response.Write "        <td width='38%'>" & vbCrLf
    Response.Write "            <select name='Marital' size='1'>" & vbCrLf
    Response.Write "               <option value='" & rsResume("Marital") & "' selected>" & GetMarital(rsResume("Marital")) & "</option>" & vbCrLf
    Response.Write "               <option value='1'>----  未婚  -----</option>" & vbCrLf
    Response.Write "               <option value='2'>----  已婚  -----</option>" & vbCrLf
    Response.Write "               <option value='3' >----  离异  -----</option>" & vbCrLf
    Response.Write "               <option value='4'>----  其它  -----</option>" & vbCrLf
    Response.Write "            </select>" & vbCrLf
    Response.Write "        </td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>健康状况：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='Health' id='Health' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("Health")) & "'></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>外语语种：</td>" & vbCrLf
    Response.Write "        <td width='38%'>" & vbCrLf
    Response.Write "            <select name='ForeignLanguageKind' size='1'>" & vbCrLf
    Response.Write "               <option value='" & rsResume("ForeignLanguageKind") & "' selected>" & GetForeignLanguageKind(rsResume("ForeignLanguageKind")) & "</option>" & vbCrLf
    Response.Write "               <option value='1'>---  英语 ---</option>" & vbCrLf
    Response.Write "               <option value='2'>---  日语 ---</option>" & vbCrLf
    Response.Write "               <option value='3'>--- 德语 ---</option>" & vbCrLf
    Response.Write "               <option value='4'>---  法语 ---</option>" & vbCrLf
    Response.Write "               <option value='5'>---  西班牙语 --</option>" & vbCrLf
    Response.Write "            </select>" & vbCrLf
    Response.Write "        </td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>外语水平：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='ForeignLanguageLeval' id='ForeignLanguageLeval' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("ForeignLanguageLeval")) & "'></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>国语水平：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='MotherLanguageLeval' id='MotherLanguageLeval' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("MotherLanguageLeval")) & "'></td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>其它语言：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='OtherLanguageLeval' id='OtherLanguageLeval' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("OtherLanguageLeval")) & "'></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>户口所在地：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='BirthPlace' id='BirthPlace' size='36' maxlength='50' value='" & PE_HTMLEncode(rsResume("BirthPlace")) & "'></td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>目前所在地：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='CurrentAddress' id='CurrentAddress' size='36' maxlength='50' value='" & PE_HTMLEncode(rsResume("CurrentAddress")) & "'></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>毕业院校：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='GraduateSchool' id='GraduateSchool' size='36' maxlength='50' value='" & PE_HTMLEncode(rsResume("GraduateSchool")) & "'></td>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>所学专业：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='Profession' id='Profession' size='36' maxlength='50' value='" & PE_HTMLEncode(rsResume("Profession")) & "'></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "    <tr class='tdbg'>" & vbCrLf
    Response.Write "        <td width='12%' class='tdbg5' align='right'>我的相片：</td>" & vbCrLf
    Response.Write "        <td width='38%'><input name='MyPhoto' type='text' size='36' value='" & PE_HTMLEncode(rsResume("Photo")) & "'></strong></td><td colspan=2><iframe style='top:2px' ID='uploadMyPhoto' src='Upload.asp?ChannelID=997&dialogtype=Intervieweepic' frameborder=0 scrolling=no width='350' height='25'></iframe></td>" & vbCrLf
    Response.Write "    </tr>" & vbCrLf
    Response.Write "  </tbody>" & vbCrLf

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='left' valign='top' width='12%'>工作经历|教育情况：</td>" & vbCrLf
    Response.Write "                       <td colspan='5'>" & vbCrLf
    Response.Write "                           <textarea name='WorkExperience' id='WorkExperience' style='display:none' >" & Server.HTMLEncode(FilterJS(rsResume("WorkExperience"))) & "</textarea>" & vbCrLf
    Response.Write "                           <iframe ID='editorWorkExperience' src='../editor.asp?tContentid=WorkExperience&ShowType=3&ChannelID=" & ChannelID & "' frameborder='1' scrolling='no' width='678' height='200' ></iframe>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='left' valign='top' >能力特长：</td>" & vbCrLf
    Response.Write "                        <td colspan='5'>" & vbCrLf
    Response.Write "                            <textarea name='ProfessionalAbility' id='ProfessionalAbility' style='display:none' >" & Server.HTMLEncode(FilterJS(rsResume("ProfessionalAbility"))) & "</textarea>" & vbCrLf
    Response.Write "                            <iframe ID='editorProfessionalAbility' src='../editor.asp?tContentid=ProfessionalAbility&ShowType=3&ChannelID=" & ChannelID & "' frameborder='1' scrolling='no' width='678' height='200' ></iframe>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                </tbody>" & vbCrLf

    Response.Write "                  <tbody id='Tabs' style='display:none'>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >联系电话：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Telephone' id='Telephone' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("Telephone")) & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >手机号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='MobilePhone' id='MobilePhone' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("MobilePhone")) & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >E_mail：</td>" & vbCrLf
    Response.Write "                        <td><input name='E_mail' id='E_mail' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("E_mail")) & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='QQ' id='QQ' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("QQ")) & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>联系地址：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Address' id='Address' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("Address")) & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>可到职时间：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='AvailableDate' id='AvailableDate' size='18' maxlength='20' value='" & PE_HTMLEncode(rsResume("AvailableDate")) & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                  </tbody>" & vbCrLf

    Response.Write "</table>" & vbCrLf
    Response.Write "</td></tr></table>" & vbCrLf
    Response.Write "<table width='100%'  border='0' align='center' cellpadding='5' cellspacing='1'><tr align='center'><td height='40'>" & vbCrLf
    Response.Write "   <input name='PositionSupplyInfoID' type='hidden' id='PositionSupplyInfoID' value='" & rsResume("PositionSupplyInfoID") & "'>"
    Response.Write "   <input name='PositionID' type='hidden' id='PositionID' value='" & rsResume("PositionID") & "'>"
    Response.Write "<input name='ChannelID' type='hidden' id='ChannelID' value='" & ChannelID & "'>"
    Response.Write "   <input name='Action' type='hidden' id='Action' value='SaveModifyResume'>"
    Response.Write "   <input name='ModifyResume' type='submit'  id='ModifyResume' value=' 修改 '  style='cursor:hand;'>&nbsp;&nbsp;"
    Response.Write "   <input name='ResumePreview' type='button'  id='ResumePreview' value=' 返回 ' onClick=""window.location.href='Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume';"" style='cursor:hand;'>"
    Response.Write "</td></tr></table>" & vbCrLf
    Response.Write "</form>" & vbCrLf
End Sub


Sub SaveModifyResume()
    Dim PositionSupplyInfoID, PositionID, SubCompanyID, WorkPlaceID, CheckStatus, CheckDate, SupplyDate
    Dim IntervieweeName, Nationality, PoliticalFeature, Age, Height, Weight, Sex, Photo, Marital, Health, BirthPlace, CurrentAddress, QQ, Telephone, MobilePhone, Address, E_mail, GraduateSchool, Education, Profession, AvailableDate, WorkExperience, ProfessionalAbility, ForeignLanguageKind, ForeignLanguageLeval, MotherLanguageLeval, OtherLanguageLeval
    Dim rs, sql

    PositionSupplyInfoID = PE_CLng(Request.Form("PositionSupplyInfoID"))
    PositionID = Request.Form("PositionID")
    SubCompanyID = GetSubCompanyID(PositionID)
    WorkPlaceID = GetWorkPlaceID(PositionID)
    CheckStatus = PE_CLng(Request.Form("CheckStatus"))
    CheckDate = Trim(Request.Form("CheckDate"))
    SupplyDate = Trim(Request.Form("SupplyDate"))
    IntervieweeName = Trim(Request.Form("IntervieweeName"))
    Nationality = PE_HTMLEncode(Trim(Request.Form("Nationality")))
    PoliticalFeature = PE_HTMLEncode(Trim(Request.Form("PoliticalFeature")))
    Age = PE_CLng(Request.Form("Age"))
    Height = PE_HTMLEncode(Trim(Request.Form("Height")))
    Weight = PE_HTMLEncode(Trim(Request.Form("Weight")))
    Sex = PE_CLng(Trim(Request.Form("Sex")))
    Photo = PE_HTMLEncode(Trim(Request.Form("MyPhoto")))
    Marital = PE_CLng(Trim(Request.Form("Marital")))
    Health = PE_HTMLEncode(Trim(Request.Form("Health")))
    BirthPlace = PE_HTMLEncode(Trim(Request.Form("BirthPlace")))
    CurrentAddress = PE_HTMLEncode(Trim(Request.Form("CurrentAddress")))
    QQ = PE_HTMLEncode(Trim(Request.Form("QQ")))
    Telephone = PE_HTMLEncode(Trim(Request.Form("Telephone")))
    MobilePhone = PE_HTMLEncode(Trim(Request.Form("MobilePhone")))
    Address = PE_HTMLEncode(Trim(Request.Form("Address")))
    E_mail = Trim(Request.Form("E_mail"))
    GraduateSchool = PE_HTMLEncode(Trim(Request.Form("GraduateSchool")))
    Education = PE_CLng(Trim(Request.Form("Education")))
    Profession = PE_HTMLEncode(Trim(Request.Form("Profession")))
    AvailableDate = PE_CDate(Trim(Request.Form("AvailableDate")))
    WorkExperience = ReplaceBadUrl(Trim(Request.Form("WorkExperience")))
    ProfessionalAbility = ReplaceBadUrl(Trim(Request.Form("ProfessionalAbility")))
    ForeignLanguageKind = PE_CLng(Trim(Request.Form("ForeignLanguageKind")))
    ForeignLanguageLeval = PE_HTMLEncode(Trim(Request.Form("ForeignLanguageLeval")))
    MotherLanguageLeval = PE_HTMLEncode(Trim(Request.Form("MotherLanguageLeval")))
    OtherLanguageLeval = PE_HTMLEncode(Trim(Request.Form("OtherLanguageLeval")))
    If PositionSupplyInfoID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的简历ID！</li>"
        Exit Sub
    End If
    If IntervieweeName = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>姓名不能为空！</li>"
    Else
        IntervieweeName = ReplaceBadChar(IntervieweeName)
    End If

    If PositionID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请选择所应聘职位！</li>"
    Else
        PositionID = PE_CLng(PositionID)
    End If
    If SubCompanyID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请选择所应聘职位！</li>"
    Else
        SubCompanyID = PE_CLng(SubCompanyID)
    End If
    If WorkPlaceID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请选择所应聘职位！</li>"
    Else
        WorkPlaceID = PE_CLng(WorkPlaceID)
    End If
    If CheckDate = "" Then
        CheckDate = Date
    Else
        CheckDate = CDate(CheckDate)
    End If
    If SupplyDate = "" Then
        SupplyDate = Date
    Else
        SupplyDate = CDate(SupplyDate)
    End If

    If E_mail <> "" Then
        If IsValidEmail(E_mail) = False Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>请输入正确的联系邮箱地址！</li>"
        End If
    End If

    If FoundErr = True Then
        Exit Sub
    End If

    sql = "select PS.PositionSupplyInfoID,PS.PositionID,PS.SubCompanyID,PS.WorkPlaceID,PS.CheckStatus,PS.CheckDate,PS.SupplyDate,R.IntervieweeName,R.Nationality,R.PoliticalFeature,R.Age,R.Height,R.Weight,R.Sex,R.Photo,R.Marital,R.Health,R.BirthPlace,R.CurrentAddress,R.QQ,R.Telephone,R.MobilePhone,R.Address,R.E_mail,R.GraduateSchool,R.Education,R.Profession,R.AvailableDate,R.WorkExperience,R.ProfessionalAbility,R.ForeignLanguageKind,R.ForeignLanguageLeval,R.MotherLanguageLeval,R.OtherLanguageLeval from PE_PositionSupplyInfo PS left join PE_Resume R on PS.UserName=R.UserName where PositionSupplyInfoID=" & PositionSupplyInfoID & ""
    Set rs = Server.CreateObject("Adodb.RecordSet")
    rs.Open sql, Conn, 1, 3
    If rs.BOF And rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的简历，可能已经被删除！</li>"
        rs.Close
        Set rs = Nothing
    Else
        rs("PositionID") = PositionID
        rs("SubCompanyID") = SubCompanyID
        rs("WorkPlaceID") = WorkPlaceID
        rs("CheckDate") = CheckDate
        rs("SupplyDate") = SupplyDate
        rs.Update
        rs("IntervieweeName") = IntervieweeName
        rs("Nationality") = Nationality
        rs("PoliticalFeature") = PoliticalFeature
        rs("Age") = Age
        rs("Height") = Height
        rs("Weight") = Weight
        rs("Sex") = Sex
        rs("Photo") = Photo
        rs("Marital") = Marital
        rs("Health") = Health
        rs("BirthPlace") = BirthPlace
        rs("CurrentAddress") = CurrentAddress
        rs("QQ") = QQ
        rs("Telephone") = Telephone
        rs("MobilePhone") = MobilePhone
        rs("Address") = Address
        rs("E_mail") = E_mail
        rs("GraduateSchool") = GraduateSchool
        rs("Education") = Education
        rs("Profession") = Profession
        rs("AvailableDate") = AvailableDate
        rs("WorkExperience") = WorkExperience
        rs("ProfessionalAbility") = ProfessionalAbility
        rs("ForeignLanguageKind") = ForeignLanguageKind
        rs("ForeignLanguageLeval") = ForeignLanguageLeval
        rs("MotherLanguageLeval") = MotherLanguageLeval
        rs("OtherLanguageLeval") = OtherLanguageLeval
        rs.Update
        rs.Close
        Set rs = Nothing
        Call CloseConn
        Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume"
    End If
End Sub


Sub DeleteResume()
    Dim PositionSupplyInfoID, UserName, Action, rs, sql
    PositionSupplyInfoID = Trim(Request("PositionSupplyInfoID"))
    UserName = ReplaceBadChar(Trim(Request("UserName")))
    Action = Trim(Request("Action"))
    If IsValidID(PositionSupplyInfoID) = False Then
        PositionSupplyInfoID = ""
    End If
    
    If PositionSupplyInfoID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>未找到任何简历信息！</li>"
        Exit Sub
    End If

    If Action = "DelResume" Or Action = "DeleteResume" Or Action = "DelResumeAndPositionSupply" Then
        sql = "select PositionSupplyInfoID from PE_PositionSupplyInfo where "
        If Action = "DelResumeAndPositionSupply" Then
            sql = sql & " UserName ='" & UserName & "' order by PositionSupplyInfoID"
        Else
            sql = sql & " PositionSupplyInfoID"
            If InStr(PositionSupplyInfoID, ",") > 0 Then
                sql = sql & " in (" & PositionSupplyInfoID & ") order by PositionSupplyInfoID"
            Else
                sql = sql & " = " & PositionSupplyInfoID
            End If
        End If
        Set rs = Server.CreateObject("ADODB.RecordSet")
        rs.Open sql, Conn, 1, 3
        Do While Not rs.EOF
             Conn.Execute ("delete from PE_PositionSupplyInfo Where PositionSupplyInfoID=" & rs("PositionSupplyInfoID") & "")
             rs.MoveNext
        Loop
        rs.Close
        Set rs = Nothing
    Else
        If Action = "DelAllResume" Then
            Conn.Execute ("delete from PE_PositionSupplyInfo")
        End If
    End If
    If Action = "DelResumeAndPositionSupply" Then
        Conn.Execute ("delete from PE_Resume where UserName='" & UserName & "'")
    End If
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=Resume"
End Sub


Function GetPositionName(PositionID)
    Dim MyPositionID
    Dim rs, sql
    If PositionID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>未找到所需参数！</li>"
        Exit Function
    Else
        MyPositionID = PE_CLng(PositionID)
    End If
    sql = "select PositionName from PE_Position where PositionID =" & MyPositionID
    Set rs = Conn.Execute(sql)
    If rs.BOF And rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到该职位或已经被删除！</li>"
        Exit Function
    End If
    GetPositionName = rs("PositionName")
End Function



Function GetSubCompanyID(PositionID)
    Dim MyPositionID
    Dim rs, sql
    If PositionID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请先选择职位！</li>"
        Exit Function
    Else
        MyPositionID = PE_CLng(PositionID)
    End If

    sql = "select SubCompanyID from PE_Position where PositionID =" & MyPositionID
    Set rs = Server.CreateObject("ADODB.RecordSet")
    rs.Open sql, Conn, 1, 3
    Set rs = Conn.Execute(sql)
    If rs.BOF And rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到该职位或已经被删除！</li>"
        Exit Function
    End If
    GetSubCompanyID = rs("SubCompanyID")
End Function


Function GetWorkPlaceID(PositionID)
    Dim MyPositionID
    Dim rs, sql
    If PositionID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请先选择职位！</li>"
        Exit Function
    Else
        MyPositionID = PE_CLng(PositionID)
    End If

    sql = "select WorkPlaceID from PE_Position where PositionID =" & MyPositionID
    Set rs = Server.CreateObject("ADODB.RecordSet")
    rs.Open sql, Conn, 1, 3
    Set rs = Conn.Execute(sql)
    If rs.BOF And rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到该职位或已经被删除！</li>"
        Exit Function
    End If
    GetWorkPlaceID = rs("WorkPlaceID")
End Function


Function GetCheckStatus(CheckStatus)
    Dim strCheckStatus
    Select Case CheckStatus
    Case 0
        strCheckStatus = "还未查看"
    Case 1
        strCheckStatus = "选为初试"
    Case 2
        strCheckStatus = "通过复试一"
    Case 3
        strCheckStatus = "通过复试二"
    Case 4
        strCheckStatus = "已经录用"
    Case Else
        strCheckStatus = "已经收到"
    End Select
    GetCheckStatus = strCheckStatus
End Function


Sub SetCheckStatus()
    Dim CheckStatus, CheckDate, PositionSupplyInfoID
    Dim SubCompanyName, Contacter, UserName, R_E_mail, E_mail, EmailOfReject, SendType, ResumeCheckStatus
    Dim Subject, PE_Mail
    Dim rs, sql
    Dim rsSendMsg, sqlSendMsg
    Dim strE_mail, strMessage

    PositionSupplyInfoID = PE_CLng(Request("PositionSupplyInfoID"))
    CheckDate = Date
    SubCompanyName = Trim(Request("SubCompanyName"))
    Contacter = Trim(Request("Contacter"))
    UserName = ReplaceBadChar(Trim(Request("UserName")))
    R_E_mail = Trim(Request("R_E_mail"))
    E_mail = Trim(Request("E_mail"))
    SendType = PE_CLng(Request("SendType"))
    EmailOfReject = ReplaceBadChar(Trim(Request("EmailOfReject")))
    ResumeCheckStatus = PE_CLng(Trim(Request("ResumeCheckStatus")))

    Subject = "To:" & UserName & "  From:" & SubCompanyName
    If PositionSupplyInfoID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>未找到所需参数！</li>"
        Exit Sub
    End If
    sql = "select CheckDate from PE_PositionSupplyInfo where PositionSupplyInfoID=" & PositionSupplyInfoID
    Set rs = Server.CreateObject("Adodb.RecordSet")
    rs.Open sql, Conn, 1, 3
    If rs.BOF And rs.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的简历，可能已经被删除！</li>"
        rs.Close
        Set rs = Nothing
    Else
        rs("CheckDate") = CDate(CheckDate)
        rs.Update
        rs.Close
        Set rs = Nothing
    End If

    Select Case SendType
    Case 1
        strE_mail = False
        strMessage = True
    Case 2
        strE_mail = True
        strMessage = False
    Case 3
        strE_mail = True
        strMessage = True
    Case Else
        strE_mail = False
        strMessage = False
    End Select
    '发送邮件
    If EmailOfReject <> "" And strE_mail Then
        Set PE_Mail = New SendMail
        If ErrMsg <> "" Then
            FoundErr = True
            Set PE_Mail = Nothing
            Exit Sub
        End If
        If IsValidEmail(R_E_mail) = True And IsValidEmail(E_mail) = True Then
            ErrMsg = PE_Mail.Send(R_E_mail, UserName, Subject, EmailOfReject, Contacter, E_mail, 3)
            'Response.Write "<li>邮件发送成功！"
        Else
            Response.Write "<li>未发送邮件发送未成功（邮件地址错误）。</li>"
        End If
        Set PE_Mail = Nothing
    End If
    '发送短消息
    If EmailOfReject <> "" And strMessage Then
        sqlSendMsg = "select UserName from PE_User where UserName ='" & UserName & "' order by UserID desc"
        Set rsSendMsg = Conn.Execute(sqlSendMsg)
        If rsSendMsg.BOF And rsSendMsg.EOF Then
            FoundErr = True
            ErrMsg = ErrMsg & "<li>未找到该会员，故未能成功发送短消息！</li>"
        Else
            Conn.Execute ("insert into PE_Message (Incept,Sender,Title,Content,SendTime,Flag,IsSend) values ('" & rsSendMsg("UserName") & "','" & AdminName & "','" & Subject & "','" & EmailOfReject & "'," & PE_Now & ",0,1)")
            Conn.Execute ("update PE_User set UnreadMsg=UnreadMsg+1 where UserName='" & rsSendMsg("UserName") & "'")
        End If
        rsSendMsg.Close
        Set rsSendMsg = Nothing
    End If

    Select Case ResumeCheckStatus
    Case "1"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=1 where PositionSupplyInfoID=" & PositionSupplyInfoID & "")
    Case "2"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=2 where PositionSupplyInfoID=" & PositionSupplyInfoID)
    Case "3"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=3 where PositionSupplyInfoID=" & PositionSupplyInfoID)
    Case "4"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=4 where PositionSupplyInfoID=" & PositionSupplyInfoID)
    Case "5"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=5 where PositionSupplyInfoID=" & PositionSupplyInfoID)
    Case "6"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=5 where PositionSupplyInfoID=" & PositionSupplyInfoID)
    Case "7"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=5 where PositionSupplyInfoID=" & PositionSupplyInfoID)
    Case "8"
        Conn.Execute ("update PE_PositionSupplyInfo Set CheckStatus=5 where PositionSupplyInfoID=" & PositionSupplyInfoID)
    End Select
    Call CloseConn
    Response.Redirect "Admin_Job.asp?ChannelID=" & ChannelID & "&Action=ResumePreview&PositionSupplyInfoID=" & PositionSupplyInfoID
End Sub

%>
