if (typeof jQuery == "function") {
jQuery(function(){
	var contentArea = jQuery("#fs01-content, #p0401-content-area");

	jQuery("td > *:first-child", contentArea).each(function(){
		jQuery(this).addClass("cell-first-child");
	});

	var emNode = jQuery('<ins style="display:block;width:1em;line-height:1em;height:1em;overflow:hidden;"></ins>').appendTo(contentArea);
	var ratio = emNode.height() / 12;
	emNode.remove();
	jQuery.each(
		jQuery.makeArray(jQuery("div.layout-frame", contentArea)).reverse(),
		function(){
			var _this = jQuery(this);
			var maxMargin = 0;
			var flg = false;
			_this.children().each(
				function(){
					var target = jQuery(this);
					if (target.attr("class").match(/col[2-5]G[1-5](_[1-5])?[LR]/)) {
						target = target.children("*:first-child");
					} else if (flg) {
						return false;
					} else {
						flg = true;
					}

					var marginTop = target.css("margin-top");
					if (!marginTop) marginTop = "0px";
					if (marginTop.indexOf("px") != -1) {
						maxMargin = Math.max(marginTop.replace("px", ""), maxMargin);
						target.css("margin-top", "0px");
					}
				}
			);
			_this.css("margin-top", (Math.ceil((maxMargin / ratio) / 12 * 100) / 100) + "em");
		}
	);
	jQuery.each(
		jQuery.makeArray(jQuery("div.figure-block", contentArea)).reverse(),
		function(){
			var _this = jQuery(this);
			if (_this.parents("*.common-block").length) return true;
			var maxMargin = 0;
			var firstChild = null;
			_this.children().each(
				function(){
					var target = jQuery(this);
					if (!target.attr("class").match(/col[2-5]G[1-5](_[1-5])?[LR]/)) {
						if (firstChild) {
							return false;
						} else {
							firstChild = this;
							if (this.nodeName.toLowerCase().match(/(ul|ol|dl)/)) {
								target.children("li:first-child, dt:first-child").css("margin-top", "0px");
							}
						}
					}

					var marginTop = target.css("margin-top");
					if (marginTop.indexOf("px") != -1) {
						maxMargin = Math.max(marginTop.replace("px", ""), maxMargin);
						if (target.hasClass("figure") && target.attr("class").match(/col[2-5]G[1-5](_[1-5])?[LR]/)) {
							target.css("margin-top", "0.34em");
						} else {
							target.css("margin-top", "0px");
						}
					}
				}
			);
			_this.css("margin-top", (Math.ceil((maxMargin / ratio) / 12 * 100 - (firstChild.nodeName.toLowerCase() != "table" ? 34 : 0)) / 100) + "em");
		}
	);
});
}
