<!--#include virtual="/includes/topofpage.asp"-->
<%
Dim State
State = "%"
%>
<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>Available Parent Entity List</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function SetParam(ID, Name, Address, City, State, Zip){
//parent.frames[1].location='main_menu.asp';
opener.document.form1.Sponsor_City.value=City;
opener.document.form1.Sponsor_State.value=State;
opener.document.form1.Sponsor_Address_1.value=Address;
opener.document.form1.Sponsor_Name.value=Name;
opener.document.form1.Sponsor_ID.value=ID;
opener.document.form1.Sponsor_zip.value=Zip;
window.close();
}
//-->
</SCRIPT>
</head>

<body bgcolor="#ffffff">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<TABLE cellSpacing=0 cellPadding=0 width=300 border=0>
  <TR bgColor=#6699cc>
    <TD colSpan=2><B><FONT face="Verdana, Arial, Helvetica, sans-serif" 
      color=#000000 size=2>&nbsp;&nbsp;&nbsp;Available Parent Entities</FONT></B></TD>
      <TD align=left><FONT face="Verdana, Arial, Helvetica, sans-serif" 
      color=#000000 size=1><A onclick="window.close()" href="#">Hide ID's</A></FONT></TD></TR>
  <TR vAlign=center bgColor=silver borderColorDark=black>
    <TD align=right width=50 height=24>
      <P align=center><B><FONT 
      face="Verdana, Arial, Helvetica, sans-serif" size=1>Entity ID 
      </FONT></B></P></TD>
    <TD width=150 height=24>
      <P align=center><STRONG><FONT size=1> 
    Name</FONT></STRONG></P> </TD>
    <TD align=middle width=100 height=24>
      <P align=center><STRONG><FONT size=1>Description</FONT></STRONG></P></TD></TR>
  <TR><FORM action="" method=POST id=form1 name=form1>
    <TD align=center colspan=3><FONT size=1>Type in a full or partial name to search for:<INPUT type="text" id="search" name="search"><br><INPUT type="button" value="Button" id="submit" name="submit" LANGUAGE=javascript onclick="form1.submit();">
    </font>
    </FORM>
      </TD>
     
    <%	
If UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" Then    
	Dim SQL2, sType_ID, sType_Name, sType_Description
	Dim Conn, RS
	
	Set Conn = Server.CreateObject("ADODB.Connection")
	Conn.Open "DRIVER={SQL Server};SERVER=WEBSRV01;UID=web;pwd=w3bs1t3;DATABASE=AVANTE"

	SQL1 = "Select * from Entity E inner join Entity_Detail ED on E.Entity_ID = ED.Entity_ID where E.[Name] Like '%" & Request.Form("search") & "%' And ED.State Like '" & State & "' ORDER BY E.[Name] ASC"
		
	Set RS=Conn.Execute(SQL1)
if rs.eof then
	Response.Write "<br>"
	Response.Write "<br>"
	Response.Write "<p></p>"
	Response.Write "<Center><h1> No Data Available </h1></center>"

End if

Do while not rs.eof
%>
<TR>
<td align=left colspan=2><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1><A href="#" onclick="SetParam('<%=rs("Entity_Id")%>', '<%=Replace(Replace(Replace(rs("Name"), "'", "\'"), """", ""), Chr(13) & Chr(10), "")%>', '<%=Replace(Replace(Replace(rs("Address_1"), "'", "\'"), """", ""), Chr(13) & Chr(10), "")%>', '<%=Replace(Replace(Replace(rs("City"), "'", "\'"), """", ""), Chr(13) & Chr(10), "")%>', '<%=Replace(rs("State"), Chr(13) & Chr(10), "")%>', '<%=Replace(rs("zip"), Chr(13) & Chr(10), "")%>');"><%=rs("Name")%></A></FONT></td>
<td><FONT face="Verdana, Arial, Helvetica, sans-serif" size=1><%=rs("City")%>&nbsp;</FONT></td></tr>
	<%
	rs.movenext
Loop	
End If
%>

  <TR align=middle>
    <TD colSpan=4 height=17>&nbsp;
  </TD></TR></TABLE>
  </font></p>
</body>
</html>
