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;
}


function getCookie(name) {
  var start = document.cookie.indexOf(name + "=");
  var len = start + name.length + 1;
  
  if ((!start) && (name != document.cookie.substring(0, name.length))) {
    return null;
  }

  if (start == -1) {
    return null;
  }

  var end = document.cookie.indexOf(";", len);

  if (end == -1) {
    end = document.cookie.length;
  }

  return unescape(document.cookie.substring(len, end));
}


function setCookie(name, value, expires, path, domain, secure) {
  var today = new Date();
  today.setTime( today.getTime() );

  if (expires) {
    expires = expires * 1000 * 60 * 60 * 24;
  }

  var expires_date = new Date(today.getTime() + (expires));

  document.cookie = name + '='+escape(value) +
    ((expires) ? ';expires=' + expires_date.toGMTString() : '') +
    ((path) ? ';path=' + path : '') +
    ((domain) ? ';domain=' + domain : '') +
    ((secure) ? ';secure' : '');
}


function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
  }
}



function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}








function addRecentFeatured(text, days, thumbUrl) {
  if (YD.hasClass(document.body, "homepage")) {
    divTags = YD.getElementsByClassName("boxBottom", "div", YD.get("featuredBox"));

    for (i=0; i<divTags.length; i++) {
      miniBox = document.createElement("div");
      miniBox.className = "miniBox";

      photoBox = document.createElement("div");
      photoBox.className = "photo";
      miniBox.appendChild(photoBox);

      photoLink = document.createElement("a");
      photoLink.setAttribute("href", "javascript:showRecent(" + days + ");");
      photoBox.appendChild(photoLink);

      photoImg = document.createElement("img");
      photoImg.setAttribute("border", "0");
      photoImg.setAttribute("alt", text);
      photoImg.setAttribute("title", text);
      photoImg.src = thumbUrl;
      photoImg.className = "imgBorder";
      photoLink.appendChild(photoImg);

      albumTitle = document.createElement("p");
      albumTitle.className = "albumTitle";
      miniBox.appendChild(albumTitle);
      albumLink = document.createElement("a");
      albumLink.className = "nav";
      albumLink.setAttribute("href", "javascript:showRecent(" + days + ");");
      albumTitle.appendChild(albumLink);

      albumLinkText = document.createTextNode(text);
      albumLink.appendChild(albumLinkText);
      spacerDiv = document.createElement("div");
      spacerDiv.className = "spacer";
      miniBox.appendChild(spacerDiv);

      divTags[i].insertBefore(miniBox, divTags[i].childNodes[1]);

      break;
    }
  }
}

function showRecent(days) {
  endDate = new Date();
  oneDay = 1000*60*60*24;
  startDate = new Date(endDate.getTime() - (parseInt(days) * oneDay));
 
  sUrl = "/date/";
  sUrl += startDate.getFullYear() + "-" + padDate(startDate.getMonth() + 1) + "-" + padDate(startDate.getDate());
  sUrl += "/";
  sUrl += endDate.getFullYear() + "-" + padDate(endDate.getMonth() + 1) + "-" + padDate(endDate.getDate());
 
  window.location = sUrl;
}

function padDate(datePart) {
  if (datePart.toString().length != 1)
    return datePart
 
  return "0" + datePart;
}





function OnLoadHandler()
{
   addKeywordFeatured('Favorite Pictures', ' ', 'fav', '/photos/380442340_nFU44-Ti-3.jpg'); 
}



function addKeywordFeatured(text, description, keyword, thumbUrl)
{
  if (IsClass("homepage"))
  {
    divTag = document.getElementById("featuredBox");
    if (divTag)
    {
      divTags = divTag.getElementsByTagName("div");
      for (i=0; i<divTags.length; i++)
      {
        if (divTags[i].className == "boxBottom")
        {
          miniBox = document.createElement("div");
          miniBox.className = "miniBox";
          photoBox = document.createElement("div");
          photoBox.className = "photo";
          miniBox.appendChild(photoBox);
          photoLink = document.createElement("a");
          photoLink.setAttribute("href", "/keyword/" + keyword);
          photoBox.appendChild(photoLink);
          photoImg = document.createElement("img");
          photoImg.setAttribute("border", "0");
          photoImg.setAttribute("alt", text);
          photoImg.setAttribute("title", text);
          photoImg.src = thumbUrl;
          photoImg.className = "imgBorder";
          photoLink.appendChild(photoImg);
          albumTitle = document.createElement("p");
          albumTitle.className = "albumTitle";
          miniBox.appendChild(albumTitle);
          albumLink = document.createElement("a");
          albumLink.className = "nav";
          albumLink.setAttribute("href", "/keyword/" + keyword);
          albumTitle.appendChild(albumLink);
          albumLinkText = document.createTextNode(text);
          albumLink.appendChild(albumLinkText);
 
          albumDescription = document.createElement("p");
          albumDescription.className = "description";
          miniBox.appendChild(albumDescription);
          albumDescriptionText = document.createTextNode(description);
          albumDescription .appendChild(albumDescriptionText);
          spacerDiv = document.createElement("div");
          spacerDiv.className = "spacer";
          miniBox.appendChild(spacerDiv);
          divTags[i].insertBefore(miniBox, divTags[i].childNodes[1]);
 
          break;
        }
      }
    }
  }
}
 
function IsClass(sClass) 
{
  sClassName = document.body.className;
  re = new RegExp(sClass + "( |$)") 
  if (!sClassName)
    return false;
  return re.test(sClassName);
}





function ModifyText ()
{
  if (YD.hasClass(document.body, "gallery_4452766"))
  {
    var objElement = YD.get("comment")
    if (objElement != null)
    {
      var str = new String(objElement.innerHTML);
      str = str.replace(/\gallery/gi, 'guestbook');
      objElement.innerHTML = str;
    }
  }
}
 
YE.onAvailable("comment", ModifyText);



showPhotoBar = false;

