$(document).ready(function() {

  var button = $(".report_top img"),
      open   = false,
      panel  = $(".report_middle p"),
      csize  = "17px",
      osize  = csize;

  osize = panel.outerHeight();

  panel.css({
    height:   csize,
    overflow: "hidden"
  });

  $(".scroller").scrollable({
    circular:  true,
    keyboard:  false,
    next:      null,
    prev:      null
  }).navigator({
    navi:     ".counter"
  }).autoscroll({
    autopause: false,
    interval:  10000
  });

  $(".showcase").scrollable({
    circular: true,
    keyboard: false
  });
  $(".showcase a").attr("tabindex", "-1");

  button.click(function(e) {
    var size, value;

    if (open) {
      open = false;
      size = csize,
      value = "none";

      button.attr({
        src: "images/btn_more.png",
        alt: "More"
      });

      $(".report_middle a").fadeOut(120, function() {;
        panel.animate({height: size}, 200);
      });
    } else {
      open = true;
      size = osize;
      value = "block";

      button.attr({
        src: "images/btn_close.png",
        alt: "Less"
      });

      panel.animate({height: size}, 200, function() {
        $(".report_middle a").fadeIn(120);
      });
    }
  });

  var random = Math.floor(Math.random() * 11);
  if ((random & 1) == 0) random = 0; else random = 1;

  var code = [
    '<a href="blog/" class="corner"><img src="images/home_lloyd.png" alt="LLoyd\'s Corner"/></a>',
    '<a href="climate_presentation_2_16_10.pdf" target="_blank" class="corner"><img src="images/climate_variables.png" alt="Climate Variables"/></a>'];

  $(".process").append(code[random]);
});
