max_w=300;
cut=6;
speed=18;

pr = new Array();

w=0;
function wide(i) {
n=i;
indi.style.visibility="visible";
w+=Math.floor(max_w/cut);

st = setTimeout('wide(n)',speed);
if(max_w <= w) {
	w=max_w;
	clearTimeout(st);
	indi.innerHTML="<b>-What's this?-</b>"+pr[n];
}
indi.style.width=w;}

function bye() {
if(st) {clearTimeout(st);}
indi.style.visibility="hidden";
indi.innerHTML="";
indi.style.width=w=0;}

//-----------------------------------------------------------

step = 3;
step2 = 2;
scr_step = 0.15;
s_top = 50;
en_flag = 0;
en_tu = 0;
en_step = 4;

tx_t = new Array(
"空が好き…道が好き…\nあの人のトコまで届く空だし\nあの人のトコまで続く道だし",
"遠い空の下のあなたに届け\n大好きってキモチ。\n大切ってキモチ。",
"遠くだって知ってる。\n声なんて届かないって知ってる。\n想いが届かないって知ってる。\nでも、君が好き",
"あなたのいない夜を過ごすものか\nあなたのいない朝目覚めるものか\nあなたのいない昼間あなたを想うものか…\nすべて辛いだけ。",
"今まで黙っていてごめん。\n言えなかった…君への想い…\n本当にずっと、君を好きだったんだ。\n今は「好きだ」と叫びたい。",
"初めて握った小さな手\n小さな笑顔が少し照れて…\n可愛いよ。大好きだよ。今も、これからも、ずっと。",
"あなたが嫌い\n幸せと笑顔しかくれなくて\nそれがないといられなくなるから…\nあなた中毒にさせるから…",
"いつまでも側にはいない。\nいつまでかの期限付き。\nそれでも私は。思い続ける。",
"Girl... I dislike\n　　her love... I like",
"There are no regret\n　　in these days we spended...\n　　　　　　　They were necessary...",
"私の命よ、絶えてしまえ…\nあの人のためには生きられないのだから"
);

tx_n = Math.floor(Math.random()*tx_t.length);

function app() {
ent.filters["alpha"].opacity += step;
if(ent.filters["alpha"].opacity >= 100){clearInterval(t);}
}

function scr() {
ent.style.top = s_top + '%';
s_top -= scr_step;
if(s_top <= 45) {ent.style.top='45%';clearInterval(t2);} //setTimeout("run()",260);
}

function run() {t3=setInterval('app2()',20);}

function app2() {
tx.innerText = tx_t[tx_n];
tx.filters["alpha"].opacity += step2;
if(tx.filters["alpha"].opacity >= 100){clearInterval(t3);}
}

function e_mou(i) {
en_flag=i;
if(!en_flag) {
	if(ent.filters["alpha"].opacity <= 10) {en_tu = 1;}
	if(ent.filters["alpha"].opacity >= 100) {en_tu = 0;}
	if(!en_tu) {
		ent.filters["alpha"].opacity -= en_step;
	} else {
		ent.filters["alpha"].opacity += en_step;
	}	
} else {
	ent.filters["alpha"].opacity = 100;
	en_tu=0;
	clearInterval(t4);

}}

//-----------------------------------------------------------

s_flag=0;
function ap() {
if(document.cookie) {sw.innerText="off";s_flag=1;}
mes.style.left=Math.floor(Math.random()*450)+50;
mes.style.top=Math.floor(Math.random()*240)+260;
tx_n2 = Math.floor(Math.random()*tx_t.length);
sou = Math.floor(Math.random()*5)+1;
mes.innerText=tx_t[tx_n2];
sofile = "./extfile/sound/d"+sou+".mid";

t4=setInterval("app3()",45);}

function app3() {
if(mes.filters["alpha"].opacity >= 25) {
clearInterval(t4);
if(s_flag) {sound.src=sofile;}
setTimeout("disa3()",2500);}
mes.filters["alpha"].opacity++;}

function disa3() {
if(mes.filters["alpha"].opacity <= 0) {mes.filters["alpha"].opacity=0;ap();}
else {setTimeout("disa3()",45);}
mes.filters["alpha"].opacity--;}

function s_swi() {
link_n=document.links.length;
if(s_flag) {s_flag=0;sw.innerText="on";document.cookie="name=MAIN_SOUND; expires=Mon, 1-Jan-1900 00:00:00;";}
else {s_flag=1;sw.innerText="off";document.cookie="name=MAIN_SOUND; expires=Fri, 31-Dec-2100 23:59:59;";}}

//-----------------------------------------------------------

vh_sig=0;
on_un=0;
flag=0;
X=0;
Y=0;

// Title Of FalseWindow
title = 'ハピバス';

// Contents Of FalseWindow
cont = 'あなたを祝うたった一言。<br>心から叫ぶ「おめでとう」<br>ストーリーは流れて、くだらなくても。<br>幸せであれと願う。<br>終わりはないのだ、<br>いつまでも、楽しき時を大切に…';

function setup_win() {
document.all.title1.onmousedown = mouse_d;
document.onmousemove = mouse_m;
document.onmouseup = mouse_u;}

function mouse_d(e) {
X = event.offsetX;
Y = event.offsetY;
if(X < 0) {X=0;}
else if(X > event.clientX) {X=event.clientX;}
if(Y < 0) {Y=0;}
else if(Y > event.clientY) {Y=event.clientY;}
on_un=1;
return false;}

function mouse_u(e) {on_un=0;}

function mouse_m(i) {
id=i;
if(!on_un) {return true;}
document.all.win1.style.left = event.clientX - X + document.body.scrollLeft - 3;
document.all.win1.style.top = event.clientY - Y + document.body.scrollTop - 3;
return false;}

function win_swich(flag) {
if(!vh_sig && flag) {
	document.all.win1.style.visibility="visible";
	vh_sig=1;
	title1.innerHTML=title+'　-　cp-2icro window';
	pr_totteoki.innerHTML=cont;
} else if(vh_sig && !flag) {document.all.win1.style.visibility="hidden";vh_sig=0;}}

