/**
 * Flatten height same as the highest element for each row.
 *
 * Copyright (c) 2011 Hayato Takenaka
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * @author: Hayato Takenaka (http://urin.take-uma.net)
 * @version: 0.0.2
**/
;(function($) {
	$.fn.tile = function(columns) {
		var tiles, max, c, h, last = this.length - 1, s;
		if(!columns) columns = this.length;
		this.each(function() {
			s = this.style;
			if(s.removeProperty) s.removeProperty("height");
			if(s.removeAttribute) s.removeAttribute("height");
		});
		return this.each(function(i) {
			c = i % columns;
			if(c == 0) tiles = [];
			tiles[c] = $(this);
			h = tiles[c].height();
			if(c == 0 || h > max) max = h;
			if(i == last || c == columns - 1)
				$.each(tiles, function() { this.height(max); });
		});
	};
})(jQuery);

/* 文字サイズ変更後　高さ調整 */
$(function() { 
  var h, $e = $('<div>', {text:'A', fontSize:'1em'}).hide().appendTo('body'); 
  setInterval(function() { 
    if(h != $e.css('font-size')) { 
      h = $e.css('font-size'); 
      $('.column3 li') 
        .css('height', 'auto') 
        .each(function() { 
          if(this.removeProperty) this.removeProperty('height'); 
          if(this.removeAttribute) this.removeAttribute('height'); 
        }) 
        .tile(3); 
    } 
  }, 2*$.fx.interval); 
}); 


