//==============================================================

$(function(){
	//$("#menu #aco_sub").hide();
	var toggleTimer = setTimeout(
							function(){
								$("#primaryMenu .acoContents").slideToggle(
																		   "slow", 
																		   function(){
																			   $("#primaryMenu .acoTrigger").removeClass("selectTrigger");
																		   });
								
							},
							 2000
   					);
	$("#primaryMenu .acoTrigger").click(function(){
		//$("#primaryMenu #newbook .acoContents").slideToggle("normal", function(){});
		$(this).parent().next(".acoContents").slideToggle("normal", function(){});
		$(this).toggleClass("selectTrigger");
	});
});

//===============================================================
/**
 * 新刊情報において
 * 書籍情報の刊行日と年月が違うものを表示しないようにする
 *
 * add at 2011/12/13
 *
 */
/*
if (!('console' in window)) {
	window.console = {};
    window.console.log = function(str) {
        return str;
    };
}

$(function() {
	//
	// 新刊情報のページ以外は何もしない
	//
	if ($('div#main h2.ttl1').text().indexOf('新刊情報') < 0) return;
	
	//
	// ページタイトルから年月を取得 (ex:2011年09月→2011/9)
	//
	var currentYearMonth = (function(){
		var pageTitle = $('div#main h2.ttl1').text();
		var aMatch = pageTitle.match(/(\d+)年(\d+)月/);
		// 月の先頭の0は削除
		var res = RegExp.$1 + '/' + RegExp.$2.replace(new RegExp('^0+'),'');
		//console.log(res);
		return res;
	})();
	
	if (!currentYearMonth) return;
	
	//
	// 刊行日の年月文字列が違っている商品はentryごと非表示にする
	//
	var showEntryCount = 0;
	var $entries = $('div#main div.entry');
	$entries.each(function(index, element) {
		var contents = $(this).find('div.entrySpecification p').text();
		//console.log(contents);
		if (contents.indexOf('刊行日: ' + currentYearMonth) >= 0) {
			// 表示するentry数を記憶
			showEntryCount++;
		} else {
			// 非表示
			$(this).remove();
		}
	});
	
	//
	// 商品数情報を上書き
	//
	$('div.productsListingNumber').each(function(index, element) {
		$(this).find('strong').each(function(index, element) {
			if (index != 0) $(this).text(showEntryCount);
		});
	});
	
});
*/
//=============================================================== add at 2011/12/13 END
