function ModifyText ()
{
  if (YD.hasClass(document.body, "gallery_6967387"))
  {
    var objElement = YD.get("comment")
    if (objElement != null)
    {
      var str = new String(objElement.innerHTML);
      str = str.replace(/\gallery/gi, 'Guest Book');
      objElement.innerHTML = str;
    }
  }
}

YE.onAvailable("comment", ModifyText);

function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

if (hasPath("galleries"))
YD.addClass(document.body, "galleries");

if (hasPath("featuredfind"))
YD.addClass(document.body, "featuredfind");


if (hasPath("mostpopular"))
YD.addClass(document.body, "mostpopular");

if (hasPath("featured"))
YD.addClass(document.body, "featured");

YE.onAvailable('featuredTitle', function() {this.innerHTML = 'Latest Pictures'}); 
YE.onAvailable('galleryTitle', function() {this.innerHTML = ''});


addEvent(window, "load", rem_pipes);

function rem_pipes () {
   for (var i = 0; i<3; i++) {
      var objElement = document.getElementById("footer")
      if (objElement != null) 
      {
         var str_a = new String(objElement.innerHTML);
         str_a = str_a.replace('|', '')
         objElement.innerHTML = str_a;
      }
      var objElement = document.getElementById("feeds")
      if (objElement != null) 
      {
         var str_b = new String(objElement.innerHTML);
         str_b = str_b.replace('|', '')
         objElement.innerHTML = str_b;
      }
   }
}

/* This moves to Style box inline with the other buttons */
YE.onDOMReady(InsertStylePicker);

function SetNewGalleryStyle(type, args, menuItem)
{
    // this click handler is called as a method of the menuItem that was clicked on
    var styleValue = this.value;        // get the value of the menu item
    
    // because we are calling styleBarChange which is expecting to be passed a comboBox object,
    // we have to create a fake comboBox object that has the new value in it so that function
    // can fetch the value from our object
    var fakeComboItem = {value: styleValue};
    var fakeComboBox = {selectedIndex: 0, options: [fakeComboItem]};
    
    // call the function that changes the style just like the Smugmug comboBox would have
    styleBarChange("Template", fakeComboBox);
}

function InsertStylePicker()
{
    if (!YD.get("stylebar"))
    {
        return;        // if there wasn't supposed to be a stylebar in this page, the don't insert our version
    }
    // declare the data for our style picker
    // you can remove any of these lines that you don't want to offer your viewers
    // just make sure the last line does not have a comma after it and all others do have a comma (IE will choke if you don't do it right)

    var stylePickerData = [
        {text: "SmugMug", value: "3", onclick: { fn: SetNewGalleryStyle }},
        {text: "Traditional", value: "4", onclick: { fn: SetNewGalleryStyle }},
        {text: "All Thumbs", value: "7", onclick: { fn: SetNewGalleryStyle }},
        {text: "Slideshow", value: "8", onclick: { fn: SetNewGalleryStyle }},
        {text: "Journal", value: "9", onclick: { fn: SetNewGalleryStyle }},
        {text: "Filmstrip", value: "11", onclick: { fn: SetNewGalleryStyle }},
        {text: "Critique", value: "12", onclick: { fn: SetNewGalleryStyle }}
    ];

    
    // now put a checkmark by the currently selected style which we get from the galleryStyle variable
    if (galleryStyle)
    {
        var tempStyle = galleryStyle.toLowerCase();
        tempStyle = tempStyle.replace("_", " ");
        for (var i in stylePickerData)
        {
            if (stylePickerData[i].text.toLowerCase() == tempStyle)
            {
                stylePickerData[i].checked = true;
                break;
            }
        }
    }
    
    // declare the style menu button
    // You can change the button text, by changing the quoted string for the label line below
    // You can put it a different place in your page by changing the container object to a different DIV object in the page
    var styleMenu = new YAHOO.widget.Button({
        id: "customStylebarMenu",
        name: "customStylebarMenu",
        type: "menu",
        menu: stylePickerData,
        label: "Style",
        className: "sm-button sm-button-small themesButton glyphButton menuButton",
        container: "altViews"
    });
    
    
}