MJL.event.add(window, "load", function() {
  // MJL に関係するコードはこの中に記述
  
  var images = [],
      lastHeight = 0,
      watchTarget,
      waitFor = MJL.getElementsByClassName(document.body, "box-books-03").length;
  
  function equalizeCollector(parent)
  {
    var i, n, li, img,
        toEqualize,
        ret = [], co = parent.childNodes;
    
    for (i = 0, n = co.length; i < n; i++)
    {
      li = co.item(i);
      
      if (li.nodeName == "LI")
      {
        img = li.getElementsByTagName("IMG").item(0);
        
        if (img != null)
        {
          toEqualize = img.parentNode;
          toEqualize.style.position = "relative";
          
          images.push(img);
          
          watchTarget = toEqualize;
          
          ret.push(toEqualize);
        }
      }
    }
    
    return ret;
  }
  
  MJL.enable.heightEqualizer('box-books-02',
  {
    groupBy : 2,
    collect : function(parent){
      return MJL.getElementsByClassName(parent, "pgh-term02");
    }
  });
  
  MJL.enable.heightEqualizer('equalize', { groupBy : 2 });
  
  MJL.enable.heightEqualizer('box-publication06', { groupBy : 3 });
  
  MJL.enable.rollover("roll-disable", { disable : "unroll" });
  
  MJL.enable.heightEqualizer("box-books-03", { groupBy : 4, collect : equalizeCollector });
  
  MJL.enable.heightEqualizer("box-books-03",
  {
    groupBy : 4,
    collect : function(parent)
    { return MJL.getElementsByClassName(parent, "pgh-term"); }
  });
  
  MJL.enable.heightEqualizer("box-books-03",
  {
    groupBy : 4,
    collect : function(parent)
    {
      var ret = MJL.getElementsByClassName(parent, "pgh-term");
      for (var i = 0, n = ret.length; i < n; i++)
        ret[i].style.zoom = "1";
      return ret;
    }
  });
  
  MJL.enable.heightEqualizer("box-books-03",
  {
    groupBy : 4,
    collect : function(parent)
    { return parent.getElementsByTagName("TABLE"); }
  });
  
  // 揃えた高さがウィンドウや文字サイズの変更で、再設定された場合を検知する
  window.setInterval(function()
  {
    var i, n;
    
    if (watchTarget.clientHeight != lastHeight)
    {
      for (i = 0, n = images.length; i < n; i++)
        images[i].style.position = "static";
      
      MJL.enable.heightEqualizer("box-books-03", { groupBy : 4, collect : equalizeCollector });
      
      for (i = 0, n = images.length; i < n; i++)
      {
        parentWidth = images[i].parentNode.clientWidth;
        
        images[i].style.position = "absolute";
        images[i].style.left = (images[i].parentNode.clientWidth - images[i].clientWidth) / 2 + "px";
        images[i].style.bottom = "0";
      }
      
      lastHeight = watchTarget.clientHeight;
    }
  }, 1);
});

// MJL と無関係なコードはこの先に記述

