function hasPath(sPath)
{
  re = new RegExp("\/" + sPath + "(\/|$)");
  return re.test(window.location)
}

document.title = "Cavalier Photographic - Fine Art Photography";
function RelevantTitle()
{
   var baseTitle = "Cavalier Photographic - Fine Art Photography";
   var separator = " - ";
   var albumTitle = document.getElementById("albumTitle");
   var galleryTitle = document.getElementById("galleryTitle");
   if( albumTitle && albumTitle.textContent )
      document.title = baseTitle + separator + albumTitle.textContent;
   else if( galleryTitle && galleryTitle.textContent )
   {
      var galleryTitleText = galleryTitle.textContent;
      // Strip " sub-categories" off the end of the category text
      var finalPositionCategory = galleryTitleText.search(" sub-categories");
      if( finalPositionCategory >= 0 )
         galleryTitleText = galleryTitleText.substr( 0, finalPositionCategory );
      else
      {
         // Strip " galleries" off the end of the category/sub-category text
         var finalPositionSubCategory = galleryTitleText.search(" galleries");
         if( finalPositionSubCategory >= 0 )
            galleryTitleText = galleryTitleText.substr( 0, finalPositionSubCategory );
      }
      document.title = baseTitle
   }
   else // Not Gallery, Category, or Subcategory
   {
      // Set title on homepage
      document.title = baseTitle;
   }
}
function redirectPath() { 
  re = /((www.)?cavalierphotographic.smugmug.com)/; 
  tmp = window.location.href; 
  if (re.test(tmp)) { 
    tmp = tmp.replace(re, 'www.cavalierphotographic.com'); 
    window.location.href = tmp; 
  } 
}
redirectPath();function norobotmail(aUser, aDomain) { 
       document.location = "mailto:" + aUser + "@" + aDomain;
    }

function AddReferralCode()  {
   var footerDiv = YD.get("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=7poOeC7WveG3o";
     }
  }
}
YE.onAvailable('footer', AddReferralCode);

/************/
/*SlideShow*/
/************/
function createSWF( w, h, params) {
 var args = "";
 for (var i in params) {
     args += i + "=" + params[i] + "&amp;";
 }
 document.writeln('<object width="100%" height="100%" align="middle">'+
'<param name="movie" value="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'" />'+
'<param name="wmode" value="transparent" />'+
'<embed src="http://www.smugmug.com/ria/ShizamSlides-2007091201.swf?'+args+'"   wmode="transparent" width="' + w + '" height="\
' + h + '" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all"/><\/object>');
return 1;
}
