/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

 function reloadBuscador(padre){
    
    var parametros = '';
    var identi     = new Array();
    var cont  = 0;
    
    $('.buscador').each(function(index, domEle){ // option:selected
           if( padre == jQuery(domEle).parent().attr('name') ) {
               parametros    += jQuery(domEle).attr('id') + '=' + domEle.value + '&';
               identi[cont++] = jQuery(domEle).attr('id');              
           }
    });

    jQuery.ajax({
        url: "reload-buscador.php",
        data: parametros,
        type:   "GET",
        async:   true,
        dataType:   "json",
        success: function(datos){
            for( i=0; i < identi.length   ;i++ ) {
                tempSelect   = jQuery('#'+identi[i]);
                
                
                selectedIndex = tempSelect.attr("selectedIndex");
                selectedArray = tempSelect.attr("options");
                titulo        = selectedArray[selectedIndex];

                tempSelect.html(titulo);
                
                if( datos[i] != null) {
                    for( y=0; y < datos[i].length  ; y++ ) {
                        if( titulo.value != datos[i][y].id){
                            tempSelect.append('<option value="'+ datos[i][y].id +'">' + datos[i][y].titulo + '</option>');
                        }
                        
                    }
                }
                
            }
        }
      });

  }

