
function scheda_progetto_cambia_immagine(url){
    //  Avvio il caricamento della nuova immagine
    document.getElementById("loader").style.display = 'block';
    var image = new Image();
    image.onload = function(){
        document.getElementById("loader").style.display = 'none';
        document.getElementById('scheda_progetto_immagine').src = url;
    }
    image.src = url;
}



//----------------------------------------------------------------------------//



var scheda_prodotto_immagine_attiva = 1;

function scheda_prodotto_cambia_immagine(index, url){
    document.getElementById('scheda_prodotto_link_immagine_'+scheda_prodotto_immagine_attiva).className = 'normal';
    document.getElementById('scheda_prodotto_link_immagine_'+index).className = 'active';

    //  Avvio il caricamento della nuova immagine
    document.getElementById("loader").style.display = 'block';
    var image = new Image();
    image.onload = function(){
        document.getElementById("loader").style.display = 'none';
        document.getElementById('scheda_prodotto_immagine').src = url;
        scheda_prodotto_immagine_attiva = index;
    }
    image.src = url;
}



//----------------------------------------------------------------------------//



function prodotti_show(id_prodotti){

    //  Cerco tutte le thumbnail
    var thumbnail = document.getElementsByTagName('img');

    for(var i=0; i<thumbnail.length; i++){
        if(thumbnail[i].getAttribute('rel')=='thumbnail_prodotto'){
            //  Controllo se questo prodotto è da mostrare o da nascondere
            var mostra = false;
            for(var k=0; k<id_prodotti.length; k++){
                if(thumbnail[i].id==id_prodotti[k]){
                    mostra = true;
                    k = id_prodotti.length;
                }
            }
            if(mostra==false){
                thumbnail[i].className = 'show_50';
            }
        }
    }
}

function prodotti_hide(id_prodotti){

    //  Cerco tutte le thumbnail
    var thumbnail = document.getElementsByTagName('img');

    for(var i=0; i<thumbnail.length; i++){
        if(thumbnail[i].getAttribute('rel')=='thumbnail_prodotto'){
            //  Controllo se questo prodotto è da mostrare o da nascondere
            var mostra = false;
            for(var k=0; k<id_prodotti.length; k++){
                if(thumbnail[i].id==id_prodotti[k]){
                    mostra = true;
                    k = id_prodotti.length;
                }
            }
            if(mostra==false){
                thumbnail[i].className = 'show_100';
            }
        }
    }
}
