<!--#include virtual="/includes/topofpage.asp"-->
<%

Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("conn_string")

If Request("Admin_Group_ID") <> "" Then Session("Admin_Group_ID") = Request("Admin_Group_ID")

If (Request("page") = "0") Then
	If Request("Admin_Group_ID") <> "" Then
		Session("Admin_Group_ID") = Request("Admin_Group_ID")
	End If
	
	If Session("Admin_Group_ID") = "" Then
		Session("Admin_Group_ID") = "0"
	End If
End If

Dim SQLName, RSName
SQLName = "get_entity_from_group @Group_ID='" & Session("Admin_Group_ID") & "'"
Set RSName=Conn.Execute(SQLName)

	Dim SQLContact, SQLEntity
	Dim RSContact, RSEntity
	
	If Request("Contact_Type_ID") = "" Then
		SQLContact = "Get_Contact @Group_ID='" & Session("Admin_Group_ID") & "', @Distinct=1"
	Else
		SQLContact = "Get_Contact @Group_ID='" & Session("Admin_Group_ID") & "', @Contact_Type_ID='" & Replace(Request("Contact_Type_ID"), "'", "''") & "', @Distinct=1"
	End If
	
	SQLEntity = "Select * from Entity E inner join Group_Entity_Map GEM on E.Entity_ID = GEM.Entity_ID Where GEM.Group_ID = '" & Session("Admin_Group_ID") & "'"
	
	Set RSContact = Conn.Execute(SQLContact)	
	Set RSEntity = Conn.Execute(SQLEntity)
	
%>
<html>
<STYLE>
BODY {SCROLLBAR-FACE-COLOR: #5e5ebe; SCROLLBAR-HIGHLIGHT-COLOR: #5e5ebe; SCROLLBAR-SHADOW-COLOR: #5e5ebe; SCROLLBAR-3DLIGHT-COLOR: #5e5ebe; SCROLLBAR-ARROW-COLOR:  #6666CC; SCROLLBAR-TRACK-COLOR: #E3E3E3; SCROLLBAR-DARKSHADOW-COLOR: #666666; }
</STYLE>
<head>
<title>Manange Staff</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/Style-Sheets/admin-form-no-lines.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/standard-input-form.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/galley-text-indent.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/input-form-small.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/page-formatting.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline-large.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/emagineering.css" type="text/css">

<script language="JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function changetype() {
	form1.submit();
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/icon-return-to-main-2.gif')">
<form name="form1" id="form1" method="post" action="">
<br><table width="97%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr bgcolor="5e5ebe"> 
    <td colspan="3" bgcolor="#5e5ebe"><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2">You 
      are working with Contact records for:</font><b><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="2"> 
<% If Not RSEntity.EOF Then %>
     <%=RSEntity("Name")%> 
<% Else %>
	No Entity Selected
<% End If %>     
     </font></b></td>
    <td><a href="<% 
		If Request.QueryString("From") = "" Then 
			Response.Write(Session("Default_Page"))
		Else
			Response.Write(Request.QueryString("From"))
		End If
    %>" target="content" onClick = "if (top.name == 'entity') top.window.close();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('ReturnToMain','','images/icon-return-to-main-2.gif',1)"><img src="images/icon-return-to-main.gif" width="75" height="17" name="ReturnToMain" border="0"></a></td>
  </tr>
  <tr bgcolor="#CCCCCC"> 
    <td width="33%" class="form-with-no-lines" height="5"> <b></b> 
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="48%"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Contacts</font></b></td>
          <td width="52%" valign="bottom"><% If Not RSEntity.EOF Then %><a href="contact_edit.asp?GID=<%=Session("Admin_Group_ID")%>"><img src="images/contact_create.gif" width="90" height="14" border="0"></a><% End If %></td>
        </tr>
      </table>
    </td>
    <td width="34%" class="form-with-no-lines" height="5"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Title</font></b></td>
    <td width="26%" class="form-with-no-lines" height="5"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Phone</font></b></td>
    <td width="7%" class="form-with-no-lines" height="5">Ext.</td>
  </tr>
  <tr> 
    <td width="33%" class="form-with-no-lines">&nbsp;</td>
    <td width="34%" class="form-with-no-lines">&nbsp;</td>
    <td width="26%" class="form-with-no-lines">&nbsp;</td>
    <td width="7%" class="form-with-no-lines">&nbsp;</td>
  </tr>

<% RowCount = 0 %>

<%
If Not RSContact.EOF Then
  Do While Not RSContact.EOF 
	RowCount = RowCount + 1
	TheID = "CID=" & RSContact("Contact_ID")
	GID = "&GID=" & RSEntity("Group_ID")
%>
  <tr> 
    <td width="33%" class="form-with-no-lines" height="18"><a href="contact_edit.asp?<%= TheID %><%= GID %>" class="form-with-no-lines"><%= Response.Write(RSContact("Name_Prefix") & " " & RSContact("Name_First") & " " & RSContact("Name_Last"))%></a></td>
    <td width="34%" class="form-with-no-lines" height="18"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><%=RSContact("Title")%></font></td>
    <td width="26%" class="form-with-no-lines" height="18"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><%Response.Write(RSContact("Phone_Wk_AreaCode") & "-" & RSContact("Phone_Wk"))%></font></td>
    <td width="7%" class="form-with-no-lines" height="18"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%=RSContact("Phone_Wk_Ext")%></font></td>
  </tr>
<% 
	RSContact.MoveNext()
  Loop
End If 
%>
<tr><td>&nbsp;</td></tr>
  <tr bgcolor="#CCCCCC"> 
    <td colspan="1" class="form-with-no-lines" height="5">&nbsp;
<b><%= RowCount %></b> Record<% If RowCount > 1 Or RowCount = 0 Then Response.Write "s"%> Found&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </td>
    <td colspan="3" class="form-with-no-lines" height="5" align="right">
    <b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000099">Display Records for Type:&nbsp;<select name="Contact_Type_ID" class="input-form-small" onchange="changetype();">
    <option value="" <% If Request("Contact_Type_ID") = "" Then Response.Write " selected"%>>All Records</option>
					<%	SQL = "Select * from Contact_Type"
						Set CT = Conn.Execute(SQL)
						Do While Not CT.EOF
							%>
							<option value="<%=CT("Contact_Type_ID")%>"
							
							<%
							If CStr(Request("Contact_Type_ID")) = CStr(CT("Contact_Type_ID")) Then Response.Write " selected"
							%>
							
							><%=CT("Contact_Type_Name")%></option>
							<%
							CT.MoveNext
						Loop
						Set CT = Nothing
					%>
    </select></font>
    </td>
  </tr>

</table>
</form>
</body>
</html>
<%
RSContact.Close
RSEntity.Close
Set RSEntity = Nothing
Set RSContact = Nothing
Set Conn = Nothing
%>
