// /index.html トップページ用クローズアップ処理用

$(function() {
	$('table.calendar tr').each(function(){
		$(this).find('td:eq(0),th:eq(0)').addClass('sat');
		$(this).find('td:eq(6),th:eq(6)').addClass('sun');
	});
	
	
	/* div要素を3つずつの組に分ける */
	var sets = [], temp = [];
	$('div.section div.inline div.inside').each(function(i){
		temp.push(this);
		if(i % 2 == 1){
			sets.push(temp);
			temp = [];
		}
	});
	if (temp.length) sets.push(temp);
	/* 各組ごとに高さ揃え */
	$.each(sets, function() {
		$(this).flatHeights();
	});
	
	
	closeupObj.init();
	$('div.section div.wrapper div.inline:odd').addClass('mr00');
});

function WrapperHeight(num){
	$("#closeup div.wrapper:eq("+num+")").each(function(){
		var WrapperHeight = $(this).height();
		$("#closeup").animate({height: WrapperHeight+13});

		//("height" , WrapperHeight );
	});
}

function CloseupClick(){
	var count = 0;
	$('#btnBnrNext').click(function(){
		if(count < 5){
			count++;
			WrapperHeight(count);
		} else {
			count = 0;
			WrapperHeight(count);
		}
	});
	$('#btnBnrPrev').click(function(){
		if(count > 0){
			count--;
			WrapperHeight(count);
		} else {
			count = 5;
			WrapperHeight(count);
		}
	});
	WrapperHeight(count);
}
$(document).ready(CloseupClick);

var closeup = function(){
	this.activeCloseupType = "Thumb";
}
closeup.prototype = {
	init : function() {
		$("#closeup").innerfade({
							type:"btnClick",
							btnNext:"#btnBnrNext",
							btnPrev:"#btnBnrPrev",
							ico_channel_active:"images/guidance/ico_channel_on.gif",
							ico_channel_normal:"images/guidance/ico_channel.gif"
					});
		$("#btnCloseupThumb img , #btnCloseupList img").css("cursor" , "pointer");
	}
};
var closeupObj = new closeup();
