<?php 
	require_once('../Connections/pandora.php');
	$query_Recordset1 = "SELECT * FROM marcavehiculo ORDER BY marcavehiculo ASC";
	$Recordset1 = mysqli_query($catalogo,$query_Recordset1) or die(mysqli_error());
	$row_Recordset1 = $Recordset1->fetch_assoc();
	$totalRows_Recordset1 = $Recordset1->num_rows;
?>
<form action="resultado.php" onsubmit="return validarFormMarca()" method="GET" name="form_marca">
	<div class="general_div_busqueda">
        <h4>&nbsp;</h4>
        <h2>
            <?php echo $diccionario['x_aplicacion']; ?> 
        </h2>
        <p>&nbsp;</p>
        <table width="100%" border="0" cellspacing="1" >
            <tr>
              <td align="left" valign="middle" >
                  <select name="idMarca" id="idMarca" class="combo_buscar" onchange="javascript:EnviarDoblePagina('fragmento_buscar_segmento.php?idMarca=' + getSeleccionCombo(this) , 'Muestra_Segmento', 'fragmento_buscar_modelo.php?idMarca=' + getSeleccionCombo(this) + '&segmento=0', 'Muestra_Modelo')">
                    <option value="0"> <?php echo $diccionario['marca']; ?> </option>
                    <?php
                        do {  
                    ?>
                    <option value="<?php echo $row_Recordset1['id']?>" >
                        <?php echo $row_Recordset1['marcavehiculo']?>
                    </option>
                    <?php
                        } while ($row_Recordset1 = $Recordset1->fetch_assoc());
                          $rows = $Recordset1->num_rows;
                          if($rows > 0) {
                              mysqli_data_seek($Recordset1, 0);
                              $row_Recordset1 = $Recordset1->fetch_assoc();
                          }
                    ?>
                  </select>
              </td>
            </tr>
            <tr>
                <td align="left" valign="middle">&nbsp;</td>
            </tr>
            <tr>
                <td align="left" valign="middle">
                    <div id="Muestra_Segmento">
                      <select name="segmento" id="segmento" class="combo_buscar" disabled>
                        <option value="0"> <?php echo $diccionario['segmento']; ?> </option>
                      </select>
                    </div>
                </td>
            </tr>
            <tr>
                <td align="left" valign="middle">&nbsp;</td>
            </tr>
            <tr>
                <td align="left" valign="middle">
                    <div>
                        <div id="Muestra_Modelo">
                            <select name="modelo" id="modelo" class="combo_buscar" style="float:left" disabled>
                                <option value="0"> <?php echo $diccionario['modelo']; ?> </option>
                            </select>   
                        </div>
                       
                    </div>
                </td>
            </tr>
             <tr>
                <td align="left" valign="middle">&nbsp;</td>
            </tr>
            <tr>
                <td align="left" valign="middle">
                 <input  id="imageField" style="float:left" name="imageField" class="btn_buscar2" type="submit" value="Buscar" align="middle">
            </tr>
        </table>
	</div>
</form>
<br />
<script type="text/javascript">
    function validarFormMarca() {
        var idMarca = document.forms["form_marca"]["idMarca"].value;
		var segmento = document.forms["form_marca"]["segmento"].value;
		var modelo = document.forms["form_marca"]["modelo"].value;
		if (idMarca == 0 || segmento == 0 || modelo == 0){
		  	alert('<?php echo $diccionario['seleccionar_marca_segmento_modelo']; ?>');
			return false;
		}
		document.getElementById('loading').style.visibility='visible';
    }
</script>
<?php
	mysqli_free_result($Recordset1);
?>