
//タイトル表示//

status="Now Loading...";

function comp(){
msg = "【"+document.title+"】";
stcnt = 0;
guideSw=true;
typing();
}
function typing(){
stcnt += 2;
status=msg.substring(0,stcnt);
if(stcnt <= msg.length){ guideSw=setTimeout("typing()",50);}
}

//画像変更//
function showform(url){url.style.visibility='visible';}
function hideform(url){url.style.visibility='hidden';}

function getCookie(keyname){
  tmp=document.cookie +";";
  index1=tmp.indexOf(keyname,0)
  if(index1!=-1){
    tmp=tmp.substring(index1,tmp.length);
    index2=tmp.indexOf("=",0)+1;
    index3=tmp.indexOf(";",index2);
    return(unescape(tmp.substring(index2,index3)));
  }
  return("");
}

function setCookie(keyname,val){
  var expdate = new Date ();
  expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 30 * 1));
  tmp=keyname+"="+escape(val)+";";
  tmp+="expires="+expdate.toGMTString()+";";
  document.cookie=tmp;
}

//メニュー//

function menulist(id) {
var disp = document.all(id).style.display;

if(disp != "none" || disp == "") {
  document.all(id).style.display = "none";
 }
else {
  document.all(id).style.display = "block";
 }
}

//戦闘効果//
function Efect(mno,eno,lr,dmg,emt,tn,abi){

	ef1 = mno;
	ef2 = eno;
	ef3 = lr;
	ef4 = dmg;
	ef5 = emt;
	ef6 = tn;
	ef7 = abi;

        mdv="dv"+ef1;
        edv="dv"+ef2;

        mid="id"+ef1;
        eid="id"+ef2;

        if(ef5 == 0){
          r=-30; g=-30; b=-30;
        }else if(ef5 == 1){
          r=-30; g=-220; b=0;
        }else if(ef5 == 2){
          r=-220; g=-220; b=-30;
        }else if(ef5 == 3){
          r=-100; g=-220; b=0;
        }else if(ef5 == 4){
          r=-220; g=-100; b=0;
        }else if(ef5 == 5){
          r=-220; g=-30; b=-30;
        }else if(ef5 == 6){
          r=-30; g=-30; b=-220;
        }else if(ef5 == 7){
          r=-30; g=-30; b=-100;
        }else if(ef5 == 8){
          r=-220; g=-220; b=0;
        }else if(ef5 == 9){
          r=-100; g=-220; b=-30;
        }

	if(tcnt == 0){
              if(ef7 == 39){//jump
		document.all[mid].style.visibility = "hidden";
              }else{
		document.all[mdv].style.pixelLeft += 10*(1-eval(ef3)*2);
              }

              if(ef6>=2){
		document.all[edv].style.pixelLeft += 10*(eval(ef3)*2-1);
                if(ef7 == 39){document.all[mid].style.visibility = "visible";}
	        ef1 = eno;
	        ef2 = mno;
	        ef3 = 1-eval(lr);

                mdv="dv"+ef1;
                edv="dv"+ef2;

                mid="id"+ef1;
                eid="id"+ef2;

              }

	      if (dmg > 0) {
                if(ef7 != 22){setColor(r,g,b,0,eid);}
              }else {
                document.all[edv].style.pixelLeft += 10*(1-eval(ef3)*2);
              }
        }
	if(dmg > 0){

		if((tcnt % 2) == 0) {
                  if(ef7 == 22){
		    document.all[eid].filters["alpha"].opacity -= 50;
                  }else{
                    document.all[edv].style.pixelLeft +=2;
                  }
                  if(ef7 == 31){setColor(r,g,b,0,eid);}//magicsword
                }else {
                  if(ef7 == 22){
		    document.all[eid].filters["alpha"].opacity += 50;
                  }else{
                    document.all[edv].style.pixelLeft -=2;
                  }
                  if(ef7 == 31){setColor(255,255,255,0,eid);}//magicsword
                }
	}
	if(tcnt >= 7){
		if (dmg > 0){
                  setColor(255,255,255,0,eid);
                }else{
		  document.all[edv].style.pixelLeft += 10*(eval(ef3)*2-1);
		}
                if(ef7 == 39 && ef6<=1){//jump_back
		  document.all[mid].style.visibility = "visible";
                }else{
		  document.all[mdv].style.pixelLeft += 10*(eval(ef3)*2-1);
                  if(ef6>=2){document.all[edv].style.pixelLeft += 10*(1-eval(ef3)*2);}
                }
                if((ef6 % 2)==0){tcnt =0;next();}else{over();}

	}else{
	  tcnt++;
	  timeID = setTimeout("Efect(ef1,ef2,ef3,ef4,ef5,ef6,ef7)",100);
        }

}
function setColor(r,g,b,a,mid) {
	document.all[mid].filters.light.addAmbient(r,g,b,a);
	document.all[mid].filters.light.ChangeColor(0,r,g,b,0);
}
function init(mid){
	document.all[mid].filters.light.addAmbient(255,255,255,100);
	document.all[mid].filters.light.ChangeColor(0,0,0,0,0);
}

function salefrm6(mo,no,it,st)
{
           form6.cmd.value=mo;
           form6.eid.value=no;
           form6.itm.value=it;
           form6.ist.value=st;
           form6.sbm.click();
}
function esc(no){
        mo=no;
        eid="id"+no;
	if(document.all[eid].filters.alpha.opacity > 0 &&  document.all[eid]){
		document.all[eid].filters["alpha"].opacity -= 10;
	}

	if(document.all[eid].filters["alpha"].opacity <= 0){return;}

	setTimeout("esc(mo)",50);
}