/* =======================================

	Common JavaScript

 -----------------------------------------
	INDEX
 -----------------------------------------
	

========================================== */

/* Cookie Script
========================================== */
function createCookie(name,value,days){
   if (days){
   var date = new Date();
   date.setTime(date.getTime()+(days*24*60*60*1000));
   var expires = "; expires="+date.toGMTString();
   }
   else var expires = "";
   document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name){
   var nameEQ = name + "=";
   var ca = document.cookie.split(';');
   for(var i=0;i < ca.length;i++)
   {
   var c = ca[i];
   while (c.charAt(0)==' ') c = c.substring(1,c.length);
   if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
   }
   return null;
}


/* Chenge Font Size
========================================== */
$(function(){
	var currentstyle = readCookie('andersenFontStyle');
	if (currentstyle){
		switchFont(currentstyle);
	}else{
		switchFont("fontMedium");
	};
		
	$("dl#change-fontsize dd.small a").click(function(){
		switchFont("fontSmall");
		textValignMiddle();
		return false;
	});
		
	$("dl#change-fontsize dd.medium a").click(function(){
		switchFont("fontMedium");
		textValignMiddle();
		return false;
	});
	
	$("dl#change-fontsize dd.large a").click(function(){
		switchFont("fontLarge");
		textValignMiddle();
		return false;
	});
});

function switchFont(className){
   $('#main').removeAttr('class').addClass(className);
   $('dl#change-fontsize').removeAttr('class').addClass(className);
   createCookie('andersenFontStyle', className, 365);
};


/* Mouse Over
========================================== */
$(function() {
  var image_cache = new Object();
  $(".swap").each(function(i) {
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_on = this.src.substr(0, dot) + '_o' + this.src.substr(dot, 4);
    image_cache[this.src] = new Image();
    image_cache[this.src].src = imgsrc_on;
    $(this).hover(
      function() { this.src = imgsrc_on; },
      function() { this.src = imgsrc; });
  });
});


/* Smooth Scroll
========================================== */
$(function(){ 
	$('a[href^=#]:not(a[href$=#])').not('.btn-navi a, .tab-navi a').click(function(){
		var href= this.hash;
		var $target = $(href == '#_top' ? 'body' : href);
		
		// アンカーリンクがあるページでだけ以下を実行
		if($target.size()){
			var top = $target.offset().top;
			$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 500, 'swing');
		}
		return false;
	});
});


