// Font-size Switcher

jQuery(function(){
	jQuery("a.fontsize_S").click(function(){
		jQuery("body")
			.removeAttr("class")
			.addClass("font_S");
		jQuery.cookie('FontSizeSet','0',{expires:30,path:'/'});
		latestNewsFlatBlock();
		return false;
	});
	jQuery("a.fontsize_M").click(function(){
		jQuery("body")
			.removeAttr("class")
			.addClass("font_M");
		jQuery.cookie('FontSizeSet','1',{expires:30,path:'/'});
		latestNewsFlatBlock();
		return false;
	});
	jQuery("a.fontsize_L").click(function(){
		jQuery("body")
			.removeAttr("class")
			.addClass("font_L");
		jQuery.cookie('FontSizeSet','2',{expires:30,path:'/'});
		latestNewsFlatBlock();
		return false;
	});
});

function FontSizeGet() {
	if (jQuery.cookie('FontSizeSet') == '0') {
		jQuery("body")
			.removeAttr("class")
			.addClass("font_S");
	}
	if (jQuery.cookie('FontSizeSet') == '2') {
		jQuery("body")
			.removeAttr("class")
			.addClass("font_L");
	}
}

function latestNewsFlatBlock() {
	FlatBlock('#latestlocalnewsdetail_container .latestlocalnews');
	FlatBlock('#latestlocalnewslist_container .latestlocalnewslist');
	FlatBlock('#latestalbinewsdetail_container .latestalbinews');
	FlatBlock('#latestalbinewslist_container .latestalbinewslist');
	FlatBlock('#albinewsphoto .latestalbinewsphotobox');
	FlatBlock('#latestglobalnewsdetail_container .latestglobalnews');
	FlatBlock('#latestglobalnewslist_container .latestglobalnewslist');
	FlatBlock('#globalnewsphoto .latestglobalnewsphotobox');
	return false;
}
function FlatBlock(trgt) {
	var maxHeight = 0;
	var targetHeight = 0;
	jQuery(trgt).each(function() {
		jQuery(this).height('auto');
		if(jQuery(this).height() > maxHeight){
			maxHeight = jQuery(this).height();
		}
	});
	jQuery(trgt).each(function() {
		jQuery(this).css('height', maxHeight + 'px');
	});
	return false;
}

