/* ============================================================
common.js
 javascripts for http://books.livedoor.com/
  created: 2007-07-01
  modified:
  $Date:: 2008-09-04 19:48:38#$
  $Author: nakamurak $
  $Revision: 39380 $
============================================================ */

(function($) {

	//execute right now
	cau1Lib.cssRules.add("#sideNav .userContentsBox dl.userMenu dd.mypage","display:none");
	cau1Lib.cssRules.add(".ldId","display:none");
	cau1Lib.cssRules.add("#aigentRecommendArea","display:none");
	cau1Lib.cssRules.add("#aigentFrame","height:0;width:0;border:none;");
	cau1Lib.cssRules.add("#cartInMsg","display:none;");

	//execute when document's ready
	$(function() {
		//window min-width for IE below 6
		if (cau1Lib.pageWidthLiquid && cau1Lib.browserIeBelow6) {
			//set constant width to IE6, this should be deplicated.
			cau1Lib.pageWidthLiquid = false;
			//cau1Lib.SetFakeMinWidth("div#wrp","body");
			//cau1Lib.SetFakeMinWidth("p.siteDescription","body");
		}
		//ldId to profile nickname.
		var idToNick = new cau1Lib.Class.nickNames();
		$(".ldId").each(function() {
			idToNick.rewrite($(this));
		});
		//左ナビ、ユーザーメニュー内のマイページエリア
		new cau1Lib.Class.myPageMenu({opened:(location.href.match(/\/mypage/) || location.href.match(/\/wallet/))});
		//ヘッダー検索フォームの切り替え
		new cau1Lib.Class.headerSearchChangeType();
		//hide selects when overlay happens
		//works only iebelow6
		new cau1Lib.Class.showHideSelect();
		//「カートに入りました」 メッセージ
		if ($("#cartInMsg").length)
			new cau1Lib.Class.cartInMessage("#cartInMsg");
		//hide long text
		cau1Lib.cssRules.add(".truncateText","overflow:hidden;");
		$(".truncateText").each(function() {
			new cau1Lib.Class.hideLongText(this);
		});
		//item summary
		var opt = {};
		if (location.href.match(/\/mypage|\/profile/))
			opt.appendArea = "div.profileArea";
		$(".showItemSummary .itemImage").each(function() {
			new cau1Lib.Class.showItemSummary(this,opt);
		});
	});
})(jQuery);