/* 
========================================== */
/****グローバルメニュー****/
$(function(){
	$('#globalnavi ul li ul').hide();
	$('#globalnavi ul li ul li a img').each(function(){
		var dot = $(this).attr('src').lastIndexOf('.');
		var imgsrc_on = $(this).attr('src').substr(0, dot) + '_o' + $(this).attr('src').substr(dot, 4);
		$(this).parent().parent().css('background-image', 'url('+imgsrc_on+')');
	});
	
	$('#globalnavi ul li').hover(function(){
		$(this).find('ul').show();
		$(this).find('ul ul').hide();
	},function(){
		$(this).children('ul').hide();
	});
	
/****サイドメニュー****/
	$('#navigation > dl > dd a > img').each(function(){
		var dot = $(this).attr('src').lastIndexOf('.');
		var img_on = $(this).attr('src').substr(0, dot) + '_o' + $(this).attr('src').substr(dot, 4);
		
		$(this).parent().css('background-image', 'url('+img_on+')');
	});
	
	/*$('#navigation > dl > dd > ul > li > a').hover(function(){
		$(this).addClass('hover');
	},function(){
		$(this).removeClass('hover');
	});*/



/* 新サイドメニュー　アコーディオン
========================================== */
jQuery.fn.mouseOverDelay = function(delay, callbackOver, callbackOut) {

	return this.each( function(idx, obj) {
		var tid;
		jQuery(obj).hover( function() {
			clearTimeout(tid);
			tid = setTimeout(callbackOver, delay * 400);
		}, function(){
			clearTimeout(tid);
			tid = setTimeout(callbackOut, delay * 400);
			/*callbackOut();*/
		});
	});
};

jQuery(document).ready( function() {
	jQuery('div#navigation > dl > dd > ul').hide();
	function genToggleFunc(obj, toggle) {
		var target = obj.childNodes;
		var i;
		for (i=0; i<target.length; i++)
			if (target[i].tagName && target[i].tagName.toLowerCase() === "ul")
				return function() {
				jQuery(target[i])[toggle]('normal');
				};
	}

	jQuery('div#navigation > dl > dd').each( function(idx, obj) {
		jQuery(obj).mouseOverDelay(
			0.8, genToggleFunc(obj, 'show'), genToggleFunc(obj, 'hide')
		);
	} );
} );


	$('#navigation > dl > dd > ul').hide();
	
	/*現在のURL取得*/
	var location_url = window.location.pathname.replace(/index\.html|index\.htm|index\.php|cat-.*\.html|allergy\.html|item-.*\.html|recipe-[0-9]+\.html|post-[0-9]+\.html/g, '');
	/*青山内商品情報*/
	if(location_url == '/item/reg/aoyama/'){var location_url2 = '/aoyama/reg/'}
	if(location_url == '/item/popular/aoyama/'){var location_url2 = '/aoyama/popular/'}
	if(location_url == '/item/hygge/'){var location_url2 = '/aoyama/hygge/'}
	if(location_url == '/item/hca/'){var location_url2 = '/aoyama/hca/'}
	if(location_url == '/item/greenb/aoyama/'){var location_url2 = '/aoyama/greenb/'}
	if(location_url == '/item/greenb/aoyama/savory/'){var location_url2 = '/aoyama/greenb/'}
	if(location_url == '/item/greenb/aoyama/bread/'){var location_url2 = '/aoyama/greenb/'}
	/*広島内商品情報*/
	if(location_url == '/item/reg/hiroshima/'){var location_url2 = '/hiroshima/reg/'}
	if(location_url == '/item/popular/hiroshima/'){var location_url2 = '/hiroshima/popular/'}
	if(location_url == '/item/hygge/'){var location_url3 = '/hiroshima/hygge/'}
	if(location_url == '/item/hca/'){var location_url3 = '/hiroshima/hca/'}
	if(location_url == '/item/greenb/hiroshima/'){var location_url2 = '/hiroshima/greenb/'}
	if(location_url == '/item/greenb/hiroshima/savory/'){var location_url2 = '/hiroshima/greenb/'}
	if(location_url == '/item/greenb/hiroshima/bread/'){var location_url2 = '/hiroshima/greenb/'}
	
	var bodyClass = '/'+$('body').attr('class').replace(/\ /g, '/').replace('individual', '')+'/';
	/*広島内商品情報*/
	var bodyClass = bodyClass.replace('//', '/');
	if(bodyClass == '/item/hygge/'){var bodyClass2 = '/hiroshima/hygge/'}
	if(bodyClass == '/item/douwa/'){var bodyClass2 = '/hiroshima/hca/'}
	
	/*レシピ詳細*/
	var recipeid = $('#main > .topic-path > a > span ').attr('id');
	var recipeid1 = bodyClass.replace('item/', '');
	var recipeid2 = recipeid1 + recipeid;
		
	/*サイド　メインカテゴリー*/
	$('#navigation > dl > dd > a').each(function(){
		if($(this).attr('href') != $(this).next().find('li:first a').attr('href')){
			if($(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == location_url || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == bodyClass || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == location_url2 || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == location_url3 || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == bodyClass2 || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == recipeid2){
				$(this).addClass('hover');
				$(this).next('ul').show();
			}
		}
	});
	/*サイド　サブカテゴリー*/
	$('#navigation > dl > dd > ul > li > a').each(function(){
		if($(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == location_url || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == bodyClass || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == location_url2 || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == location_url3 || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == bodyClass2 || $(this).attr('href').replace(/index\.html|index\.htm|index\.php/, '') == recipeid2){
			$(this).addClass('hover');
			$(this).parent().parent().parent().find('a:first').addClass('hover');
			$(this).parent().parent().parent().find('ul').show();
		}
	});


/*
$('#navigation > dl > dd').not('dd:has(a.hover)').hover(function(){
			$(this).find('a:first').toggleClass('hover');
$(this).find('ul').animate({'height': 'toggle'}, 800);
	},function(){
			$(this).find('a:first').toggleClass('hover');
$(this).find('ul').animate({'height': 'toggle'}, 800);
	});
*/

/*
if (window.confirm(recipeid)) {
   document.F1.submit();
}*/


});




/* item-list01 hover
========================================== */
$(function() {
	$('.section .thumb a').css({
			'position': 'relative',
			'zoom': '1',
			'cursor': 'pointer'})
		.each(function(){
				$(this).append('<span class="bg-btm" style="font-size: 0; left: 0; width: 100%; height: 3px; overflow: hidden; background: #B90017; position: absolute; bottom: 0;"></span>');
			});
	
	$('.section .thumb a span.bg-btm').css({'opacity': '0'});
	
	$('.section .thumb a').hover(function(){
		$(this).find('span.bg-btm').animate({'opacity': '1'}, 200);
	},function(){
		$(this).find('span.bg-btm').animate({'opacity': '0'}, 100);
	}).click(function(){
		$(this).find('span.bg-btm').animate({'opacity': '0'}, 100);
	});
	

/* IE6クリック不具合応急処置 [10.05.21]
========================================== */
/*
	if($('#hiroshimaIndex').size() != 0){
		if(navigator.userAgent.indexOf("MSIE 6") != -1){
			$('.section .thumb a').click(function(){
				location.href = $(this).attr('href');
			});
		}
	}
*/

});


/* Thumbnail Image Valign Middle
========================================== */
function thumbImgValign(){
	$('#main .section .thumb img').not('body.individual #main .section .thumb img').each(function(){
		$(this).css({
			'marginTop': ( ($(this).parent().height() - $(this).height()) /　2)+'px'
		});
	});
}
	
$(window).load(function (){ thumbImgValign(); });


/* Hover Light
========================================== */
$(function() {
	$('.hoverLight').hover(function(){
		$(this).animate({'opacity': '0.7'}, 200);
	}, function(){
		$(this).animate({'opacity': '1'}, 200);
	}).click(function(){
		$(this).animate({'opacity': '1'}, 200);
	});
	
	$('body#home .bannerArea li#marArea').click(function(){
		location.href = $(this).find('.mar-caption a').attr('href');
		return false;
	}).css('cursor', 'pointer');
});


/* btn navi
========================================== */
$(function() {
	var btnNaviNum_cookieName = 'andersen'+$('body').attr('class')+$('body').attr('id')+'btnNaviNum';
	var currentBtnNaviNum = readCookie(btnNaviNum_cookieName);
	
	
	if(($('.btn-navi').size() != false) && ($('.toggle-contents').size() != false)){
		$('.toggle-contents').hide();
		
		if(currentBtnNaviNum){
			$('.toggle-contents:eq('+currentBtnNaviNum+')').show();
		}else{
			$('.toggle-contents:first').show();
		}
		
		$('.btn-navi li a').click(function(){
			var btnNaviNum = $('.btn-navi li a').index(this);
			$('.toggle-contents').fadeOut(200);
			$('.toggle-contents:eq('+btnNaviNum+')').fadeIn(400, function(){thumbImgValign();});
			createCookie(btnNaviNum_cookieName, btnNaviNum, 365);
			return false;
		});
	}
});

$(function() {
	var tabNaviNum_cookieName = 'andersen'+$('body').attr('class')+$('body').attr('id')+'tabNaviNum';
	var currentTabNaviNum = readCookie(tabNaviNum_cookieName);
	
	if(($('.tab-navi').size() != false) && ($('.toggle-contents').size() != false)){
		$('.toggle-contents').hide();
		
		if (currentTabNaviNum){
			$('.toggle-contents:eq('+currentTabNaviNum+')').show();
			$('.tab-navi li a:eq('+currentTabNaviNum+')').find('img').addClass('active');
		}else{
			$('.toggle-contents:first').show();
			$('.tab-navi li a:eq(0)').find('img').addClass('active');
		};
		
		$('.tab-navi li a').click(function(){
			var tabNaviNum = $('.tab-navi li a').index(this);
			$('.tab-navi li a').find('img').removeClass('active');
			$(this).find('img').addClass('active');
			$('.toggle-contents').fadeOut(200);
			$('.toggle-contents:eq('+tabNaviNum+')').fadeIn(400, function(){thumbImgValign();});
			createCookie(tabNaviNum_cookieName, tabNaviNum, 365);
			return false;
		});
		
		$('.tab-navi li a').css('display', 'block').each(function(){
			var dot = $(this).find('img').attr('src').lastIndexOf('.');
			var img_on = $(this).find('img').attr('src').substr(0, dot) + '_o' + $(this).find('img').attr('src').substr(dot, 4);
			$(this).css('background-image', 'url('+img_on+')');
		}).hover(function(){
			$(this).find('img').addClass('hover');
		},function(){
			$(this).find('img').removeClass('hover');
		});
	}
});


/* 店舗情報エリア
========================================== */
$(function() {
	var shopHash = location.hash;
	if(shopHash){
		$('#area-result .section').not(shopHash).hide();
		
		var $target = $(shopHash == '#_top' ? 'body' : shopHash);
		
		if($target.size()){
			var top = $target.offset().top;
			$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 500, 'swing');
		}
	}else{
		var currentstyle = readCookie('andersen_shopSearch');
		
		if(currentstyle){
			if(currentstyle != '#area-result'){
				$('#area-result .section').hide();
				$('#area-result .section'+currentstyle).show();
			}
		}
	}
	
	$('.area-list ul li a:not(a[href=#all]), #shopMap a').click(function(){
		var thisHash = $(this).attr('href');
		$('#area-result .section').fadeOut(200);
		$('#area-result .section'+thisHash).fadeIn(400, function(){
					var $target = $(thisHash == '#_top' ? 'body' : thisHash);
					
					if($target.size()){
						var top = $target.offset().top;
						$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 500, 'swing');
					}
				});
		createCookie('andersen_shopSearch', thisHash, 365);
		return false;
	});
	
	$('.area-list ul li a[href=#all]').click(function(){
		var thisHash = '#area-result';
		$('#area-result .section').fadeOut(200);
		$('#area-result .section').fadeIn(400, function(){
					var $target = $(thisHash == '#_top' ? 'body' : thisHash);
					
					if($target.size()){
						var top = $target.offset().top;
						$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 500, 'swing');
					}
				});
		createCookie('andersen_shopSearch', thisHash, 365);
		return false;
	});
	
	if(location.pathname == '/shop/' || location.pathname == '/shop/index.html'){
		$('.shopListNavi ul li a').click(function(){
			var thisHash = $(this).attr('href').substr($(this).attr('href').indexOf('#'));
			$('#area-result .section').fadeOut(200);
			$('#area-result .section'+thisHash).fadeIn(400, function(){
					var $target = $(thisHash == '#_top' ? 'body' : thisHash);
					
					if($target.size()){
						var top = $target.offset().top;
						$($.browser.safari ? 'body' : 'html').animate({scrollTop:top}, 500, 'swing');
					}
				});
			createCookie('andersen_shopSearch', thisHash, 365);
			return false;
		});
	}
	
	$('.shopListNavi dt a').click(function(){
		createCookie('andersen_shopSearch', '', 365);
	});
	
	if($('body').attr('id') == 'shopIndex'){
		$('a').not('.shopListNavi ul li a, .area-list ul li a, #shopMap a, .shop-data th a').click(function(){
			createCookie('andersen_shopSearch', '', 365);
		});
	}
});



