function clearmsg(){  //人工取消谈话.
msgyoubiao=0;msgshangxian=1;box1.style.display="none";box3.innerHTML="";suoding=false
}
function boxmsg(boxneirong,boximage,boxdongzuo,boxobject){  //模拟谈话
if(boxneirong!=null)boxneirong=boxneirong.replace(/ /g,"&nbsp;")
if(msgyoubiao>=msgshangxian){  //最后一次谈话,执行事件
if(msgdongzuo=="消失"){msgtd.innerHTML="";msgtd.value=null}
if(msgdongzuo=="战斗"){zhandou();}
else if(msgdongzuo.indexOf("送你-")!=-1){
var tempsong=msgdongzuo.split(",")
for(var i=0;i<tempsong.length;i++){
if(tempsong[i].indexOf("送你-")!=-1){
switch(tempsong[i].replace("送你-","")){
case "+key1":key1++;gx1();break;
case "+key2":key2++;gx1();break;
case "+key3":yinxiao("lv");key3++;gx1();break;
case "+key4":key4++;gx1();break;
case "+★魔物图鉴":gxwupin("★魔物图鉴",1);break;
case "+碎冰铲":gxwupin("碎冰铲",1);msgtd.value=null;break;
case "+神之泪":gxwupin("神之泪",1);break;
case "+月之泪":gxwupin("月之泪",1);break;
case "+瞬间传送术":gxwupin("瞬间传送术",1);break;
case "+★幸运项链":gxwupin("★幸运项链",1);break;
case "+宝箱钥匙":gxwupin("宝箱钥匙",1);break;
case "+★战神之戒":gxwupin("★战神之戒",1);break;
case "+初级·召唤术":gxwupin("初级·召唤术",1);break;
case "+中级·召唤术":gxwupin("中级·召唤术",1);break;
case "+高级·召唤术":gxwupin("高级·召唤术",1);break;
case "+究极·召唤术":gxwupin("究极·召唤术",1);break;
case "+★雅典之杖":gxwupin("★雅典之杖",1);break;
case "+body1":yinxiao("lv");def+=5;mef+=20;gx1();break;
case "+body2":yinxiao("lv");def+=15;mef+=40;gx1();break;
case "+body3":yinxiao("lv");def+=30;mef+=100;gx1();break;
case "+act+20":yinxiao("lv");act+=20;gx1();break;
case "+aoyi":yinxiao("lv");aoyi++;gx1();break;
case "+dun6":yinxiao("lv");def+=60;mef+=10;gx1();break;
case "+jian6":yinxiao("lv");act+=90;def+=10;mef+=10;gx1();break;
case "+宝箱全加":act+=2;def+=3;mef+=5;exp1+=100;gxwupin("宝箱钥匙",-1);gx1(msgtd);break;
case "+财富宝箱":cod+=1000;gxwupin("宝箱钥匙",-1);gx1(msgtd);break;
case "+血色披风":yinxiao("lv");act+=20;def+=20;mef+=20;hp1+=4000;gx1();break;
case "+npc能力":
if(nandu==1){act+=6;def+=6;mef+=6;hp1+=2000}else{act+=12;def+=12;mef+=12;hp1+=4000}
yinxiao("lv");gx1();break;
case "+★大自然之靴":gxwupin("★大自然之靴",1);break;
case "+★生命头巾":gxwupin("★生命头巾",1);break;
case "+遗迹头盔":yinxiao("lv");def+=25;mef+=25;hp2+=500;gx1();break;
case "+骑士手套":yinxiao("lv");act+=19;def+=19;mef+=19;gx1();break;
case "+天蚕内衣":yinxiao("lv");def+=15;mef+=20;hp2+=600;gx1();break;
case "+妖刀№村正":yinxiao("lv");act+=110;hp2-=700;gx1();break;
case "+秘银铠甲":yinxiao("lv");def+=40;mef+=40;gx1();break;
case "+↑三分归元气":gxwupin("↑三分归元气",1);break;
case "+↑摩诃无量":gxwupin("↑摩诃无量",1);break;
case "+绿精灵披风":yinxiao("lv");act+=30;def+=20;mef+=20;hp1+=5000;gx1();break;
case "+冒险家手套":yinxiao("lv");act+=30;def+=30;mef+=30;gx1();break;
case "+圣女の丝衣":yinxiao("lv");def+=15;mef+=50;hp2+=1000;gx1();break;
case "+堂吉诃德钢盔":yinxiao("lv");def+=45;mef+=35;hp2+=800;gx1();break;
case "+英雄剑":yinxiao("lv");act+=160;hp2+=1200;gx1();break;
case "+☆圣战神之靴":yinxiao("lv");act+=60;def+=60;mef+=60;hp2+=2000;gx1();break;
case "+莫邪剑":yinxiao("lv");act+=160;mef+=50;gx1();break;
case "+奥丁之盾":yinxiao("lv");def+=99;mef+=20;gx1();break;
case "+魔剑一夕":yinxiao("lv");act+=200;hp2-=1000;gx1();break;
case "+黄金骑士甲":yinxiao("lv");def+=99;mef+=99;gx1();break;
case "+赤霞披风":yinxiao("lv");act+=40;def+=30;mef+=30;hp1+=6000;gx1();break;
case "+修罗王之盔":yinxiao("lv");def+=60;mef+=40;hp2-=600;gx1();break;
case "+铁门钥匙":yinxiao("lv");key5++;gx1();break;
case "+会员信用卡":gxwupin("会员信用卡",1);break;
case "+火麟剑":yinxiao("lv");act+=250;mef+=50;hp2+=2000;gx1();break;
case "+吸血鬼披风":yinxiao("lv");act+=80;def+=30;mef+=40;hp1+=8000;gx1();break;
case "+黄金十字盾":yinxiao("lv");def+=130;mef+=120;hp2+=1300;gx1();break;
case "+金缕内衣":yinxiao("lv");def+=50;mef+=50;hp2+=1500;gx1();break;
case "+月之泪":gxwupin("月之泪",1);break;
case "+干将剑":yinxiao("lv");act+=200;hp2+=1800;gx1();break;
case "+机械重铠":yinxiao("lv");def+=160;mef+=100;gx1();break;
case "+天空神盔":yinxiao("lv");def+=100;mef+=120;hp2+=2200;gx1();break;
case "+☆宙斯之拳":yinxiao("lv");act+=120;def+=120;mef+=120;hp2+=3000;gx1();break;
case "+↑易筋经":gxwupin("↑易筋经",1);break;
case "+↑八剑齐飞":gxwupin("↑八剑齐飞",1);break;
case "+↑玄心奥妙决":gxwupin("↑玄心奥妙决",1);break;
case "+↑斩天拔剑术":gxwupin("↑斩天拔剑术",1);break;
case "+正义神护手":yinxiao("lv");act+=80;def+=80;mef+=80;gx1();break;
case "+圣光盾":yinxiao("lv");def+=200;mef+=200;hp2+=1000;gx1();break;
case "+☆自然内衣":yinxiao("lv");def+=90;mef+=130;hp2+=4000;gx1();break;
case "+天使の内衣":yinxiao("lv");def+=70;mef+=90;hp2+=2800;gx1();break;
case "+达芬奇的斗篷":yinxiao("lv");act+=80;def+=100;mef+=60;hp1+=10000;gx1();break;
case "+阿鲁卡多之剑":yinxiao("lv");act+=300;hp2+=2500;gx1();break;
case "+↑斩天拔剑术":gxwupin("↑斩天拔剑术",1);break;
case "+格兰蒂亚金铠":yinxiao("lv");def+=160;mef+=160;hp2+=2000;gx1();break;
case "+☆太阳神之盔":yinxiao("lv");act+=60;def+=160;mef+=160;hp2+=5000;gx1();break;
case "+紫电雷鸣剑":yinxiao("lv");act+=499;mef-=50;hp2-=2500;gx1();break;
case "+☆救世主披风":yinxiao("lv");act+=150;def+=150;mef+=150;hp1+=30000;hp2+=3000;gx1();break;
case "+☆梦想之铠":yinxiao("lv");act+=100;def+=300;mef+=300;hp2+=5000;gx1();break;
case "+☆真爱之盾":yinxiao("lv");def+=521;mef+=521;hp2+=5921;exp1+=19998;gx1();break;
case "+☆希望之剑":yinxiao("lv");act+=800;def+=100;mef+=100;hp2+=9999;exp1+=29997;gx1();break;
}  //end switch
}  //end indexOf2
else if(tempsong[i]=="消失"){msgtd.innerHTML="";}
}  //end for
}  //end indexOf1
clearmsg()
return false;
}  //end 最后一次对话

if(msgyoubiao==0){  //首次对话
var tempn=boxneirong.replace(/\!\!(\w+)\!\!/g,"<img src='../image/biaoqing/$1.gif' style='margin-left:-6' align=left>")
tempn=tempn.split("^^^");
msgboosming=tempn[0];msgboosimg=boximage;msgdongzuo=boxdongzuo;msgtd=boxobject
if(tempn[1].indexOf("##woman##")!=-1){  //剧情不同
tempn2=tempn[1].split("##woman##")
yousex==true?tempn3=tempn2[0]:tempn3=tempn2[1]
}else{
tempn3=tempn[1]
}

if(tempn3.indexOf("@@@")==-1){msgneirong[0]=tempn3;msgshangxian=0}else{msgneirong=tempn3.split("@@@");msgshangxian=msgneirong.length}
}

if(msgneirong[msgyoubiao].indexOf('%%boos%%')!=-1){  //怪对话框样式
msgneirong[msgyoubiao]=msgneirong[msgyoubiao].replace("%%boos%%","")
box1.style.top=tab1.offsetTop+50;box2.innerText=msgboosming;boximg1.src=msgboosimg
}else{    //rpg对话框
box1.style.top=tab1.offsetTop+350;box2.innerText=rpgname.innerText;boximg1.src=rpgimg.src}

if(msgneirong[msgyoubiao].match(/\(\d+\(/g)!=null){  //存在选择
temphua=msgneirong[msgyoubiao].replace(/\(3\((.*?)\-取消\)3\)/g,"<span id=thzhong style='background-color:black' class=b_3 value='取消'>$1</span>")
temphua=temphua.replace(/\(2\((.*?)\-放了\)2\)/g,"<span id=thzhong class=b_3 value='放了'>$1</span>")
temphua=temphua.replace(/\(1\((.*?)\-打她\)1\)/g,"<span id=thzhong style='background-color:black' class=b_3 value='战斗'>$1</span>")
temphua=temphua.replace(/\(4\((.*?)\-挑战\)4\)/g,"<span id=thzhong class=b_3 value='战斗'>$1</span>")
temphua=temphua.replace(/\(3\((.*?)\-嫁slm\)3\)/g,"<span id=thzhong class=b_3 style='background-color:black' value='嫁slm'>$1</span>")
temphua=temphua.replace(/\(5\((.*?)\+(\d+)\)5\)/g,"<span id=thzhong style='background-color:black' class=b_3 value=$2>$1+$2</span>")
temphua=temphua.replace(/\(6\((.*?)\+(\d+)\)6\)/g,"<span id=thzhong class=b_3 value=$2>$1+$2</span>")
temphua=temphua.replace(/\(7\((.*?)\+(\d+)\)7\)/g,"<span id=thzhong class=b_3 value=$2>$1+$2</span>")
temphua=temphua.replace(/\(8\((.*?)\+(\d+)\)8\)/g,"<span id=thzhong class=b_3 value=$2>$1+$2</span>")
temphua=temphua.replace(/\(10\((.*?)\-配偶\)10\)/g,"<span id=thzhong class=b_3 style='background-color:black' value='配偶'>$1</span>")
temphua=temphua.replace(/\(11\((.*?)\-配偶\)11\)/g,"<span id=thzhong class=b_3 value='配偶'>$1</span>")
}else{temphua=msgneirong[msgyoubiao]}

box3.innerHTML=temphua+"<img src='../image/jiben/next.gif'><font color=#cccccc style='font-size:15px'>(C或D键继续/X或S键撤销)</font>";
box1.style.display="";msgyoubiao++
suoding=true;yinxiao("duihua")
}