
function breadcrumbs() {
    sURL = new String;
    bits = new Object;
    var x = 0;
    var stop = 0;
    var output = "<a href=\"/\">Home</a> &nbsp;>&nbsp; ";
    sURL = location.href;
    chunkEnd = sURL.indexOf("?");
    if (chunkEnd != -1) {
        sURL = sURL.slice(0, chunkEnd);
    }
    var sPage = sURL.substring(sURL.lastIndexOf('/') + 1);

    sURL = sURL.slice(8, sURL.length);
    chunkStart = sURL.indexOf("/");
    sURL = sURL.slice(chunkStart + 1, sURL.length)

    while (!stop) {
        chunkStart = sURL.indexOf("/");
        if (chunkStart != -1) {
            bits[x] = sURL.slice(0, chunkStart)
            sURL = sURL.slice(chunkStart + 1, sURL.length);
        } else {
            stop = 1;
        }
        x++;
    }

    for (var i in bits) {
        output += "<a href=\"";
        for (y = 1; y < x - i; y++) {
            output += "../";
        }
       
        bit = bits[i].replace(/_/g, ' ').toLowerCase();
        var display = '';
        var temp = new Array();
        temp = bit.split(' ');
        for (var i in temp) {
            display += temp[i].substr(0, 1).toUpperCase() + temp[i].substr(1) + ' ';
        }

        output += bits[i] + "/\">" + display.substr(0, 1).toUpperCase() + display.substr(1) + "</a> &nbsp;>&nbsp; ";
    }

    if (sPage.length > 0) {
        if (sPage.indexOf('.') > 0) {
            sPage = sPage.substring(0, sPage.indexOf('.')).toLowerCase();

            if (sPage != 'default' && sPage != 'index') {

                bit = sPage.replace(/_/g, ' ').toLowerCase();
                var display = '';
              
                    var temp = new Array();
                    temp = bit.split(' ');
                    for (var i in temp) {
                        display += temp[i].substr(0, 1).toUpperCase() + temp[i].substr(1) + ' ';
                    }

                output += display.substr(0, 1).toUpperCase() + display.substr(1);
            }
        }
    }

    document.write(output);
}