/* History Back
========================================== */
$(function() {
	$('a.history-back').click(function(){
		history.back();
		return false;
	});
});

/* Print
========================================== */
function print_out() {
  //印刷が使えるか判定する
  if (navigator.userAgent.match(/msie (\d)/i)) {
    v = (eval(RegExp.$1) >= 5) ? 1 : 0;
  } else if (self.innerWidth) {
    v = (eval(navigator.appVersion.charAt(0)) >= 4) ? 1 : 0;
  } else {
    v = 0;
  }

  if (v){ self.print() }
}


/* Text Valign Middle
========================================== */
function textValignMiddle(){
	$('#wrapper #main .section .section-contents .item-list04 .item .name').each(function(){
		var marginTop = (58 - $(this).height()) / 2;
		$(this).css({
			'position': 'relative',
			'top': marginTop+'px'
		});
	});
}
$(function() {
	textValignMiddle();
});


$(function() {
	$('.item.individual #wrapper #main #item-state dl.shop dd').append('<br />');
	$('#wrapper #main .section .section-contents .pick02.last').css('margin','0');
	$('body.joy.guest #main .monthly-guest-contents .monthly-guest-intro .contents').css('top', (482-$('body.joy.guest #main .monthly-guest-contents .monthly-guest-intro .contents').height())/2+'px');
});



