function OnLoadHandler() {
	ContextualizeTitle();
}

function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}


// first block of code that goes in the JavaScript HTML section
//-----------------------------------------------------------------
// 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 =
 {
   finady : "http://adejoie.smugmug.com/gallery/3740574",
   dana :  "http://adejoie.smugmug.com/gallery/3977913",
   nybg : "http://adejoie.smugmug.com/Flowers/82231"
 };
  function IsHomePage()
  {
  	// test for the "homepage" class name in the <BODY> tag
  	var bodyLinks = document.getElementsByTagName("BODY");
  	if ((bodyLinks != undefined) && (bodyLinks != null) && (bodyLinks.length > 0))
  	{
  		var classStr = bodyLinks[0].className;
 		if ((classStr != undefined) && (classStr != null) && (classStr.indexOf("homepage") != -1))
  		{
  			return(true);
  		}
  	}
  	return(false);
  }
  
  function CheckRedirects()
  {
  	if (IsHomePage())	// only run this code on the home page
  	{
  		// 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 we found it in the table && newURL is different than where we are
  		if ((newURL != undefined) && (newURL != window.location))
  		{
 		 window.location = newURL;		// go to the new URL
  		}
  	}
  }
/*=====End of VanityTable stuff ====================*/



<!-- Start of StatCounter Code -->
var sc_project=1212598; 
var sc_invisible=0; 
var sc_partition=10; 
var sc_security="80e06f5e"; 
<!-- End of StatCounter Code -->


/*
--------------------------------------------------
 Dynamic Title code 
--------------------------------------------------
*/

addEvent(window, "load", ContextualizeTitle);
var titleSettings = new Array();
/*
--------------------------------------------------
    customize page title settings
--------------------------------------------------
*/
titleSettings.separator   = ": "; // text to insert between parts of title
titleSettings.maxLength   = -1;   // limits length of title (-1 == no limit)
titleSettings.doPhotos    = false; // true == append photo captions
titleSettings.doAlbums    = true; // true == append album names
titleSettings.doGalleries = true; // true == append gallery names
titleSettings.doSubCats   = true; // true == append sub category names
function ContextualizeTitle() {
  var re1 = /([\s\S]*)( - powered by smugmug)/;
  var re2 = /([\s\S]*) (galleries|sub-categories)/;
  var newTitle = document.title;
  var newText = null;
  if(IsHomePage())
  {
     newTitle = newTitle.replace(re1, "$1");
     document.title = newTitle;
  }
  if(!IsHomePage()) 
  {
    // add gallery title
    if(titleSettings.doGalleries)
    {
      var galleryTitle = document.getElementById("galleryTitle");
      var subCatTitle = document.getElementById("subCatGalleryTitle");
      if(galleryTitle)
      {
        var galleryTitleText = GetTextContent(galleryTitle);
        if(galleryTitleText.length > 0)
        {
          galleryTitle = galleryTitleText.replace(re2, "$1")
          newText = titleSettings.separator + galleryTitle;
          newTitle = newTitle.replace(re1, "$1" + newText);
        }
      }
    }
    // add sub category title
    if(titleSettings.doSubCats)
    {
      var subCatTitle = document.getElementById("subCatGalleryTitle");
      if(subCatTitle)
      {
        var subCatTitleText = GetTextContent(subCatTitle);
        if(subCatTitleText.length > 0)
        {
          subCatTitle = subCatTitleText.replace(re2, "$1")
          newText = titleSettings.separator + subCatTitle;
          newTitle = newTitle.replace(re1, "$1" + newText);
        }
      }
    }
 
    // add album title
    if(titleSettings.doAlbums)
    {
      var albumTitle = document.getElementById("albumTitle");
      if(albumTitle)
      {
        var albumTitleText = GetTextContent(albumTitle);
        if(albumTitleText.length > 0)
        {
          newText = titleSettings.separator + albumTitleText;
          newTitle = newTitle.replace(re1, "$1" + newText);
        }
      }
    }
    // add photo title
    if(titleSettings.doPhotos)
    {
      var photoTitleText = GetPhotoCaption();
      if(photoTitleText.length > 0)
      {
        newText = titleSettings.separator + photoTitleText;
        newTitle = newTitle.replace(re1, "$1" + newText);
      }
    }
    if(titleSettings.maxLength > -1)
      newTitle = newTitle.substr(0, titleSettings.maxLength);
    document.title = newTitle;
  }
}
function GetPhotoCaption() {
  var photoTitle = document.getElementById("caption_bottom");
  if(!photoTitle)
    photoTitle = document.getElementById("caption_top");
  if(!photoTitle)
    return "";
 
  return GetTextContent(photoTitle);
}
function GetTextContent(node) {
  var text = "";
  if(node) {
    if(node.children) {
      text = GetTextContent(node.firstChild);
    } else {
      if(node.nodeValue) {
        text = node.nodeValue; // IE
      } else {
        text = node.textContent; // mozilla
      }
    }
  }
  text = Trim(text);
  return text;
}
function Trim(text) {
    var regexp = /^\s+|\s+$/g;
    text = text.replace(regexp, "");
    return text;
}
 
function IsHomePage() {
  var classStr = document.body.className;
  var re = /homepage /;
  if (!classStr)
    return false;
  return re.test(classStr);
}
/* end of Dynamic Title code */