String.prototype.capitalize_each_word = function () {
var words = this.split(" ");
var str = "";
words.each(function (word, index) {
str += word.capitalize()
if (index !== (str.length - 1)) { str += " "; }
});
return str;
}
document.observe('dom:loaded', function () {
var output = "";
var url = "";
var path = location.pathname.split("/").without("");
var div = $("breadcrumbs");
if (path.length >= 1) {
output += "Home > ";
path.each(function (i, index) {
url += "/" + i;
i = i.gsub("[-|_]"," ").capitalize_each_word();
if (index !== (path.length - 1)) {
output += "" + i + " > ";
} else { output += i; }
});
}
if (div) { div.update(output); }
});