/* ============================================================
top.js
 javascripts for top page of
 http://books.livedoor.com/
  created: 2007-06-11
  modified:
  $Date:: 2008-10-31 16:57:08#$
  $Author: nakamurak $
  $Revision: 52599 $
============================================================ */

(function($) {
	//execute right now

	//execute when document's ready
	$(function() {
		//set title to form button inputs.
		$("div.categoryBlock03").each(function() {new cau1Lib.Class.setTitleToInput(this);});
		$("div.categoryBlock04 div.itemA01, div.categoryBlock04 div.itemA02, div.categoryBlock04 div.itemB01, div.categoryBlock04 div.itemB02")
		.each(function() {new cau1Lib.Class.setTitleToInput(this);});
		$("div.categoryBlock06 li").each(function() {new cau1Lib.Class.setTitleToInput(this);});
		$("div.categoryBlock07 div.itemA, div.categoryBlock07 div.itemB").each(function() {new cau1Lib.Class.setTitleToInput(this);});
	});
	//execute when window.load(after img has loaded)

	$(window).load(function() {
		//setting box height equal
		cau1Lib.topPageHeightEqual("div.categoryBlock04 div.itemA","div.itemA01, div.itemA02");
		cau1Lib.topPageHeightEqual("div.categoryBlock04 div.itemB","div.itemB01, div.itemB02");
		cau1Lib.topPageHeightEqual("div.categoryBlock06 ol","li:first",{wrpContents:"p:not('.buttonArea')"});
		cau1Lib.topPageHeightEqual("div.categoryBlock06 ol","li:eq(1)",{wrpContents:"p:not('.buttonArea')"});
		cau1Lib.topPageHeightEqual("div.categoryBlock06 ol","li:last",{wrpContents:"p:not('.buttonArea')"});
		cau1Lib.topPageHeightEqual("div.categoryBlock07 div.item:first","div.itemA, div.itemB");
		cau1Lib.topPageHeightEqual("div.categoryBlock07 div.item:last","div.itemA, div.itemB");
		// review,userランキング始まったら消す
		new cau1Lib.Class.heightEqualizer($("div.categoryBlock06 div.rankings"));
	});

	//setting box height equal
	cau1Lib.topPageHeightEqual = function(area,eachTarget,options) {
		var self = this;
		//optional settings
		this.options = $.extend({
			wrpContents: "h3, p",
			wrapperClass:"heightWrapper"
		},options);
		$(area).find(eachTarget).each(function() {
			$(this).find(self.options.wrpContents).wrapAll('<div class="' + self.options.wrapperClass + '" />');
		});
		new cau1Lib.Class.heightEqualizer($(area).find(eachTarget).find('.' + this.options.wrapperClass));
	};
})(jQuery);
