function _code2str(t){var out="";var i=0;var loop=1;while(loop){var s=t.indexOf("&#",i);if(s==-1){ out+=t.substring(i,t.length);loop=0;}else{if(s!=i) out+=t.substring(i,s);var e=t.indexOf(";",s);if(e==-1) { out+=t.substring(i,t.length);loop=0;}else{out+=String.fromCharCode((t.substring(s+2,e)));i=e+1;}}}return out;}function _getRnd (x){return Math.floor( Math.random() * x );}function _getWidth(t){ return document.layers ? t.clip.width:(t.offsetWidth || t.style.pixelWidth || 0);}function _getHeight(t){return document.layers ? t.clip.height:(t.offsetHeight || t.style.pixelHeight || 0);}function _getLeft(t){  if(_bro==1||_bro==4) return t.offsetLeft;     if(_bro==2) return t.left;  if(_bro==3) return t.offsetLeft;  return 0;}function _getTop(t){  if(_bro==1||_bro==4) return t.offsetTop;     if(_bro==2) return t.top;  if(_bro==3) return t.offsetTop;  return 0;}function _removeElement(t){if(_bro==1) document.body.removeChild(t);else t.removeNode(true);}function _setClip(t,top,right,bottom,left){  if(document.layers){ t.clip.top=top;t.clip.right=right;    t.clip.bottom=bottom;t.clip.left=left;  }else if(typeof t.style.clip!="undefined"){      t.style.clip='rect('+top+'px '+right+'px '+bottom+'px '+left+'px)';  }}function _setStyle(t,sl){var o=new Array();var flg=false;for(var i=0;i<sl.length;i++){var a=sl.charAt(i);if(flg){o.push(a.toUpperCase());flg=false;}else if(a=="-") flg=true;else if(a!=" ") o.push(a);}var l=o.join("");var u=l.split(";");for(var i=0;i<u.length;i++){var v=u[i].split(":");if(v[0]!="") t.style[v[0]]=v[1];}}function _getObjRef(name) { if(document.all) return document.all[name]; else if(document.getElementById) return document.getElementById(name);  else return null;}function _getObjRef2(name) { if(document.all) return document.all[name]; else if(document.getElementById) return document[name]; else return null;}function _getEventX(e){  if(_bro==1) return window.scrollX+e.clientX;  if(_bro==2) return e.pageX;  if(_bro==3) return document.body.scrollLeft+event.clientX;  if(_bro==4) return (document.documentElement?window.pageXOffset:0)+e.clientX;  return 0;}function _getEventY(e){  if(_bro==1) return window.scrollY+e.clientY;  if(_bro==2) return e.pageY;  if(_bro==3) return document.body.scrollTop+event.clientY;  if(_bro==4) return (document.documentElement?window.pageYOffset:0)+e.clientY;  return 0;}function _getscreensize(){if(!document.all && (document.layers || document.getElementById)) {_m_w=window.innerWidth;_m_h=window.innerHeight;}else if (document.getElementById && (document.compatMode=='CSS1Compat')) {    _m_w=document.documentElement.clientWidth;    _m_h=document.documentElement.clientHeight;}else if (document.all) {    _m_w=document.body.clientWidth;    _m_h=document.body.clientHeight;}}function _onmousemove(e){if(_bonmousemove)_bonmousemove(e);_lx=_getEventX(e);_ly=_getEventY(e);if(_m_kf) _getObjRef("output").innerHTML=_lx+","+_ly;if(_dlgf){var a=_m_target;if(_m_tt==0){a.mx=_lx-fx;a.my=_ly-fy;_setmakupos(a);a.count=1000;_setpurpose(a,a.tx,a.ty);}else{a.mx=_lx-fx;a.my=_ly-fy;_setPos(a.obj,a.mx,a.my);}}}function _ondblclick(e){var a=(e==undefined) ? event.srcElement : e.currentTarget;for(var i=0;i<_m_itemtbl.length;i++){var b=_m_itemtbl[i];if(b.obj==a){b.mode=4;b.count=0;return;}}for(var i=0;i<_m_makutbl.length;i++){var b=_m_makutbl[i];if(b.obj==a || b.swf==a){_removeElement(b.obj);_m_makutbl.splice(i,1);return;}}}function _onmousedown(e){var a=(e==undefined) ? event.srcElement : e.currentTarget;_m_target=0;for(var i=0;i<_m_makutbl.length;i++){var b=_m_makutbl[i];if(b.obj==a || b.swf==a){_m_target=b;_m_tt=0;break;}}if(_m_target==0){for(var i=0;i<_m_itemtbl.length;i++){var b=_m_itemtbl[i];if(b.obj==a){_m_target=b;_m_tt=1;break;}}}if(_m_target==0) return;var a=_m_target;fx=_getEventX(e)-Math.round(a.mx);fy=_getEventY(e)-Math.round(a.my);if(_m_tt==0){ _setanim(a,"drag");a.count=100000;a.state="wait";a.dlgf=true;}_dlgf=true;}function _onmouseup(e){if(_bonmouseup)_bonmouseup(e);if(_m_target){var a=_m_target;if(_m_tt==0){a.count=100;a.state="wait";_setanim(a,"wait");a.dlgf=false;}_m_target=0;}_dlgf=false;}function _split(s){var k0=0;var k1=0;var f=0;var t=0;var out=new Array();for(var i=0;i<s.length;i++){var c=s.charAt(i);if(c=='"'){if(k1==1) out.push("%22");else{if(k0==1 && t==0){out.push("\r");f=0;}k0^=1;}}else if(c=="'"){if(k0==1) out.push("%27");else{if(k1==1 && t==0){out.push("\r");f=0;}k1^=1;}}else if(c=="=") out.push("%3D");else if(c=="&") out.push("%38");else if(c=="<") {t++;out.push("%3C");}else if(c==">") {t--;out.push("%3E");}else if(c==" "){if(k0 || k1 || t) out.push("%20");else if(f){out.push("\r");f=0;k0=0;k1=0;}}else if(c!="\n"){out.push(c);f=1;if(c=="\r"){out.push(c);f=0;k0=0;k1=0;}}}return out.join("");}function _handler(){_setmakuwalk();_itemmove();for(var i=0;i<_m_makutbl.length;i++){var t=_m_makutbl[i];var u=t.obj;var v=t.swf;var a=t.mode;if(a==2) _ef(t,u,v);else if(a==1) _checkconnect(t,u,v);else if(a==0) _makuwalkinit(t);}}function _makuwalkinit(t){if(_bro==3){if(t.swf.readyState!=4) return;}t.counter=40;t.state="";t.im=0;t.mode=1;t.mx=0;t.my=0;_setmakupos(t);}function _checkconnect(t,u,v){if(t.im==0){if(v!=null){if(typeof v.GetVariable=="unknown" || typeof v.GetVariable=="function"){ if(_readswf(v,"__ready")=="true") t.im=1;}}}else if(t.im==1){if(typeof v.SetVariable=="unknown" || typeof v.SetVariable=="function"){_writeswf(v,"__test",1);}t.chkcnt=0;t.im=2;}else if(t.im==2){if(_readswf(v,"__test")=="OK") t.im=3;else{t.chkcnt++;if(t.chkcnt==25) t.im=1;}}else if(t.im==3){t.ctype=Number(_readswf(v,"ctype"));t.speed=_readswf(v,"speed");t.behavior=_readswf(v,"behavior");var a=_readswf(v,"clip");if(a!=0){var b=a.split("-");var c=b[0].split(",");t.clipl=Number(c[0]);t.clipu=Number(c[1]);var c=b[1].split(",");t.clipr=Number(c[0]);t.clipd=Number(c[1]);t.clip=true;}else tclip=false;var p=_getrndpoint(t);t.mx=p.x;t.my=p.y;_setmakupos(t);t.tx=0;t.ty=0;if(t.behavior==0) t.behavior="sleep,20,500/walk,50,300/chase,30,300";t.style=_readswf(v,"style");if(t.style==0) t.style="font-size:12px;width:250px;height:auto;border-style:solid;border-width:2px;border-color:#aaddaa;background-color:#ffffff;padding:2px;position:absolute";t.behatbl=new Array();var z=0;var a=t.behavior.split("/");for(var i=0;i<a.length;i++){var b=a[i].split(",");z+=Number(b[1]);t.behatbl.push({action:b[0],prob:z,counter:b[2]});}t.probmax=z;u.onmousedown=_onmousedown;u.onmouseup=_onmouseup;u.ondblclick=_ondblclick;t.mode=2;_m_born=false;}}function _setmakuwalk(){if(_bro==3){ if(document.readyState!="complete") return;}if(!_m_born){var cnt=(_m_makucnt==0)? "" : _m_makucnt;var n="makutalkdata"+cnt;var n2="_makutkw"+cnt;if(_getObjRef(n)){if(_bro==3){if(_getObjRef(n).readyState!="complete") return;}_m_born=true;var a=document.createElement('div');var m="makutalk"+cnt;a.setAttribute('id',m);a.setAttribute('title',_code2str("&#12454;&#12523;&#12469;&#12452;&#26178;&#12399;&#12289;&#12489;&#12521;&#12483;&#12464;&#12391;&#31227;&#21205;&#12289;&#12461;&#12515;&#12521;&#12398;&#21608;&#36794;&#12434;&#12480;&#12502;&#12523;&#12463;&#12522;&#12483;&#12463;&#12391;&#21066;&#38500;&#12391;&#12365;&#12414;&#12377;&#12290;"));document.body.appendChild(a);var c=_split(_getObjRef(n).innerHTML.split("&quot;").join('"'));var b='walk=1&baseUrl='+baseurl+ '&makutalk='+c;var tag='<OBJECT id="'+n2+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="180" HEIGHT="150" ALIGN=""> <PARAM NAME=movie VALUE="'+baseurl+'makutalksw.swf"><PARAM NAME=FlashVars VALUE="'+b+'"> <PARAM NAME=wmode VALUE="transparent"> <PARAM NAME=quality VALUE=high><param name="swLiveConnect" value="true"> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED swLiveConnect=true name="'+n2+'" wmode="transparent" flashvars="'+b+'" src="'+baseurl+'makutalksw.swf" quality=high bgcolor=#FFFFFF  WIDTH="180" HEIGHT="150" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';var t=_getObjRef(m);t.style.position="absolute";t.style.zIndex=10000+Number(cnt);t.innerHTML=tag;var u=_getObjRef2(n2);_m_makutbl.push({name:n,swfname:n2,obj:t,swf:u,mode:0,dlgf:0});_m_makucnt++;}}}function _readswf(t,str){return t.GetVariable(str);}function _writeswf(t,str,v){t.SetVariable(str,v);}function _setpurpose(t,x,y) {t.tx = x;t.ty = y;if (t.tx > t.mx) var a= -1;else var a= 1;_writeswf(t.swf,"__pp",a);}function _ef(t,u,v){if(_readswf(v,"__tflg")==1) {t.state="wait";t.counter=50;_writeswf(v,"__tflg",0);}var s=_readswf(v,"__talk");if(s!=0) {t.state="wait";t.counter=150;_makeitem(s,t);_writeswf(v,"__talk",0);}if(t.counter<=0) _nextstate(t);else t.counter--;if(t.state=="chase"){_setpurpose(t,_lx,_ly);_approach(t);}else if(t.state=="walk") _approach(t);}function _approach(t) {if(!t.dlgf){var x = t.tx - t.mx;    var y = t.ty - t.my;if(Math.abs(x) < t.speed && Math.abs(y) < t.speed) {t.mx=t.tx;t.my=t.ty;_nextstate(t);}else{var d=Math.sqrt(x*x+y*y); var dx=(x)/d*t.speed;var dy=(y)/d*t.speed;t.mx+=dx;t.my+=dy;}_setmakupos(t);}}function _setPos(t,x,y){t.style.left=Math.round(x)+"px";t.style.top=Math.round(y)+"px";}function _setmakupos(t){var x=t.mx;var y=t.my;if(t.clip){if(y<t.clipu-126) y=t.clipu-126;if(y>t.clipd-126) y=t.clipd-126;if(x<t.clipl-126) x=t.clipl-126;if(x>t.clipr-126) x=t.clipr-126;}t.mx=x;t.my=y;_setPos(t.obj,t.mx,t.my);}function _nextstate(t) {var a = Math.random() * t.probmax;for(var i=0;i<t.behatbl.length;i++){if(a<t.behatbl[i].prob){t.state=t.behatbl[i].action;t.counter=t.behatbl[i].counter;break;}}if(t.state=="walk" ) {_setanim(t,"walk");var p = _getrndpoint(t);_setpurpose(t,p.x,p.y);}else if(t.state=="sleep") _setanim(t,"sleep");else if(t.state=="chase") _setanim(t,"walk");else if(t.state=="wait") _setanim(t,"wait");else if(t.state=="random"){var a=_animtbl[t.ctype].split(",");_setanim(t,a[_getRnd(a.length)]);}}function _setanim(t,anim){_writeswf(t.swf,"__anim",anim);}function _getrndpoint(t){if(t.clip)  return {x:_getRnd(t.clipr-t.clipl)+t.clipl-126,y:_getRnd(t.clipd-t.clipu)+t.clipu-126}; else return {x:_getRnd(_m_w-200), y:_getRnd(_m_h-150) };}function _itemmove(){for(var i=0;i<_m_itemtbl.length;i++){var u=_m_itemtbl[i];var t=u.obj;var deg=u.angle*Math.PI/180;var sdeg=Math.sin(deg);var cdeg=Math.cos(deg);if(u.mode==0){u.cx=u.sx+u.speed*cdeg*u.count*u.vect;u.cy=u.sy-u.speed*sdeg*u.count+9.8/2*Math.pow(u.count,2);_setPos(t,u.cx,u.cy);if(u.count<u.speed*2*sdeg/9.8){u.count+=u.cnt;}else{ u.sx=Math.round(u.cx);u.sy=Math.round(u.cy);  u.count=u.cnt;u.speed*=u.dec;u.mode=1;}}else if(u.mode==1){u.cx=u.sx+u.speed*cdeg*u.count*u.vect;     u.cy=u.sy-u.speed*sdeg*u.count+(9.8/2)*Math.pow(u.count,2);_setPos(t,u.cx,u.cy);u.count+=u.cnt;   if(u.count<(u.speed*2)*sdeg/9.8){_setPos(t,u.cx,u.cy);u.count+=u.cnt;}else{u.sx=u.sx+Math.pow(u.speed,2)*Math.sin((u.angle*2)*Math.PI/180)/9.8*u.vect;_setPos(t,u.sx,u.sy);u.count=u.cnt;u.speed*=u.dec;     if(u.count>=(u.speed*2)*sdeg/9.8 || Math.round(u.speed)<=0) u.mode=2;}}else if(u.mode==2){u.mode=3;t.innerHTML=u.mess;u.count=Math.round(u.mess.length*0.15*1000/25);_setStyle(t,u.par.style);var w=_getWidth(t);var l=_getLeft(t);var x=l-w/2;if(x<0) x=0;if(x+w>_m_w) x=_m_w-w;var y=_getTop(t)-_getHeight(t)/2;if(y<0) y=0;_setPos(t,x,y);u.mx=x;u.my=y;u.w=_getWidth(t);u.h=_getHeight(t);u.ct=u.h/2;u.cd=u.h/2;u.cr=u.w/2;u.cl=u.w/2;_setClip(t,u.ct,u.cr,u.cd,u.cl);}else if(u.mode==3){var z=Math.round(u.w/25);var y=Math.round(u.h/25);u.ct-=y;u.cd+=y;u.cl-=z;u.cr+=z;if(u.ct<0) u.ct=0;if(u.cd>u.h) u.cd=u.h;if(u.cl<0) u.cl=0;if(u.cr>u.w) u.cr=u.w;_setClip(t,u.ct,u.cr,u.cd,u.cl);if(u.ct==0 && u.cd==u.h && u.cl==0 && u.cr==u.w){u.mode=4;t.onmousedown=_onmousedown;t.ondblclick=_ondblclick;}}else if(u.mode==4){u.count--;if(u.count<=0){_removeElement(t);_m_itemtbl.splice(i,1);}}}}function _onkeydown(e){if(_bonkeydown)_bonkeydown(e);var a=(e==undefined) ? event.keyCode : e.which;if(a==17) _m_ctrl=1;else if(a==16) _m_shift=1;if(_m_shift && _m_ctrl) _m_kf^=1;if(!_m_kf)_getObjRef("output").innerHTML="";}function _onkeyup(e){if(_bonkeyup)_bonkeyup(e);var a=(e==undefined) ? event.keyCode : e.which;if(a==17) _m_ctrl=0;else if(a==16) _m_shift=0;}function _makeitem(s,t){var x=Math.round(t.mx);var y=Math.round(t.my);var a=document.createElement('div');var n="_item"+_m_itemcnt;a.setAttribute('id',n);a.setAttribute('title',_code2str("&#12452;&#12521;&#12490;&#12452;&#26178;&#12399;&#12289;&#12489;&#12521;&#12483;&#12464;&#12391;&#31227;&#21205;&#12289;&#12480;&#12502;&#12523;&#12463;&#12522;&#12483;&#12463;&#12391;&#21066;&#38500;&#12391;&#12365;&#12414;&#12377;&#12290;"));document.body.appendChild(a);var a=_getObjRef(n);_setStyle(a,"width:8px;height:8px;background-color:#ddaaaa;position:absolute;clip:rect(0px,8px,8px,0px)");a.style.zIndex=5000;_setPos(a,x+126,y+126);_m_itemtbl.push({obj:_getObjRef(n),mode:0,sx:x+126,sy:y+126,cx:0,cy:0,par:t,speed:45+_getRnd(15),angle:55+_getRnd(15),dec:0.6,cnt:0.3,count:0.3,vect:(x>_m_w/2)?-1:1,mess:s});_m_itemcnt++;}_bro=(window.opera?4:(typeof window.external!="undefined" ?3:(window.controllers?1:(document.layers?2:0)))); if(_bro==3 || _bro==1){_dlgf=false;_m_itemtbl=new Array();_m_born=false;_m_kf=_m_ctrl=_m_shift=_m_tt=_m_target=_m_itemcnt=_m_makucnt=_lx=_ly=0;_animtbl=new Array("wait,walk,back,sleep,swing,guard,shrink,damage,drown,jump,swin","drag,walker,talk,eat,wait,chat,electric,dead,sleeper","select,wait,thanks,hello,bye,come,please,no,yes,beer,drink,beerS,drinkS,angry,happy,cry,start,chat");_m_makutbl=new Array();if(_bro==1) document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP | Event.DBLCLICK | Event.KEYDOWN |Event.KEYUP);var tbl=new Array("onmousemove","onmouseup","onkeydown","onkeyup");for(var i=0;i<tbl.length;i++){var a=tbl[i];if(document[a]!=null) this["_b"+a]=document[a];else this["_b"+a]=null;document[a]=eval("_"+a);}document.write("<div id=output style='position:absolute;top:0;left:0'></div>");_getscreensize();baseurl="";baseurl="http://www.bb.isas.ne.jp/beltram/maku/";_makutalktimer=setInterval("_handler()",40);}
