// enable url search for path, lets you add/remove css classes based on url
function hasPath(sPath)
{
  re = new RegExp("\/" + sPath + "(\/|$)");
  return re.test(window.location)
}

/*---------------------------------*/

$('.rounded').corners();
//$('.content').corners();

  /*  'set' tab for the page we're currently viewing  */
  var homePage = true;

  if (hasPath("popular")) {
    YD.addClass(document.body, "popular");
    var popular= document.getElementById("popularPage");
    YD.addClass(popular, "current");
    homePage = false;
  }
  else if (hasPath("information")) {
    var information= document.getElementById("informationPage");
    YD.addClass(information, "current");
    homePage = false;
  }
  else if (hasPath("about") || hasPath("7782266_J6WMD")) {
    var about= document.getElementById("aboutPage");
    YD.addClass(about, "current");
    homePage = false;
  }
  else if (hasPath("galleries") || hasPath("gallery")) {
    YD.addClass(document.body, "galleries");
    var gallery = document.getElementById("galleriesPage");
    YD.addClass(gallery, "current");
    homePage = false;
  }

  if(homePage == true) {
    var home = document.getElementById("homePage");
    YD.addClass(home, "current");
  } 

wrap("homepage");
wrap("smugmug");
wrap("category");
wrap("critique");

/* wrap main content div with outter div, used to merge smugmug to wordpress layout */
function wrap(myDiv)
{
  if(null != document.getElementById(myDiv))
  {
   var wrapper = document.createElement('div'); 
   wrapper.className = "outer";
   var mydiv = document.getElementById(myDiv); 
   wrapper.appendChild(mydiv.cloneNode(true)); 
   mydiv.parentNode.replaceChild(wrapper, mydiv); 
  }
}