// JavaScript Document
var $ = jQuery ;
function resize() {
	//全画面表示の高さを適宜変更
	var bodyHeight = document.body.scrollHeight;
	var bodyWidth = document.body.scrollWidth;

	//全画面表示の画像のサイズを適宜変更
	if ((bodyWidth/1200) > (bodyHeight/900)) {
		var top = Math.floor(((900 * (bodyWidth / 1200)) - bodyHeight) / 2);
		$('#bodyImg img').css( 'width', '100%');
		$('#bodyImg img').css( 'height', 'auto');
		$('#bodyImg img').css( 'top', '-'+top+'px');
		$('#bodyImg img').css( 'left', '0px');
	}else{
		var left = Math.floor(((1200 * (bodyHeight / 900)) - bodyWidth) / 2);
		$('#bodyImg img').css( 'height', '100%');
		$('#bodyImg img').css( 'width', 'auto');
		$('#bodyImg img').css( 'left', '-'+left+'px');
		$('#bodyImg img').css( 'top', '0px');
	}

	//１行に入るギャラリーの写真数を適宜変更
	if(bodyWidth > 1400){
		$('#gallery-1 .gallery-item').css( 'width', '14.2%');
	}else if(bodyWidth > 1200){
		$('#gallery-1 .gallery-item').css( 'width', '16.6%');
	}else if(bodyWidth > 1000){
		$('#gallery-1 .gallery-item').css( 'width', '20%');
	}else{
		$('#gallery-1 .gallery-item').css( 'width', '25%');
	}
}

//テキストの置き換え
function replaceText() {
	$("#gallery-1 br").replaceWith("");
	$("#navigation .backToList a").html("記事一覧へ戻る");
}


function topSlideshow(){
	$('#bodyImg').css( 'display', 'block');
	$('#bodyImg img:gt(0)').hide();
	setInterval(function(){$('#bodyImg :first-child').fadeOut(2000).next('img').fadeIn(2000).end().appendTo('#bodyImg');}, 7000);
};

