// look to swap after the page is loaded
onload = swapFF;
// the swap function
function swapFF() {
     // look at the body tags classes, if it is the homepage then swap
     bodyClass = document.getElementsByTagName("body")[0].className;
     if (bodyClass.indexOf("homepage") != -1) {
          swap = document.getElementById("ffBox").innerHTML;
          document.getElementById("ffBox").innerHTML = document.getElementById("featuredBox").innerHTML;
          document.getElementById("featuredBox").innerHTML = document.getElementById("galleriesBox").innerHTML;
          document.getElementById("galleriesBox").innerHTML = swap;
     }
}

// ****************************************************
// Custom function by Devbobo & BigWebGuy to add desc to cats
// ****************************************************

function addCategoryDescription()
{
  var categoryDescription = {
      "Events"         : "Great events like the Reneissance Fests and OSTR Conferences",
      "Weddings"       : "PRIVATE - Devin & Jessica's Wedding Photos",
      "Places"         : "",
      "Portraits"      : "NEW - Photos taken in my new photo studio in my basement  TFP arrangements available",
      "Trains"         : "",
      "Portfolio"      : "Modeling photography with FredMiranda photo club  TFP arrangements available",

      "Administrative" : "PRIVATE - site administrative postings",
      "Flowers"        : "",
      "Projects"       : "Photo assignments for fun",
      "Variety"        : "",
      "Sports"         : "Local sports shooting for fun and experience",
      "Parties"        : "", 
      "Friends"        : "",
      "Family"         : ""
  };

  if ((isClass("category")) && (!isClass("subcategory")))
  {

    re = /category_(\S+)/i;
    re.exec(document.body.className);

    breadCrumb = document.getElementById("breadcrumb");
    if (breadCrumb)
    {
      divTag = document.createElement("div");
      divTag.className = "categoryDescription";
      divTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
      breadCrumb.parentNode.insertBefore(divTag, breadCrumb.nextSibling);
    }
  }
  if (isClass("homepage"))
  {
    re = /\>([\w\-]+)<\/a>/i;

    divTag = document.getElementById("categoriesBox");
    if (divTag)
    {
      divTags = divTag.getElementsByTagName("p");

      for (i=0; i<divTags.length; i++)
      {
        if (divTags[i].className == "albumTitle")
        {
          re.exec(divTags[i].innerHTML);
          pTag = document.createElement("p");
          pTag.className = "categoryDescription";
          pTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
          divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
        }
      }
    }
  }
}

function isClass(sClass) {
  sClassName = document.body.className;

  re = new RegExp(sClass + "( |$)") 

  if (!sClassName)
    return false;
  return re.test(sClassName);
}

// addEvent(window, "load", addCategoryDescription);

