$(document).ready(function(){
  
  $("div.expandable-content h2").click(function(event){
    var this_parent = $(this).parent();
    var the_p = $(this_parent).children().filter("p");
    if ($(the_p).is(":visible"))
      $(the_p).hide();
    else
      $(the_p).show();
  });
  
  $("div.expandable-content h2").hover(function(event){
    $(this).css({"text-decoration":"none"});
  }, function(event){
    $(this).css({"text-decoration":"underline"});
  });

  $("div.short-story a.short-story").toggle(function(event){
    $(this).parent().parent().children(".summary-hidden").show();
    event.preventDefault();
  }, function(event){
    $(this).parent().parent().children(".summary-hidden").hide();
    event.preventDefault();
  });

  $("div.arrows img").click(function(event){
    var this_parent = $(this).parent();
    var this_class = $(this_parent).attr("class");
    var off = $(this_parent).children().filter("input").val();
    if (this_class=="arrows next"){
      $("#slide-"+(off - 1)).fadeOut(500, function(){
        $("#slide-"+off).fadeIn(1000);
      });
    }
    else if (this_class="arrows prev"){
      $("#slide-"+off).fadeOut(500, function(){
        $("#slide-"+(off - 1)).fadeIn(1000);
      });  
    }  
  });

/*
  $("div.class-name a").hover(function(event){
    var the_id = $(this).attr("href");
    $("div#summary"+the_id).show();
  }, function(event){
    var the_id = $(this).attr("href");
    $("div#summary"+the_id).hide();
  });
*/
  $("div.class-name a").click(function(event){
    var the_id = $(this).attr("title");
    var the_p = $("div#summary"+the_id);
    if ($(the_p).is(":visible"))
      $(the_p).hide();
    else
      $(the_p).show();
    event.preventDefault();
  });

  $("div.item-summary div.shadow-box-item-summary div.close").click(function(event){
    $(this).parent().parent().hide();
  });

  $("a.archive-year").click(function(event){
    event.preventDefault();
  });
  
  $("a.archive-year-past").click(function(event){
    event.preventDefault();
  });

  $("#search-button").click(function(event){
    $("#search-form").submit();
    event.preventDefault();
  });

});


