﻿
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
var data=new Array("btn_anime0_off.gif","btn_anime1_off.gif","btn_anime2_off.gif","btn_anime3_off.gif","btn_anime4_off.gif","btn_anime5_off.gif","btn_anime6_off.gif","btn_anime6.gif","btn_anime6_on.gif","btn_anime0.gif","btn_anime0_on.gif","btn_anime1.gif","btn_anime1_on.gif","btn_anime2.gif","btn_anime2_on.gif","btn_anime3.gif","btn_anime3_on.gif","btn_anime4.gif","btn_anime4_on.gif","btn_anime5.gif","btn_anime5_on.gif","btn_bg0.gif","btn_bg0_on.gif","btn_bg1.gif","btn_bg1_on.gif","btn_bg2.gif","btn_bg2_on.gif","btn_bg3.gif","btn_bg3_on.gif","btn_body0.gif","btn_body0_on.gif","btn_body1.gif","btn_body1_off.gif","btn_body1_on.gif","btn_color0.gif","btn_color0_off.gif","btn_color0_on.gif","btn_color1.gif","btn_color1_off.gif","btn_color1_on.gif","btn_color10.gif","btn_color10_off.gif","btn_color10_on.gif","btn_color2.gif","btn_color2_off.gif","btn_color2_on.gif","btn_color3.gif","btn_color3_off.gif","btn_color3_on.gif","btn_color4.gif","btn_color4_off.gif","btn_color4_on.gif","btn_color5.gif","btn_color5_off.gif","btn_color5_on.gif","btn_color6.gif","btn_color6_off.gif","btn_color6_on.gif","btn_color7.gif","btn_color7_off.gif","btn_color7_on.gif","btn_color8.gif","btn_color8_off.gif","btn_color8_on.gif","btn_color9.gif","btn_color9_off.gif","btn_color9_on.gif","btn_frame0.gif","btn_frame0_on.gif","btn_frame1.gif","btn_frame1_on.gif","btn_frame2.gif","btn_frame2_on.gif","btn_move.gif","btn_move_on.gif","btn_reset.gif","btn_reset_on.gif","btn_rotate.gif","btn_rotate_on.gif","btn_seat0.gif","btn_seat0_on.gif","btn_seat1.gif","btn_seat1_on.gif","btn_seat2.gif","btn_seat2_off.gif","btn_seat2_on.gif","btn_type0.gif","btn_type0_on.gif","btn_type1.gif","btn_type1_on.gif","btn_type2.gif","btn_type2_on.gif","btn_type3.gif","btn_type3_on.gif","btn_zoom_in.gif","btn_zoom_in_off.gif","btn_zoom_in_on.gif","btn_zoom_out.gif","btn_zoom_out_off.gif","btn_zoom_out_on.gif","btn_color10.gif","btn_color10_off.gif","btn_color10_on.gif","btn_color11.gif","btn_color11_off.gif","btn_color11_on.gif","btn_color12.gif","btn_color12_off.gif","btn_color12_on.gif","btn_color13.gif","btn_color13_off.gif","btn_color13_on.gif","btn_color14.gif","btn_color14_off.gif","btn_color14_on.gif");
var prImg=new Array();
for(i=0;i<data.length;i++)
{
	prImg[i]=new Image();
	prImg[i].src="img/"+data[i];
}
var data2=new Array("thumbnail0.gif","thumbnail1.gif","thumbnail2.gif","thumbnail3.gif","thumbnail4.gif","thumbnail5.gif");
var prImg2=new Array();
for(i=0;i<data2.length;i++)
{
	prImg2[i]=new Image();
	prImg2[i].src="thumbnail/"+data[i];
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
var type_flg="1";//now_type_data
var old_type_flg="1";//old_type_data
function con_type(n)
{
	if(!flg_3d_check)return;
	if(type_flg==n)return;
	if(anime_flg==1)return;
	document.images["btn_type"+n].src="img/btn_type"+n+"_on.gif";
	document.images["btn_type"+type_flg].src="img/btn_type"+type_flg+".gif";
	
	if(n=="2"||n=="3"){
		con_frame("0");
		document.images["btn_frame1"].src="img/btn_frame1_off.gif";
		document.images["btn_frame2"].src="img/btn_frame2_off.gif";
		con_body("0");
		con_seat("2");
		document.images["btn_seat0"].src="img/btn_seat0_off.gif";
		document.images["btn_seat1"].src="img/btn_seat1_off.gif";
		
		document.images["anime5"].src="img/btn_anime5_off.gif";
	}
	
	if((old_type_flg=="2"||old_type_flg=="3")&&(n=="0"||n=="1")){
		document.images["btn_frame1"].src="img/btn_frame1.gif";
		document.images["btn_frame2"].src="img/btn_frame2.gif";
		
		document.images["btn_seat0"].src="img/btn_seat0.gif";
		document.images["btn_seat1"].src="img/btn_seat1.gif";
		
		document.images["anime5"].src="img/btn_anime5.gif";
	}
	
	type_flg=n;
	code_hakidasi();////goukei
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
var frame_flg="1";//now_frame_data
var old_frame_flg="1";//old_frame_data
function con_frame(n)
{
	if(!flg_3d_check)return;
	if(frame_flg==n)return
	if(anime_flg==1)return;
	if(type_flg=="2"||type_flg=="3")return;
	document.images["btn_frame"+n].src="img/btn_frame"+n+"_on.gif";
	document.images["btn_frame"+frame_flg].src="img/btn_frame"+frame_flg+".gif";
	frame_flg=n;
	if(n==0||n==2){//////////////////////////////////////////////////con_body_you
		document.images["btn_body1"].src="img/btn_body1_off.gif";
		//con_body_3d("0");
		body_flg="0";
		document.images["btn_body0"].src="img/btn_body0_on.gif";
	}else{
		document.images["btn_body1"].src="img/btn_body1.gif";
	}////////////////////////////////////////////////////////////////con_body_you
	if(n==1||n==2){//////////////////////////////////////////////////con_seat_you
		document.images["btn_seat2"].src="img/btn_seat2_off.gif";
		if(seat_flg=="2"){
			//con_seat_3d("0")
				seat_flg="0";
			document.images["btn_seat0"].src="img/btn_seat0_on.gif";
		}
	}else{
		document.images["btn_seat2"].src="img/btn_seat2.gif";
	}/////////////////////////////////////////////////////////////////con_seat_you
	if(color_flg=="12"||color_flg=="13"||color_flg=="14"){///////////////////////////////////////////////con_color_you
		for(i=0;i<=11;i++){
			document.images["btn_color"+i].src="img/btn_color"+i+".gif";
		}
		for(i=12;i<=14;i++){
			document.images["btn_color"+i].src="img/btn_color"+i+"_off.gif";
		}
		
		
		document.images["btn_color0"].src="img/btn_color0_on.gif";
		color_flg="0";
		//con_color_3d("0");
	}/////////////////////////////////////////////////////////////////con_color_you
	
	
	
	code_hakidasi();////goukei
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
var body_flg="0";
var old_body_flg="0";
function con_body(n)
{
	if(!flg_3d_check)return;
	if(body_flg==n)return;
	if(anime_flg==1)return;
	if((frame_flg=='0'||frame_flg=='2')&&n=="1")return;////////////////////////////
	document.images["btn_body"+n].src="img/btn_body"+n+"_on.gif";
	document.images["btn_body"+body_flg].src="img/btn_body"+body_flg+".gif";
	body_flg=n;
	code_hakidasi();////goukei
	
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
var seat_flg="0";
var old_seat_flg="0";
function con_seat(n)
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	if((frame_flg=='1'||frame_flg=='2')&&n=="2")return;///////////////////////////
	if(seat_flg==n)return;
	if(type_flg=="2"||type_flg=="3")return;
	document.images["btn_seat"+n].src="img/btn_seat"+n+"_on.gif";
	document.images["btn_seat"+seat_flg].src="img/btn_seat"+seat_flg+".gif";
	seat_flg=n;
	if(n==2){///////////////////////////////////con_color_you
		for(i=0;i<=11;i++){
			document.images["btn_color"+i].src="img/btn_color"+i+"_off.gif";
		}
		for(i=12;i<=14;i++){
			document.images["btn_color"+i].src="img/btn_color"+i+".gif";
		}
		document.images["btn_color12"].src="img/btn_color12_on.gif";
		color_flg="12";
	}else{
		if(color_flg=="12"||color_flg=="13"||color_flg=="14"){
			for(i=0;i<=11;i++){
				document.images["btn_color"+i].src="img/btn_color"+i+".gif";
			}
			for(i=12;i<=14;i++){
				document.images["btn_color"+i].src="img/btn_color"+i+"_off.gif";
			}
			document.images["btn_color0"].src="img/btn_color0_on.gif";
			color_flg="0";
		}
	}/////////////////////////////////////////////////////con_color_you
	code_hakidasi();////goukei
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
var color_flg="0";
var old_color_flg="0";
function con_color(n)
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	if(seat_flg=="2"&&(n==0||n==1||n==2||n==3||n==4||n==5||n==6||n==7||n==8||n==9||n==10||n==11))return;///////////////////////
	if(seat_flg!="2"&&(n==12||n==13||n==14))return;///////////////////////
	if(color_flg==n)return;
	document.images["btn_color"+n].src="img/btn_color"+n+"_on.gif";
	document.images["btn_color"+color_flg].src="img/btn_color"+color_flg+".gif";
	color_flg=n;
	code_hakidasi();////goukei
}

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
var code_hakidasi_flg="1100";//code
function code_hakidasi()
{
	code_hakidasi_flg = type_flg + frame_flg + body_flg + seat_flg;
	setTimeout("kakidasi_layer_data()",100);
	setTimeout("bnr_change()",100);
	
	///////////////3d
	setTimeout("aa();",200);
	///////////////3d
	
}
function aa(){

	if((type_flg!=old_type_flg)||(old_frame_flg!=frame_flg)||(old_body_flg!=body_flg)||(old_seat_flg!=seat_flg)||(old_color_flg!=color_flg)){
		anime_flg=1;
		document.Applet1.setRedrawEnabled(-1);
		if(type_flg!=old_type_flg){
			con_type_3d(type_flg);
			old_type_flg=type_flg;
		}
		if(old_frame_flg!=frame_flg){
			con_frame_3d(frame_flg);
			old_frame_flg=frame_flg;
		}
		if(old_body_flg!=body_flg){
			con_body_3d(body_flg);
			old_body_flg=body_flg;
		}
		if(old_seat_flg!=seat_flg){
			con_seat_3d(seat_flg);
			old_seat_flg=seat_flg;
		}
		if(old_color_flg!=color_flg){
			con_color_3d(color_flg);
			old_color_flg=color_flg;
		}
		setTimeout("document.Applet1.setRedrawEnabled(400)",200);
		setTimeout("anime_flg=0",650);
	}

}



///////////////////////////////////////////////////////
///////////////////////////////////////////////////////

function data_page()
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	var win;
	win=window.open('','datapage','width=500,height=790');
	win.location.href="data.html";
}

///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
function mouse_over2(val)
{
	if(!flg_3d_check)return;
	if(val=="zoom_in" && flg_zoom>=3) return;
	if(val=="zoom_out" && flg_zoom<=(-3)) return;
	document.images[val].src="img/btn_"+val+"_on.gif";
}
function mouse_out2(val)
{
	if(!flg_3d_check)return;
		if(flg_zoom==(-3)){
			document.images["zoom_out"].src="img/btn_zoom_out_off.gif";
			document.images["zoom_in"].src="img/btn_zoom_in.gif";
		}else if(flg_zoom==3){
			document.images["zoom_out"].src="img/btn_zoom_out.gif";
			document.images["zoom_in"].src="img/btn_zoom_in_off.gif";
		}else{
			document.images["zoom_out"].src="img/btn_zoom_out.gif";
			document.images["zoom_in"].src="img/btn_zoom_in.gif";
		}
}
var flg_zoom=0;
function mouse_click2(val)
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	if(val=="zoom_in"){
		if(flg_zoom>=3)return;
		document.Applet1.setRedrawEnabled(-1);
		document.Applet1.selSetSelected(1, document.Applet1.getTransformNumber('all_dummy'));
		document.Applet1.addPos(0,0,(+40));
		if(flg_zoom==3){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(100);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(100);
		}else if(flg_zoom==2){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(90);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(90);
		}else if(flg_zoom==1){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(80);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(80);
		}else if(flg_zoom==0){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(70);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(70);
		}else if(flg_zoom==(-1)){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(55);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(55);
		}else if(flg_zoom==(-2)){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(30);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(30);
		}else if(flg_zoom==(-3)){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(20);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(20);
		}
		document.Applet1.setRedrawEnabled(0);
		flg_zoom++;
		if(flg_zoom==3){
		document.images[val].src="img/btn_"+val+"_off.gif";
		}
		if(flg_zoom==(-2)){
		document.images["zoom_out"].src="img/btn_zoom_out.gif";
		}	
	}else if(val=="zoom_out"){
		if(flg_zoom<=(-3))return;
		document.Applet1.setRedrawEnabled(-1);
		document.Applet1.selSetSelected(1, document.Applet1.getTransformNumber('all_dummy'));
		document.Applet1.addPos(0,0,(-40));
		if(flg_zoom==3){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(100);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(100);
		}else if(flg_zoom==2){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(90);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(90);
		}else if(flg_zoom==1){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(80);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(80);
		}else if(flg_zoom==0){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(70);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(70);
		}else if(flg_zoom==(-1)){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(55);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(55);
		}else if(flg_zoom==(-2)){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(30);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(30);
		}else if(flg_zoom==(-3)){
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_back")); 
			document.Applet1.setTransparency(20);
			document.Applet1.selSetSelected(5, document.Applet1.getMaterialNumber("toumei_seat")); 
			document.Applet1.setTransparency(20);
		}
		document.Applet1.setRedrawEnabled(0);
		flg_zoom--;
		if(flg_zoom==(-3)){
		document.images[val].src="img/btn_"+val+"_off.gif";
		}
		if(flg_zoom==2){
		document.images["zoom_in"].src="img/btn_zoom_in.gif";
		}		
	}
	//alert(flg_zoom);
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
function mouse_over(val)
{
	if(!flg_3d_check)return;
	if(mouse_click_flg==val)return;
	document.images[val].src="img/btn_"+val+"_on.gif";
}
function mouse_out(val)
{
	if(!flg_3d_check)return;
	if(mouse_click_flg==val)return;
	document.images[val].src="img/btn_"+val+".gif";
}
var mouse_click_flg='rotate';
function mouse_click(val)
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	if(mouse_click_flg==val)return;
	document.images[val].src="img/btn_"+val+"_on.gif";
	document.images[mouse_click_flg].src="img/btn_"+mouse_click_flg+".gif";
	////////////////////////////////////////////////////////////////////////////
	if(val=='rotate'){
		document.Applet1.setMouseAction(0);
	}else if(val=='move'){
		document.Applet1.setMouseAction(1);
	}
	////////////////////////////////////////////////////////////////////////////
	mouse_click_flg=val;
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
function reset_over()
{
	if(!flg_3d_check)return;
	document.images["reset"].src="img/btn_reset_on.gif";
}
function reset_out()
{
	if(!flg_3d_check)return;
	document.images["reset"].src="img/btn_reset.gif";
}
function reset_click()
{
	if(anime_flg==1)return;
	if(!flg_3d_check)return;
	anime_flg=1;
	flg_zoom=0;
	document.Applet1.setRedrawEnabled(-1);
	anime('reset');
	document.Applet1.setRedrawEnabled(400);
	setTimeout("anime_flg=0",500);
	zoom_reset();

}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
function anime_over(n)
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	if((type_flg=="2"||type_flg=="3")&&n==5)return;
	document.images["anime"+n].src="img/btn_anime"+n+"_on.gif";
}
function anime_out(n)
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	if((type_flg=="2"||type_flg=="3")&&n==5)return;
	document.images["anime"+n].src="img/btn_anime"+n+".gif";
}

