/**************************************************************************\
 breadcrumbs
 \**************************************************************************/
function breadcrumbs(pagina) {
    
    sURL = new String;
    bits = new Object;
    var x = 0;
    var stop = 0;

    sURL = location.href;
    var output = "<a href=\"/home/index.dot\">Home</a> | ";

    if (sURL.indexOf("ricercaAction") != -1 || sURL.indexOf("risultato-ricerca.dot") != -1 || sURL.indexOf("coda.dot") != -1) {
        document.write(output + pagina);
        return;
    }
    if (sURL.indexOf("/contatti/") != -1) {
        output += "<a href=\"#\">Contatti</a> | ";
        document.write(output + pagina);
        return;
    }

    if (sURL.indexOf("dotCMS") == -1) {

        sURL = sURL.slice(8, sURL.length);
        chunkStart = sURL.indexOf("/");
        sURL = sURL.slice(chunkStart + 1, sURL.length);

        var n;
        while (!stop) {
            chunkStart = sURL.indexOf("/");
            if (chunkStart != -1) {
                bits[x] = sURL.slice(0, chunkStart);
                sURL = sURL.slice(chunkStart + 1, sURL.length);
                n = x;
            } else {
                stop = 1;
            }
            x++;
        }

        var nomeBig;
        var nome;

        for (var i in bits) {
            if (i != n || sURL.indexOf("index.dot") == -1) {
                output += "<a href=\"";
                for (y = 1; y < x - i; y++) {
                    output += "../";
                }
                nome = bits[i].replace(/-/g, " ").replace(/_/g, " ");
                var firLet = nome.substr(0, 1);
                var rest = nome.substr(1, nome.length - 1);
                nomeBig = firLet.toUpperCase() + rest;

                output += bits[i] + "/\">" + nomeBig + "</a> | ";
            }
        }
        document.write(output + pagina);
    }
}


function submitToRefresh(combo, action) {
    var form = combo.form;
    form.action = action;
    form.submit();
    return true;
}


/**************************************************************************\
 per pulire la combo della ricerca
 \**************************************************************************/
function doClear(theText) {
    if (theText.value == theText.defaultValue) {
        theText.value = "";
    }
}

