function showRecent(days) {
  endDate = new Date();
  oneDay = 1000*60*60*24;
  startDate = new Date(endDate.getTime() - (parseInt(days) * oneDay));
 
  sUrl = "http://californiaclimber.smugmug.com/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;
}

  if (document.images)
   {
     picclimbingon= new Image(300,225);
  picclimbingon.src="http://californiaclimber.smugmug.com/photos/299278639_EpZfT-O.jpg";  
     
     picfriendson = new Image(300,225);
     picfriendson.src="http://californiaclimber.smugmug.com/photos/299304270_bpN6j-O.jpg";

     picbackpackingon = new Image(300,225);
     picbackpackingon.src="http://californiaclimber.smugmug.com/photos/299304309_kYR7M-O.jpg";

     pictravelon = new Image(300,225);
     pictravelon.src="http://californiaclimber.smugmug.com/photos/299304278_8smEL-O.jpg";

     picbaseballon = new Image(300,225);
     picbaseballon.src="http://californiaclimber.smugmug.com/photos/299304239_B4uMQ-O.jpg";

     picotheron = new Image(300,225);
     picotheron.src="http://californiaclimber.smugmug.com/photos/299304289_pmCj9-O.jpg";

     picclimbingoff= new Image(300,225);
 picclimbingoff.src="http://californiaclimber.smugmug.com/photos/299173534_zomNH-O.jpg";

     picfriendsoff= new Image(100,25);
     picfriendsoff.src="http://californiaclimber.smugmug.com/photos/299173560_gAJnY-O.jpg"; 

     picbackpackingoff= new Image(100,25);
     picbackpackingoff.src="http://californiaclimber.smugmug.com/photos/299173569_PPqLY-O.jpg"; 

     pictraveloff= new Image(100,25);
     pictraveloff.src="http://californiaclimber.smugmug.com/photos/299173445_mZFJE-O.jpg"; 

     picbaseballoff= new Image(100,25);
     picbaseballoff.src="http://californiaclimber.smugmug.com/photos/299173347_5oKeg-O.jpg"; 

     picotheroff= new Image(100,25);
     picotheroff.src="http://californiaclimber.smugmug.com/photos/299173354_G2G5h-O.jpg"; 
   }

function lightup(imgName)
 {
   if (document.images)
    {
      imgOn=eval(imgName + "on.src");
      document[imgName].src= imgOn;
    }
 }

function turnoff(imgName)
 {
   if (document.images)
    {
      imgOff=eval(imgName + "off.src");
      document[imgName].src= imgOff;
    }
 }

var vanityTable = 
 {
     "wedding" : "http://californiaclimber.smugmug.com/gallery/5002058_zoePH",
     "wedding/" : "http://californiaclimber.smugmug.com/gallery/5002058_zoePH",
     "gifts" : "http://californiaclimber.smugmug.com/gallery/5006992_2HKE4",
     "gifts/" : "http://californiaclimber.smugmug.com/gallery/5006992_2HKE4",
 };
 function CheckRedirects()
 {
     if (YD.hasClass(document.body, 'homepage'))    // 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 && (newURL != window.location))
         {
             window.location.replace(newURL);        // go to the new URL
         }
     }
 }
