function hasPath(sPath)
{
  re = new RegExp("\/" + sPath + "(\/|$)"); 
  return re.test(window.location)
}


// fix the pesky pipes

YE.onAvailable("cobrand_footer", function() {this.innerHTML = this.innerHTML.replace(/\||what are feeds\?/gi, '');});

// Map Box Title Hack
YE.onContentReady('mapTitle', function() {this.innerHTML = 'Moon River Photography - Mapped'});

// Date Box Title Hack
YE.onContentReady('datesTitle', function() {this.innerHTML = 'Browse by Date'});

// Popular Box Title Hack
YE.onContentReady('popularTitle', function() {this.innerHTML = 'Moon River Photography - Popular Photos'});

// Keyword Box Title Hack
YE.onContentReady('keywordsTitle', function() {this.innerHTML = 'Browse by Keywords'});

// Custom Right Click Message

rightClickWarning = "All photos are © Andy Williams - Moon River Photography. All rights reserved. Unauthorized use is prohibited."


// Removes the clickable link from my portrait services journal gallery

function doOnLoad() {
if (window.AlbumID && (window.AlbumID == "830860" || window.AlbumID ==
"2616865" || window.AlbumID == "729391" || window.AlbumID == "729385")) //
      removeLinkFromImg();
}

function removeLinkFromImg()

{

    var links = document.getElementsByTagName("A");

    for (var i = 0; i < links.length; i++)

    {

        var link = links[i];

        var divElm = link.parentNode;

        if (!divElm)

            continue;

        divElm = divElm.parentNode;

        if (!divElm)

            continue;

        if (divElm.className.indexOf("photo")<0)

            continue;

        link.href = "javascript:void(0);";

    }

} 
YE.onAvailable('bodyWrapper', doOnLoad);



// Secure Email Code

function norobotmail(aUser, aDomain) { document.location = "mailto:" + aUser + "@" + aDomain; }

// automatic smugmug referral code by linkage

function AddReferralCode()  {
   var footerDiv = YD.get("footer");
   if (footerDiv)  {
     var links = footerDiv.getElementsByTagName("A");
     if (links && (links.length != 0)) {
       var smugLink = links.item(0);
       smugLink.href = "http://www.smugmug.com/?referrer=lKTcC0p8CkfRK";
     }
  }
}
YE.onAvailable('footer', AddReferralCode);


// Vanity URLs

var vanityTable =
 {
     contact: "http://www.moonriverphotography.com/Site-Files/Please-Say-Hello/729385_qbFqd",
    
     yourportraits: "http://www.moonriverphotography.com/gallery/830860_WaToT",

     gear: "http://www.moonriverphotography.com/gallery/1836785"

 };

 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
         }
     }
 }

