     var proveList= {identifier:"sezione_prove",items:[{sezione_prove:"scegli"},{sezione_prove:"CityBike"},{sezione_prove:"DownHill"},{sezione_prove:"Elettriche"},{sezione_prove:"Mtb"},{sezione_prove:"Strada"},{sezione_prove:"Telaio"},{sezione_prove:"Triatlhon"},{sezione_prove:""}]};
     var modelloList = {identifier:"id",items:[{id:"scegli", name:"scegli"}]};
     var marcheList= {identifier:"id",items:[{id:"scegli", name:"scegli"}]};
     var anniList= {identifier:"id",items:[{id:"scegli", name:"scegli"}]};
     var proveStore;
     var modelloStore;
     var marcaStore;
     var annoStore;

     dojo.addOnLoad(init);  // in  questo modo in fase di inizializzazione carica le variabili degli store di Dojo
     
function init(){
     traccia=false; 
     proveStore= new dojo.data.ItemFileReadStore({data: proveList});
     modelloStore = new dojo.data.ItemFileReadStore({data: modelloList});
     marcaStore = new dojo.data.ItemFileReadStore({data: marcheList});
     annoStore= new dojo.data.ItemFileReadStore({data: anniList});

     dijit.byId('tipo').store = proveStore;
     dijit.byId('marca').store = marcaStore;
     dijit.byId('modello').store =modelloStore;
     dijit.byId('anno').store =annoStore;

     dijit.byId('marca').setDisplayedValue('scegli');
     dijit.byId('modello').setDisplayedValue('scegli');
     dijit.byId('tipo').setDisplayedValue('scegli');
     dijit.byId('anno').setDisplayedValue('scegli');
     traccia=true;
}

     function Esegui_Ricerca(valore) {
          LoadAdvAndTrack('ricerca/'+dijit.byId('tipo').value+'/'+dijit.byId('marca').value+'/'+dijit.byId('modello').value+'/'+dijit.byId('anno').value+"/cerca");
          var trovato=false;
          SearchJSON.init({layer:"risultati",link:"true",pag:1,widget:"risultato_ricerca",ordby:"data_search"});
          var q;
          var query;
          q="NOT FIELD IDPadre is present" ;
          if ((dijit.byId("tipo").value!="scegli") && (dijit.byId("tipo").value!="undefined")) 
             {q=q+" AND FIELD tipologia=\""+dijit.byId("tipo").value+"\"";trovato=true}
          if ((dijit.byId("marca").value!="scegli") && (dijit.byId("tipo").value!="undefined")) 
             {q=q+" AND FIELD marca=\""+dijit.byId("marca").value+"\"";trovato=true}
          if ((dijit.byId("modello").value!="scegli") && (dijit.byId("tipo").value!="undefined")) 
             {q=q+" AND FIELD modello=\""+dijit.byId("modello").value+"\"";trovato=true;}
           if ((dijit.byId("anno").value!="scegli") && (dijit.byId("tipo").value!="undefined")) 
             {q=q+" AND FIELD anno=\""+dijit.byId("anno").value+"\"";trovato=true}
          if (trovato==true)  SearchJSON.load_search(q)
       } 

