<!--#include file="Admin_Common.asp"-->
<!--#include file="Admin_CommonCode_CRM.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 = 0   '0--不检查，1--频道管理员，2--栏目总编，3--栏目管理员
Const PurviewLevel_Others = ""   '其他权限

Dim arrEducation, arrIncome

'检查管理员操作权限
If AdminPurview > 1 Then
    arrPurview(0) = CheckPurview_Other(AdminPurview_Others, "Client_View")
    arrPurview(1) = CheckPurview_Other(AdminPurview_Others, "Client_Add")
    arrPurview(2) = CheckPurview_Other(AdminPurview_Others, "Client_ModifyOwn")
    arrPurview(3) = CheckPurview_Other(AdminPurview_Others, "Client_ModifyAll")
    arrPurview(4) = CheckPurview_Other(AdminPurview_Others, "Client_Del")
    For PurviewIndex = 0 To 4
        If arrPurview(PurviewIndex) = True Then
            PurviewPassed = True
            Exit For
        End If
    Next
    If PurviewPassed = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Response.End
    End If
End If

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 "<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 "  }" & vbCrLf
Response.Write "}" & vbCrLf
Response.Write "</script>" & vbCrLf

Response.Write "</head>" & vbCrLf
Response.Write "<body leftmargin='2' topmargin='0' marginwidth='0' marginheight='0'>" & vbCrLf
Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>" & vbCrLf
Response.Write "  <form name='searchform1' action='Admin_Contacter.asp' method='get'>"
Call ShowPageTitle("联 系 人 管 理", 10222)
Response.Write "  <tr class='tdbg' height='30'>" & vbCrLf
Response.Write "    <td width='120'>快速查找联系人：</td>" & vbCrLf
Response.Write "    <td><select size=1 name='SearchType' onChange=""javascript:submit()"">"
Response.Write "          <option value='0' "
If SearchType = 0 Then Response.Write " selected"
Response.Write ">所有联系人</option>"
Response.Write "          <option value='1' "
If SearchType = 1 Then Response.Write " selected"
Response.Write ">主联系人</option>"
Response.Write "          <option value='2' "
If SearchType = 2 Then Response.Write " selected"
Response.Write ">其他联系人</option>"
Response.Write "        </select>"
Response.Write "        &nbsp;&nbsp;&nbsp;&nbsp;<a href='Admin_Contacter.asp'>联系人管理首页</a>&nbsp;|&nbsp;<a href='Admin_Contacter.asp?Action=AddContacter'>添加联系人</a>"
Response.Write "    </td>" & vbCrLf
Response.Write "  </tr>" & vbCrLf
Response.Write "  </form>" & vbCrLf
Response.Write "</table>" & vbCrLf

arrEducation = GetArrFromDictionary("PE_Contacter", "Education")
arrIncome = GetArrFromDictionary("PE_Contacter", "Income")

Select Case Action
Case "AddContacter"
    Call AddContacter
Case "Modify"
    Call Modify
Case "SaveAdd", "SaveModify"
    Call SaveContacter
Case "Show"
    Call Show
Case "Del"
    Call DelContacter
Case Else
    Call main
End Select
If FoundErr = True Then
    Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Response.Write "</body></html>"
Call CloseConn


