rightClickWarning = "© Copyright Eduardo Machuca. All rights reserved. Todos los Derechos Reservados."; <!-- secondary galleries page -->
function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

if (hasPath("galleries"))
YD.addClass(document.body, "galleries");
<!-- ends secondary galleries page -->

<!-- email scrambler -->
function norobotmail(aUser, aDomain) { document.location = "mailto:" + aUser + "@" + aDomain; }

<!-- to change gallery comments for guestbook comments on guestbook page -->
function ModifyText ()
{
  if (YD.hasClass(document.body, "gallery_2289581"))
  {
    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);



// -----------
// TrimCategoryPhotoCount
// Takes a category of subcategory description that would typically
// look like this:
// 1 gallery with 11 photos 
// 4 galleries with 140 photos
// And changes it to remove the photo count so it just looks like this:
// 1 gallery
// 4 galleries
// -----------
function TrimCategoryPhotoCount()
{
    var miniBoxes = YD.getElementsByClassName("miniBox", "div", this);
    for (var i = 0; i < miniBoxes.length; i++)
    {
        var descriptions = YD.getElementsByClassName("description", "p", miniBoxes[i]);
        try 
        {
            var match = descriptions[0].innerHTML.match(/^\d+ galler(y|ies)/);
            descriptions[0].innerHTML = match[0];
        } catch (e) {}
    }
}
YE.onContentReady("categoriesBox", TrimCategoryPhotoCount);
YE.onContentReady("subcategoriesBox", TrimCategoryPhotoCount);

<!-- smugmug referral code -->
function AddReferralCode() {
var links = this.getElementsByTagName("A");
if (links && (links.length != 0)) {
var smugLink = links.item(0);
smugLink.href = "http://www.smugmug.com/?referrer=AgInOl27M4qTk";
}
}
YE.onAvailable('footer', AddReferralCode);


//====TagThumbs====
// adds a CSS classname to the minibox for a category or sub-category thumb so you can then style them individually with CSS (including hiding them)
// in category or sub-category view, this adds a class name of the form thumbnail_catname_subcatname_galleryname
// for gallery thumbs, it also adds a class thumbnail_gallery_xxxxxxx (where xxxxxx is the gallery ID)
// If you are displaying your galleries as a flat list (no categories), 
//    then you only get the thumbnail_gallery_xxxxxxx class name (because category and subcategory are not known)
function TagThumbs() 
{
	// get current category and subcategory
	var info = GetCategoryInfo();
	
	// get list of miniBox divs in the "this" object
	var miniBoxList = YD.getElementsByClassName('miniBox', 'div', this);

	// for each miniBox, get the category or sub-category name from the albumTitle div
	for (var i = 0; i < miniBoxList.length; i++) 
	{
		// get the albumTitle p tag
		var titleTags = YD.getElementsByClassName("albumTitle", "p", miniBoxList[i]);
		if (titleTags && (titleTags.length > 0))
		{
			// get the link in the albumTitle
			var linkTags = titleTags[0].getElementsByTagName('a');
			if (linkTags && (linkTags.length > 0))
			{
				// grab the name of the category/subcategory from the thumb
				var thumbName = linkTags[0].innerHTML;
				thumbName = thumbName.replace(/\s+|\&[a-z]+;|[^_a-zA-Z0-9-]/g, "_");	// replace illegal CSS chars with underscore
				var newClassName = "thumbnail_";
				if (info.cat)
				{
					newClassName += info.cat + "_";
				}
				if (info.subcat)
				{
					newClassName += info.subcat + "_";
				}
				newClassName += thumbName;
				YD.addClass(miniBoxList[i], newClassName);
			}
		}
		
		// get the photo div in each miniBox
		var photoTags = YD.getElementsByClassName("photo", "div", miniBoxList[i]);
		if (!photoTags || (photoTags.length == 0))
		{
			photoTags = YD.getElementsByClassName("photoLarge", "div", miniBoxList[i]);
		}
		if (photoTags && (photoTags.length > 0))
		{
			// get the link in the photo tag
			var photoLinkTags = photoTags[0].getElementsByTagName('a');
			if (photoLinkTags && (photoLinkTags.length > 0))
			{
				// grab the URL of the gallery
				var link = photoLinkTags[0].href;
				// href should be "/gallery/5608799_ZJ27n"
				var matches = link.match(/\/gallery\/(\d+)_/);
				if (matches && (matches.length > 1))
				{
					YD.addClass(miniBoxList[i], "thumbnail_gallery_" + matches[1]);
				}
				
			}
			
		}
	}
}

YE.onContentReady('categoriesBox', TagThumbs);
YE.onContentReady('subcategoriesBox', TagThumbs);
YE.onContentReady('galleriesBox', TagThumbs);

//====End of TagThumbs====


//====GetCategoryInfo====
// Retrieves category and subcategory names from the body tag classes
// returns an object
function GetCategoryInfo()
{
    var info = new Object;
    info.cat = "";
    info.subcat = "";
    
    if (YD.hasClass(document.body, "category"))
    {
        var re = /category_(\S+)/i;
        var matches = re.exec(document.body.className);
        if (matches && (matches.length > 1))
        {
            info.cat = matches[1];
        }
        if (YD.hasClass(document.body, "subcategory"))
        {
            re = /subcategory_(\S+)/i;
            matches = re.exec(document.body.className);
            if (matches && (matches.length > 1))
            {
                info.subcat = matches[1];
            }
        }
    }
    return(info);
}

//show only Category or Sub-category name, 
//without the category or sub-category words
function RemoveGalleryWord()
{
    this.innerHTML = this.innerHTML.replace(/ Galleries$| Sub-Categories$/, "");
}

YE.onAvailable("subCatGalleryTitle", RemoveGalleryWord);
YE.onAvailable("galleryTitle", RemoveGalleryWord);

//Get rid of the text bubble caption
//that shows on mouse over pictures
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)});

