<!-- #include file="config.asp" -->
<!-- #include file="app_inc/db.asp" -->
<!-- #include file="app_inc/form.asp" -->

<%
if (request.form("nome") <> "") then filtro = " and cf_entrevistador.nome like '%"&request.form("nome")&"%' "

sql_lista = "select  id_cf_entrevistador, cf_entrevistador.nome as nome, cf_status.nome as status, cidade, estado, email from cf_entrevistador, cf_status where cf_entrevistador.id_cf_status = cf_status.id_cf_status and cf_entrevistador.id_cf_status <> 3 and id_cf_tipo_usuario = 1 "&filtro&" and id_cf_entrevistador in (select id_cf_entrevistador from CF_PESQUISA_ENTREVISTADOR where CF_PESQUISA_ENTREVISTADOR.inativo <> 1 and CF_PESQUISA_ENTREVISTADOR.id_cf_entrevistador = cf_entrevistador.id_cf_entrevistador) order by nome asc"
'set rs = con.execute(sql_lista)

'sql_lista = "select  id_cf_entrevistador, cf_entrevistador.nome as nome, cf_status.nome as status, cidade, estado from cf_entrevistador, cf_status where cf_entrevistador.id_cf_status = cf_status.id_cf_status and cf_entrevistador.id_cf_status <> 3 and id_cf_tipo_usuario = 1" _
'		  & " "&filtro&"  and id_cf_entrevistador in (select id_cf_entrevistador from CF_PESQUISA_ENTREVISTADOR where CF_PESQUISA_ENTREVISTADOR.inativo <> 1 and CF_PESQUISA_ENTREVISTADOR.id_cf_entrevistador = cf_entrevistador.id_cf_entrevistador) order by nome asc"
'set rs = con.execute(sql_lista)
	
If Request.QueryString("pag")<>"" Then 
   Session("pagina")=Request.QueryString("pag") 
Else 
   Session("pagina")=1 
End If 
Const adCmdText = &H0001 : Const adOpenStatic = 3 
Set Command = Server.CreateObject("ADODB.Command") 
Set RS =Server.CreateObject("ADODB.RecordSet") 
call db_open()
RS.Open sql_lista,Con,adopenstatic,adcmdtext 

if not (rs.eof) then
	'resultados por pagina a escolher arbitrariamente 	'Dimensionamos as paginas e determinamos a pagina atual 
	num_registros = 15 :									RS.PageSize=num_registros : RS.AbsolutePage=Session("pagina") 
end if


'if (Request.Form() <> "") then
'	for each item in request.Form()
'		if (left(item,3) = "cmb") and (request.Form(item) <> "") then
'			id = split(item,"-")
'				if (id(1) <> "") then
'					str_sql = "update cf_entrevistador set id_cf_status = " & request.Form(item) & " where id_cf_entrevistador = " & id(1)
'					con.execute(str_sql)
'				end if	
'		end if	
'	next
'end if

' response.Write(str_sql)
' Lê as pesquisas do banco



%>
<html>
<head>
<title>IPESO</title>
<link href="css.css" rel="stylesheet" type="text/css">
<script src="form.js" type="text/javascript"></script>
<style type="text/css">
.div_iframe {position:absolute; left:200px; top:100px; width:780px; height:359px; z-index:1; padding: 3px; 

}

</style>
<script type="text/javascript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
function show_div() {if (div_iframe.style.display == 'none') {div_iframe.style.display = 'block'} else {div_iframe.style.display = 'none'}}
function go_page(id_pessoa){
	div_iframe.style.top = event.clientY; div_iframe.style.display = 'block'; main_frame.location.href = 'agendanewpgtoprocentrevexi.asp?identre='+id_pessoa;
	//location.href='agendanewpgtoprocentrevexi.asp?identre='+id_pessoa;
}


function do_over(obj)
{
obj.style.background = 'white';
}
function do_out(obj)
{
obj.style.background = '#f3f3f3';
}
function do_click(obj)
{
//obj.style.background = 'gray';
}
	
   // -->
