/* Redirect "Vanity URL's" to proper tables */

var vanityTable = 
 {
     garylisa : "http://www.digitalkinetics.org/gallery/2040191",
     waterpolochamps : "http://www.digitalkinetics.org/gallery/2044591",
     thekitchen : "http://www.digitalkinetics.org/gallery/2040041",
     meganandrew : "http://www.digitalkinetics.org/gallery/2041482"
 };

function IsHomePage()
 {
    return(YD.hasClass(document.body, 'homepage'));
 }
 
 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 && (newURL != window.location))
         {
             window.location.replace(newURL);        // go to the new URL
         }
     }
 }










function redirectPath() { 
  re = /(digitalkinetics.smugmug.com)/; 
  tmp = window.location.href; 
  if (re.test(tmp)) { 
    tmp = tmp.replace(re, 'www.digitalkinetics.org'); 
    window.location.href = tmp; 
  } 
}
redirectPath();













/* This bit makes the bottom "smugmug" link a referral */
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=RbEK9S1gR9IQf";
     }
  }
}
YE.onAvailable('footer', AddReferralCode);


