/**********************/
/* Duplicate Homepage */
/**********************/
function hasPath(sPath)
{
re = new RegExp("\/" + sPath + "(\/|$)");
return re.test(window.location)
}

/***********************/
/* Remove Keywords     */
/***********************/
function removeKeywords() {

 var aKeywords = ['scannednegatives','watermark', 'zoo'];

 var oBox = YD.get('keywordsBox');
 oKeywords = YD.getElementsByClassName('keyword', 'a', oBox);

 for (i=0; i<oKeywords.length; i++) {
   for (j=0; j<aKeywords.length; j++) {
     if (aKeywords[j] == oKeywords[i].innerHTML) {
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i].previousSibling);
       } catch(e){}
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i].nextSibling);
       } catch(e){}
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i].nextSibling);
       } catch(e){}
       try {
         oKeywords[i].parentNode.removeChild(oKeywords[i]);
       } catch(e){}
       break;
     }
   }
 }
}

/********************************/
/* Change Gallery Comments Text */
/********************************/
function ModifyText () 
{
  if (YD.hasClass(document.body, "gallery_3598304")) 
  {
    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);

/*******************************************************************************/
/* From within the galleries, ensure redirection to gallery home, not homepage */
/*******************************************************************************/
YE.onAvailable('breadcrumb', hackBreadcrumb);

function hackBreadcrumb() {
  re1 = /href="(http:\/\/(\S+.smugmug.com))?(\/)?"/;
  re2 = /LittleMountainPhotography/;
  this.innerHTML = this.innerHTML.replace(re1, "href='/galleries/'");
  this.innerHTML = this.innerHTML.replace(re2, "Galleries");
}

/***************************************/
/* Set the right click warning message */
/***************************************/
rightClickWarning = "All pictures property of Little Mountain Photography"

/******************************************/
/* Setup Recent Gallery Search for Navbar */
/******************************************/
//Goto Recent Gallery 
 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;
}
//Goto Recent Gallery
