function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

if (hasPath("galleries"))
YD.addClass(document.body, "galleries");

if (hasPath("map")) {
 YD.addClass(document.body, "map");
 loadSmugMaps();
} 

// fix the pesky pipes
YE.onAvailable("cobrand_footer", function() {this.innerHTML = 
this.innerHTML.replace(/\||what are feeds\?/gi, '');});


// change the link on the SmugMug Logo

YE.onAvailable('homelink', function(e) {
this.href = "http://www.richardcrowe.co.uk";
this.firstChild.alt = "Photographs by Richard Crowe";
this.firstChild.title = "Photographs by Richard Crowe";
});



// removes the click on the images in the 'about - contact - guest book' galleries

function noLinky()

{

if (window.AlbumID && (window.AlbumID == "6209603" || window.AlbumID == "6209574" || window.AlbumID == "6209536") && YD.hasClass(document.body, 'loggedIn')) //
return;

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);";

    }

}

noLinky();


// changes the comment to guest 

function ModifyText ()
{
  if (YD.hasClass(document.body, "gallery_6209536"))
  {
    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);

function norobotmail(aUser, aDomain) { document.location = "mailto:" + aUser + "@" + aDomain; }

function delHover() {
    oLst = YD.getElementsBy(function(el) {return (YD.hasClass(el,'imgBorder') || YD.hasClass(el,'imgBorderOn'))},'img');
    for (i=0; i < oLst.length ; i++) {
        if (oLst[i].title && oLst[i].title != '') oLst[i].title = '';
        if (oLst[i].alt && oLst[i].alt != '') oLst[i].alt = '';
    }
}
YE.onContentReady('bodyWrapper', function() {if (!YD.hasClass(document.body, 'smugmug_ajax')) delHover()});
onPhotoShow.subscribe(function(){YE.onAvailable('mainImage', delHover)});


showPhotoBar = false; 


function AddReferralCode() {
var links = this.getElementsByTagName("A");
if (links && (links.length != 0)) {
var smugLink = links.item(0);
smugLink.href = "http://www.smugmug.com/?referrer=dlXzaQAkAmO5g";
}
}
YE.onAvailable('footer', AddReferralCode);

function showRecent(days){
  endDate = new Date();
  oneDay = 1000*60*60*24;
  startDate = new Date(endDate.getTime() - (parseInt(days) * oneDay));
  sUrl = "/date/";
  sUrl += startDate.getFullYear() + "-" + padDate(startDate.getMonth() + 1) + "-" + padDate(startDate.getDate());
  sUrl += "/";
  sUrl += endDate.getFullYear() + "-" + padDate(endDate.getMonth() + 1) + "-" + padDate(endDate.getDate());
   window.location = sUrl;
}

function padDate(datePart){
  if (datePart.toString().length != 1)
    return datePart

  return "0" + datePart;

}
// end Most Recent