<?

	include("../adm/conexao_e_agenda.php");

	include("../adm/funcoes.php");

	//include("/mostradata.php");

//...............................
  $situcao = "s";
  $_parametro = "";

 if($situcao == "s"){  
  $_parametro .= ($_parametro == "" ? " WHERE " : " AND ");
  $_parametro .= "situacao = 'd'";
  }   
     if($_GET['tipo'] != '0'){  
  $_parametro .= ($_parametro == "" ? " WHERE " : " AND ");
  $_parametro .= "tipo = '$_GET[tipo]'";
  }
    if($_GET['valor'] != '0'){  
  $_parametro .= ($_parametro == "" ? " WHERE " : " AND ");
  $_parametro .= "valor = '$_GET[valor]'";
  }


  $order = ($_GET["ordem"] == "" ? "ORDER BY valor ASC" : "ORDER BY valor ".$_GET["ordem"]);
  $totregpag = ($_GET["regpags"] == "" ? "50" : $_GET["regpags"]);   

  $select_cad = "SELECT * FROM produtos $_parametro $order";
  //$select_cad = "SELECT * FROM imoveis order by id desc"; 

  $result_cad = mysqli_query($conexao,$select_cad) or die($select_cad." = ".mysqli_error($conexao));

//-----------------------------------------------------------------------



$mostrar = $totregpag;//"50"; // total por pagina

if (!($_GET['pagina'])) {

  $pc=1; 

}

else {

  $pc = $_GET['pagina']; 

}



$inicio = $pc - 1; 

$inicio = $inicio * $mostrar;

$result_cad = mysqli_query($conexao,"$select_cad LIMIT $inicio, $mostrar") or die(mysqli_error($conexao));

$result_cad_total = mysqli_query($conexao,"$select_cad") or die(mysqli_error($conexao));

$tr = mysqli_num_rows($result_cad_total); // verifica o número total de registros 

$tp = ceil($tr / $mostrar);  // verifica o número total de páginas 



//------------------------------------------

$variaveis_get = "";

if (!empty($_GET)){	

  foreach($_GET as $chave=>$valor){

    if ($chave != "pagina" && $chave != "ger")      // para não ficar duplicada a variável 'pagina'

      $variaveis_get = $variaveis_get."&$chave=$valor";

  }

}	



//------------------------------------------

$_SESSION['voltando'] = $_SERVER['REQUEST_URI'];	

	?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title><? echo empresa; ?> - Mobile</title>

 <!--<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1;">-->
<?php include("metatags.php"); ?>
 <meta name="viewport" content="width=320, initial-scale=-1">

		<!-- CSS

  	================================================== -->

	<link rel="stylesheet" href="css/base.css">

	<link rel="stylesheet" href="css/grid.css">

	<link rel="stylesheet" href="css/mobile.css">

    

	<!-- Ícones

	================================================== -->

		

    <!-- JS

  	================================================== -->

	<script src="js/jquery_002.js"></script>

	<script src="js/jquery-migrate.js"></script>

	<script src="js/jquery.js"></script>

    <script src="js/selectivizr.js"></script>  

    <script src="js/functions.js"></script>

       

	<!--[if lt IE 9]>

		<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>

	<![endif]-->

    

</head>

<body>

<? include("menu_iniciar.php"); ?>

	

	

	<div class="cols full" id="logo">

		<a href="http://www.adrianosoutoimoveis.com.br/mobile/"><img src="logo_adriano_creci_nabase_la224.png" width="322"></a>	</div>    

