// 元号	年	場所(月)	力士名	位	商品ID	サムネイル
var dtPremoSumouLines = new Array;
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	10	1	武蔵丸	大関	A01100000028	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/028-10h01musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	10	3	若乃花	大関	A01100000029	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/029-10h03wakanohana_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	10	5	若乃花	大関	A01100000030	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/030-10h05wakanohana_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	10	7	貴乃花	横綱	A01100000031	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/031-10h07takanohana_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	10	9	貴乃花	横綱	A01100000032	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/032-10h09takanohana_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	10	11	琴錦	前12	A01100000033	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/033-10h11kotonishiki_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	11	1	千代大海	関脇	A01100000034	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/034-11h01chiyotaikai_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	11	3	武蔵丸	大関	A01100000035	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/035-11h03musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	11	5	武蔵丸	大関	A01100000036	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/036-11h05musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	11	7	出島	関脇	A01100000037	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/037-11h07dejima_l.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	11	9	武蔵丸	横綱	A01100000038	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/038-11h09musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	11	11	武蔵丸	横綱	A01100000039	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/039-11h11musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	12	1	武双山	関脇	A01100000040	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/040-12h01musouyama_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	12	3	貴闘力	前頭14	A01100000041	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/041-12h03takatouriki_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	12	5	魁皇	小結	A01100000042	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/042-12h05kaiou_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	12	7	曙	横綱	A01100000043	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/043-12h07akebono_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	12	9	武蔵丸	横綱	A01100000044	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/044-12h09musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	12	11	曙	横綱	A01100000045	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/045-12h11akebono_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	13	1	貴乃花	横綱	A01100000046	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/046-13h01takanohana_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	13	3	魁皇	大関	A01100000047	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/047-13h03kaiou_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	13	5	貴乃花	横綱	A01100000016	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/016-13h05takanohana_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	13	7	魁皇	大関	A01100000048	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/048-13h07kaiou_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	13	9	琴光喜	前頭2	A01100000049	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/049-13h09kotomituki_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	13	11	武蔵丸	横綱	A01100000050	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/050-13h11murashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	14	1	栃東	大関	A01100000051	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/051-14h01tochiazuma_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	14	3	武蔵丸	横綱	A01100000052	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/052-14h03musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	14	5	武蔵丸	横綱	A01100000053	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/053-14h05musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	14	7	千代大海	大関	A01100000054	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/054-14h07chiyotaikai_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	14	9	武蔵丸	横綱	A01100000055	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/055-14h09musashimaru_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	14	11	朝青龍	大関	A01100000056	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/056-14h11asashouryu_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	15	1	朝青龍	大関	A01100000057	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/057-15h01asashouryu_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	15	3	千代大海	大関	A01100000058	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/058-15h03chiyotaikai_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	15	5	朝青龍	横綱	A01100000059	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/059-15h05asasyouryu_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	15	7	魁皇	大関	A01100000060	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/060-15h07kaiou_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	15	9	朝青龍	横綱	A01100000015	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/015-15h09asasyouryu_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	15	11	栃東	大関	A01100000014	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/014-15h11tochiazuma_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	16	1	朝青龍	横綱	A01100000013	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/011-S1601s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	16	3	朝青龍	横綱	A01100000005	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/001-S1603.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	16	5	朝青龍	横綱	A01100000061	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/061-16h05asasyouryu_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	16	7	朝青龍	横綱	A01100000109	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/109-16h07asasyouryu_s.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	16	9	魁皇	大関	A01100000239	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/239thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	16	11	朝青龍	横綱	A01100000260	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/260thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	17	1	朝青龍	横綱	A01100000264	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/264thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	17	3	朝青龍	横綱	A01100000280	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/280thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	17	5	朝青龍	横綱	A01100000286	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/286thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	17	7	朝青龍	横綱	A01100000411	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/411thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	17	9	朝青龍	横綱	A01100000464	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/464thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	17	11	朝青龍	横綱	A01100000471	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/471thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	18	1	栃東	大関	A01100000486	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/486thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	18	3	朝青龍	横綱	A01100000495	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/495thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	18	5	白鵬	大関	A01100000504	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/504thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	18	7	朝青龍	横綱	A01100000555	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/505thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	18	9	朝青龍	横綱	A01100000558	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/558thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	18	11	朝青龍	横綱	A01100000559	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/559thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	19	1	朝青龍	横綱	A01100000566	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/566thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	19	3	白鵬	大関	A01100000569	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/569thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	19	5	白鵬	大関	A01100000586	http://premo.mainichi.co.jp/premo/shop/html/showcase/img/586thum.jpg';
dtPremoSumouLines[dtPremoSumouLines.length] = '平成	19	7	朝青龍	横綱	A01100000595	http://premo.mainichi.co.jp/premo/shop/image4parts/20070904dd1dd1phj281000c.jpg';

