//==============================
// 中央画像を入れ替える
//==============================
function SubmitPhoto(spread_num)
{
  	gnSubPhotoErrorcount = 0;
	var intSpreadno = parseInt(spread_num,10);
	// 拡大画像位置に、指定画像を入れる
	document.getElementById('car_img_main').src=sub_src_b[intSpreadno];
	return;	
}

//==============================
//画像のロードチェック
//==============================
function hidePhoto(pict_no,img) {

	if(pict_no <= 9){
		gnSubPhotoErrorcount++;
	}
	if(gnSubPhotoErrorcount >= 8){
		document.getElementById('switch_top').style.display='none';
	}
	subimg_flg[pict_no]=-1;

	//代替画像を見えなくする
	document.getElementById("spread_sub"+pict_no).style.display='none';

	// コメントを非表示にする
	document.getElementById("sub_comment_0"+pict_no).innerHTML='';

}

//==============================
// サブ画像の有無をチェックし、画像をセットする
//==============================
function loadImage(counter){
	this.ImageLoad = document.getElementById("spread_sub"+counter);
	this.ImageLoad.onerror = function worksForErr()
	{
			sub_src[counter] = "";
			hidePhoto(counter,this.ImageLoad);
	}
	this.ImageLoad.onload = function worksForOk(){
		document.getElementById('sub_comment_0'+counter).innerHTML = "拡大して見る";
	}
	ImageLoad.src = sub_src[counter];
}

//==============================
// d_log初期セット
// サムネイル事前チェック
//==============================
function LoadSubphoto(){
	arry_sub_photo_comment = new Array();
	for(var counter=0; counter<=8; counter++){
		// 正しい画像パスをセット
		loadImage(counter);
	}
	return;
}

