function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

if (hasPath("galleries"))
YD.addClass(document.body, "galleries");



/*========================================*/
/*==   Paypal shopping functionality    ==*/
/*========================================*/
function setPaypalForm(form) {
 urlToImage = webServer + "/gallery/" + AlbumID + "_" + AlbumKey + "/1/" + ImageID + "_" + ImageKey + "/Large" + "   " + photoInfo[ImageID]['fileName']; 
 i = form.photoselection.selectedIndex
 
 sPhotoType = form.photoselection.options[i].text;
 sPhotoPrice = form.photoselection.options[i].value;
 urlToImage = urlToImage + "    " + sPhotoType ;
 form.item_name.value = urlToImage;
 form.amount.value = sPhotoPrice;
}




function AddReferralCode() {
var links = this.getElementsByTagName("A");
if (links && (links.length != 0)) {
var smugLink = links.item(0);
smugLink.href = "http://www.smugmug.com/?referrer=0e4EAeNYrXaWA";
}
}
YE.onAvailable('footer', AddReferralCode);

function norobotmail(aUser, aDomain) 
   { 
     document.location = "mailto:" + aUser + "@" + aDomain; 
   }


// Facebook button
     if (SM) {
        var thisURL = webServer + "/gallery/" + 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+Image',
		target: '_blank',
		className: 'sm-button sm-button-small facebookButton glyphButton menuButton share_button'
	});
     }