if( !(gymPremoSumouClick) ){
	var gymPremoSumouClick = new Array;
		gymPremoSumouClick['G'] = '平成';
		gymPremoSumouClick['Y'] = '';
		gymPremoSumouClick['M'] = '';
	var posPremoSumou;		// 現在の表示場所を格納する
	var prePremoSumouImage = new Image;
}

// 元号・年・月がクリックされたとき
function fnGymClick( gym, nm, blckObj ){
	gymPremoSumouClick[gym] = nm;
	
	blckObj.style.backgroundColor = 'red';
	
	// 3つがクリックされていたら
	if( gymPremoSumouClick['G'] != '' && gymPremoSumouClick['Y'] != '' && gymPremoSumouClick['M'] != ''){
		
		setTimeout("fnCloseIdDvPremoSumouTmSlct()", 3000);
		
		fnPremoSumouChangeImage( gymPremoSumouClick );
		
		gymPremoSumouClick['G'] = '平成';
		gymPremoSumouClick['Y'] = '';
		gymPremoSumouClick['M'] = '';
	}else{
		setTimeout("document.getElementById('idDvPremoSumouTmSlct').innerHTML = fnPremoSumouDispListYear();",500);
	}
	
	return(true);
}

// 画像を切り替える
function fnPremoSumouChangeImage( gymPremoSumouClick ){
	var i;
	for(i=0; i<dtPremoSumouLines.length; i++){
		var dd = dtPremoSumouLines[i].split(/\t/);
		if( gymPremoSumouClick['G'] == dd[0]
			&& gymPremoSumouClick['Y'] == dd[1]
			&& gymPremoSumouClick['M'] == dd[2]
		){
			document.getElementById('idDvPremoSumouMain').innerHTML = fnPremoSumouDispJob( i );
			break;
		}
	}
	if( i >= dtPremoSumouLines.length ){
		document.getElementById('idDvPremoSumouTmSlct').innerHTML = '<div style="color: red; background-color: pink; padding: 0.2em; font-weight: bold;">' + gymPremoSumouClick['G'] + gymPremoSumouClick['Y'] + '年' + gymPremoSumouClick['M'] + '月場所<br />の画像は、<br />未セットです</div>';
	}
}


// 年月一覧表を閉じる
function fnCloseIdDvPremoSumouTmSlct(){
	with( document.getElementById('idDvPremoSumouTmSlct') ){
		style.display = 'none';
		innerHTML = fnPremoSumouDispListYear();
	}
}

// 年月一覧表を表示する
function fnPremoSumouDispListYear(){
	var i;
	var oStr = new String;
	
	with( document ){
		// 年表示
		var yStr = new Array;
		var gStr = new Array;
		oStr += '<span style="font-weight: bold;">年：</span>';
		
		// 元号と年数を格納しつつユニークに表示する
		for(i=0; i<dtPremoSumouLines.length; i++){
			var dd = new Array;
			dd = dtPremoSumouLines[i].split(/\t/);
			gStr[i] = dd[0];
			yStr[i] = dd[1];
			
			if(i==0 || gStr[i] != gStr[i-1] ){ oStr += '<span class="clSpnPremoSumouGymG" onclick="fnGymClick(\'G\',\'' + dd[0] + '\',this)" style="cursor: pointer"> ' + dd[0] + ' </span>'; }
			if(i==0 || yStr[i] != yStr[i-1] ){ oStr += '<span class="clSpnPremoSumouGymY" onclick="fnGymClick(\'Y\',\'' + dd[1] + '\',this)" style="cursor: pointer"> ' + dd[1] + ' </span>'; }
		}
		
		// 月を表示する(6回固定)
		oStr += '<br /><span style="font-weight: bold;">場所月：</span>';
		for(i=1; i<=12; i+=2 ){
			oStr +='<span class="clSpnPremoSumouGymM" onclick="fnGymClick(\'M\',\'' + i + '\',this)" style="cursor: pointer"> ' + i + ' </span>';
		}
	}
	return(oStr);
}

