function setPaypalForm(form) {
     urlToPage = "http://www.CutawayPhoto.com/gallery/" + AlbumID + "_" + AlbumKey;
     form.item_number.value = urlToPage;

     form.cancel_return.value = urlToPage;

     myAlbumTitle = GetText( document.getElementById("albumTitle"));
     form.item_name.value = "Game Photos on CD - " + myAlbumTitle;
}

function GetText( node )
{
    if( !node )
        return "No Node";
    if( node.innerText )
        return node.innerText; // For IE
//        return Trim( node.innerText ); // For IE
    if( node.textContent )
        return node.textContent; // For others
//        return Trim( node.textContent ); // For others
    return "Game CD";
} // GetText

//-----------------------------------------------------------------
// This is a table of vanity URLs that can be appended to your
// main domain and will then redirect the browser to the actual gallery.
//
// This lets you have memorable URLs like:
// http://jfriend.smugmug.com/stanford
//
// rather than URLs like:
// http://jfriend.smugmug.com/gallery/329885
//
// which aren't so memorable.
//
// To extend this yourself, just add more items to the table below.
// The first string must be all lowercase and is the vanity string
// that you want to represent a gallery or category on your site.
// The second string is the actual smugmug URL you want the browser
// to go to when they type the vanity URL.
// Note that this is a JavaScript array.  If you add items to the end
// of the array, you must have a comma at the end of each line (except
// the last line).
//-----------------------------------------------------------------
var vanityTable =
{
    "psflightinvitational" : "http://www.cutawayphoto.com/Sports/482855",
    "basketball" : "http://www.cutawayphoto.com/Sports/273594",
    "wwpba" : "http://www.cutawayphoto.com/Sports/749641",
    "wwpbalastseason" : "http://www.cutawayphoto.com/Sports/705782",
    "wwpba2007" : "http://www.cutawayphoto.com/Sports/301053",
    "posterinfo" : "http://www.CutawayPhoto.com/gallery/4262489",
    "wwpba2006" : "http://www.cutawayphoto.com/Sports/240625",
    "volleyball" : "http://www.cutawayphoto.com/Sports/394369",
    "remax2007" : "http://www.cutawayphoto.com/gallery/3928874/1/228097926",
    "andi" : "http://www.cutawayphoto.com/share/Wgrqz2uYdwCdw",
    "megillah" : "http://www.cutawayphoto.com/gallery/2557103",
    "sidekicks" : "http://www.cutawayphoto.com/share/waq2SEgywYEB6",
    "marysvillesoccer" : "http://www.cutawayphoto.com/Sports/233562",
    "ladyhawks" : "http://www.cutawayphoto.com/share/DOzmbdGHETeoM",
    "siddrawsu" : "http://www.cutawayphoto.com/gallery/2823685"
};

function CheckRedirects()
{
	// get the path from the current URL,
	// convert it to lowercase and remove the leading slash
	var path = window.location.pathname.toLowerCase().substr(1);

	var newURL = vanityTable[path];		// look it up in our table

	if (newURL != undefined) 		// if we find it in the table
	{
		window.location = newURL;		// go to the new URL
	}
}

CheckRedirects();

// Have the PhotoBar display at the bottom of the photos (Disabled for now)
// SM.PhotoBar.config.position = 'bottom'; 

// Actually I don't want the PhotoBar to show
showPhotoBar = false;

// change the link on the SmugMug Logo
YE.onAvailable('homelink', function(e) {
    this.href = "http://www.cutawayphoto.com/";
    this.firstChild.alt = "Return to Cutaway Photo Home";
    this.firstChild.title = "Return to Cutaway Photo Home";
});

// removes the pipes characters in the toolbar header

YE.onAvailable('toolbar', function(e)
{
    this.innerHTML = this.innerHTML.replace(new RegExp(/\|/g),"");
});

function norobotmail(aUser, aDomain)
{
  document.location = "mailto:" + aUser + "@" + aDomain;
}

function posterMail(aUser, aDomain, aPosterId)
{
  document.location = "mailto:" + aUser + "@" + aDomain + "?subject=Requesting information about poster " + aPosterId + "&body=Please send ordering information for poster " + aPosterId;
}

//----------------------------------------------------------
//  These functions add my referer code to the SmugMug link
//----------------------------------------------------------
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=ghblla6tvBQrk ";
    }
  }
}

function OnLoadHandler()
{
  AddReferralCode();
}

