// Change Gallery Categories text
YE.onAvailable('categoryTitle', function() {this.innerHTML = 'Galleries'});

YE.onAvailable('subCatGalleryTitle', function() {this.innerHTML = this.innerHTML.replace(/Sub\-Categories/i, "")});

// Photobar position
SM.PhotoBar.config.position = 'bottom';

// Setting categories descriptions
function addCategoryDescription() {
 var categoryDescription = {
     "Round the World 2002" : "A round the world trip we undertook in 2002",
     "Travel" : "Pictures from a number of my travels",
     "Events" : "Different events pics collected", 
     "Video" : "Random video clips"
 };

  if ((YD.hasClass(document.body, "category")) && (!YD.hasClass(document.body, "subcategory"))) { 

    re = /category_(\S+)/i;
    re.exec(document.body.className);

    breadCrumb = YD.get("breadcrumb");
    if (breadCrumb && categoryDescription[RegExp.$1]) {
      divTag = document.createElement("div");
      divTag.className = "categoryDescription";
      divTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
      breadCrumb.parentNode.insertBefore(divTag, breadCrumb.nextSibling);
    }
  }
  if (YD.hasClass(document.body, "homepage")) {
    re = /\>([\w\-\s]+)<\/a>/i;

    divTag = YD.get("categoriesBox");
   if (divTag) {
      divTags = YD.getElementsByClassName("albumTitle", "p", divTag);

      for (i=0; i<divTags.length; i++) {
       re.exec(divTags[i].innerHTML);
        if (categoryDescription[RegExp.$1] != undefined) {
          pTag = document.createElement("p");
          pTag.className = "categoryDescription";
          pTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
          divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
        }
      }
    }
  }
}
YE.addListener(window, "load", addCategoryDescription);

// fix the pesky pipes
YE.onAvailable("cobrand_footer", function() {this.innerHTML = this.innerHTML.replace(/\||what are feeds\?|Available feeds/gi, '');});
