//初期設定
nav=navigator.appName.substring(0,1);
s_pt="0,0,2,2,4,4,6,6,8,9,10,11,12,13,113,15,15,17,18,18,17,21,22,23,24,25".split(",");
p_no=1;
if(dt[0]){p_no=0;}

gaku_bg=(gaku+",,,,,,,,,,").split(",");
if(gaku_bg[3]==""){gaku_bg[3]="16";}//文字サイズ
if(gaku_bg[4]==""){gaku_bg[4]="23-1";}//ランダム-写真ワイプ
c_type=(gaku_bg[4]+"--").split("-");
if(c_type[0]==""){c_type[0]="23";}
if(c_type[1]==""){c_type[1]="0";}
if(gaku_bg[5]==""){gaku_bg[5]="1";}//スクロールバーあり
if(gaku_bg[6]==""){gaku_bg[6]="0";}//縦幅自動
if(gaku_bg[7]==""){spd=5000;}else{spd=gaku_bg[7]*1000;}//スライド秒
if(gaku_bg[8]==""){gaku_bg[8]="0";}//スライドループ
if(gaku_bg[9]==""){gaku_bg[9]="0";}//スライド手動
crs_color=gaku_bg[1];if(crs_color==gaku_bg[0]){crs_color=gaku_bg[2]}
if(gaku_bg[10]==""){gaku_bg[10]="inset";}//スライド手動
//ウィンドウ内径
function win_size(){
if(document.body.clientWidth){
win_ww=document.body.clientWidth;
if(win_ww<screen.width&&gaku_bg[5]=="0"){
win_ww+=16;
}
win_hh=Math.floor(document.body.clientHeight*0.725);///////

}else{
win_ww=Math.floor(screen.width);
win_hh=Math.floor(screen.height*0.725);//////
}

/////win_hh=Math.floor(win_ww/2);
//menu_ww=Math.floor(win_ww/5);
menu_ww=Math.floor(win_hh/2.5);

img_hh="height:"+(win_hh-50)+";";
g=gaku_bg[6]*1

if(g==1){img_hh="";}
if(g>1){
//if(g>(win_hh-50)){g=win_hh-50;}
img_hh="height:"+g+";";
}
}
//ウインドウリサイズ
function win_resize(){
win_size();
document.getElementById("yoko1").style.width=win_ww;
document.getElementById("yoko2").style.width=win_ww;
//document.getElementById("yoko2").style.height=win_hh;
document.getElementById("yoko3").style.width=win_ww;
//document.getElementById("yoko4").style.width=menu_ww*4-14;
document.getElementById("yoko4").style.width=win_ww-menu_ww*1.5;

if(gaku_bg[6]=="0"){
//document.getElementById("myimg").style.height=win_hh-50;
}
//document.getElementById("tate1").style.height=win_hh-24;
}

win_size();

dd=(dt[p_no]+",,,").split(",");


//サムネールオンマウス
function m_on(p,q,r){
tate1.document.getElementById("m"+p).style.borderColor=crs_color;
if(q==24||r==2){
tate1.document.all["m"+p].filters["gray"].enabled=false;
}
}
function m_off(p,q,r){
tate1.document.getElementById("m"+p).style.borderColor=gaku_bg[0];
if(q==24||r==2){
tate1.document.all["m"+p].filters["gray"].enabled=true;
}
}
//ＭＥＮＵ切替
function img_chg(p){
p_no=p;
if(at_flg==1 && gaku_bg[9]!="2"){
clearTimeout(tm);
document.myform.at_sw.value="スライド開始";

at_flg=0;

}
img_set(p_no);
}
//拡大イメージ切替
function img_set(p){

p_no=p;
dd=(dt[p_no]+",,,").split(",");
document.getElementById("com").innerHTML=dd[3];
if(dd[2]==""){dd[2]=gaku_bg[4];}

d1=(dd[2]+"--").split("-");
d10=d1[0];
if(d1[0]=="23" || d1[0]=="24"){d10=""+Math.floor(Math.random()*23);}

if(d1[1]==""){d1[1]=c_type[1];}
if( nav!="M"){
document.images["myimg"].src=ur+dd[0];
return;
}
if(c_type[2]!=""){shut_bgm.src=c_type[2];}else{ if(d1[2]!=""){shut_bgm.src=d1[2];}}
if(d1[1]=="4"){
shatter();return;
}
if(d1[1]=="3"){
myta.filters["blendTrans"].Apply();
myta.filters["blendTrans"].duration=3;


}
if(d1[0]=="24"){wip25_on();return;}
if(d1[1]=="0"){
document.getElementById("myimg").style.visibility="hidden";
}
if(d10!="99"){
mytc.filters["revealTrans"].Apply();
mytc.filters["revealTrans"].Transition=d10;
mytc.filters["revealTrans"].duration=2;
}
if(d1[1]=="2"){;
wip25(true);
mono_tim=setTimeout("wip25(false)",2000);
}
document.images["myimg"].src=ur+dd[0];
//document.getElementById("myimg").style.visibility="visible";
if(d1[0]!="99"){
mytc.filters["revealTrans"].Play();
}
if(d1[1]==3){
myta.filters["blendTrans"].play();
}
if(d1[1]==0){
document.getElementById("myimg").style.visibility="visible";

}
}
//シャッター
function shatter(){
t_no=s_pt[(d10*1)]*1;
mytc.filters["revealTrans"].Apply();
mytc.filters["revealTrans"].Transition=""+t_no;
mytc.filters["revealTrans"].duration=1;
document.getElementById("myimg").style.visibility="hidden";
mytc.filters["revealTrans"].Play();
shatter_tm=setTimeout("shatter_open()",1000);
}

