/* A. CHANGE URL FROM ANDREW52.SMUGMUG.COM TO LOUWPHOTOGRAPHY.COM */


function redirectPath() 
  {
     re = /(andrew52.smugmug.com)/;
     tmp = window.location.href;
     if (re.test(tmp)) 
       {
         tmp = tmp.replace(re, 'www.louwphotography.com');
         window.location.href = tmp;
       }
  }
redirectPath();



/* B1. Setup galleryRedirect and vanity Table Parameters */

//     redirect one gallery to another

var galleryRedirectTable = 
 {
     2892503 : "http://www.louwphotography.com/gallery/2860200"
 };

//     redirect a phrase in the url to another

var vanityTable = 
 {
     mappy : "http://www.louwphotography.com/gallery/3450869",
     dawawa : "http://www.louwphotography.com/share/4YDGo0YovFiKE",
     fiji : "http://www.louwphotography.com/gallery/3870937",
     australia : "http://www.louwphotography.com/Australia",
     wedding : "http://www.louwphotography.com/share/dic9IqeqOOh7s",
     pagna : "http://www.louwphotography.com/share/kMdR04cSrrIHc",
     galapagos : "http://www.louwphotography.com/Americas/514045",
     goulding : "http://www.louwphotography.com/share/TCPulfYqw8a4E",
     perse : "http://www.louwphotography.com/gallery/7548993_CJyt9",
     tetsuyas : "http://www.louwphotography.com/gallery/3890951_MxYh7",
     othergoulding : "http://www.louwphotography.com/gallery/4452236_bWERz",
     makewine : "http://www.louwphotography.com/share/QG3jO9ZBFFJHQ",
     fp : "http://www.louwphotography.com/South%20Pacific/609205",
     tahiti : "http://www.louwphotography.com/South%20Pacific/609205",
     borabora : "http://www.louwphotography.com/South%20Pacific/609205",
     santosa : "http://www.louwphotography.com/gallery/6091960_GzN92",
     thereisnospoon : "http://www.louwphotography.com/gallery/9152007_mp3TQ",
     indo : "http://www.louwphotography.com/Asia/802162",
     indogelap : "http://www.louwphotography.com/share/HkGCG3I6Gjryw",
     tanzania : "http://www.louwphotography.com/Africa/Tanzania",
     italy : "http://www.louwphotography.com/Europe/417696",
     godzeno : "http://www.louwphotography.com/gallery/9850390_FBhRk",
     contact : "http://www.louwphotography.com/gallery/8998851_ryhrR",
     gingerbread : "http://www.louwphotography.com/gallery/6891456_PGwpP",
     paris : "http://www.louwphotography.com/gallery/3435714"
 };

/* B2 REDIRECT/VANITYURL function - customized */
function CheckRedirects()
 {
  if (! YD.hasClass(document.body, 'loggedIn'))
     {
         // get the path from the current URL, 
         // convert it to lowercase and remove the leading slash
         var path = window.location.pathname.toLowerCase().substr(9); 
         
         var newURL = galleryRedirectTable[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
         }
     }
  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
         }
     }
 }


/* F. separate page for the galleries/map */
function hasPath(sPath)
{
  re = new RegExp("\/" + sPath + "(\/|$)");
  return re.test(window.location)
}


