function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

if (hasPath("galleries"))
YD.addClass(document.body, "galleries");

function ModifyText ()
{
if (YD.hasClass(document.body, "gallery_4836697"))
{
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);

//-------------------------------------------------------------------------
// Code to move the slideshow button to the same row 
// as the buy button
//-------------------------------------------------------------------------
function MyNewSlideshowInit(container, id, config)
{
    if (config && config.slideshowDiv && (config.slideshowDiv == "fsssButton"))
    {
        var cartDiv = YD.get("cartButtonsWrapper");
        if (cartDiv)
        {
            var ssDiv = YD.get("fsssButton");
            if (ssDiv)
            {
                ssDiv.parentNode.removeChild(ssDiv);
            }
            var newDiv = document.createElement("div");
            newDiv.id = "fsssButton";
            cartDiv.appendChild(newDiv);
            container = "cartButtonsWrapper";
        }
    }
    return (myOldSlideshowInit.apply(this, arguments));
}

var myOldSlideshowInit;
if (typeof(SM.buttons.slideshow) != "undefined")
{
    // hook the init function on the SM.buttons.slideshow object
    myOldSlideshowInit = SM.buttons.slideshow.prototype.init;
    SM.buttons.slideshow.prototype.init = MyNewSlideshowInit;
}


function AdjustBreadcrumb()
{
    var str = this.innerHTML;
    str = str.replace(/\n/g, " ");
    str = str.replace(/^\s*<a .*?<\/a>/i, '<a href="/galleries" class="nav">Home</a>');
    this.innerHTML = str;
}

YE.onContentReady("breadCrumbTrail", AdjustBreadcrumb);