YE.onAvailable('galleryTitle', function() {this.innerHTML = '<h3>Image Gallery by Karl Tepfer....Come along on my exploration of light and life</h3></font>'});

YE.onAvailable('categoryTitle', function() {this.innerHTML = '<h3>Image Galleries by Karl Tepfer</h3></font>'});

rightClickWarning = "All photos are © Dr.Karl Tepfer, Karl Tepfer Photography. All rights reserved. Unauthorized use is prohibited"

function AddReferralCode()
  {
  	var footerDiv = document.getElementById("footer");
  	if (footerDiv)
  	{
  		var links = footerDiv.getElementsByTagName("A");
  		if (links && (links.length != 0))
  		{
  			var smugLink = links.item(0);
 			smugLink.href = "http://www.smugmug.com/?referrer=GRcyy7n9EX8U2";
  		}
  	}
  }
  
  function OnLoadHandler()
  {
  	AddReferralCode();
  }

function photoHoverLeft(photoID, photoImageID, waited) {

	var position = SM.PhotoBar.config.position || 'right';
	var hoverPhoto = YD.get(photoID);

	if (!showPhotoBar ||
		hoverPhoto.offsetWidth * hoverPhoto.offsetHeight < 30000 ||
		photoInfo[photoImageID] == undefined ||
		photoHovering ||
		(YD.inDocument('themeChoicesContainer') && parseInt(YD.getStyle('themeChoicesContainer', 'height')) != 0)) {
		return;
	}

	if (waited != true) {
		YE.addListener(document, 'mousemove', watchPhotoBar, photoID);
		photoBarTimeout = setTimeout("photoHoverLeft('" + photoID + "', '" + photoImageID + "', true)", photoBarDelay * 1000);
		return;
	}

	if (YD.inDocument('photoBarBg') && YD.inDocument('photoBarContent') && !YD.hasClass('photoBarContent', 'photoId_' + photoImageID)) {
		removeFromDOM('photoBarBg');
		removeFromDOM('photoBarContent');
	}	
	
	var hoverRegion = YAHOO.util.Region.getRegion(hoverPhoto);
	var photoBarBg = YD.get('photoBarBg');
	var photoBarContent = YD.get('photoBarContent');	
	
	if (!photoBarBg) {
		photoBarBg = document.createElement('div');
		photoBarBg.setAttribute('id', 'photoBarBg');
		photoBarBg.className = position;
		document.body.appendChild(photoBarBg);

		YD.setStyle(photoBarBg, 'zIndex', getZindex(hoverPhoto) + 1);
		photoBarBg.innerHTML = '<div class="first"></div><div class="middle"></div><div class="last"></div>';
	}

	if (!photoBarContent) {
		photoBarContent = document.createElement("div");
		//photoBarContent.ImageID = photoImageID;
		photoBarContent.setAttribute('id', 'photoBarContent');
		YD.addClass(photoBarContent, position);
		YD.addClass(photoBarContent, 'photoId_' + photoImageID)
		//photoBarContent.className = position;
		document.body.appendChild(photoBarContent);

		YD.setStyle(photoBarContent, 'zIndex', getZindex(photoBarBg) + 1);

		/* Photo Rank */
		if (displaySmugPopular) {
			if (photoInfo[photoImageID]['displayPopular'] != '') {
				var photoRank = document.createElement('div');
				YD.addClass(photoRank, 'photoRank');
				photoRank.id = 'photoRank';

				if (photoBarContent.childNodes.length == 0) {
					YD.addClass(photoRank, 'first');
				}

				photoBarContent.appendChild(photoRank);

				postArray = new Array();
				postArray['tool'] = 'smugPopular';
				postArray['Type'] = "Image";
				postArray['TypeID'] = photoImageID;

							}
		}

		/* Photo Sizes */
		if (YD.getStyle(YD.get('lightBoxStage'),'display') != "block") {
			var photoSizes = document.createElement("div");
			YD.addClass(photoSizes, "photoSizes");

			if (photoBarContent.childNodes.length == 0) {
				YD.addClass(photoSizes, 'first');
			}

			photoBarContent.appendChild(photoSizes);
			photoSizes.innerHTML = '<h4>Photo Sizes</h4>';

			var photoSizesContent = document.createElement("ul");
			photoSizes.appendChild(photoSizesContent);

			photoSizesContent.innerHTML += '<li><a href="#' + photoImageID + '-S-LB">Small<\/a></li>';
			photoSizesContent.innerHTML += '<li><a href="#' + photoImageID + '-M-LB">Medium<\/a></li>';

			if (photoInfo[photoImageID]['LargeSrc'] != '') {
				photoSizesContent.innerHTML += '<li><a href="#' + photoImageID + '-L-LB">Large<\/a></li>';
			}

			if (photoInfo[photoImageID]['OriginalSrc'] != '') {
				photoSizesContent.innerHTML += '<li><a href="#' + photoImageID + '-O-LB">Original<\/a></li>';
			}
		}

		/* Exif Info */
		if (photoInfo[photoImageID]['displayEXIF'] != '') {
			var photoExif = document.createElement("div");
			photoExif.setAttribute("id", "photoExif");

			if (photoBarContent.childNodes.length == 0) {
				YD.addClass(photoExif, 'first');
			}

			photoBarContent.appendChild(photoExif);

			photoExif.innerHTML = '<h4>Photo Info</h4>';
			photoExif.innerHTML += '<a href="javascript:exifDetails(\'' + photoImageID + '\');"><img id="photoInfoButton" src="/img/spacer.gif" width="27" height="27" border="0" /></a>';
		}

		/* Save Photo */
		if (photoInfo[photoImageID]['OriginalSrc'] != '' && photoInfo[photoImageID]['protected'] == '') {
			var photoSave = document.createElement("div");
			photoSave.setAttribute("id", "photoSave");

			if (photoBarContent.childNodes.length == 0) {
				YD.addClass(photoSave, 'first');
			}

			photoBarContent.appendChild(photoSave);

			photoSave.innerHTML = '<h4>Save Photo</h4>';
			photoSave.innerHTML += '<a href="/photos/'+photoImageID+'-D.jpg"><img id="savePhotoButton" src="/img/spacer.gif" width="28" height="31" border="0" /></a>';
		}

				if (hoverPhoto.offsetHeight < photoBarContent.offsetHeight + 20) {
			YD.setStyle(YD.get('photoTools'),'visibility','hidden');
		}
			}
	
	switch (position) {
	case 'right':
		YD.setStyle(photoBarBg.childNodes[1], 'height', photoBarContent.offsetHeight - photoBarBg.childNodes[0].offsetHeight + 'px');
		YD.setStyle(photoBarBg, 'height', YD.getStyle(photoBarBg.childNodes[1], 'height'));
		YD.setXY(photoBarBg, [hoverRegion.left, hoverRegion.top]);
		YD.setXY(photoBarContent, [hoverRegion.left - photoBarContent.offsetWidth, hoverRegion.top]);
		var attr = {'left': {'by': -97}, 'width': {'to': 96}};
		break;
	case 'bottom':
					YD.setStyle(photoBarBg.childNodes[1], 'width', photoBarContent.offsetWidth + 'px');
		
		YD.setStyle(photoBarBg, 'width', YD.getStyle(photoBarBg.childNodes[1], 'width'));
		YD.setXY(photoBarBg, [hoverRegion.right - (hoverPhoto.offsetWidth / 2) - (photoBarBg.offsetWidth / 2), hoverRegion.bottom]);

					YD.setXY(photoBarContent, [hoverRegion.right - (hoverPhoto.offsetWidth / 2) - (photoBarBg.offsetWidth / 2) + photoBarBg.childNodes[0].offsetWidth, hoverRegion.bottom + 7]);
				var attr = {'height': {'to': 100}};

				YD.setStyle('photoTools', 'visibility', 'hidden');
			}

	photoHovering = true;

	switch (position) {
		case 'right':
			if (parseInt(YD.getStyle(photoBarBg,'width')) > 0) {
				YD.setStyle(photoBarBg,'width',0);
			}
		break;
		case 'bottom':
			if (parseInt(YD.getStyle(photoBarBg,'height')) > 0) {
				YD.setStyle(photoBarBg,'height',0);
			}
		break;
	}

	photoHoveringAnimation = new YAHOO.util.Anim(photoBarBg, attr, .5, YAHOO.util.Easing.backOut);
	photoHoveringAnimation.onComplete.subscribe(function(e) {
				ajax_query(smugPopularResponse, webServer+'/hack/RPC/gallery.mg', postArray, true);
				if (photoHovering) {
			YD.setStyle('photoBarContent', 'visibility', 'visible');
		}
	});
	photoHoveringAnimation.animate();
}