//--------------------------------------------------------------------
// Highlight the link in your navbar that matches the current page.
//
// See http://www.dgrin.com/showthread.php?t=141678 for documentation.
//--------------------------------------------------------------------
YE.onContentReady("customNavContainer", function ()
{
	function AddTrailingSlash(str)
	{
		if (str.search(/\/$/) == -1)
		{
			str = str + "/";
		}
		return(str);
	}
	
	function StripDomainAndHash(oldStr)
	{
		var str = oldStr.replace(/#.*$/, "");				// get rid of hash value
		str = AddTrailingSlash(str);							// make sure it always ends in a slash
		str = str.replace(/^https?:\/\/[^\/]*/, "");			// get rid of domain on the front
		return(str);
	}
	
	var links = this.getElementsByTagName("a");
	if (links && (links.length > 0))
	{
		var pageURL = StripDomainAndHash(window.location.href);
	
		var foundExactMatch = false;
		var partialIndex = -1;		// index of best partial match
		var partialLength = 0;		// length of the best partial match
		var galleriesIndex = -1;		// index of the /galleries link
		
		// check each link for an href match with our current page
		for (var i = 0; i < links.length; i++)
		{
			var testLink = StripDomainAndHash(links[i].href);			// relative link will be turned into absolute link here
			if (testLink == pageURL)
			{
				YD.addClass(links[i], "navCurrentPage navCurrentPageExact");
				YD.addClass(links[i].parentNode, "navCurrentPageParent navCurrentPageParentExact");
				foundExactMatch = true;
				break;
			}
			// if testLink is not the top level (don't want to do partial matches for top level)
			else if (testLink != "/")
			{
				// if the testLink is contained within the pageURL 
				// (e.g. the current page link is longer than the navbar link and starts with it),
				// remember it as a partial match
				if (pageURL.indexOf(testLink) == 0)
				{
					// save the longest partial match (assuming it to be the most specific)
					if (testLink.length > partialLength)
					{
						partialIndex = i;
						partialLength = testLink.length;
					}
				}
				else if (testLink == "/galleries/")
				{
					galleriesIndex = i;
				}
			}
		}
		if (!foundExactMatch)
		{
			// since we had no exact match, check for partial matches
			if (partialIndex != -1)
			{
				YD.addClass(links[partialIndex], "navCurrentPage navCurrentPagePartial");
				YD.addClass(links[partialIndex].parentNode, "navCurrentPageParent navCurrentPageParentPartial");
			}
			// if no exact match and no partial matches 
			// and we did have a galleries link 
			// and we're on a gallery page or a category or subcategory page
			// then, mark the galleries link
			else if ((galleriesIndex != -1) && (YD.hasClass(document.body, "galleryPage") || YD.hasClass(document.body, "category")))
			{
				YD.addClass(links[galleriesIndex], "navCurrentPage navCurrentPageGallery");
				YD.addClass(links[galleriesIndex].parentNode, "navCurrentPageParent navCurrentPageParentGallery");
			}
		}
	}
});

//-----------------------------------------------
//When using separate /galleries page, different from homepage
// Script to change the breadcrumb link to your homepage 
// to point to your galleries page instead of your slideshow
// It also changes that link to say "Galleries" instead of your user name

function AdjustBreadcrumb()
{
    // there are something like six different forms of the breadcrumb including search and keyword and date and communities, categories and galleries that we have to make this work for
    var tags = YD.getElementsByClassName("nav", "a", this);        // get all the <a> tags with class "nav"
    var filteredTags = new Array;
    // filter out any that aren't at the top level in the breadCrumbTrail (this gets rid of the relatedDate tags)
    for (var i in tags)
    {
        if (tags[i].parentNode == this)
        {
            filteredTags.push(tags[i]);
        }
    }
    if (filteredTags.length == 0)
    {
        return;
    }
    // default to targeting the first filtered tag
    var targetTag = filteredTags[0];
    
    // see if we have a community here
    if (filteredTags.length > 1)
    {
        // if we have a community here, then the user top level is in the 2nd position
        if (filteredTags[0].href.search(/\/community\//) != -1)
        {
            targetTag = filteredTags[1];
        }
    }
    // make sure URL ends with a slash
    var str = targetTag.href;
    if (str.search(/\/$/) == -1)
    {
        str += "/";
    }
    str +="galleries";
    targetTag.href = str;
    targetTag.innerHTML = "Galleries";
}

YE.onContentReady("breadCrumbTrail", AdjustBreadcrumb);