function hasPath(sPath)
{
  re = new RegExp("/" + sPath + "(/|$)");
  return re.test(window.location)
}

displaySmugPopular = false;


function AddReferralCode()  {
  var links = this.getElementsByTagName("A");
  if (links && (links.length != 0)) {
    var smugLink = links.item(0);
    smugLink.href = "http://www.smugmug.com/?referrer=fUW5qS1Mau40c";
  }
}
YE.onAvailable('footer', AddReferralCode);


rightClickWarning = "All photos are © Caroline Shipsey Photography. All rights reserved. Unauthorized use is prohibited."



var vanityTable = 
 {
     mendip : "http://www.carolineshipsey.co.uk/gallery/2594622"
      };

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
         }
     }
 }



YE.onAvailable('categoryTitle', function() {this.innerHTML = 'All Galleries'});
displaySmugPopular = false;



function norobotmail(aUser, aDomain) {
document.location = "mailto:" + aUser + "@" + aDomain;
}


function redirectPath() { 
  re = /((www.)?carolineshipsey.smugmug.com)/; 
  tmp = window.location.href; 
  if (re.test(tmp)) { 
    tmp = tmp.replace(re, 'www.carolineshipsey.co.uk'); 
    window.location.href = tmp; 
  } 
}
redirectPath();


/*================================== */
/* Change position of sub categories */ 
/*===================================*/

function swapBoxes() {
   box1 = YD.get("subcategoriesBox");
   box2 = YD.get("galleriesBox");
   if (box1 && box2)
   {
      swap = box1.innerHTML;
      box1.innerHTML = box2.innerHTML;
      box2.innerHTML = swap;
   }
}





