App = $merge(App,{
  // "body":function(element) {
  //   if (window.location.toString().match(/\/lifestyles\/(his|hers|hardcore|over-50|sports-specific)$/ig)) {
  //     var cover = new Element("div",{styles:{backgroundColor:"#000",position:"absolute",height:"100%",left:0,opacity:0.4,top:0,width:"100%"}}).injectInside(document.body);
  //     var splash = new Element("div",{styles:{background:"url(/images/genres/splash.png) no-repeat;",height:268,left:"50%",marginLeft:-209,position:"absolute",top:100,width:518}}).injectInside(document.body);
  //     var splashContent = new Element("div",{styles:{fontSize:"14px",padding:20}}).setHTML($("lifestyle-welcome").innerHTML).injectInside(splash);
  //     var splashClose = new Element("a",{styles:{position:"absolute",top:20,right:20}}).setHTML("close").addEvent("click",function(){splash.remove();cover.remove();}).injectInside(splash);
  //   }
  // },
  // ".feature":function(element) {
  //   var content = element.getAttribute("id") + "-content";
  //   element.setStyle("position","relative")
  //   var size = element.getSize().size;
  //   var clone = new Element("div",{styles:{backgroundImage:"url(/images/background-black-trans.png)",position:"absolute",left:0,top:0,width:size.x,height:size.y}});
  //   element.addEvent("mouseenter",function(){
  //     clone.setHTML(content.innerHTML).injectInside(element);
  //   });
  //   element.addEvent("mouseout",function(){
  //     clone.remove();
  //   });
  // },
  "#menu":function(element) {
    var links = element.getElements("a");
    var oldCurrent;
    var body = $(document.body);
    var callouts = $("callouts");
    var content = $("content");
    var contentContainer = $("content-container");
    var container = $("container");
    var current = container.getElements("div").filter(function(element){return element.getStyle("display") != "none";})[0];
    var currentRight = $("right").getElements("div").filter(function(element){return element.getStyle("display") != "none";})[0];
    links.forEach(function(element) {
      element.addEvent("click",function(event){
        new Event(event).stop();
        element.blur();
        var replace = $(element.getAttribute("rel") + "-content");
        if (current != replace) {
          contentContainer.setStyle("overflow","hidden").effects({duration:1000,onComplete:function(){
            oldCurrent.setStyle("display","none");
            if (oldCurrent.id == "main-content") {
              callouts.setStyle("display","none");
              body.removeClass("low-spacing");
            } else if (oldCurrent.id == "calendar-content") content.addClass("has-right");
            if (replace.id == "main-content") {
              callouts.setStyle("display","");
              body.addClass("low-spacing");
            } else if (replace.id == "calendar-content") content.removeClass("has-right");
            if (currentRight) currentRight.setStyle("display","none");
            currentRight = $(replace.id + "-right");
            if (currentRight) {
              currentRight.setStyle("display","");
              var cloneRight = currentRight.clone().setStyles({position:"absolute",overflow:"hidden",visibility:"hidden",width:currentRight.getSize().size.x,top:0}).injectInside(body);
              var rightSize = cloneRight.getSize().size;
              cloneRight.remove();
            }
            replace.setStyle("display","");
            var clone = replace.clone().setStyles({position:"absolute",visibility:"hidden"}).injectInside(body);
            var size = clone.getSize().size;
            clone.remove();
            contentContainer.effects({duration:1000,onComplete:function(){
              contentContainer.setStyle("overflow","");//.style.height = "auto";
              contentContainer.style.height = "";
            }}).start({height:Math.max(size.y+45,rightSize ? rightSize.y-45 : 0)+45,opacity:1});
          }}).start({height:0,opacity:0});
          oldCurrent = current;
          current = replace;
        }
      });
    });
  }
});