function shatter_open(){
if(t_no<8 || (t_no>12 && t_no<21)){t_no++;}
if(t_no==18){t_no=20;}
mytc.filters["revealTrans"].Apply();
mytc.filters["revealTrans"].Transition=""+t_no;
document.images["myimg"].src=ur+dd[0];
document.getElementById("myimg").style.visibility="visible";
mytc.filters["revealTrans"].Play();
if(d1[0]=="24"){wip25_on();return;}
}

//白黒タイマー

function wip25_on(){
wip25(true);
document.images["myimg"].src=ur+dd[0];
mono_tim=setTimeout("wip25(false)",2000);
}
function wip25(c){
if(!c){
myta.filters["blendTrans"].Apply();
myta.filters["blendTrans"].duration=3;
myta.filters["blendTrans"].play();
}

mytb.filters["gray"].enabled=c;

}

//ウインドウを閉じる
function cls(){
if(history.length>0){
history.back();
}else{
window.close();
}
}

//自動スライド
function start(){
tm=setTimeout("at()",spd);
}
at_flg=0;
function at(){

if(at_flg==1){
at_flg=0;
clearTimeout(tm);
document.myform.at_sw.value="スライド開始";
//document.getElementById("menu_win").style.top=0;
/////tate1.window.scrollTo(0,0);
/////tate1.document.getElementById("m"+dm_no).style.borderColor=gaku_bg[0];

return;
}else{
at_flg=1;//////p_no=0;menu_y=0;
dm_no=1;
tate1.document.getElementById("m"+dm_no).style.borderColor=crs_color;

document.myform.at_sw.value="スライド停止";
at_sub();
}
}
function at_sub(){

p_no++;
if(p_no>dn){
if(gaku_bg[8]!="0"){
document.myform.at_sw.value="スライド開始";
clearTimeout(tm);
tate1.window.scrollTo(0,0);
//document.getElementById("menu_win").style.top=0;
tate1.document.getElementById("m"+dm_no).style.borderColor=gaku_bg[0];

return;
}
p_no=1;
}
m_scroll();
}
//ＭＥＮＵスクロール
function m_scroll(){
dm_y=menu_y;
menu_y=Math.floor((menu_ww/2+15)*(p_no)-(win_hh-24-15));
if(menu_y<0){menu_y=0;}
menu_s=(menu_y-dm_y)/20;
mn=0;
m_scroll_sub();
}
function m_scroll_sub(){
mn++;
if(mn<20){
tate1.window.scrollTo(0,(menu_s*mn)+dm_y);

tm=setTimeout("m_scroll_sub()",50);

}else{
tate1.window.scrollTo(0,menu_y);
tate1.document.getElementById("m"+p_no).style.borderColor=crs_color;
tate1.document.getElementById("m"+dm_no).style.borderColor=gaku_bg[0];
img_set(p_no);
dm_no=p_no;
tm=setTimeout("at_sub()",spd);
}
}
function cl(){
return false;
}
//手動ＵＤ
menu_y=0;
menu_e=Math.floor((menu_ww/2+15)*(dn)-(win_hh-24-15));
function menu_roll(u){
if(gaku_bg[9]=="2"){
if(u!=0){ud=u;}
return;
}
if(at_flg==1){return;}
if(u==0){
clearTimeout(roll_tm);return;
}
ud=u;
menu_roll_sub();


}
function menu_roll_sub(){
menu_y+=ud*10;
//document.test_form.test_box.value=menu_y+"/"+menu_e;
if(menu_y>menu_e){
menu_y=menu_e;
}
if(menu_y<0){
menu_y=0;
}
tate1.window.scrollTo(0,menu_y);

roll_tm=setTimeout("menu_roll_sub()",30);
}
//自動ＵＤ
menu_y=0;
menu_e=Math.floor((menu_ww/2+15)*(dn)-(win_hh-24-15));
function menu_at_onoff(){
if(at_flg==1){
clearTimeout(roll_tm);
document.myform.at_sw.value="スライド開始";
at_flg=0;return;
}else{
at_flg=1;
menu_at_sub();
}
}
function menu_at_st(){
roll_tm=setTimeout("menu_at(1)",5000);
document.myform.at_sw.value="スライド停止";
at_flg=1;
}
function menu_at(u){

if(u==0){
clearTimeout(roll_tm);return;
}
ud=u;
menu_at_sub();


}
function menu_at_sub(){
menu_y+=ud;
//document.test_form.test_box.value=menu_y+"/"+menu_e;
if(menu_y>menu_e){
menu_y=menu_e;
}
if(menu_y<0){
menu_y=0;
}
tate1.window.scrollTo(0,menu_y);
if(menu_y>=menu_e || menu_y<=0){
ud*=-1;
roll_tm=setTimeout("menu_at_sub()",3000);
}else{
roll_tm=setTimeout("menu_at_sub()",30);
}
}
//画面はみ出し処理
function img_size(){
img_w=document.myimg.width;
img_h=document.myimg.height;
m=menu_ww*4-30;
if(img_w>m){
h=Math.floor(img_h*(m/img_w));

document.getElementById("myimg").style.height=h;
document.getElementById("tate1").style.height=h;
}
}
//ＪソースＬＯＡＤ
function js_link(){
//load_win=window.open("http://www2a.biglobe.ne.jp/~qpon/js/index.htm?http://qpon.quu.cc/java/quality/quality6_b.htm","dl","titlebar=yes,scrollbars=yes");
//alert("プログラムテスト中（"+opener+"/"+history.length+"/"+document.body.clientHeight+"/"+screen.height);

if(document.body.clientHeight>=(screen.height-10)){
//ＯＰＥＮウインドウ
opener.location.href="http://www2a.biglobe.ne.jp/~qpon/js/index.htm?http://qpon.quu.cc/java/quality/quality6_b.htm";
close();
}else{
location.href="http://www2a.biglobe.ne.jp/~qpon/js/index.htm?http://qpon.quu.cc/java/quality/quality6_b.htm";

}

}
//画面作成
document.write('<table id="yoko1" width='+win_ww+' height=32 cellpaddind=0 bgcolor='+gaku_bg[1]+'><tr><td width=100></td><td id="com" style="background:'+gaku_bg[1]+';color:'+gaku_bg[2]+';font-size:'+gaku_bg[3]+';text-align:center">'+dd[3]+'</td><td width=100 align=right valign=top>');
if(gaku_bg[5]=="0"){
document.write('<input type=button  style="width:20;background:'+gaku_bg[1]+';color:'+gaku_bg[2]+';border-color:'+gaku_bg[0]+';cursor:pointer" onClick="cls();" value="x">');

}
document.write('</td></tr></table>\n');
document.write('<table id="yoko2" width='+win_ww+' height='+win_hh+' bgcolor="'+gaku_bg[0]+'" cellpadding=0 onContextmenu="cl();return false;"><tr>');
	//サムネール
	document.write('<td width='+(menu_ww-2)+' align=center>');