/* Room Map
========================================== */
$(function() {
	$('body.hiroshima#room #main .room-pageNavi ul').find('li:first').addClass('first');
	
	$('body.hiroshima#room #main .room-map').find('ul.room-map-list li:first a').addClass('active');
	$('body.hiroshima#room #main .room-map').find('.room-map-display img').wrap('<div style="background: #FFF;"></div>');
	$('body.hiroshima#room #main .room-map').find('ul.room-map-list li a').click(function(){
		$(this).closest('ul.room-map-list').find('li a').removeClass('active');
		var src = $(this).attr('href');
		$(this)
			.addClass('active')
			.closest('.room-map').find('.room-map-display img').fadeOut(200, function(){ $(this).attr('src', src).fadeIn(600); });
		return false;
	});
});


/* Link
========================================== */
$(function() {
	$('a[href=/hiroshima/wedding/]').click(function(){
		window.open(this.href, 'wedding', 'width='+screen.availWidth+', height='+screen.availHeight+',toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1').focus();
		return false;
	});
	
	$('a[href=/hiroshima/kannai/]').click(function(){
		window.open(this.href, 'kannai', 'width='+screen.availWidth+', height='+screen.availHeight+',toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1').focus();
		return false;
	});
});

/* heightline.js
========================================== */
new function(){
	
	function heightLine(){
	
		this.className="heightLine";
		this.parentClassName="heightLineParent"
		reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
		objCN =new Array();
		var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
		for(var i = 0; i < objAll.length; i++) {
			var eltClass = objAll[i].className.split(/\s+/);
			for(var j = 0; j < eltClass.length; j++) {
				if(eltClass[j] == this.className) {
					if(!objCN["main CN"]) objCN["main CN"] = new Array();
					objCN["main CN"].push(objAll[i]);
					break;
				}else if(eltClass[j] == this.parentClassName){
					if(!objCN["parent CN"]) objCN["parent CN"] = new Array();
					objCN["parent CN"].push(objAll[i]);
					break;
				}else if(eltClass[j].match(reg)){
					var OCN = eltClass[j].match(reg)
					if(!objCN[OCN]) objCN[OCN]=new Array();
					objCN[OCN].push(objAll[i]);
					break;
				}
			}
		}
		
		//check font size
		var e = document.createElement("div");
		var s = document.createTextNode("S");
		e.appendChild(s);
		e.style.visibility="hidden"
		e.style.position="absolute"
		e.style.top="0"
		document.body.appendChild(e);
		var defHeight = e.offsetHeight;
		
		changeBoxSize = function(){
			for(var key in objCN){
				if (objCN.hasOwnProperty(key)) {
					//parent type
					if(key == "parent CN"){
						for(var i=0 ; i<objCN[key].length ; i++){
							var max_height=0;
							var CCN = objCN[key][i].childNodes;
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j] && CCN[j].nodeType == 1){
									CCN[j].style.height="auto";
									max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
								}
							}
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j].style){
									var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","");
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									CCN[j].style.height =newheight+"px";
								}
							}
						}
					}else{
						var max_height=0;
						for(var i=0 ; i<objCN[key].length ; i++){
							objCN[key][i].style.height="auto";
							max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
						}
						for(var i=0 ; i<objCN[key].length ; i++){
							if(objCN[key][i].style){
								var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									objCN[key][i].style.height =newheight+"px";
							}
						}
					}
				}
			}
		}
		
		checkBoxSize = function(){
			if(defHeight != e.offsetHeight){
				changeBoxSize();
				defHeight= e.offsetHeight;
			}
		}
		changeBoxSize();
		setInterval(checkBoxSize,1000)
		window.onresize=changeBoxSize;
	}
	
	function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
	addEvent(window,"load",heightLine);
}