<div class="full" id="content">

		

		<div class="container" id="home">           

			

            <!-- nova pesquisa rapida -->      

             

			<h1>Pesquisa clássica</h1>

            

            <div class="full cols">

                <script type="text/javascript" src="js/pesquisa.js"></script>

                <script type="text/javascript">

                    var valorbus = '';

                    var valorcod = '33';

                    var valorneg = '';

                    var valortip = '';

                    var valormin = '';

                    var valormax = '';

                    var valorest = '';

                    var valorcid = '';

                    var valorbai = '';

                    var valormap = '';

                </script>

                                <form id="form2" name="form2" method="get" action="resultado_pesquisa.php">

                

					<div class="c5 cols">

                    	<label for="b_negocio">Faixa de Valor</label>

                        	   <select name="valor" id="select5" class="form2"  style="width:280px">
				               <option value="0"<?  if ($_GET['valor'] == "0") echo "selected"; ?>>Escolher</option>
				               <option value="0-100"<?  if ($_GET['valor'] == "0-100") echo "selected"; ?>>R$ 0,00 - R$ 100,00</option>
                               <option value="100-300"<?  if ($_GET['valor'] == "100-300") echo "selected"; ?>>R$ 100,00 - R$ 300,00</option>
				               <option value="301-500"<?  if ($_GET['valor'] == "301-500") echo "selected"; ?>>R$ 301,00 - R$ 500,00</option>
				               <option value="501-800"<?  if ($_GET['valor'] == "501-800") echo "selected"; ?>>R$ 501,00 - R$ 800,00</option>
				               <option value="801-1000"<?  if ($_GET['valor'] == "801-1000") echo "selected"; ?>>R$ 801,00 - R$ 1.000,00</option>
				               <option value="1001-1500"<?  if ($_GET['valor'] == "1001-1500") echo "selected"; ?>>R$ 1.001,00 - R$ 1.500,00</option>
				               <option value="1501-2000"<?  if ($_GET['valor'] == "1501-2000") echo "selected"; ?>>R$ 1.501,00 - R$ 2.000,00</option>
				               <option value="2001-3000"<?  if ($_GET['valor'] == "2001-3000") echo "selected"; ?>>R$ 2.001,00 - R$ 3.000,00</option>
				               <option value="3000-50000"<?  if ($_GET['valor'] == "3000-50000") echo "selected"; ?>>R$ 3.001,00 - R$ 50.000,00</option>
			                   </select>						

					</div>
        		<div class="c5 cols">

                        <label for="b_tipo">Tipo</label>

                        <? $sql_f="select * from tipos order by desc_tipo asc";

	              $result_f = mysqli_query($conexao,$sql_f);

	          ?>

              <select id="tipo" name="tipo">

              <option value="0" selected>Todos os Tipos</option>

    <? while ($linha_f = mysqli_fetch_array($result_f)){ ?>

    <option value="<? echo $linha_f['id'] ?>" <? if ($linha_f['id'] == $_GET['tipo']) echo "selected"; ?>><? echo minusc_inicia_maiusc($linha_f['desc_tipo']); ?></option>

    <? } ?>

              </select>

					</div>

                     <div class="c25 cols">

						<label for="b_valor_min">Lançamento</label>

                        <select name="lancamento" id="select" class="form2">

                                <option value="0" selected="selected">Todos</option>				                 

                                <option value="2" <? if ($_GET['lancamento'] == "2") echo "selected"; ?>>Não</option>

				                <option value="1" <? if ($_GET['lancamento'] == "1") echo "selected"; ?>>Sim</option>

                      </select>

					</div> 

                    

                    <div class="c25 cols">

						<label for="b_valor_min">Ordem</label>

						<select name="ordem" id="select" class="form2">				                 

                                <option value="DESC" <? if ($_GET['ordem'] == "DESC") echo "selected"; ?>>Maior Valor</option>

				                <option value="ASC" <? if ($_GET['ordem'] == "ASC") echo "selected"; ?>>Menor Valor</option>

                      </select>



					</div>                       

                    

              <div class="cols c5 fist">

						<label>&nbsp;</label>

                    	<input value="PESQUISAR" class="button cols c5 first last" id="pesquisa_botao" type="submit">

                    </div>

                    

                </form>



            </div>

		</div>

	</div>

    

		<div class="full" id="footer">    

    

    	<div class="container">



			<p class="address imobiliaria">

                <strong>Cabelos e Cremes</strong>

                <!--Rua Roberto Rikle, 1250, apto 401 Bloco 07, <br />CEP 85856-440

    Jardim S&atilde;o Paulo II -  Foz do Igua&ccedil;u-PR-->

            </p>

           

         

            <span class="telefone"><span class="ddd">(18)</span>99701-9372<img src="whatsapp-logo.png" width="35" height="31" /></span><br><br>

            <a href="../index.php" class="change"><img src="footer_version_icon.png" height="15" width="17">Acessar a versão clássica</a>

            

<span class="copyright">Cabelos e Cremes © 2016 - <? echo date("Y"); ?>. <br>

            	Todos os direitos reservados.

            </span>

                        

        </div>

        

	</div>        



</body></html>

