/* ============================================================
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 window.load(after img has loaded)

	$(window).load(function() {
		//setting box height equal
		cau1Lib.topPageHeightEqual("div.categoryBlock01 div.item","div.itemA, div.itemB", {wrpContents: ".image a, .title, .subData"});
        cau1Lib.topPageHeightEqual("div.categoryBlock03 ol","li:first",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock03 ol","li:eq(1)",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock03 ol","li:eq(2)",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock03 ol","li:eq(3)",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock03 ol","li:last",{wrpContents:".title"});
		cau1Lib.topPageHeightEqual("div.categoryBlock04 div.recommend",".subBlock", {wrpContents: ".image a"});
        cau1Lib.topPageHeightEqual("div.categoryBlock05 dl","dt:first",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock05 dl","dt:eq(1)",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock05 dl","dt:eq(2)",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock05 dl","dt:eq(3)",{wrpContents:".title"});
        cau1Lib.topPageHeightEqual("div.categoryBlock05 dl","dt:last",{wrpContents:".title"});

        // add cart conversion code
        $("form.usedCartBtnType1").submit(function() { cau1Lib.sc_CustomClick(this,'中古をカートに入れる',{extraEvars:{eVar11:"used01_01"}}); }); 
        $("form.usedCartBtnType3").submit(function() { cau1Lib.sc_CustomClick(this,'中古をカートに入れる',{extraEvars:{eVar11:"used03_01"}}); }); 
        $("form.usedCartBtnType4").submit(function() { cau1Lib.sc_CustomClick(this,'中古をカートに入れる',{extraEvars:{eVar11:"used04_01"}}); }); 
        $("form.usedCartBtnType5").submit(function() { cau1Lib.sc_CustomClick(this,'中古をカートに入れる',{extraEvars:{eVar11:"used05_01"}}); }); 
        $("form.usedCartBtnType6").submit(function() { cau1Lib.sc_CustomClick(this,'中古をカートに入れる',{extraEvars:{eVar11:"used06_01"}}); }); 
        $("form.usedCartBtnType7").submit(function() { cau1Lib.sc_CustomClick(this,'中古をカートに入れる',{extraEvars:{eVar11:"used07_01"}}); }); 
        $("form.usedCartBtnType8").submit(function() { cau1Lib.sc_CustomClick(this,'中古をカートに入れる',{extraEvars:{eVar11:"used08_01"}}); }); 
	});

	//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);