document.write('<table width=100% height=100% cellpadding=0 cellspacing=0 >');
document.write('<tr height=8><td onMouseover="menu_roll(-1);"  onMouseout="menu_roll(0);" style="text-align:center;font-size:10;color:'+crs_color+';cursor:default;">△</td></tr>');
document.write('<tr><td align=center>');
	document.write('<iframe name="tate1" id="tate1" frameborder=0 style="width:'+(menu_ww-6)+';height:'+(win_hh-24)+';"></iframe>');
document.write('<tr height=8><td onMouseover="menu_roll(+1);"  onMouseout="menu_roll(0);"  style="text-align:center;font-size:10;color:'+crs_color+';cursor:default;">▽</td></tr>');

	document.write('</table>');
//
function tate1_set(){
tate1.document.open();
tate1.document.write('<html><body style="margin:0;text-align:center;background:'+gaku_bg[0]+';scrollbar-base-color:'+gaku_bg[0]+';">');
		tate1.document.write('<table id="menu_win" name="menu_win" cellpadding=5 style="position:relative;top:0;left:0">');

		for(i=1;i<=dn;i++){
		d0=(dt[i]+",,,").split(",");if(d0[1]==""){d0[1]=d0[0];}
		if(d0[2]==""){d0[2]=gaku_bg[4];}

		d1=(d0[2]+"-").split("-");
if(d1[1]==""){d1[1]=c_type[1];}

		d="";if(d1[0]=="24" || d1[1]=="2"){d=";filter:gray(enabled=1)";}
	tate1.document.write('<tr><td align=center><img src="'+ur+d0[1]+'" id="m'+i+'" border=2 style="border-color:'+gaku_bg[0]+d+';" onClick="parent.img_chg('+i+')" onMouseOver="parent.m_on('+i+','+d1[0]+','+d1[1]+')" onMouseOut="parent.m_off('+i+','+d1[0]+','+d1[1]+')" height='+(Math.floor(menu_ww/2))+'></td></tr>');

		}

		tate1.document.write('</table></body></html>');
	tate1.document.close();
}

	document.write('</td><td align=center>\n');