Sub main()
    Dim i
    Dim sql, Querysql, rsContacterList

    strFileName = "Admin_Contacter.asp?SearchType=" & SearchType & "&Field=" & strField & "&keyword=" & Keyword
    
    Call ShowJS_Main("联系人")
    
    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Contacter.asp'>联系人管理</a>&nbsp;&gt;&gt;&nbsp;"
    sql = "select top " & MaxPerPage & " C.ContacterID,C.TrueName,C.Title,C.OfficePhone,C.Mobile,C.Email,C.UserType,C.ClientID,C.Owner,Cl.ShortedForm from PE_Contacter C left join PE_Client Cl on C.ClientID=Cl.ClientID"
    Querysql = Querysql & " where 1=1 "
    Select Case SearchType
    Case 0
        Querysql = Querysql & " and C.UserType>0"
        Response.Write "所有联系人"
    Case 1
        Querysql = Querysql & " and C.UserType=1"
        Response.Write "主联系人"
    Case 2
        Querysql = Querysql & " and C.UserType=2"
        Response.Write "其他联系人"
    Case 10
        If Keyword = "" Then
            Response.Write "所有联系人"
        Else
            Select Case strField
            Case "ContacterID"
                If IsNumeric(Keyword) = False Then
                    FoundErr = True
                    ErrMsg = ErrMsg & "<li>联系人ID必须是整数</li>"
                Else
                    Querysql = Querysql & " and C.ContacterID=" & PE_CLng(Keyword)
                    Response.Write "联系人ID等于<font color=red> " & PE_CLng(Keyword) & " </font>的联系人"
                End If
            Case "ContacterName"
                Querysql = Querysql & " and C.TrueName like '%" & Keyword & "%'"
                Response.Write "名称中含有“ <font color=red>" & Keyword & "</font> ”的联系人"
            Case "IDCard"
                Querysql = Querysql & " and C.IDCard like '%" & Keyword & "%'"
                Response.Write "身份证号码中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Company"
                Querysql = Querysql & " and C.Company like '%" & Keyword & "%'"
                Response.Write "单位名称中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Address"
                Querysql = Querysql & " and C.Address like '%" & Keyword & "%'"
                Response.Write "联系地址中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Mobile"
                Querysql = Querysql & " and C.Mobile like '%" & Keyword & "%'"
                Response.Write "手机号码中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "OfficePhone"
                Querysql = Querysql & " and C.OfficePhone like '%" & Keyword & "%'"
                Response.Write "办公电话号码中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "HomePhone"
                Querysql = Querysql & " and C.HomePhone like '%" & Keyword & "%'"
                Response.Write "家庭电话号码中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "PHS"
                Querysql = Querysql & " and C.PHS like '%" & Keyword & "%'"
                Response.Write "小灵通号码中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Fax"
                Querysql = Querysql & " and C.Fax like '%" & Keyword & "%'"
                Response.Write "传真号码中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Email"
                Querysql = Querysql & " and C.Email like '%" & Keyword & "%'"
                Response.Write "电子邮件中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Homepage"
                Querysql = Querysql & " and C.Homepage like '%" & Keyword & "%'"
                Response.Write "个人主页中含有“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "QQ"
                Querysql = Querysql & " and C.QQ='" & Keyword & "'"
                Response.Write "QQ号为“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "ICQ"
                Querysql = Querysql & " and C.ICQ='" & Keyword & "'"
                Response.Write "ICQ号为“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "MSN"
                Querysql = Querysql & " and C.MSN='" & Keyword & "'"
                Response.Write "MSN帐号为“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Yahoo"
                Querysql = Querysql & " and C.Yahoo='" & Keyword & "'"
                Response.Write "雅虎通帐号为“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "UC"
                Querysql = Querysql & " and C.UC='" & Keyword & "'"
                Response.Write "UC号为“ <font color=red>" & Keyword & "</font> ”的会员"
            Case "Aim"
                Querysql = Querysql & " and C.Aim='" & Keyword & "'"
                Response.Write "Aim帐号为“ <font color=red>" & Keyword & "</font> ”的会员"
            Case Else
                Querysql = Querysql & " and C.TrueName like '%" & Keyword & "%'"
                Response.Write "名称中含有“ <font color=red>" & Keyword & "</font> ”的联系人"
            End Select
        End If
    End Select
    
    TotalPut = PE_CLng(Conn.Execute("select Count(*) from PE_Contacter C" & 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 CurrentPage > 1 Then
        Querysql = Querysql & " and ContacterID < (select min(ContacterID) from (select top " & ((CurrentPage - 1) * MaxPerPage) & " ContacterID from PE_Contacter C " & Querysql & " order by ContacterID desc) as QueryContacter) "
    End If
    sql = sql & Querysql & " order by ContacterID desc"


    Response.Write "</td></tr></table>"
    If FoundErr = True Then Exit Sub
    
    Response.Write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    Response.Write "  <tr>"
    Response.Write "  <form name='myform' method='Post' action='Admin_Contacter.asp'>"
    Response.Write "      <td>"
    Response.Write "      <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "        <tr class='title' height='22' align='center'>"
    Response.Write "          <td width='30'><strong>选中</strong></td>"
    Response.Write "          <td width='100'><strong>姓 名</strong></td>"
    Response.Write "          <td width='60'><strong>称谓</strong></td>"
    Response.Write "          <td width='100'><strong>工作电话</strong></td>"
    Response.Write "          <td width='100'><strong>手机</strong></td>"
    Response.Write "          <td width='100'><strong>Email地址</strong></td>"
    Response.Write "          <td width='90'><strong>类型</strong></td>"
    Response.Write "          <td width='100'><strong>对应客户</strong></td>"
    Response.Write "          <td width='90'><strong> 操作</strong></td>"
    Response.Write "        </tr>"
    Set rsContacterList = Server.CreateObject("Adodb.RecordSet")
    rsContacterList.Open sql, Conn, 1, 1
    If rsContacterList.BOF And rsContacterList.EOF Then
        Response.Write "<tr><td colspan='20' height='50' align='center'>共找到 <font color=red>0</font> 个联系人</td></tr>"
    Else
        Dim ContacterNum
        ContacterNum = 0
        Do While Not rsContacterList.EOF
            Response.Write "      <tr class='tdbg' onmouseout=""this.className='tdbg'"" onmouseover=""this.className='tdbgmouseover'"">"
            Response.Write "        <td width='30' align='center'><input name='ContacterID' type='checkbox' onclick=""unselectall()"" id='ContacterID' value='" & CStr(rsContacterList("ContacterID")) & "'></td>"
            Response.Write "        <td align='center'><a href='Admin_Contacter.asp?Action=Show&ContacterID=" & rsContacterList("ContacterID") & "'>" & rsContacterList("TrueName") & "</a></td>"
            Response.Write "        <td width='60' align='center'>" & rsContacterList("Title") & "</td>"
            Response.Write "        <td width='100' align='center'>" & rsContacterList("OfficePhone") & "</td>"
            Response.Write "        <td width='100' align='center'>" & rsContacterList("Mobile") & "</td>"
            Response.Write "        <td width='100' align='center'>" & rsContacterList("Email") & "</td>"
            Response.Write "        <td width='90' align='center'>" & GetArrItem(Array("个人客户", "主联系人", "其他联系人"), rsContacterList("UserType")) & "</td>"
            Response.Write "        <td width='100' align='center'><a href='Admin_Client.asp?Action=Show&ClientID=" & rsContacterList("ClientID") & "'>" & rsContacterList("ShortedForm") & "</a></td>"
            Response.Write "        <td width='90' align='center'>"
            Response.Write "<a href='Admin_Contacter.asp?Action=Show&ContacterID=" & rsContacterList("ContacterID") & "'>查看</a>&nbsp;"
            If AdminPurview = 1 Or arrPurview(3) = True Or (arrPurview(2) = True And rsContacterList("Owner") = AdminName) Then
                Response.Write "<a href='Admin_Contacter.asp?Action=Modify&ContacterID=" & rsContacterList("ContacterID") & "'>修改</a>&nbsp;"
            End If
            If AdminPurview = 1 Or arrPurview(4) = True Then
                Response.Write "<a href='Admin_Contacter.asp?Action=Del&ContacterID=" & rsContacterList("ContacterID") & "' onClick='return confirm(""确定要删除此联系人吗？"");'>删除</a> "
            End If
            Response.Write "        </td>"
            Response.Write "      </tr>"

            ContacterNum = ContacterNum + 1
            If ContacterNum >= MaxPerPage Then Exit Do
            rsContacterList.MoveNext
        Loop
    End If
    rsContacterList.Close
    Set rsContacterList = Nothing
    Response.Write "      </table>"
    If TotalPut > 0 Then
        Response.Write "      <table width='100%' border='0' cellpadding='0' cellspacing='0'>"
        Response.Write "        <tr height='30'>"
        Response.Write "          <td width='200'><input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form);' value='checkbox'>"
        Response.Write "          选中本页显示的所有联系人</td>"
        Response.Write "          <td><input type='hidden' name='Action' value=''>"
        If AdminPurview = 1 Or arrPurview(4) = True Then
            Response.Write "          <input name='Del' type='submit' value=' 批量删除 ' onClick=""document.myform.Action.value='Del';return confirm('确定要删除选定的联系人吗？');"">&nbsp;&nbsp;&nbsp;&nbsp;"
        End If
        'Response.Write "          <input name='BatchMove' type='submit' value=' 批量移动 ' onClick=""document.myform.Action.value='BatchMove'"">"
        Response.Write "        </tr>"
        Response.Write "      </table>"
    End If
    Response.Write "      </td>"
    Response.Write "  </form>"
    Response.Write "  </tr>"
    Response.Write "</table>"
    If TotalPut > 0 Then
        Response.Write ShowPage(strFileName, TotalPut, MaxPerPage, CurrentPage, True, True, "个联系人", True)
    End If


    Response.Write "<br>"
    Call ShowSearch
End Sub


Sub ShowSearch()
    Response.Write "<form name='SearchForm' action='Admin_Contacter.asp' method='post'>" & vbCrLf
    Response.Write "<table width='100%'  border='0' align='center' cellpadding='1' cellspacing='1' class='border'>" & vbCrLf
    Response.Write "  <tr class='tdbg'>" & vbCrLf
    Response.Write "    <td width='80'><b>联系人查询：</b></td>" & vbCrLf
    Response.Write "    <td>" & vbCrLf
    Response.Write "      <select name='Field' size='1'>" & vbCrLf
    Response.Write "        <option value='ContacterID'>联系人ID</option>" & vbCrLf
    Response.Write "        <option value='ContacterName' selected>联系人名称</option>" & vbCrLf
    Response.Write "        <option value='IDCard'>身份证号码</option>" & vbCrLf
    Response.Write "        <option value='Company'>单位名称</option>" & vbCrLf
    Response.Write "        <option value='Address'>联系地址</option>" & vbCrLf
    Response.Write "        <option value='Mobile'>手机号码</option>" & vbCrLf
    Response.Write "        <option value='OfficePhone'>办公电话</option>" & vbCrLf
    Response.Write "        <option value='HomePhone'>家庭电话</option>" & vbCrLf
    Response.Write "        <option value='PHS'>小灵通</option>" & vbCrLf
    Response.Write "        <option value='Fax'>传真号码</option>" & vbCrLf
    Response.Write "        <option value='Email'>电子邮件</option>" & vbCrLf
    Response.Write "        <option value='Homepage'>个人主页</option>" & vbCrLf
    Response.Write "        <option value='QQ'>QQ号</option>" & vbCrLf
    Response.Write "        <option value='ICQ'>ICQ号</option>" & vbCrLf
    Response.Write "        <option value='MSN'>MSN帐号</option>" & vbCrLf
    Response.Write "        <option value='UC'>UC号</option>" & vbCrLf
    Response.Write "        <option value='Aim'>Aim帐号</option>" & vbCrLf
    Response.Write "      </select>" & vbCrLf
    Response.Write "      <input name='Keyword' type='text' id='Keyword' size='20' maxlength='40'>" & vbCrLf
    Response.Write "      <input type='submit' name='Submit' value='搜 索' id='Submit'>" & vbCrLf
    Response.Write "      <input type='hidden' name='SearchType' value='10'>" & vbCrLf
    Response.Write "    </td>" & vbCrLf
    Response.Write "  </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "</form>" & vbCrLf
    Response.Write "" & vbCrLf
End Sub

Sub ShowJS_Check()
    Response.Write "<script language=javascript>" & vbCrLf
    Response.Write "function CheckSubmit(){" & vbCrLf
    Response.Write "    if(document.myform.TrueName.value==''){" & vbCrLf
    Response.Write "        alert('必须填写联系人真实姓名！');" & vbCrLf
    Response.Write "        document.myform.TrueName.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    if(document.myform.ClientID.value==''){" & vbCrLf
    Response.Write "        alert('必须填写所属客户！');" & vbCrLf
    Response.Write "        document.myform.ClientName.focus();" & vbCrLf
    Response.Write "        return false;" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "    document.myform.Country.value=frm1.document.regionform.Country.value;" & vbCrLf
    Response.Write "    document.myform.Province.value=frm1.document.regionform.Province.value;" & vbCrLf
    Response.Write "    document.myform.City.value=frm1.document.regionform.City.value;" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function SelectClient(){" & vbCrLf
    Response.Write "    var arr=showModalDialog('Admin_SourceList.asp?TypeSelect=ClientList&ClientType=E','','dialogWidth:600px; dialogHeight:450px; help: no; scroll: yes; status: no');" & vbCrLf
    Response.Write "    if (arr != null){" & vbCrLf
    Response.Write "        var ss=arr.split('$$$');" & vbCrLf
    Response.Write "        document.myform.ClientName.value=ss[0];" & vbCrLf
    Response.Write "        document.myform.ClientID.value=ss[1];" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf
    Response.Write "function SelectContacter(){" & vbCrLf
    Response.Write "    var arr=showModalDialog('Admin_SourceList.asp?TypeSelect=ContacterList','','dialogWidth:600px; dialogHeight:450px; help: no; scroll: yes; status: no');" & vbCrLf
    Response.Write "    if (arr != null){" & vbCrLf
    Response.Write "        var ss=arr.split('$$$');" & vbCrLf
    Response.Write "        document.myform.Parenter.value=ss[0];" & vbCrLf
    Response.Write "        document.myform.ParentID.value=ss[1];" & vbCrLf
    Response.Write "    }" & vbCrLf
    Response.Write "}" & vbCrLf

    Response.Write "</script>" & vbCrLf
End Sub


Sub AddContacter()
    If AdminPurview > 1 And arrPurview(1) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If
    Call PopCalendarInit
    Call ShowJS_Check
    Dim ClientID
    ClientID = PE_CLng(Trim(Request("ClientID")))

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Contacter.asp'>联系人管理</a>&nbsp;&gt;&gt;&nbsp;添加联系人</td></tr></table>"
    Response.Write "<form name='myform' id='myform' action='Admin_Contacter.asp' method='post' onSubmit='return CheckSubmit();'>" & vbCrLf

    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'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "            <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 class='tdbg5' align='right'  width='12%'>对应客户：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='ClientName' ReadOnly type='text' size='35' value='" & GetClientName(ClientID) & "'><input type='button' name='Submit' value='...' onclick='SelectClient()'><input type='hidden' name='ClientID' value='" & ClientID & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>上级联系人：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Parenter' type='text' ReadOnly id='Parenter' size='35'><input type='button' name='Submit' value='...' onclick='SelectContacter()'><input type='hidden' name='ParentID' value='0'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >真实姓名：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='TrueName' type='text' size='35' maxlength='200'> <font color='#FF0000'>*</font></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >称谓：</td>" & vbCrLf
    Response.Write "                        <td><input name='Title' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >所属部门：</td>" & vbCrLf
    Response.Write "                        <td><input name='Department' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >职位：</td>" & vbCrLf
    Response.Write "                        <td><input name='Position' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >负责业务：</td>" & vbCrLf
    Response.Write "                        <td><input name='Operation' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >类别：</td>" & vbCrLf
    Response.Write "                        <td><input name='UserType' type='radio' value='1' checked>主联系人 <input name='UserType' type='radio' value='2'>其他联系人</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 rowspan='2' class='tdbg5' align='right'  width='12%'>通讯地址：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <iframe name='frm1' id='frm1' src='../Region.asp' width='100%' height='75' frameborder='0' scrolling='no'></iframe>" & vbCrLf
    Response.Write "                            <input name='Country' id='Country' type='hidden'> <input name='Province' id='Province' type='hidden'> <input name='City' id='City' type='hidden'>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <table width='100%'  border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td width='12%' align='right' class='tdbg5' align='right' >联系地址：</td>" & vbCrLf
    Response.Write "                                    <td><input name='Address' type='text' size='60' maxlength='255'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td align='right' class='tdbg5' align='right' >邮政编码：</td>" & vbCrLf
    Response.Write "                                    <td><input name='ZipCode' type='text' size='35' maxlength='10'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                            </table>" & vbCrLf
    Response.Write "                        </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='OfficePhone' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>住宅电话：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='HomePhone' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >移动电话：</td>" & vbCrLf
    Response.Write "                        <td><input name='Mobile' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='Fax' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >小灵通：</td>" & vbCrLf
    Response.Write "                        <td><input name='PHS' type='text' size='35' maxlength='30'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' ></td>" & vbCrLf
    Response.Write "                        <td></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >个人主页：</td>" & vbCrLf
    Response.Write "                        <td><input name='Homepage' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Email地址：</td>" & vbCrLf
    Response.Write "                        <td><input name='SpareEmail' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='QQ' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >MSN帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='MSN' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >ICQ号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='ICQ' type='text' size='35' maxlength='25'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >雅虎通帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='Yahoo' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >UC帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='UC' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Aim帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='Aim' type='text' size='35' maxlength='255'></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'  width='12%'>出生日期：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Birthday' type='text' size='35' maxlength='10' onFocus=""PopCalendar.show(document.myform.Birthday, 'yyyy-mm-dd', null, null, null, '11');""></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>证件号码：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='IDCard' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >籍贯：</td>" & vbCrLf
    Response.Write "                        <td><input name='NativePlace' type='text' size='35' maxlength='20'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >民族：</td>" & vbCrLf
    Response.Write "                        <td><input name='Nation' type='text' size='35' maxlength='3'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >性别：</td>" & vbCrLf
    Response.Write "                        <td><input name='Sex' type='radio' value='0' checked>未知 <input name='Sex' type='radio' value='1'>男 <input name='Sex' type='radio' value='2'>女</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >婚姻状况：</td>" & vbCrLf
    Response.Write "                        <td><input name='Marriage' type='radio' value='0' checked>未知 <input name='Marriage' type='radio' value='1'>未婚 <input name='Marriage' type='radio' value='2'>已婚 <input name='Marriage' type='radio' value='3'>离异</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >学历：</td>" & vbCrLf
    Response.Write "                        <td><select name='Education'>" & Array2Option(arrEducation, -1) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >毕业学校：</td>" & vbCrLf
    Response.Write "                        <td><input name='GraduateFrom' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >生活爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfLife' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >文化爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfCulture' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >娱乐休闲爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfAmusement' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >体育爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfSport' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >其他爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfOther' type='text' size='35' maxlength='255'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >月 收 入：</td>" & vbCrLf
    Response.Write "                        <td><select name='Income'>" & Array2Option(arrIncome, -1) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >家庭情况：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'><textarea name='Family' cols='75' rows='5' id='Family'></textarea></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                  </tbody>" & vbCrLf
    Response.Write "                </table>" & vbCrLf
    Response.Write "            </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "<table width='100%' height='40'><tr align='center'><td>"
    Response.Write "    <input type='hidden' name='action' value='SaveAdd'>" & vbCrLf
    Response.Write "    <input type='submit' name='Submit' value='保存联系人信息'>" & vbCrLf
    Response.Write "</td></tr></table>"
    Response.Write "</form>" & vbCrLf
End Sub


Sub Modify()
    If AdminPurview > 1 And arrPurview(2) = False And arrPurview(3) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If

    Dim ContacterID
    Dim rsContacter
    ContacterID = Trim(Request("ContacterID"))
    If ContacterID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>参数不足！</li>"
        Exit Sub
    Else
        ContacterID = CLng(ContacterID)
    End If
    Set rsContacter = Conn.Execute("select * from PE_Contacter where ContacterID=" & ContacterID & "")
    If rsContacter.BOF And rsContacter.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的联系人！</li>"
        rsContacter.Close
        Set rsContacter = Nothing
        Exit Sub
    End If
    If rsContacter("Owner") <> AdminName And AdminPurview > 1 And arrPurview(3) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        rsContacter.Close
        Set rsContacter = Nothing
        Exit Sub
    End If
    
    Call PopCalendarInit
    Call ShowJS_Check

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Contacter.asp'>联系人管理</a>&nbsp;&gt;&gt;&nbsp;修改联系人信息</td></tr></table>"
    Response.Write "<form name='myform' id='myform' action='Admin_Contacter.asp' method='post' onSubmit='return CheckSubmit();'>" & vbCrLf

    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'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "            <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 class='tdbg5' align='right'  width='12%'>对应客户：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='ClientName' type='text' ReadOnly size='35' value='" & GetClientName(rsContacter("ClientID")) & "'><input type='button' name='Submit' value='...' onclick='SelectClient()'><input type='hidden' name='ClientID' value='" & rsContacter("ClientID") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>上级联系人：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Parenter' type='text' ReadOnly id='Parenter' size='35' value='" & GetContacterName(rsContacter("ParentID")) & "'><input type='button' name='aaa' value='...' onclick='SelectContacter()'><input type='hidden' name='ParentID' value='" & rsContacter("ParentID") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >真实姓名：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='TrueName' type='text' size='35' maxlength='200' value='" & rsContacter("TrueName") & "'> <font color='#FF0000'>*</font></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >称谓：</td>" & vbCrLf
    Response.Write "                        <td><input name='Title' type='text' size='35' maxlength='20' value='" & rsContacter("Title") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >所属部门：</td>" & vbCrLf
    Response.Write "                        <td><input name='Department' type='text' size='35' maxlength='30' value='" & rsContacter("Department") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >职位：</td>" & vbCrLf
    Response.Write "                        <td><input name='Position' type='text' size='35' maxlength='30' value='" & rsContacter("Position") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >负责业务：</td>" & vbCrLf
    Response.Write "                        <td><input name='Operation' type='text' size='35' maxlength='30' value='" & rsContacter("Operation") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >类别：</td>" & vbCrLf
    Response.Write "                        <td><input name='UserType' type='radio' value='1'"
    If rsContacter("UserType") = 1 Then Response.Write " checked"
    Response.Write ">主联系人 <input name='UserType' type='radio' value='2'"
    If rsContacter("UserType") = 2 Then Response.Write " checked"
    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 rowspan='2' class='tdbg5' align='right'  width='12%'>通讯地址：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <iframe name='frm1' id='frm1' src='../Region.asp?Action=Modify&Country=" & rsContacter("Country") & "&Province=" & rsContacter("Province") & "&City=" & rsContacter("City") & "' width='100%' height='75' frameborder='0' scrolling='no'></iframe>" & vbCrLf
    Response.Write "                            <input name='Country' id='Country' type='hidden'> <input name='Province' id='Province' type='hidden'> <input name='City' id='City' type='hidden'>" & vbCrLf
    Response.Write "                        </td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & vbCrLf
    Response.Write "                            <table width='100%'  border='0' cellpadding='2' cellspacing='1' bgcolor='#FFFFFF'>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td width='12%' align='right' class='tdbg5' align='right' >联系地址：</td>" & vbCrLf
    Response.Write "                                    <td><input name='Address' type='text' size='60' maxlength='255' value='" & rsContacter("Address") & "'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                                <tr class='tdbg'>" & vbCrLf
    Response.Write "                                    <td align='right' class='tdbg5' align='right' >邮政编码：</td>" & vbCrLf
    Response.Write "                                    <td><input name='ZipCode' type='text' size='35' maxlength='10' value='" & rsContacter("ZipCode") & "'></td>" & vbCrLf
    Response.Write "                                </tr>" & vbCrLf
    Response.Write "                            </table>" & vbCrLf
    Response.Write "                        </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='OfficePhone' type='text' size='35' maxlength='30' value='" & rsContacter("OfficePhone") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>住宅电话：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='HomePhone' type='text' size='35' maxlength='30' value='" & rsContacter("HomePhone") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >移动电话：</td>" & vbCrLf
    Response.Write "                        <td><input name='Mobile' type='text' size='35' maxlength='30' value='" & rsContacter("Mobile") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='Fax' type='text' size='35' maxlength='30' value='" & rsContacter("Fax") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >小灵通：</td>" & vbCrLf
    Response.Write "                        <td><input name='PHS' type='text' size='35' maxlength='30' value='" & rsContacter("PHS") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' ></td>" & vbCrLf
    Response.Write "                        <td></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >个人主页：</td>" & vbCrLf
    Response.Write "                        <td><input name='Homepage' type='text' size='35' maxlength='255' value='" & rsContacter("Homepage") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Email地址：</td>" & vbCrLf
    Response.Write "                        <td><input name='Email' type='text' size='35' maxlength='255' value='" & rsContacter("Email") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='QQ' type='text' size='35' maxlength='20' value='" & rsContacter("QQ") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >MSN帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='MSN' type='text' size='35' maxlength='255' value='" & rsContacter("MSN") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >ICQ号码：</td>" & vbCrLf
    Response.Write "                        <td><input name='ICQ' type='text' size='35' maxlength='25' value='" & rsContacter("ICQ") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >雅虎通帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='Yahoo' type='text' size='35' maxlength='255' value='" & rsContacter("Yahoo") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >UC帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='UC' type='text' size='35' maxlength='255' value='" & rsContacter("UC") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Aim帐号：</td>" & vbCrLf
    Response.Write "                        <td><input name='Aim' type='text' size='35' maxlength='255' value='" & rsContacter("Aim") & "'></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'  width='12%'>出生日期：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='Birthday' type='text' size='35' maxlength='10' value='" & rsContacter("Birthday") & "' onFocus=""PopCalendar.show(document.myform.Birthday, 'yyyy-mm-dd', null, null, null, '11');""></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>证件号码：</td>" & vbCrLf
    Response.Write "                        <td width='38%'><input name='IDCard' type='text' size='35' maxlength='20' value='" & rsContacter("IDCard") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >籍贯：</td>" & vbCrLf
    Response.Write "                        <td><input name='NativePlace' type='text' size='35' maxlength='20' value='" & rsContacter("NativePlace") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >民族：</td>" & vbCrLf
    Response.Write "                        <td><input name='Nation' type='text' size='35' maxlength='3' value='" & rsContacter("Nation") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >性别：</td>" & vbCrLf
    Response.Write "                        <td><input name='Sex' type='radio' value='0' "
    If rsContacter("Sex") <= 0 Or rsContacter("Sex") > 2 Then Response.Write " checked"
    Response.Write ">未知 <input name='Sex' type='radio' value='1'"
    If rsContacter("Sex") = 1 Then Response.Write " checked"
    Response.Write ">男 <input name='Sex' type='radio' value='2'"
    If rsContacter("Sex") = 2 Then Response.Write " checked"
    Response.Write ">女</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >婚姻状况：</td>" & vbCrLf
    Response.Write "                        <td><input name='Marriage' type='radio' value='0'"
    If rsContacter("Marriage") = 0 Then Response.Write " checked"
    Response.Write ">未知 <input name='Marriage' type='radio' value='1'"
    If rsContacter("Marriage") = 1 Then Response.Write " checked"
    Response.Write ">未婚 <input name='Marriage' type='radio' value='2'"
    If rsContacter("Marriage") = 2 Then Response.Write " checked"
    Response.Write ">已婚 <input name='Marriage' type='radio' value='3'"
    If rsContacter("Marriage") = 3 Then Response.Write " checked"
    Response.Write ">离异</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >学历：</td>" & vbCrLf
    Response.Write "                        <td><select name='Education'>" & Array2Option(arrEducation, rsContacter("Education")) & "</select></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >毕业学校：</td>" & vbCrLf
    Response.Write "                        <td><input name='GraduateFrom' type='text' size='35' maxlength='255' value='" & rsContacter("GraduateFrom") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >生活爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfLife' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfLife") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >文化爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfCulture' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfCulture") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >娱乐休闲爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfAmusement' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfAmusement") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >体育爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfSport' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfSport") & "'></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >其他爱好：</td>" & vbCrLf
    Response.Write "                        <td><input name='InterestsOfOther' type='text' size='35' maxlength='255' value='" & rsContacter("InterestsOfOther") & "'></td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >月 收 入：</td>" & vbCrLf
    Response.Write "                        <td><select name='Income'>" & Array2Option(arrIncome, rsContacter("Income")) & "</select></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >家庭情况：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'><textarea name='Family' cols='75' rows='5' id='Family'>" & rsContacter("Family") & "</textarea></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                  </tbody>" & vbCrLf
    Response.Write "                </table>" & vbCrLf
    Response.Write "            </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    Response.Write "<table width='100%' height='40'><tr align='center'><td>"
    Response.Write "    <input type='hidden' name='action' value='SaveModify'><input type='hidden' name='ContacterID' value='" & ContacterID & "'>" & vbCrLf
    Response.Write "    <input type='submit' name='Submit' value='保存修改结果'>" & vbCrLf
    Response.Write "</td></tr></table>"
    Response.Write "</form>" & vbCrLf
    Set rsContacter = Nothing
End Sub


Sub Show()
    Dim ContacterID
    Dim rsContacter, sqlContacter
    ContacterID = PE_CLng(Trim(Request("ContacterID")))
    If ContacterID <= 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>参数不足！</li>"
        Exit Sub
    End If
    sqlContacter = "select * from PE_Contacter where ContacterID=" & ContacterID
    Set rsContacter = Conn.Execute(sqlContacter)
    If rsContacter.BOF And rsContacter.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的联系人！</li>"
        rsContacter.Close
        Set rsContacter = Nothing
        Exit Sub
    End If

    Response.Write "<br><table width='100%'><tr><td align='left'>您现在的位置：<a href='Admin_Contacter.asp'>联系人管理</a>&nbsp;&gt;&gt;&nbsp;查看联系人信息：" & rsContacter("TrueName") & "</td></tr></table>"
    Response.Write "<br><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'>" & vbCrLf
    Response.Write "        <tr class='tdbg'>" & vbCrLf
    Response.Write "            <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 class='tdbg5' align='right'  width='12%'>对应客户：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & GetClientName(rsContacter("ClientID")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>上级联系人：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & GetContacterName(rsContacter("ParentID")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >真实姓名：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("TrueName") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >称谓：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Title") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >所属部门：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Department") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >职位：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Position") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >负责业务：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Operation") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >类别：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(Array("个人客户", "主联系人", "其他联系人"), rsContacter("UserType")) & "</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'  width='12%'>国家/地区：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("Country") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>省/市：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("Province") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >市/县/区：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("City") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >邮政编码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("ZipCode") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >联系地址：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & rsContacter("Address") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >办公电话：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("OfficePhone") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >住宅电话：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("HomePhone") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >移动电话：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Mobile") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >传真号码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Fax") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >小灵通：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("PHS") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' ></td>" & vbCrLf
    Response.Write "                        <td></td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >个人主页：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Homepage") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Email地址：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Email") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >QQ号码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("QQ") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >MSN帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("MSN") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >ICQ号码：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("ICQ") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >雅虎通帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Yahoo") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >UC帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("UC") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >Aim帐号：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Aim") & "</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'  width='12%'>出生日期：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("Birthday") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right'  width='12%'>证件号码：</td>" & vbCrLf
    Response.Write "                        <td width='38%'>" & rsContacter("IDCard") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >籍贯：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("NativePlace") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >民族：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("Nation") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >性别：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(Array("未知", "男", "女"), rsContacter("Sex")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >婚姻状况：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(Array("未知", "未婚", "已婚", "离异"), rsContacter("Marriage")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >学历：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrEducation, rsContacter("Education")) & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >毕业学校：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("GraduateFrom") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >生活爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfLife") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >文化爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfCulture") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >娱乐休闲爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfAmusement") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >体育爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfSport") & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >其他爱好：</td>" & vbCrLf
    Response.Write "                        <td>" & rsContacter("InterestsOfOther") & "</td>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >月 收 入：</td>" & vbCrLf
    Response.Write "                        <td>" & GetArrItem(arrIncome, rsContacter("Income")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                    <tr class='tdbg'>" & vbCrLf
    Response.Write "                        <td class='tdbg5' align='right' >家庭情况：</td>" & vbCrLf
    Response.Write "                        <td colspan='3'>" & PE_HTMLEncode(rsContacter("Family")) & "</td>" & vbCrLf
    Response.Write "                    </tr>" & vbCrLf
    Response.Write "                  </tbody>" & vbCrLf

    Response.Write "                </table>" & vbCrLf

    Response.Write "            </td>" & vbCrLf
    Response.Write "        </tr>" & vbCrLf
    Response.Write "</table>" & vbCrLf
    If AdminPurview = 1 Or arrPurview(3) = True Or (arrPurview(2) = True And rsContacter("Owner") = AdminName) Then
        Response.Write "<table width='100%' height='40'><tr align='center'><td>"
        Response.Write "<input type='button' name='modify' value='修改联系人信息' onclick=""window.location.href='Admin_Contacter.asp?Action=Modify&ContacterID=" & ContacterID & "';""> "
        Response.Write "<input type='button' name='SendMessage' value='发送手机短信' onclick=""window.location.href='Admin_SMS.asp?SendTo=Contacter&InceptType=3&TrueName=" & rsContacter("TrueName") & "';""> "
        Response.Write "</td></tr></table>"
    End If
    rsContacter.Close
    Set rsContacter = Nothing
End Sub

Sub SaveContacter()
    Dim ContacterID, ClientID, TrueName
    ContacterID = PE_CLng(Trim(Request.Form("ContacterID")))
    ClientID = PE_CLng(Trim(Request.Form("ClientID")))
    TrueName = Trim(Request.Form("TrueName"))
    
    If ClientID <= 0 Then
        FoundErr = True
        ErrMsg = "必须指定所属客户！"
    End If
    If TrueName = "" Then
        FoundErr = True
        ErrMsg = "联系人名称不能为空！"
    End If

    If FoundErr Then
        Exit Sub
    End If

    Dim sqlContacter, rsContacter

    Set rsContacter = Server.CreateObject("adodb.recordset")

    If Action = "SaveAdd" Then
        If AdminPurview > 1 And arrPurview(1) = False And arrPurview(3) = False Then
            Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
            Call WriteEntry(6, AdminName, "越权操作")
            Exit Sub
        End If
        ContacterID = GetNewID("PE_Contacter", "ContacterID")
        sqlContacter = "SELECT top 1 * FROM PE_Contacter"
        rsContacter.Open sqlContacter, Conn, 1, 3
        rsContacter.addnew
        rsContacter("ContacterID") = ContacterID
        rsContacter("CreateTime") = Now()
        rsContacter("Owner") = AdminName
    Else
        If AdminPurview > 1 And arrPurview(2) = False And arrPurview(3) = False Then
            Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
            Call WriteEntry(6, AdminName, "越权操作")
            Exit Sub
        End If
        sqlContacter = "SELECT * FROM PE_Contacter Where ContacterID=" & ContacterID & ""
        rsContacter.Open sqlContacter, Conn, 1, 3
        If rsContacter.BOF And rsContacter.EOF Then
            FoundErr = True
            ErrMsg = "找不到指定的联系人！"
        Else
            If rsContacter("Owner") <> AdminName And AdminPurview > 1 And arrPurview(3) = False Then
                Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
                Call WriteEntry(6, AdminName, "越权操作")
                rsContacter.Close
                Set rsContacter = Nothing
                Exit Sub
            End If
        End If
    End If
    If FoundErr Then
        rsContacter.Close
        Set rsContacter = Nothing
        Exit Sub
    End If

    rsContacter("ClientID") = ClientID
    rsContacter("TrueName") = TrueName
    rsContacter("ParentID") = PE_CLng(Trim(Request.Form("ParentID")))
    rsContacter("Title") = Trim(Request.Form("Title"))
    
    rsContacter("Department") = Trim(Request.Form("Department"))
    rsContacter("Position") = Trim(Request.Form("Position"))
    rsContacter("Operation") = Trim(Request.Form("Operation"))
    rsContacter("UserType") = PE_CLng(Trim(Request.Form("UserType")))

    rsContacter("Country") = Trim(Request.Form("Country"))
    rsContacter("Province") = Trim(Request.Form("Province"))
    rsContacter("City") = Trim(Request.Form("City"))
    rsContacter("ZipCode") = Trim(Request.Form("ZipCode"))
    rsContacter("Address") = Trim(Request.Form("Address"))

    rsContacter("Mobile") = Trim(Request.Form("Mobile"))
    rsContacter("OfficePhone") = Trim(Request.Form("OfficePhone"))
    rsContacter("HomePhone") = Trim(Request.Form("HomePhone"))
    rsContacter("PHS") = Trim(Request.Form("PHS"))
    rsContacter("Fax") = Trim(Request.Form("Fax"))

    rsContacter("Homepage") = Trim(Request.Form("Homepage"))
    rsContacter("Email") = Trim(Request.Form("Email"))
    rsContacter("QQ") = Trim(Request.Form("QQ"))
    rsContacter("MSN") = Trim(Request.Form("MSN"))
    rsContacter("ICQ") = Trim(Request.Form("ICQ"))
    rsContacter("Yahoo") = Trim(Request.Form("Yahoo"))
    rsContacter("UC") = Trim(Request.Form("UC"))
    rsContacter("Aim") = Trim(Request.Form("Aim"))

    rsContacter("BirthDay") = PE_CDate(Trim(Request.Form("Birthday")))
    rsContacter("IDCard") = Trim(Request.Form("IDCard"))
    rsContacter("NativePlace") = Trim(Request.Form("NativePlace"))
    rsContacter("Nation") = Trim(Request.Form("Nation"))
    rsContacter("Sex") = PE_CLng(Trim(Request.Form("Sex")))
    rsContacter("Marriage") = PE_CLng(Trim(Request.Form("Marriage")))
    rsContacter("Education") = PE_CLng(Trim(Request.Form("Education")))
    rsContacter("GraduateFrom") = Trim(Request.Form("GraduateFrom"))
    rsContacter("InterestsOfLife") = Trim(Request.Form("InterestsOfLife"))
    rsContacter("InterestsOfCulture") = Trim(Request.Form("InterestsOfCulture"))
    rsContacter("InterestsOfAmusement") = Trim(Request.Form("InterestsOfAmusement"))
    rsContacter("InterestsOfSport") = Trim(Request.Form("InterestsOfSport"))
    rsContacter("InterestsOfOther") = Trim(Request.Form("InterestsOfOther"))
    rsContacter("Income") = PE_CLng(Trim(Request.Form("Income")))
    rsContacter("Family") = Trim(Request.Form("Family"))
    rsContacter("UpdateTime") = Now()
    rsContacter("Company") = ""
    rsContacter("CompanyAddress") = ""

    rsContacter.Update
    rsContacter.Close
    Set rsContacter = Nothing

    Call WriteSuccessMsg("保存联系人资料成功", "Admin_Contacter.asp?Action=Show&ContacterID=" & ContacterID)
    
End Sub

Sub DelContacter()
    If AdminPurview > 1 And arrPurview(4) = False Then
        Response.Write "<br><p align='center'><font color='red' style='font-size:9pt'>对不起，你没有此项操作的权限。</font></p>"
        Call WriteEntry(6, AdminName, "越权操作")
        Exit Sub
    End If

    Dim ContacterID
    ContacterID = Trim(Request("ContacterID"))
    If IsValidID(ContacterID) = False Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定正确的ContacterID！</li>"
        Exit Sub
    End If
    Dim rsContacter, sqlContacter, iTemp
    iTemp = 0
    sqlContacter = "select * from PE_Contacter where ContacterID in (" & ContacterID & ")"
    ContacterID = ""
    Set rsContacter = Server.CreateObject("adodb.recordset")
    rsContacter.Open sqlContacter, Conn, 1, 3
    Do While Not rsContacter.EOF
        If ContacterID = "" Then
            ContacterID = rsContacter("ContacterID")
        Else
            ContacterID = ContacterID & "," & rsContacter("ContacterID")
        End If
        rsContacter.Delete
        rsContacter.Update
        iTemp = iTemp + 1
        rsContacter.MoveNext
    Loop
    rsContacter.Close
    Set rsContacter = Nothing
    Conn.Execute ("update PE_User set ContacterID=0 where ContacterID in (" & ContacterID & ")")
    Call WriteSuccessMsg("删除客户成功！共删除了 " & iTemp & " 名客户。", "Admin_Contacter.asp")

End Sub
%>
