rightClickWarning = "please email me if you need a copy of it.."; /*============================*/

/*== Change Breadcrumb ==*/

/*============================*/

var objElement = document.getElementById("breadCrumbTrail")
if (objElement != null) {
var str = new String(objElement.innerHTML);
str = str.replace('>baikodaker<', '>Home</a><');
objElement.innerHTML = str;
}

//------------------ change gustbook title
function ModifyText ()
{
 if (YD.hasClass(document.body, "gallery_8464125"))
 {
   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);
//------------------

// This is a script to combine the categories with the gallery listing to have just one //continuous listing of thumbs
YE.onContentReady("subcategoriesBox", CombineCategoriesWithGalleries);

function IsArrayEmpty(testVal)
{
   return(!testVal || (testVal.length == 0));
}

function CombineCategoriesWithGalleries()
{
   // get miniBoxes in the subcategoriesBox object
   var miniBoxes = YD.getElementsByClassName("miniBox", "div", this);
   // get target galleriesBox object
   var galleriesObj = document.getElementById("galleriesBox");
   var galleryMiniBoxes = new Array;

   // now find the right miniBox in the galleriesBox in order to insert the sub-categories
   if (galleriesObj)
   {
       galleryMiniBoxes = YD.getElementsByClassName("miniBox", "div", galleriesObj);
   }

   // if we don't have everything we need, then return without doing anything
   if (!galleriesObj || IsArrayEmpty(miniBoxes) || IsArrayEmpty(galleryMiniBoxes) || (window.location.hash == "#stop"))
   {
       this.style.display = "block";        
       return;
   }

   // set default spacer point as first miniBox (sub-categories at start of galleries)
   var insertPoint = galleryMiniBoxes[0];

   // now get the last spacer DIV in the boxBottom object (the parent of our miniboxes)
   var spacerDivs = YD.getElementsByClassName("spacer", "div", galleryMiniBoxes[0].parentNode);
   if (!IsArrayEmpty(spacerDivs))
   {
       insertPoint = spacerDivs[spacerDivs.length - 1];        
   // use last spacer as the insertion point
   }


   // move all the sub-categories over to the gallery listing
   for (var i in miniBoxes)
   {
       miniBoxes[i].parentNode.removeChild(miniBoxes[i]);
       galleryMiniBoxes[0].parentNode.insertBefore(miniBoxes[i], insertPoint);
   }
}


//------------------------------------------------------------------------------------
// Move share and slideshow buttons to the cart line
//works only if printing is enabled
//-------------------------------------------------------------------------------------

YE.onContentReady("shareButton", MoveToCartDiv);
YE.onContentReady("slideshowButton", MoveToCartDiv);

function MoveToCartDiv()
{
	MoveObjToDiv(this, "cartButtonsWrapper");
}

function MoveObjToDiv(sourceObj, destDiv)
{
	var destDivObj = document.getElementById(destDiv);	
   // get the object for the dest div
	if (sourceObj && destDivObj)
	{
		sourceObj.parentNode.removeChild(sourceObj);	
   // remove object from it's current parent
		destDivObj.appendChild(sourceObj);				
   // add it to the new parent
	}	
}


//----------------------------------------------------------------------------------
//Getting rid of the "Galleries" or "Sub-Categories" suffix
//----------------------------------------------------------------------------------
function RemoveGalleryWord()
{
   this.innerHTML = this.innerHTML.replace(/ Galleries$| Sub-Categories$/, "");
}

YE.onAvailable("subCatGalleryTitle", RemoveGalleryWord);
YE.onAvailable("galleryTitle", RemoveGalleryWord);


//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------

function findFeed(feedType, feedImage) {
 linkTags = document.getElementsByTagName("link");
 for (i = 0; i < linkTags.length; i++) {
   if (linkTags[i].type == feedType) {
     document.write('<a href="'+linkTags[i].href+'"><img src="http://www.smugmug.com/img/'+feedImage+'.gif" border="0"/>< /a>');
   }
 }
}

YE.onDOMReady(ContextualizeTitle);
// enable share on facebuk
var pos = window.document.URL.indexOf("Portfolio");

if (pos > 0 && SM) {
        var thisURL = webServer + "/Portfolio/" + AlbumID + "_" + AlbumKey + "/1/" + ImageID + "_" + ImageKey ;
	SM.buttons.FacebookButton = new YAHOO.widget.Button({
		id: 'Share on Facebook',
		label: 'Share on Facebook',
		container: 'altViews',
		type: 'link',
		href: 'http://www.facebook.com/share.php?u='+thisURL+'&t=SmugMug+Album',
		target: '_blank',
		className: 'sm-button sm-button-small facebookButton glyphButton menuButton share_button'
	});

}