//拡大画面

		document.write('<table width='+(menu_ww*4-2)+' height='+(win_hh)+'><tr><td align=center>');

		document.write('<span id="mytc" name="mytc" style="width:'+(menu_ww*4-5)+';height:'+win_hh+';vertical-align:middle;filter:revealTrans(duration=2);">\n');

		document.write('<span id="myta" name="myta" style="width:'+(menu_ww*4-8)+';height:'+win_hh+';cursor:crosshair;filter:blendTrans(duration=3);">\n');
		document.write('<span id="mytb" name="mytb" style="width:'+(menu_ww*4-11)+';height:'+win_hh+';vertical-align:middle;filter:gray(enabled=0);">\n');

			document.write('<table id="yoko4" border=0 width='+(menu_ww*4-14)+' height='+win_hh+' cellpadding=20><tr><td align=center valign=middle>');
			document.write('<img id="myimg" name="myimg" src="'+ur+dd[0]+'" onLoad="img_size()" galleryimg="no" style="'+img_hh+'border-style:'+gaku_bg[10]+';border-color:#ffffee;visibility:visible"><br>');
			document.write('</td></tr></table>');
		document.write('</span>');
		document.write('</span>');
		document.write('</span>');
		document.write('</td></tr></table>\n');

document.write('</td></tr></table>\n');
tate1_set();
//document.write('</td></tr>\n');
document.write('<table id="yoko3" width='+win_ww+' height=32 bgcolor='+gaku_bg[1]+' cellpadding=0 cellspacing=0 bgcolor=><tr><form name="myform"><td width=160></td><td align=center>');
document.write('<input type=button  style="width:100;background:'+gaku_bg[1]+';color:'+gaku_bg[2]+';border-color:'+gaku_bg[0]+';cursor:pointer" onClick="cls();" value="閉じる">');
if(gaku_bg[9]=="2"){
document.write('<input name="at_sw" type=button onClick="menu_at_onoff()" value="スライド開始" style="width:100;background:'+gaku_bg[1]+';color:'+gaku_bg[2]+';border-color:'+gaku_bg[0]+';cursor:pointer">');
}else{
document.write('<input name="at_sw" type=button onClick="at()" value="スライド開始" style="width:100;background:'+gaku_bg[1]+';color:'+gaku_bg[2]+';border-color:'+gaku_bg[0]+';cursor:pointer">');

}
document.write('</td><td width=160 align=center style="font-size:9;color:'+gaku_bg[2]+';cursor:pointer;" onClick="js_link()">システム提供：ＱＰＯＮ</td></form></tr></table>');
//if(c_type[2]!=""){
document.write('<bgsound id="shut_bgm" src="">');
//}
//スクロールバー
if(gaku_bg[5]=="0"){
document.body.scroll="no";
}
document.body.style.margin=0;
window.onresize=win_resize;
//window.onresize=win_size;

if(gaku_bg[9]=="1"){

window.onload=start;

}
if(gaku_bg[9]=="2"){
window.onload=menu_at_st;
}
