$(document).ready(function(){
  //Data
  $("dl#mapDefs a").click(function(){
    $("div#stations div").hide();
    
    var url = $(this).attr('href');
    var siteID = url.split("#")[1];
    $("div#" + siteID).show();
  });

  //Expanding List
  $("dl.expand dd").not("dd.start").not("dl dl dd").hide();
  $("dl.expand dt").not("dl dl dt").click(function(){
      $(this).next("dd").slideToggle("slow")
      .siblings("dd:visible").slideUp("slow");
      $(this).toggleClass("active");
      $(this).siblings("dt").removeClass("active");
  });

  //External links to open in new window
  $("a.external, a[href $='.pdf']").attr({target: "_blank"});
  
  //Colorbox
  $("a[rel='gallery']").colorbox({ maxHeight: "90%" });
  $("a[rel='gallery2']").colorbox({ maxHeight: "90%" });
  $(".colorboxframe").colorbox({ iframe: true, width: "750px", height: "80%" });
  $(".jwvideo").colorbox({ iframe: true, width: "695px", height: "570px" });
  $("a[rel='youtube']").colorbox({ iframe: true, width: "695px", height: "475px" });
  $("a[rel='flickrvideo']").colorbox({ iframe: true, width: "690px", height: "560px" });
});
