// Nayuki : Robou no tanpopo
// Copyright (C) 2000 tsubasa.com

function Is() {
     var agent = navigator.userAgent.toLowerCase();
     this.major = parseInt(navigator.appVersion);
     this.minor = parseFloat(navigator.appVersion);
     this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
     this.ns2 = (this.ns && (this.major == 2));
     this.ns3 = (this.ns && (this.major == 3));
     this.ns4b = (this.ns && (this.major == 4) && (this.minor <= 4.03));
     this.ns4 = (this.ns && (this.major >= 4));
     this.ie   = (agent.indexOf("msie") != -1);
     this.ie3  = (this.ie && (this.major == 2));
     this.ie4  = (this.ie && (this.major >= 4));
     this.op3 = (agent.indexOf("opera") != -1);
}

var is = new Is()

if(is.ns4) {
     doc = "document";
     sty = "";
     htm = ".document"
} else if(is.ie4) {
     doc = "document.all";
     sty = ".style";
     htm = ""
}

var count = 0;

function layerSetup() {
	blackLyr	= eval(doc + '["blackLayer"]' + sty );
	blackSLyr	= eval(doc + '["blackshadowLayer"]' + sty );
	blackSSLyr	= eval(doc + '["blackshadowSLayer"]' + sty );
	whiteLyr	= eval(doc + '["whiteLayer"]' + sty );
	whiteSLyr	= eval(doc + '["whiteshadowLayer"]' + sty );
	whiteSSLyr	= eval(doc + '["whiteshadowSLayer"]' + sty );
	robouLyr	= eval(doc + '["rubiRobouLayer"]' + sty );
	roboubackLyr	= eval(doc + '["backRobouLayer"]' + sty );
	tanpopoLyr	= eval(doc + '["rubiTanpopoLayer"]' + sty );
	tanpopobackLyr  = eval(doc + '["backTanpopoLayer"]' + sty );
	setTimeout("blackbounce()",100);
	setTimeout("whitebounce()",80);
}

bx=535;
bh=200;
bc=485;
bd=0;
e2=0.8*0.8;
bsh=50;
function blackbounce() {
	if( bc>=235 ){
		dx=bx-bd-bc;
		by=236-bh+bh*0.0004*dx*dx;
		bsy=238-bsh+dx*dx*bsh*0.0004;
		blackLyr.left=bx-bd;
		blackLyr.top=by;
		blackLyr.visibility="visible";
		if( bd>=10 && bd<=90 ){
			blackSSLyr.left=bx-bd+2;
			blackSSLyr.top=bsy;
			blackSSLyr.visibility="visible";
			blackSLyr.visibility="hidden";
		}
		else{
			blackSLyr.left=bx-bd+2;
			blackSLyr.top=bsy;
			blackSLyr.visibility="visible";
			blackSSLyr.visibility="hidden";
		}
		bd+=5;
		if( bd>100 ){
			bd=5;
			bx-=100;
			bc-=100;
			bh*=e2;
			bsh*=e2;
		}
		setTimeout("blackbounce()",100);
	}
	else{
		setTimeout("blackVibration()",2000);
	}
}

wx=579;
wh=150;
wc=529;
wd=0;
e2=0.7*0.7;
wsh=30;
function whitebounce() {
	if( wc>=179 ){
		dx=wx-wd-wc;
		wy=278-wh+wh*0.0004*dx*dx;
		wsy=280-wsh+dx*dx*wsh*0.0004;
		whiteLyr.left=wx-wd;
		whiteLyr.top=wy;
		whiteLyr.visibility="visible";
		if( wd>=10 && wd<=90 ){
			whiteSSLyr.left=wx-wd+2;
			whiteSSLyr.top=wsy;
			whiteSSLyr.visibility="visible";
			whiteSLyr.visibility="hidden";
		}
		else{
			whiteSLyr.left=wx-wd+2;
			whiteSLyr.top=wsy;
			whiteSLyr.visibility="visible";
			whiteSSLyr.visibility="hidden";
		}
		wd+=5;
		if( wd>100 ){
			wd=5;
			wx-=100;
			wc-=100;
			if( wc==329 ){
				tanpopoLyr.visibility="visible";
				tanpopobackLyr.visibility="visible";
			}
			wh*=e2;
			wsh*=e2;
		}
		setTimeout("whitebounce()",80);
	}
	else{
		robouLyr.visibility="visible";
		roboubackLyr.visibility="visible";
		setTimeout("whiteVibration()",3500);
	}
}

bflag=1;
function blackVibration(){
	if( bflag ){
		blackLyr.left=237;
		setTimeout("blackVibration()",200);
		bflag=0;
	}
	else{
		bflag=1;
		blackLyr.left=235;
		setTimeout("blackVibration()",2000);
	}
}

wflag=1;
function whiteVibration(){
	if( wflag ){
		whiteLyr.top=275;
		setTimeout("whiteVibration()",500);
		wflag=0;
	}
	else{
		wflag=1;
		whiteLyr.top=278;
		setTimeout("whiteVibration()",3500);
	}
}

