function hasPath(sPath)
{
  re = new RegExp("\/" + sPath + "(\/|$)");
  return re.test(window.location)
}


/*===============+++++++===============*/
/*===== Change Guestbook Wording ======*/
/*===================+++++++===========*/


function ModifyText () 
{
  if (YD.hasClass(document.body, "gallery_2827743")) 
  {
    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);

YE.onAvailable('featuredTitle', function() {this.innerHTML = 'Featured galleries'});

YE.onAvailable('categoryTitle', function() {this.innerHTML = 'Gallery categories'});

YE.onAvailable('popularTitle', function() {this.innerHTML = 'Selected photos'});


var vanityTable = 
 {
     blog : "http://rosscollins.smugmug.com/gallery/3053020",
     about : "http://rosscollins.smugmug.com/gallery/3443708",
     guestbook: "http://rosscollins.smugmug.com/gallery/2827743",
     tools: "http://rosscollins.smugmug.com/gallery/1643502",
     copyright: "http://rosscollins.smugmug.com/gallery/1159411",
     problems: "http://rosscollins.smugmug.com/gallery/1462697",
     smugmug: "http://rosscollins.smugmug.com/gallery/1908247",
     updates: "http://rosscollins.smugmug.com/gallery/1636639"
 };

 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
         }
     }
 }