// rename "gallery comments" to "guestbook comments" on the guestbook page
function ModifyText ()
{
  if (YD.hasClass(document.body, "gallery_3392710"))
  {
    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);


// rename "galleries" to "Main Galleries" on homepage
YE.onAvailable('galleryTitle', function() {this.innerHTML = 'Main Galleries'});


// custom right-click copyright notice
rightClickWarning = "All images are copyright Mark Graves - DigitalNature.co.uk, all rights reserved.\nIf you wish to reproduce anything or require high resolution originals, click the contact link at the top of the page.";


// replace smugmug link in footer with my affiliate link
function AddReferralCode()  {
  var links = this.getElementsByTagName("A");
  if (links && (links.length != 0)) {
    var smugLink = links.item(0);
    smugLink.href = "http://www.smugmug.com/?referrer=UzwybQsrOgwzY";
  }
}
YE.onAvailable('footer', AddReferralCode);


// Vanity URL's
var vanityTable = 
 {
     jordan : "http://www.digitalnature.co.uk/gallery/7043281_hdoMK",
     egypt : "http://www.digitalnature.co.uk/gallery/7043279_gU7ds",
     canaries : "http://www.digitalnature.co.uk/gallery/6829785_zNWy8",
     thailand : "http://www.digitalnature.co.uk/gallery/3382212_CdhVE",
     uganda: "http://www.digitalnature.co.uk/gallery/3445996_hxedK",
     tyneham: "http://www.digitalnature.co.uk/gallery/3384914_jKpjK",
     portsmouth: "http://www.digitalnature.co.uk/gallery/4311672_kGkVB",
     snowdonia: "http://www.digitalnature.co.uk/gallery/4032766_sH2Yy",
     bletchley: "http://www.digitalnature.co.uk/gallery/4270269_Pemx4",
     gower: "http://www.digitalnature.co.uk/gallery/9211491_7jRpZ",
     argyll: "http://www.digitalnature.co.uk/Travel/Argyll"
 };

 function CheckRedirects()
 {
     if (YD.hasClass(document.body, 'homepage'))    // 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
         }
     }
 }