function swapBoxes() {
     bodyClass = document.getElementsByTagName("body")[0].className;
     if (bodyClass.indexOf("category") != -1)
     {
        box1 = document.getElementById("subcategoriesBox");
        box2 = document.getElementById("galleriesBox");

        if (box1 && box2)
        {
           swap = box1.innerHTML;
           box1.innerHTML = box2.innerHTML;
           box2.innerHTML = swap;
        }
     }
}

function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}



/*Guestbook*/
function ModifyText () 
{
  if (YD.hasClass(document.body, "gallery_3229264")) 
  {
    var objElement = YD.get("comment")
    if (objElement != null) 
    {
      var str = new String(objElement.innerHTML);
      str = str.replace(/\gallery/gi, 'guestbook');
      objElement.innerHTML = str;
    }
  }
}

YE.onAvailable("comment", ModifyText);

/* Email Us Script (anti-spam) */
function writeEMail(pLinkText, pSubject)
{
var v2="NEX4FA62SN8VCII";
var v7=unescape("%24%20%3ER%06*CX2%3APx%20%26%24");
 var v5=v2.length;var v1="";
 for(var v4=0;v4<v5;v4++)
 {
  v1+=String.fromCharCode(v2.charCodeAt(v4)^v7.charCodeAt(v4));
 }
document.write('<a href="javascript:void(0)" onclick="window.location=\'mail\u0074o\u003a'+v1+'?subject=Smugmug%3A%20email'+'\'">'+'email us!<\/a>');
}

/* Custom Category Descriptions */
/*
function addCategoryDescription() {
  var categoryDescription = {
      "Family"  : "This is where the bulk of our pictures go.",
      "Friends"  : "I haven't kept this up to date very much.",
      "Other"  : "Just some miscellaneous galleries that I use for other things."
      "House"  : "I haven't kept this up to date very much."
  };

  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\-]+)<\/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);
*/


//Add descriptions for Categories
function addCategoryDescription() {
  var categoryDescription = {
      "Family"  : "Our most recent pictures are here.  If you're looking for older stuff, scroll down to the Family sub-categories section.",
      "Other"  : "Various pictures that don't really fit anywhere.",
      "Friends"  : "We don't update this very often.",
      "House"  : "We don't update this very often.",
      "Mom Ku Australian Adventure"  : "Pictures from my Mom's vacation a long time ago.",
      "General" : "There is nothing here."
  };

  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\-]+)<\/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);