//      Hide Categories
function delCategory() {
  re = /\/(Other|Rancho%20California%20AHA%20March%2020-22%2009|Part%20Arabian|Older%20Equine%20Events,%20Dressage%20and%20other%20Shows|Equine%20Events|Drinkers%20of%20the%20Wind%20-%20Arabians|Egyptian%20Event%202008|html%20galleries|Tehachapi%20California%20Dressage%20Society%20-%20Aug%2024%2008|Tehachapi%20California%20Dressage%20Society%20-%20June%2022%2008%20show)$/;

  var oList = YD.getElementsByClassName('miniBox', 'div', this);

  for (i = 0; i < oList.length; i++) {
    if (re.test(oList[i].getElementsByTagName('a')[0].href))
      oList[i].parentNode.removeChild(oList[i]);
  }
}
YE.onContentReady('categoriesBox', delCategory);
//      End Hide Categories 


rightClickWarning = "All photos are property of Christine Emmert. All rights reserved. Unauthorized use is prohibited."; 



function ModifyText () 
{
  if (YD.hasClass(document.body, "gallery_5364562")) 
  {
    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 addCategoryDescription() {
 var categoryDescription = {
     "Bierbeek_C_Show_June_28_09_(Belgium)" : "click on picture to access the gallery",
     "Tehachapi_California_Dressage_Society_-_June_22_08_show" : "",
     "Tehachapi_California_Dressage_Society_-_Aug_24_08" : "",
     "Egyptian_Event_2008" : "Most pictures are not edited, many not loaded yet and I am still adding captions when I have time. If you don't like a picture, contact me and I will remove it",
     "Egyptian_Event_09" : "Pictures are not edited and not shown at full resolution. With the poor indoor light, only small prints, up to 8x10 should be ordered (check for sharpness). If you don't like a picture of your horse, contact me and I will remove it. Digital downloads are - as is - as they are instant. If you would like them edited first, let me know and an edited version will be substituted at no extra cost. Credit must be given. License type available on order page."
 };

  if ((YD.hasClass(document.body, "category")) && (!YD.hasClass(document.body, "subcategory"))) { 

    re = /category_(\S+)/i;
    re.exec(document.body.className);

    breadCrumbTrail = YD.get("breadCrumbTrail");
    if (breadCrumbTrail && categoryDescription[RegExp.$1]) {
      divTag = document.createElement("div");
      divTag.className = "categoryDescription";
      divTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
      breadCrumbTrail.parentNode.insertBefore(divTag, breadCrumbTrail.nextSibling);
    }
  }
  if (YD.hasClass(document.body, "homepage")) {
    re = /\>([\w\-]+)<\/a>/i;

    divTag = YD.get("categoriesBox");
   if (divTag) {
      divTags = YD.getElementsByClassName("albumTitle", "p", divTag);

      for (i=0; i<divTags.length; i++) {
       re.exec(divTags[i].innerHTML);
        if (categoryDescription[RegExp.$1] != undefined) {
          pTag = document.createElement("p");
          pTag.className = "categoryDescription";
          pTag.appendChild(document.createTextNode(categoryDescription[RegExp.$1]));
          divTags[i].parentNode.insertBefore(pTag, divTags[i].nextSibling);
        }
      }
    }
  }
}
YE.addListener(window, "load", addCategoryDescription); 






//--------------------------------------------------------------------------------------------------------------------
// MarkHiddenThumbs puts a red X on thumbnails in the Smugmug view that are hidden
//
// Installation and support is here: http://www.dgrin.com/showthread.php?t=143433.
//--------------------------------------------------------------------------------------------------------------------
if (typeof(JLF) == "undefined") var JLF = new Object;

// Declare a global object with our various methods on it.  This puts all of our methods in their own namespace like YUI does.
JLF.HiddenMarkers = 
{
	// global data variables on the object
	oldHidePhoto: "",
	
	// externally accessible methods
	
	// Replacement for the built-in hidePhoto function.  
	// It calls the original function, then updates the hidden marker for the affected thumb
	NewHidePhoto: function(status, ImageID, ImageKey)
	{
		var retVal = JLF.HiddenMarkers.oldHidePhoto.apply(this, arguments);
		var thumb = YD.get("photoBox_" + ImageID);
		if (thumb)
		{
			JLF.HiddenMarkers.MarkSingleHiddenThumb(thumb);
		}
		return(retVal);
	},
	
	// Set the style from a whole style string rather than one attribute at a time
	SetStyleString: function(element, str)
	{
		var styles = str.split(/\s*;\s*/);
		for (var i in styles)
		{
			var pieces = styles[i].split(/\s*:\s*/);
			if (pieces.length > 1)
			{
				YD.setStyle(element, pieces[0], pieces[1]);
			}
		}
	},
	
	// Update the hidden status of a single thumb
	MarkSingleHiddenThumb: function(element)
	{
		try
		{
			// get existing marker if here
			var markers = YD.getElementsByClassName("hiddenMarker", "div", element);
			var imageID = element.id.substr(9);		// strip off "photoBox_" off the id to get just the id
			if (photoInfo[imageID].Status == "Hidden")
			{
				// if there is no marker yet, add one
				if (!markers || (markers.length == 0))
				{
					var links = element.getElementsByTagName("a");
					var imgs = links[0].getElementsByTagName("img");
					var newDiv = document.createElement("div");
					newDiv.className = "hiddenMarker";
					JLF.HiddenMarkers.SetStyleString(newDiv, "position: absolute; top:1px; left:5px; z-index:10; color: #F00; font-size: 14pt; font-weight: bold; font-family: Arial;");
					newDiv.innerHTML = "X";
					imgs[0].parentNode.insertBefore(newDiv, imgs[0]);
				}
			}
			else	// not hidden now
			{
				// if there's a hidden marker, then remove it
				if (markers && (markers.length != 0))
				{
					markers[0].parentNode.removeChild(markers[0]);		// remove it
				}
			}
		} catch (e) {}
	},
	
	// Update the hidden status of all thumbs
	// Only written to work in the Smugmug view when logged in
	// Other views don't appear to have the photoInfo array which gives us the hidden status
	MarkAllHiddenThumbs: function()
	{
		
		if (YD.hasClass(document.body, "loggedIn") && YD.hasClass(document.body, "smugmug"))
		{
			YD.getElementsByClassName("photo", "div", YD.get("thumbnails"), JLF.HiddenMarkers.MarkSingleHiddenThumb);
		}
	}
};

// Install our replacement function for hidePhoto
if (typeof(hidePhoto) == "function")
{
	JLF.HiddenMarkers.oldHidePhoto = hidePhoto;
	hidePhoto = JLF.HiddenMarkers.NewHidePhoto;
}

// Register for notifications when the Smugmug view has been rendered
onPhotoShow.subscribe(JLF.HiddenMarkers.MarkAllHiddenThumbs);

// --------------------------------------
// End of MarkHiddenThumbs code
// --------------------------------------










function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

if (hasPath("galleries"))
YD.addClass(document.body, "galleries");





// fix the pesky pipes

YE.onAvailable("cobrand_footer", function() {this.innerHTML = this.innerHTML.replace(/\||what are feeds\?/gi, '');});