function anime_click(n)
{
	if(anime_flg==1)return;
	if(!flg_3d_check)return;
	if((type_flg=="2"||type_flg=="3")&&n==5)return;
	//////////////////////////////////////////////////////////////////////////3d
	anime_3d(n);
	//////////////////////////////////////////////////////////////////////////3d
	
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
function thumbnail_over(n)
{
	if(!flg_3d_check)return;
	if(thumbnail_number_flg==n)return;
	if(n==6||anime_flg==1)return;//////////////////////////////
	if((frame_flg=='0'||frame_flg=='2')&&n==12)return;////////////////////////////
	if((frame_flg=='1'||frame_flg=='2')&&n==15)return;///////////////////////////
	if((type_flg=="2"||type_flg=="3")&&n==5)return;
	document.images["thumbnail"].src="thumbnail/thumbnail"+n+".gif";
}
function thumbnail_out(n)
{
	if(!flg_3d_check)return;
	if(thumbnail_number_flg==n)return;
	if(n==6||anime_flg==1)return;//////////////////////////////
	if((frame_flg=='0'||frame_flg=='2')&&n==12)return;////////////////////////////
	if((frame_flg=='1'||frame_flg=='2')&&n==15)return;///////////////////////////
	if((type_flg=="2"||type_flg=="3")&&n==5)return;
	document.images["thumbnail"].src="thumbnail/thumbnail"+thumbnail_number_flg+".gif";
}
var thumbnail_number_flg=0;
function thumbnail_click(n)
{
	if(!flg_3d_check)return;
	if(thumbnail_number_flg==n)return;
	if(n==6||anime_flg==1)return;//////////////////////////////
	if((frame_flg=='0'||frame_flg=='2')&&n==12)return;////////////////////////////
	if((frame_flg=='1'||frame_flg=='2')&&n==15)return;///////////////////////////
	if((type_flg=="2"||type_flg=="3")&&n==5)return;
	document.images["thumbnail"].src="thumbnail/thumbnail"+n+".gif";
	thumbnail_number_flg=n;
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
var bg_change_flg="3";
function bg_change(n)
{
	if(!flg_3d_check)return;
	if(anime_flg==1)return;
	if(bg_change_flg==n)return;
	document.images["btn_bg"+n].src="img/btn_bg"+n+"_on.gif";
	document.images["btn_bg"+bg_change_flg].src="img/btn_bg"+bg_change_flg+".gif";
	//////////////////////////////////////////////////////////////////////3d
	anime_flg=1;
	document.Applet1.setRedrawEnabled(-1);
	document.Applet1.loadBackground("maps/bg_img_0"+n+".jpg");
	document.Applet1.setRedrawEnabled(500);
	setTimeout("anime_flg=0",500);
	//////////////////////////////////////////////////////////////////////3d
	bg_change_flg=n;
}