/*
JavaScript: top.js

last updated on 2010.02.02
(c) 2010 YOSUKE INUI Design Office (http://www.inuiyosuke.jp/)
*/

// ------------------------------- Over Write CSS -------------------------------
doc.open();
doc.write('<style type="text/css">');
if (get_COOKIE('INTRO') != 1) { doc.write('div#BG { display:block; z-index:100; background:#fff url(/com/img/title.png) no-repeat 50% 50%; } '); }
doc.write('div#JSS div.OBJ { top:0px; } div#TOPSLIDE { height:400px; } div#TOPSLIDE a { position:absolute; display:none; } div#TOPSLIDE a span { visibility:hidden; } div#TOPSLIDE a:link span { display:block; } div#TOPSLIDE a:visited span { display:block; } div#TOPSLIDE a:hover span { display:block; } div#TOPSLIDE a:active span { display:block; }');
doc.write('</style>');
doc.close();


// -- NEXT : BALLOON --
NEXT.bflag	= true;
INITIAL.set	= function () { INTRO.timer = setTimeout('INTRO.set();', 100); }

// ------------------------------- INTRO -------------------------------
doc.onclick	= function () { INTRO.skip_flag = true; }
// -- INTRO --
var INTRO = { timer:undefined, flag:false, page:new Object(), obj:new Object(),
set:function () {
/* IE Bug-fix */	if (ENV.IE) { var bug_winIE_LOGO = new OBJ ('LOGO'); bug_winIE_LOGO.jss.backgroundImage = 'none'; bug_winIE_LOGO.setI('<img src="/com/img/transparent.png" width="180" height="35" />'); bug_winIE_LOGO.path.runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + '/com/img/title.png' + '", sizingmethod="image");';}
	INTRO.page	= new OBJ('PAGE'); 
	INTRO.obj		= new OBJ('BG'); if (!INTRO.obj.flag) { INTRO.obj = ADD('div','id=BG'); }
	INTRO.obj.path.onclick	= function () { INTRO.skip(); }

	if (INTRO.skip_flag || get_COOKIE('INTRO') == 1) { INTRO.skip(); }
	else { INTRO.timer = setTimeout('INTRO.set1();', 100); }
	// -- COOKIE --
	set_COOKIE('INTRO', '1', 9*60);
},set1:function () { if (INTRO.timer) { clearTimeout(INTRO.timer); }
	if (ENV.CH)	{ trans.Set(INTRO.obj, 0); }
	else		{ trans.Set(INTRO.obj, 0, 3, 15); }
	INTRO.set2();
},set2:function () { if (INTRO.timer) { clearTimeout(INTRO.timer); }
	if (INTRO.obj.A <= 5 ) { INTRO.skip(); }
	else { INTRO.timer = setTimeout('INTRO.set2();', 100); }
},skip:function () { if (INTRO.obj.flag) {
	clearTimeout(INTRO.timer);
	INTRO.obj.setA(0).setZ(0);
	INTRO.obj.jss.backgroundImage = 'none';
	INTRO.obj.jss.backgroundColor = '#333';
	INTRO.flag	= true;
// -- fadeBG --
	fadeBG.set();
}}
}

// ----- TOP TOPSLIDE : IMAGES SLIDESHOW -----
load.Set('TOPSLIDE.set();');
var TOPSLIDE	= { timer:undefined, flag:false, obj:new Object(), imgs:new Array(), objs:new Array(), loc:99999,
set:function () { 
	TOPSLIDE.obj	= new OBJ('TOPSLIDE');
	if (this.obj.flag) { 
		for (i = 0; i < this.obj.path.childNodes.length; i ++) { 
			this.imgs[i] = new OBJ(this.obj.path.childNodes[i]);
			this.objs[i] = new OBJ(this.imgs[i].path.firstChild);
			this.objs[i].setV(1).setC(30,600,60,0);
			eval( 'TOPSLIDE.imgs[' + ( i ) + '].path.onmouseover	= function () { TOPSLIDE.over(' + ( i ) + '); AUDIO.play();}');
			eval( 'TOPSLIDE.imgs[' + ( i ) + '].path.onmousemove	= function () { TOPSLIDE.over(' + ( i ) + '); }');
			eval( 'TOPSLIDE.imgs[' + ( i ) + '].path.onmouseout	= function () { TOPSLIDE.out(' + ( i ) + '); }');
		}
		TOPSLIDE.flag = true;
		TOPSLIDE.timer = setTimeout('TOPSLIDE.on(0);', 1000);
	}
}, on:function () {
	if (this.timer)		{ clearTimeout(this.timer); }
	if (this.loc == arguments[0])	{ return; }
	// TOPSLIDE.loc
	if	(this.loc >= 99999)			{ this.loc = 0; }
	else if	(arguments[0] >= 0)			{ this.loc = arguments[0]; TOPSLIDE.out(i); }
	else if	(this.loc >= (this.imgs.length -1))	{ this.loc = 0; }
	else					{ this.loc += (arguments[1] < 0) ? -1 : 1; }

	this.imgs[(this.loc)].setA(0).setD(1);
	for (i = 0; i < this.imgs.length; i ++) { 
		if (i == TOPSLIDE.loc)		{ TOPSLIDE.imgs[i].setZ(10); }
		else				{ TOPSLIDE.imgs[i].setZ((TOPSLIDE.imgs[i].Z -1)); }
		if (TOPSLIDE.imgs[i].Z == 9)		{ trans.Set(TOPSLIDE.imgs[i], 0, 5); }
		else if (TOPSLIDE.imgs[i].Z < 9)	{ TOPSLIDE.imgs[i].setD(0); }
	}
	trans.Set(TOPSLIDE.imgs[(TOPSLIDE.loc)],100,12);		// 透過処理

	// SLIDSHOW
	TOPSLIDE.timer = setTimeout('TOPSLIDE.on();', 5000);
}, over:function () { if (TOPSLIDE.flag) {
	sweep.Set(TOPSLIDE.objs[(arguments[0])], 0,600,30,0);
}}, out:function () { if (TOPSLIDE.flag) {
	sweep.Set(TOPSLIDE.objs[(arguments[0])], 30,600,30,0);
}}
}