/* jquery.flatheights.js
======================================================================
	Version: 2007-08-01
	$.changeLetterSize.addHandler(func)
	文字の大きさが変化した時に実行する処理を追加
======================================================================
*/

jQuery.changeLetterSize = {
	handlers : [],
	interval : 500,//定期処理を行う時間間隔。一応0.5秒で設定して有ります。1秒 = 1000
	currentSize: 0
};

(function($) {

	var self = $.changeLetterSize;

	/* 文字の大きさを確認するためのins要素 */
	var ins = $('<ins>M</ins>').css({
		display: 'block',
		visibility: 'hidden',
		position: 'absolute',
		padding: '0',
		top: '0'
	});

	/* 文字の大きさが変わったか */
	var isChanged = function() {
		
		ins.appendTo('body');
		var size = ins[0].offsetHeight;
		ins.remove();
		
		if (self.currentSize == size) return false;
		self.currentSize = size;
		
		return true;
	};

	/* 文書を読み込んだ時点で
	   文字の大きさを確認しておく */
	$(isChanged);

	/* 文字の大きさが変わっていたら、
	   handlers中の関数を順に実行 */
	var observer = function() {
		if (!isChanged()) return;
		
		$.each(self.handlers, function(i, handler) {
			handler();
		});
	};

	/* ハンドラを登録し、
	   最初の登録であれば、定期処理を開始 */
	self.addHandler = function(func) {
		self.handlers.push(func);
		if (self.handlers.length == 1) {
			setInterval(observer, self.interval);
		}
	};

})(jQuery);