</script>
</head>
<body onclick="close_sub_menu_geral();">
<form name="f" method="post" action="#"  onSubmit="//return form_confirm('Confirma ação?');">
<div id="div_iframe" class="div_iframe" style="display: none">
<table id="tb_iframe" width="100%" border="1" bgcolor="#F3F3F3" style="border-collapse: collapse; border-color: #f0f0f0; display: block">
	<tr> 
		<td height="20" background="app_img/faixa_top.jpg">
			<table width="100%" cellpadding="1" cellspacing="0">
				<tr><td><b><font size="1" face="verdana">Detalhes</font></b></td><td align="right">
					<input  onClick="show_div()" type="button" name="Submit2" value="" align="top" style=" font-family: comic sans; font-size: 8px; width: 18px; font-weight: bold; height: 17px; padding: 0px 0px 0px 0px; background: url(app_img/bg_close.gif); background-repeat: no-repeat">
				</td>
				</tr>
		  </table>
		</td>
    </tr>
	<tr>
		<td height="300">
		<iframe src="" name="main_frame" id="main_frame" width="100%" frameborder="0" height="100%" marginheight="0" marginwidth="0"></iframe>		</td>
	</tr>
	<tr>
	  <td>&nbsp;</td>
    </tr>
</table>
</div>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td height="40" background="app_img/topo_background.jpg" bgcolor="#DFDFDF">
				
				</td>
            </tr>
			<tr>
			  <td height="15px"><!-- #include file="menu.asp" --></td>
			</tr>
            <tr>
              <td align="center" valign="top" style="padding-bottom: 30px; padding-top: 30px;">
			  <!-- Content here -->
			  <div class="div_topic" style="width: 750px">Listagem de entrevistadores			  </div>
                    <table width="750" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                      <tr>
                        <td align="left" bgcolor="f0f0f0">
						
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="44%" bgcolor="#B9D4E5" class="td_title">Nome</td>
                            <td width="9%" bgcolor="#B9D4E5" class="td_title">Estado</td>
                            <td width="9%" bgcolor="#B9D4E5" class="td_title">Email</td>
                          </tr>
						  
                          <tr>
                            <td class="td_content"><input name="nome" type="text" class="textBox" id="nome" value="<% = request.form("busca") %>">
                            <input name="Submit" type="submit" class="Botao" value="Buscar"></td>
                            <td class="td_content">&nbsp;</td>
                            <td class="td_content">&nbsp;</td>
                          </tr>
			  <% While (Not RS.eof And registros_mostrados < num_registros) registros_mostrados = registros_mostrados +1 %>
						  <tr style="cursor: default" title="Exibir Dados Bancários" onClick="go_page(<%=rs("id_cf_entrevistador")%>); do_click(this); " onMouseOver="do_over(this)" onMouseOut="do_out(this)"	>
                          <td class="td_content"><% db_write(rs("nome")) %></td>
                          <td class="td_content"><% db_write rs("estado") %></td>
                          <td class="td_content"><% db_write rs("email") %></td>
                          </tr>
						  <%
						  	
						  	rs.moveNext 
							wend 
							%>
                          <tr>
                            <td colspan="3" align="center" bgcolor="#B9D4E5" class="td_title_content">
								<div align="center">
	<% 
		i=0 
		While ( i < RS.PageCount )
	    i=i+1 
		%> 
		<b>
		<a href="agendanovopgtoprocentrev.asp?pag=<%=i%>"><%=i%></a></b> 
<% 
Wend 
%> 
								</div>							</td>
                          </tr>
                        </table>
						
						</td>
                      </tr>
                    </table>
					<div align="left" class="texto" style="padding-left: 15%">

	Página atual: <b><%=Session("pagina")%></b> <br> 
	Total de páginas: <b><%=RS.PageCount%></b> <br> 
	Registros por página: <b><%=RS.PageSize%></b> <br> 
	Total de registros: <b><%=RS.RecordCount%></b> 
</div> 

                    <br>
                    <iframe name="frmMain" width="750" scrolling="no" height="50" frameborder="0"></iframe>			  </td>
            </tr>
            <tr>
                <td height="26" background="app_img/bottom_background.jpg" bgcolor="#DFDFDF">&nbsp;              </td>
            </tr>
  </table>
</form>
</body>
</html>