//Begin my local customizations

//redirect people who get the SM domain...
function redirectPath() { 
  re = /(rdlugosz.smugmug.com)/; 
  tmp = window.location.href; 
  if (re.test(tmp)) { 
    tmp = tmp.replace(re, 'gallery.rrdphoto.com'); 
    window.location.href = tmp; 
  } 
}
redirectPath(); 

//Add referral code to footer
function AddReferralCode() {
  var links = this.getElementsByTagName("A");
  if (links && (links.length != 0)) {
    var smugLink = links.item(0);
    smugLink.href = "http://www.smugmug.com/?referrer=gpWgUPMRMHPNU";
  }
}
YE.onAvailable('footer', AddReferralCode);

copyMsg = "All photographs Copyright ©1997-" + new Date().getFullYear() + ", Ryan R. Dlugosz / RRD Photo, LLC.";

rightClickWarning = copyMsg + " All rights reserved. Unauthorized use is prohibited.\n\nProfessional lab prints and digital downloads are available for personal use via the Buy Photo link. Commercial and editorial licensing is also available for most images; please contact us with the specifics of your need.";

//Custom Titles on Pages
//see: http://www.dgrin.com/showthread.php?t=25861
document.title = "RRD Photo :: [loading...]";
function RelevantTitle()
{
   var homeTitle = "RRD Photo :: Ryan R. Dlugosz Photography - Cincinnati, OH";
   var baseTitle = "RRD Photo";
   var separator = " :: ";
   var albumTitle = document.getElementById("albumTitle");
   var galleryTitle = document.getElementById("galleryTitle");
   if( albumTitle && albumTitle.textContent )
      document.title = baseTitle + separator + albumTitle.textContent;
   else if( galleryTitle && galleryTitle.textContent )
   {
      var galleryTitleText = galleryTitle.textContent;
      // Strip " sub-categories" off the end of the category text
      var finalPositionCategory = galleryTitleText.search(" sub-categories");
      if( finalPositionCategory >= 0 )
         galleryTitleText = galleryTitleText.substr( 0, finalPositionCategory );
      else
      {
         // Strip " galleries" off the end of the category/sub-category text
         var finalPositionSubCategory = galleryTitleText.search(" galleries");
         if( finalPositionSubCategory >= 0 )
            galleryTitleText = galleryTitleText.substr( 0, finalPositionSubCategory );
      }
      document.title = baseTitle + separator + galleryTitleText;
   }
   else // Not Gallery, Category, or Subcategory
   {
      // Set title on homepage
      document.title = homeTitle;
   }
}

function dhtmlLoadScript(url)
{
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e);
}