// Initializes User Scripts:
$(document).ready(function() {
  if (document.getElementById('layerContainer')) {
    divHeightStart();
  }
  if (document.getElementById('supportColumn')) {
    divSupportHeightStart();
  }
  $("a#BPTOC").click(function() {
    $("ul#catalogBPTOC").slideToggle("normal");
    if ($("a#BPTOC img").attr("src") == "/collapse-plus.gif") {
      $("a#BPTOC img").attr({
        src: "/collapse-minus.gif",
        alt: "[-]"
      });
    } else {
      $("a#BPTOC img").attr({
        src: "/collapse-plus.gif",
        alt: "[+]"
      });
    }
  });
  $("a#RTOC").click(function() {
    $("ul#catalogRTOC").slideToggle("normal");
    if ($("a#RTOC img").attr("src") == "/collapse-plus.gif") {
      $("a#RTOC img").attr({
        src: "/collapse-minus.gif",
        alt: "[-]"
      });
    } else {
      $("a#RTOC img").attr({
        src: "/collapse-plus.gif",
        alt: "[+]"
      });
    }
  });
  /*
  $("div#header").append('<div id="browserCheck" style="display: none;"></div>');
  $.each(navigator, function(i, val){
    $("div#browserCheck").append(i + ": " + val + "\n");
  });
  */
});

function adjustHeight() {
  var rtColHeight = $("#rightColumn").height();
  rtColHeight -= 2;
  $("#layerContainer").height(rtColHeight);
  $("#descriptionLayer").height(rtColHeight);
  $("#featuresLayer").height(rtColHeight);
  $("#imagesLayer").height(rtColHeight);
  $("#demoLayer").height(rtColHeight);
}
function divHeightStart() {
  adjustHeight();
  document.body.onresize = adjustHeight;
  window.onresize = adjustHeight;
}
function adjustSupportHeight() {
  var rtColHeight = $("#rightColumn").height();
  rtColHeight -= 2;
  $("#supportColumn").height(rtColHeight);
}
function divSupportHeightStart() {
  adjustSupportHeight();
  document.body.onresize = adjustSupportHeight;
  window.onresize = adjustSupportHeight;
}