/*
======================================================================
	$(expr).flatHeights()
	$(expr)で選択した複数の要素について、それぞれ高さを
	一番高いものに揃える
======================================================================
*/

(function($) {

	/* 対象となる要素群の集合 */
	var sets = [];

	/* 高さ揃えの処理本体 */
	var flatHeights = function(set) {
		var maxHeight = 0;
		set.each(function(){
			var height = this.offsetHeight;
			if (height > maxHeight) maxHeight = height;
		});
		set.css('height', maxHeight + 'px');
	};

	/* 要素群の高さを揃え、setsに追加 */
	jQuery.fn.flatHeights = function() {
		if (this.length > 1) {
			flatHeights(this);
			sets.push(this);
		}
		return this;
	};

	/* 文字の大きさが変わった時に、
	   setsに含まれる各要素群に対して高さ揃えを実行 */
	$.changeLetterSize.addHandler(function() {
		$.each(sets, function() {
			this.height('auto');
			flatHeights(this);
		});
	});

})(jQuery);


/*
Copyright (c) 2007, KITAMURA Akatsuki

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/


	/* Setting
	---------------------------------------- */
	$(function(){
		$('#main .section .section-contents .event-info01 .event dl dt').flatHeights();
		$('#main .section .section-contents .event-info01 .event dl dd').flatHeights();
		$('body.marguerite#category #wrapper #main .section .section-contents .item-list03 .item .point').flatHeights();
		$('#wrapper #main .section .section-contents .item-list03 .item .name').flatHeights();
		$('#wrapper #main .section .section-contents .item-list01 .item').flatHeights();
		$('#wrapper #main .section .section-contents .item-list05 .item').flatHeights();
	});