function updateModelli() {
if (dijit.byId("marca").value!="scegli") { 

     var query = "";
     if (dijit.byId("tipo").value!="scegli")  {
        if (query.length > 0) query += " AND ";
        query += "FIELD tipologia=\""+dijit.byId("tipo").value+"\"";
     }
     if (dijit.byId("marca").value!="scegli")  {
        if (query.length > 0) query += " AND ";
        query += "FIELD marca=\""+dijit.byId("marca").value+"\"";
     }

      xhr={
            url: '../StoreFilteringSelect?OpenAgent&charset=UTF-8',
            handleAs: 'json',
            sync:false,
            content: {query:query, fieldret:"modello",vista:"gdSearch" },
            preventCache:true,
            load: function(response, args) {
                           console.debug("Caricamento dati...");
                           var modelli=response;
                           if(modelli.errore){
                             // azzerare datastore
                                    var jsonObj={identifier:"id",items:[{id:"scegli",name:"scegli"}]};
                           }
                           else{
                                var jsonObj = response; 
                           }
                         var dataStore = new dojo.data.ItemFileReadStore({data: jsonObj}); 
                         dijit.byId('modello').store = dataStore;
     traccia=false;
                         dijit.byId('modello').setDisplayedValue('scegli');
     traccia=true;
                         dojo.fadeIn({
                                   node: 'layer_modello',
                                   duration: 500,
                                   beforeBegin: function() {
                                      var node = dojo.byId('layer_modello');
                                      dojo.style(node, "opacity", 0);
                                      dojo.style(node, "display", "block");
                                     }
                                 }).play();                        
                         updateAnni();
                    },
            error: function(response, args) {
            console.error("JSON HTTP Request Error with [HTTP] status code: ", args.xhr.status);
            return(response);
        }};
      var response = dojo.xhrGet(xhr); 
   }
  }


  function updateMarche() {

      var query="";
      if (dijit.byId("tipo").value!="scegli")  {
        if (query.length > 0) query += " AND ";
        query += "FIELD tipologia=\""+dijit.byId("tipo").value+"\"";
     }

       xhr={
            url: '../StoreFilteringSelect?OpenAgent&charset=UTF-8',
            handleAs: 'json',
            sync:false,
            content: {query:query, fieldret:"marca",vista:"gdSearch" },
            preventCache:true,
            load: function(response, args) {
                          console.debug("Caricamento dati...");
                          var marche=response; 
                          if(marche.errore){
                         // azzerare datastore
                            var jsonObj={identifier:"id",items:[{id:"scegli",name:"scegli"}]};
                         }
                         else{
                           var jsonObj = response;
                         }
                         var dataStore = new dojo.data.ItemFileReadStore({data: jsonObj}); 
                         dijit.byId('marca').store = dataStore;
     traccia=false;
                         dijit.byId('marca').setDisplayedValue('scegli');
     traccia=true;
                         dojo.fadeIn({
                           node: 'layer_marca',
                           duration: 500,
                           beforeBegin: function() {
                                var node = dojo.byId('layer_marca');
                                dojo.style(node, "opacity", 0);
                                dojo.style(node, "display", "block");
                             }
                         }).play();
                       updateModelli()
                       updateAnni();
            },
            error: function(response, args) {
            console.error("JSON HTTP Request Error with [HTTP] status code: ", args.xhr.status);
            return(response);
        }};
      var response = dojo.xhrGet(xhr); 
     
  }


 function updateAnni() {
      var query="";
      if (dijit.byId("tipo").value!="scegli")  {
        if (query.length > 0) query += " AND ";
        query += "FIELD tipologia=\""+dijit.byId("tipo").value+"\"";
     }
     if (dijit.byId("marca").value!="scegli")  {
        if (query.length > 0) query += " AND ";
        query += "FIELD marca=\""+dijit.byId("marca").value+"\"";
     }
     if (dijit.byId("modello").value!="scegli")  {
        if (query.length > 0) query += " AND ";
        query += "FIELD modello=\""+dijit.byId("modello").value+"\"";
     }

      xhr={
            url: '../StoreFilteringSelect?OpenAgent&charset=UTF-8',
            handleAs: 'json',
            sync:false,
            content: {query:query, fieldret:"anno",vista:"gdSearch" },
            preventCache:true,
            load: function(response, args) {
                           console.debug("Caricamento dati...");
                           var anni=response; 
                           if(anni.errore){
                             // azzerare datastore
                             var jsonObj={identifier:"id",items:[{idl:"scegli",name:"scegli"}]};
                           }
                           else{
                              var jsonObj = response; 
                           }
                           var dataStore = new dojo.data.ItemFileReadStore({data: jsonObj}); 
                           dijit.byId('anno').store = dataStore;
     traccia=false;
                           dijit.byId('anno').setDisplayedValue('scegli');
     traccia=true;
                           dojo.fadeIn({
                               node: 'layer_anno',
                               duration: 500,
                               beforeBegin: function() {
                               var node = dojo.byId('layer_anno');
                               dojo.style(node, "opacity", 0);
                              dojo.style(node, "display", "block");
                           }
                          }).play();
            },
            error: function(response, args) {
            console.error("JSON HTTP Request Error with [HTTP] status code: ", args.xhr.status);
            return(response);
        }};
      var response = dojo.xhrGet(xhr); 
  }