// 指定番号を表示する
function fnPremoSumouDispJob( dtNm ){
	if( dtNm < -1 || dtPremoSumouLines.length <= dtNm ){ return(''); }
	
	posPremoSumou = dtNm;
	
	var dd = new Array;
	
	dd = dtPremoSumouLines[dtNm].split(/\t/);
	prePremoSumouImage.src = dd[6];
	
	var imgw;
	var imgh;
	imgw = prePremoSumouImage.width;
	imgh = prePremoSumouImage.height;
	
	return('<div id="idDvPremoSumouImage"><!-- <div id="dvDvPremoSumouFWDRWD"><div style="width: auto; float: left;"><a href="javascript: void(0);" onclick="fnPremoSumouOnClckFWDRWD(-1);">&lt;</a></div><div style="width: auto; float: right;"><a href="javascript: void(0);" onclick="fnPremoSumouOnClckFWDRWD(1);">&gt;</a></div></div> --><span onclick="fnPremoSumouOpenTmSlct();" style="cursor: pointer;"><img id="idImgPremoSumouImage" src="' + dd[6] + '" width="' + imgw + '" height="' + imgh + '" border="0" alt="" /></span></div><div id="idDvPremoSumouDesc"><div id="idDvPremoSumouClickArea"><div id="idDvPremoSumouDescYear"><span onclick="fnPremoSumouOpenTmSlct();" style="cursor: pointer;">' + dd[0] + dd[1] + '年</span></div><div id="idDvPremoSumouDescMonth"><span onclick="fnPremoSumouOpenTmSlct();" style="cursor: pointer;">' + dd[2] + '月場所</span></div><div id="idDvPremoSumouTmSlct" style="display: none;"><script type="text/javascript">document.write( fnPremoSumouDispListYear());</script></div></div><div id="idDvPremoSumouDescClass">' + dd[4] + '</div><div id="idDvPremoSumouDescName">' + dd[3] + '関</div><div id="idDvPremoSumouCartBttn"><a href="https://premo.mainichi.co.jp/cgi-bin/premo/sc/intocart.cgi?MODE=ADD&PID=' + dd[5] +  '" title="毎日プレミアムモールで購入する"><img id="ImgPremoSumouCartBttn" src="http://premo.mainichi.co.jp/premo/shop/img/right/cart.gif" border="0" alt="毎日プレミアムモールで購入する" /></a></div></div><hr id="idHrPremoSumouWhatIsYuShoGaku" style="width: 50%; text-align: center;"><div id="idDvPremoSumouWhatIsYuShoGaku"><a href="javascript: void(0);" onclick="fnPremoSumouOnClckWhatIsYuShoGaku()">優勝額とは？</a><div id="idDvPremoSumouAboutYuShoGaku" style="display: none; font-size: 0.8em; text-align: left;">毎日新聞社は大相撲優勝力士に優勝色彩写真額を贈り、両国国技館に掲額されています。この優勝額のミニチュア版( 縦32センチ×横23センチ ) を一般の方にお分けしています。</div></div>');
}

// 前後の画像に移動する 20070921Fr_140656
function fnPremoSumouOnClckFWDRWD( drff ){
	if( drff == 0 ){ return(true); }
	if( drff < 0 ){ drff = -1; }
	if( 0 < drff ){ deff = 1;  }
	
	drff = posPremoSumou + drff;
	if( drff < 0 ){ drff = dtPremoSumouLines.length-1; }
	if( dtPremoSumouLines.length <= drff  ){ drff = 0; }
	
	with( document ){
		getElementById('idDvPremoSumouMain').innerHTML = fnPremoSumouDispJob(drff);
	}
}

function fnPremoSumouOnClckWhatIsYuShoGaku(){
	with( document.getElementById('idDvPremoSumouAboutYuShoGaku').style ){
		if( display == 'none' ){
			display = 'block';
		}else{
			display = 'none';
		}
	}
}

// 年月一覧表を開閉する
function fnPremoSumouOpenTmSlct(){
	with( document.getElementById('idDvPremoSumouTmSlct').style ){
		if( display == 'none' ){
			display = 'block';
		}else{
			fnCloseIdDvPremoSumouTmSlct();
		}
	}
	return(true);
}

// 配列の最終値を表示する
document.write( '<div id="idDvPremoSumouMain">' + fnPremoSumouDispJob(dtPremoSumouLines.length - 1) + '</div>');
