var vanityTable = 
 {
     cpi : "http://pilotdave.smugmug.com/Skydiving/232912",
     vic : "http://pilotdave.smugmug.com/gallery/2024282",
     owen : "http://pilotdave.smugmug.com/gallery/2119972",
     grinch : "http://www.skydivingstills.com/gallery/2302594",
     ray : "http://www.skydivingstills.com/gallery/2327909",
     ellington : "http://www.skydivingstills.com/gallery/5921007_rLef5",
     lw07 : "http://www.skydivingstills.com/gallery/2393722",
     info : "http://www.skydivingstills.com/gallery/2587999",
     vortex : "http://www.skydivingstills.com/gallery/5266244_5wEwN",
     harness : "http://www.skydivingstills.com/gallery/2795704",
     cpi2007 : "http://www.skydivingstills.com/gallery/3940083",
     george : "http://www.skydivingstills.com/gallery/2938283",
     cpi08 : "http://www.skydivingstills.com/gallery/5838580_5KEQ4",
     book08 : "http://www.skydivingstills.com/gallery/6787354_oCVLV",
     meg : "http://www.skydivingstills.com/gallery/8890235_quxZZ",
     israelwedding : "http://www.skydivingstills.com/Other/Shimrit-Meir-Wedding-Israel/11384592_UMs5m",
     fran_ed : "http://www.skydivingstills.com/gallery/2038913"
 };



function IsHomePage()
 {
    return(YD.hasClass(document.body, 'homepage'));
 }
 
 function CheckRedirects()
 {
     if (IsHomePage())    // only run this code on the home page
     {
         // get the path from the current URL, 
         // convert it to lowercase and remove the leading slash
         var path = window.location.pathname.toLowerCase().substr(1);
         
         var newURL = vanityTable[path];        // look it up in our table
         
         // if we found it in the table && newURL is different than where we are
         if (newURL && (newURL != window.location))
         {
             window.location.replace(newURL);        // go to the new URL
         }
     }
 }

rightClickWarning = "This photo can be downloaded by clicking 'Buy This Photo' above and selecting 'Digital Download' from the purchase options." 

YE.onAvailable('featuredTitle', function() {this.innerHTML = 'newest galleries'});
YE.onAvailable('categoryTitle', function() {this.innerHTML = 'categories'});

function addCategoryDescription() {
 var categoryDescription = {
     "Connecticut_Parachutists" : "Ellington, CT",
     "category2" : "This is another test.",
      "category3" : "Final test" 
 };

  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); 

// change the link on the SmugMug Logo

YE.onAvailable('homelink', function(e) {

this.href = "http://www.SkydivingStills.com/";

this.firstChild.alt = "SkydivingStills.com Home";

this.firstChild.title = "SkydivingStills.com Home";

});

// removes the pipes characters in the toolbar header

YE.onAvailable('toolbar', function(e) {

this.innerHTML = this.innerHTML.replace(new RegExp(/\|/g),"");

});






/* Code for left-hand photobar removed */

 
function AddReferralCode()  {
  var links = this.getElementsByTagName("A");
  if (links && (links.length != 0)) {
    var smugLink = links.item(0);
    smugLink.href = "http://www.smugmug.com/?referrer=LtRqdQ9lfYRr6";
  }
}
YE.onAvailable('footer', AddReferralCode);


function writeEMail(pLinkText, pSubject)
{
var v2="WF5CYVXGWJ6MJQ2YBTXSIVDA";
var v7=unescape("3%27C%26%19%253%3E3%23@%24%246A-+84%20g5+%2C");
 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='+escape(pSubject)+'\'">'+pLinkText+'</a>');
}


function ModifyBreadcrumb () {
var objElement = document.getElementById("breadcrumb")
if (objElement != null) {
var str = new String(objElement.innerHTML);
str = str.replace('Dave', 'Home');
objElement.innerHTML = str;
}
}
YE.onAvailable('breadcrumb', ModifyBreadcrumb);