class Dotto{
	constructor(namae,yoko,tate,canvas,sosu){
		this.img=document.createElement('img');
		this.img.src=sosu;
		this.namae=namae;
		this.canvas=canvas;
		this.yoko=yoko;
		this.tate=tate;
		this.x=0;
		this.y=0;
		this.koma=0;
		this.promptc=0;
		this.ototati=new Array();
	};
	oto(o){
		for(var i=1;i<arguments.length;i++){
			if(this.ototati[arguments[i]]==undefined){
				this.ototati[arguments[i]]=new Array();							
			}			
			this.ototati[arguments[i]].push(o);			
		}
	}
	haikei(x,y,li,col){
		if(li==undefined){
			li=0;
		}
		if(col==undefined){
			col=0;
		}		
		this.canvas.drawImage(this.img,col*this.yoko,li*this.tate,this.yoko,this.tate,x,y,this.yoko,this.tate)
	};
	kyara(x,y,li,col){		
		if(li==undefined){
			li=0;
		}
		if(col==undefined){
			col=0;
		}		
		this.canvas.drawImage(this.img,col*this.yoko,li*this.tate,this.yoko,this.tate,x-(this.yoko/2),y-this.tate,this.yoko,this.tate)
	};
	wink(x,y,li){
		if(li==undefined){
			li=0;
		}
		var rancol=Math.floor(Math.random()*10);
		if(rancol<9){
			this.koma=0;
		}else{
			this.koma=1;
		}		
		this.canvas.drawImage(this.img,this.koma*this.yoko,li*this.tate,this.yoko,this.tate,x-(this.yoko/2),y-this.tate,this.yoko,this.tate)
	};
	talk(x,y,li){
		if(li==undefined){
			li=0;
		}
		var rancol=Math.floor(Math.random()*15);
		if(rancol<9){
			this.koma=0;
		}else if(rancol<10){
			this.koma=1;
		}else{
			this.koma=2;
		}		
		this.canvas.drawImage(this.img,this.koma*this.yoko,li*this.tate,this.yoko,this.tate,x-(this.yoko/2),y-this.tate,this.yoko,this.tate)
	};
	prompt(x,y,li){
		if(li==undefined){
			li=0;
		}
		this.promptc++;
		if(this.promptc<4){
			this.koma=0;
		}else{
			this.koma=1;
			if(this.promptc>=7){
				this.promptc=0;
			}
		}
		this.canvas.drawImage(this.img,this.koma*this.yoko,li*this.tate,this.yoko,this.tate,x-(this.yoko/2),y-this.tate,this.yoko,this.tate)
	};
	ani(x,y,li,ripi,hanasi){
		if(li==undefined){
			li=0;
		}
		
		if(this.ototati[this.koma]!=undefined){
			for(var bb=0;bb<this.ototati[this.koma].length;bb++){
				this.ototati[this.koma][bb].p();
			}
		}
		this.canvas.drawImage(this.img,this.koma*this.yoko,li*this.tate,this.yoko,this.tate,x-(this.yoko/2),y-this.tate,this.yoko,this.tate)		
		
		if(hanasi==undefined){		
			if((this.koma+1)*this.yoko<this.img.width){
				this.koma++;
			}else{
				if(ripi==undefined){
					this.koma=0;
				}else{				
					this.koma=ripi;
				}			
			}
		}else{	
			if(this.koma<ripi){
				this.koma++;
			}else{
				var rancol=Math.floor(Math.random()*15);
				if(rancol<9){
					this.koma=ripi;
				}else if(rancol<10){
					this.koma=ripi+1;
				}else{
					this.koma=ripi+2;
				}				
			}
		}
	};
};
class Oto{
	constructor(src){
		this.o0=new Audio(src);
		this.o1=new Audio(src);
		this.o1.volume=0.5;
	}
	p(){
		if(this.o0.currentTime==this.o0.duration|this.o0.currentTime==0){
			this.o0.play();			
		}else if(this.o1.currentTime==this.o1.duration|this.o1.currentTime==0){			
			this.o1.play();
			
		}
	}
};
class Hitoa{
	constructor(x,y,x1,y1){
		this.x=x;
		this.y=y;
		this.x1=x1;
		this.y1=y1;
		this.chii;
		this.dai;
	};
	c(x,y){
		if(x>=this.x&x<=this.x1&y>=this.y&y<=this.y1){
			return true
		}else{
			return false
		}
	};
	d(x,y){
		this.chii=this.x-(y-this.y);
		this.dai=this.x1+(this.y1-y);
		if(x>=(this.x-(y-this.y))&x<=(this.x1+(this.y1-y))&y>=this.y&y<=this.y1){
			return true
		}else{
			return false
		}		
	}	
	
};
class Sou{
	constructor(namae){
		this.namae=namae;
		this.main=new Array();		
		this.temp=new Array();
	}
	tasu(){		
		for(var tt=0;tt<arguments.length;tt++){
			this.main.push(arguments[tt]);						
		}				
		
	}
	hiku(aitemu){
		for(var hik=0;hik<this.main.length;hik++){
			if(this.main[hik].id==aitemu){				
				this.main.splice(hik,1);				
			}			
		}		
	}
	koushin(){		
		var nagasa=this.main.length;
		while(this.temp.length<nagasa){		
			for(var h=0;h<this.main.length;h++){
				var count=0;				
				if(this.temp.length>0){					
					for(var i=0;i<this.main.length;i++){
						if(this.main[h].id!=this.main[i].id){						
							if(this.main[h].y>this.main[i].y){						
								count++;										
							}										
						}							
					}						
					
				}else{				
					for(var i=0;i<this.main.length;i++){
						if(this.main[h].id!=this.main[i].id){						
							if(this.main[h].y>this.main[i].y){						
								count++;									
							}								
						}							
					}					
				}

				if(count==0){			
					this.temp.push(this.main[h]);										
					this.main.splice(h,1);
					h--;
				}
			}			
		}		
		this.main=this.temp;				
		this.temp=new Array();
	}
};
class Balloon{
	constructor(fonts,width,height,canv){
		this.font=document.createElement('img');
		this.font.src=fonts;
		this.width=width;
		this.height=height;
		this.canv=canv;		
		this.prom=0;		
		this.posi=0;
		this.leposi=0;
		this.tleposi=0;
		this.dian=1;
		this.dialogs=new Array();
		this.diav=false;
		this.nx=true;
		this.ttx;		
	}	
	fukif(fukidasi){
		this.fukidasi=document.createElement('img');
		this.fukidasi.src=fukidasi;
	}
	letter(l,nex,sto){
		this.letters=l;
		this.nex=nex;
		this.sto=sto;
	}	
	dialog(d){
		this.dialogs=d;		
	}
	next(){		
		if(this.tleposi!=0&this.tleposi<this.ttx){
			this.leposi=this.tleposi;
		}else{
			this.dian++;
			this.leposi=0;	
		}		
	}
	reset(){		
		this.dian=1;
		this.leposi=0;		
		this.nx=true;
	}
	seri(txt,x,y,nagasa,takasa,alpha){			
		this.ttx=this.dialogs[txt+this.dian].length;
		if(this.dialogs[txt+(this.dian+1)]==undefined){
			this.diav=false;
		}else{
			this.diav=true;
		}		
		if(this.dialogs[txt+this.dian]!=undefined){			
			var tx=this.dialogs[txt+this.dian].toLowerCase();
			var line=0;
			var posi=0
			var mj=0;
			if(this.prom<10){
				this.prom++;
			}else{
				this.prom=0;
			}
			this.canv.save();
			if(alpha!=undefined){
				this.canv.globalAlpha=alpha;
			}else{
				this.canv.globalAlpha=0.6;
			}
			
			this.canv.drawImage(this.fukidasi,x-3,y-3);				
			
			for(var i=this.leposi;i<=tx.length;i++){			
				for(var j=0;j*this.width<this.font.width;j++){				
					if(tx.charAt(i)==this.letters[j]){
						if(posi>0){							
							posi+=4;
						}else{
							if(tx.charAt(i-1)=='。'||tx.charAt(i-1)=='！'||tx.charAt(i-1)=='、'||tx.charAt(i-1)=='ょ'||tx.charAt(i-1)=='1'||tx.charAt(i-1)=='（'||tx.charAt(i-1)=='）'||tx.charAt(i-1)=='：'||tx.charAt(i-1)=="「"||tx.charAt(i-1)=="」"){
								if(mj!=0){
									posi+=4;
								}
							}
						}						
						this.canv.drawImage(this.font,j*this.width,0,this.width,this.height,x+posi,y+(line*this.height),this.width,this.height);
						if(tx.charAt(i)=='ま'||tx.charAt(i)=='し'||tx.charAt(i)=='よ'||tx.charAt(i)=='し'||tx.charAt(i)=='ち'||tx.charAt(i)=='り'||tx.charAt(i)=='さ'||tx.charAt(i)=='そ'||tx.charAt(i)=='ら'||tx.charAt(i)=='き'||tx.charAt(i)=='こ'||tx.charAt(i)=='ゅ'||tx.charAt(i)=='よ'||tx.charAt(i)=='っ'||tx.charAt(i)=='ぇ'||tx.charAt(i)=='た'||tx.charAt(i)=='ー'){
							posi-=1;
						}else if(tx.charAt(i)=='き'||tx.charAt(i)=='ひ'){							
							if(tx.charAt(i+1)=='ゃ'||tx.charAt(i+1)=='ゅ'||tx.charAt(i+1)=='ょ'){							
								posi-=1;							
							}
						}else　if(j>=46&j<=70){
							if(tx.charAt(i)=='ぐ'){
								posi+=1;
							}else if(tx.charAt(i)=='じ'){
								posi-=1;
							}else{
								if(tx.charAt(i)=='び'||tx.charAt(i)=='ぴ'||tx.charAt(i)=='ぎ'){							
									if(tx.charAt(i+1)=='ゃ'||tx.charAt(i+1)=='ゅ'||tx.charAt(i+1)=='ょ'){							
										posi+=1;							
									}else{
										posi+=2;
									}
								}else{
									posi+=2;
								}
							}							
						}else if(tx.charAt(i)=="？"){							
								posi-=2;							
						}else if(tx.charAt(i)=='ゃ'||tx.charAt(i)=='く'||tx.charAt(i)=='ぉ'||tx.charAt(i)=='ぃ'||tx.charAt(i)=='ぅ'||tx.charAt(i)=='ぁ'){
							posi-=2;
						}else if(tx.charAt(i)=='ょ'||tx.charAt(i)=="。"||tx.charAt(i)=="（"||tx.charAt(i)=="）"||tx.charAt(i)=="「"||tx.charAt(i)=="」"){							
							posi-=3;
						}else if(tx.charAt(i)=="、"||tx.charAt(i)=="！"){														
							posi-=4;																						
						}else if(tx.charAt(i)=='：'){
							posi-=5;
						}else if(j>=78&j<=87){
							posi-=2;
							if(j==79){
								posi-=1;
							}
						}else if(tx.charAt(i)=='ぬ'||tx.charAt(i)=='ね'||tx.charAt(i)=='の'||tx.charAt(i)=='め'||tx.charAt(i)=='ゆ'||tx.charAt(i)=='や'||tx.charAt(i)=='わ'||tx.charAt(i)=='ん'||tx.charAt(i)=='か'||tx.charAt(i)=='れ'||tx.charAt(i)=='み'){
							posi+=1;
						}else if(tx.charAt(i)=="な"||tx.charAt(i)=="ふ"){
							posi+=2;
						}
					}											
				}
				
				mj++;				
				if(i>=tx.length-1){				
					this.tleposi=0;					
					if(this.dialogs[txt+(this.dian+1)]==undefined){
						this.nx=false;
					}else{
						this.nx=true;						
					}
					if(posi+(this.width+6)>=nagasa){
						line++;
						mj=0;							
						posi=0;						
					}else{
						posi+=2;					
					}					
				}else{	
					this.nx=true;
					if(posi+(this.width*3)>=nagasa&line*(this.height*2)>=takasa){								
						this.tleposi=i+1;
						i=tx.length;				
						posi+=4;								
					}else if(posi+(this.width+6)>=nagasa){
						line++;
						mj=0;
						if(line*this.height>=takasa){										
							i=tx.length;												
						}
						posi=0;						
					}else{
						posi+=3;					
					}					
				}				
			}		
			if(this.prom>5){
				if(this.tleposi==0&this.dialogs[txt+(this.dian+1)]==undefined){			
					this.canv.drawImage(this.font,this.sto*this.width,0,this.width,this.height,x+(posi+4),y+(line*this.height),this.width,this.height);
				}else{
					this.canv.drawImage(this.font,this.nex*this.width,0,this.width,this.height,x+posi+4,y+(line*this.height),this.width,this.height);
				}
			}	
			this.canv.restore();
			line=0;					
		}
	}
	koto(txt,x,y,nagasa,takasa,arufa){			
		this.ttx=txt.length;		
		var tx=txt.toLowerCase();
		var line=0;
		var posi=0
		var mj=0;
		if(arufa==undefined){
			arufa=0.9;
		}
		this.canv.save();		
		this.canv.globalAlpha=arufa;
		
		for(var i=this.leposi;i<=tx.length;i++){			
			for(var j=0;j*this.width<this.font.width;j++){				
				if(tx.charAt(i)==this.letters[j]){
					if(posi>0){							
						posi+=4;
					}else{
						if(tx.charAt(i-1)=='。'||tx.charAt(i-1)=='！'||tx.charAt(i-1)=='、'||tx.charAt(i-1)=='ょ'||tx.charAt(i-1)=='1'||tx.charAt(i-1)=='（'||tx.charAt(i-1)=='）'||tx.charAt(i-1)=='：'||tx.charAt(i-1)=="「"||tx.charAt(i-1)=="」"){
							if(mj!=0){
								posi+=4;
							}
						}
					}						
					this.canv.drawImage(this.font,j*this.width,0,this.width,this.height,x+posi,y+(line*this.height),this.width,this.height);
					if(tx.charAt(i)=='ま'||tx.charAt(i)=='し'||tx.charAt(i)=='よ'||tx.charAt(i)=='し'||tx.charAt(i)=='ち'||tx.charAt(i)=='り'||tx.charAt(i)=='さ'||tx.charAt(i)=='そ'||tx.charAt(i)=='ら'||tx.charAt(i)=='き'||tx.charAt(i)=='こ'||tx.charAt(i)=='ゅ'||tx.charAt(i)=='よ'||tx.charAt(i)=='っ'||tx.charAt(i)=='ぇ'||tx.charAt(i)=='た'||tx.charAt(i)=='ー'){
						posi-=1;
					}else if(tx.charAt(i)=='き'||tx.charAt(i)=='ひ'){							
						if(tx.charAt(i+1)=='ゃ'||tx.charAt(i+1)=='ゅ'||tx.charAt(i+1)=='ょ'){							
							posi-=1;							
						}
					}else　if(j>=46&j<=70){
						if(tx.charAt(i)=='ぐ'){
							posi+=1;
						}else if(tx.charAt(i)=='じ'){
							posi-=1;
						}else{
							if(tx.charAt(i)=='び'||tx.charAt(i)=='ぴ'||tx.charAt(i)=='ぎ'){							
								if(tx.charAt(i+1)=='ゃ'||tx.charAt(i+1)=='ゅ'||tx.charAt(i+1)=='ょ'){							
									posi+=1;							
								}else{
									posi+=2;
								}
							}else{
								posi+=2;
							}
						}							
					}else if(tx.charAt(i)=="？"){							
							posi-=2;							
					}else if(tx.charAt(i)=='ゃ'||tx.charAt(i)=='く'||tx.charAt(i)=='ぉ'||tx.charAt(i)=='ぃ'||tx.charAt(i)=='ぅ'||tx.charAt(i)=='ぁ'){
						posi-=2;
					}else if(tx.charAt(i)=='ょ'||tx.charAt(i)=="。"||tx.charAt(i)=="（"||tx.charAt(i)=="）"||tx.charAt(i)=="「"||tx.charAt(i)=="」"){							
						posi-=3;
					}else if(tx.charAt(i)=="、"||tx.charAt(i)=="！"){														
						posi-=4;																						
					}else if(tx.charAt(i)=='：'){
						posi-=5;
					}else if(j>=78&j<=87){
						posi-=2;
						if(j==79){
							posi-=1;
						}
					}else if(tx.charAt(i)=='ぬ'||tx.charAt(i)=='ね'||tx.charAt(i)=='の'||tx.charAt(i)=='め'||tx.charAt(i)=='ゆ'||tx.charAt(i)=='や'||tx.charAt(i)=='わ'||tx.charAt(i)=='ん'||tx.charAt(i)=='か'||tx.charAt(i)=='れ'||tx.charAt(i)=='み'){
						posi+=1;
					}else if(tx.charAt(i)=="な"||tx.charAt(i)=="ふ"){
						posi+=2;
					}
				}											
			}
			
			mj++;				
			if(i>=tx.length){				
				this.tleposi=0;									
			}else{					
				if(posi+(this.width*3)>=nagasa&line*(this.height*2)>=takasa){								
					this.tleposi=i+1;
					i=tx.length;				
					posi+=4;								
				}else if(posi+(this.width+6)>=nagasa){
					line++;
					mj=0;
					if(line*this.height>=takasa){										
						i=tx.length;												
					}
					posi=0;						
				}else{
					posi+=3;					
				}					
			}				
		}				
		this.canv.restore();
		line=0;					
		
	}
}

class BalloonEn{
	constructor(fonts,width,height,canv){
		this.font=document.createElement('img');
		this.font.src=fonts;
		this.width=width;
		this.height=height;
		this.canv=canv;		
		this.prom=0;		
		this.posi=0;
		this.leposi=0;
		this.tleposi=0;
		this.dian=1;
		this.dialogs=new Array();
		this.diav=false;
		this.nx=true;
		this.ttx;		
	}	
	fukif(fukidasi){
		this.fukidasi=document.createElement('img');
		this.fukidasi.src=fukidasi;
	}
	letter(l,nex,sto){
		this.letters=l;
		this.nex=nex;
		this.sto=sto;
	}	
	dialog(d){
		this.dialogs=d;		
	}
	next(){		
		if(this.tleposi!=0&this.tleposi<this.ttx){
			this.leposi=this.tleposi;
		}else{
			this.dian++;
			this.leposi=0;	
		}		
	}
	reset(){		
		this.dian=1;
		this.leposi=0;		
		this.nx=true;
	}
	seri(txt,x,y,nagasa,takasa,alpha){		
		this.ttx=this.dialogs[txt+this.dian].length;
		if(this.dialogs[txt+(this.dian+1)]==undefined){
			this.diav=false;
		}else{
			this.diav=true;
		}		
		if(this.dialogs[txt+this.dian]!=undefined){			
			var tx=this.dialogs[txt+this.dian].toLowerCase();
			var line=0;
			var posi=0;
			var mj=0;
			if(this.prom<10	){
				this.prom++;
			}else{
				this.prom=0;
			}
			this.canv.save();
			if(alpha!=undefined){
				this.canv.globalAlpha=alpha;
			}else{
				this.canv.globalAlpha=0.6;			
			};
			this.canv.drawImage(this.fukidasi,x-3,y-3);	
			
			for(var i=this.leposi;i<=tx.length;i++){			
				for(var j=0;j*this.width<this.font.width;j++){				
					if(tx.charAt(i)==this.letters[j]){											
						if(posi>0){
							posi+=2;			
						}else{
							if(tx.charAt(i-1)=='!'||tx.charAt(i-1)==','||tx.charAt(i-1)=='.'||tx.charAt(i-1)=="'"||tx.charAt(i-1)==':'||tx.charAt(i-1)=='-'){
							 if(mj!=0){
								posi+=2;								
							 }
							}
						}
						
						if(tx.charAt(i)=='m'||tx.charAt(i)=='w'){
							posi+=1;
						}else if(tx.charAt(i)=='!'||tx.charAt(i)==','||tx.charAt(i)=="'"||tx.charAt(i)=="."){
							posi-=1;
						}
						this.canv.drawImage(this.font,j*this.width,0,this.width,this.height,x+posi,y+(line*this.height),this.width,this.height);
						if(tx.charAt(i)=='m'||tx.charAt(i)=='n'||tx.charAt(i)=='w'){
							posi+=1;
						}else if(tx.charAt(i)=='!'||tx.charAt(i)==','||tx.charAt(i)=='1'||tx.charAt(i)=="'"||tx.charAt(i)=="."||tx.charAt(i)=='-'){
							posi-=1;
						}else if(tx.charAt(i)==':'){
							posi-=2;
						}
					}						
				}
				mj++;
				if(i>=tx.length-1){						
					this.tleposi=0;
					if(this.dialogs[txt+(this.dian+1)]==undefined){
						this.nx=false;
					}else{
						this.nx=true;
					}
					if(posi+(this.width+(this.width/2))>=nagasa){
						line++;
						mj=0;						
						posi=0;					
					}else{
						posi+=2;			
					}
				}else{
					this.nx=true;					
					if(posi+(this.width*3)>=nagasa&line*(this.height*2)>=takasa){								
							this.tleposi=i+1;
							i=tx.length;				
							posi+=4;		
							
					}else if(posi+(this.width+(this.width/2))>=nagasa){
						line++;
						mj=0;
						if(line*this.height>=takasa){										
							i=tx.length;											
						}
						posi=0;					
					}else{
						posi+=2;			
					}
				}				
			}		
			if(this.prom>5){
				if(this.tleposi==0&this.dialogs[txt+(this.dian+1)]==undefined){			
					this.canv.drawImage(this.font,this.sto*this.width,0,this.width,this.height,x+(posi-1),y+(line*this.height),this.width,this.height);
				}else{
					this.canv.drawImage(this.font,this.nex*this.width,0,this.width,this.height,x+posi,y+(line*this.height),this.width,this.height);				
				}
			}		
			this.canv.restore();
			line=0;		
		}		
	}	
	koto(txt,x,y,nagasa,takasa,arufa){		
		this.ttx=txt.length;		
		var tx=txt.toLowerCase();
		var line=0;
		var posi=0;
		var mj=0;		
		this.canv.save();
		if(arufa==undefined){
			arufa=0.9
		}
		this.canv.save();	
		this.canv.globalAlpha=arufa;				
		for(var i=this.leposi;i<=tx.length;i++){			
			for(var j=0;j*this.width<this.font.width;j++){				
				if(tx.charAt(i)==this.letters[j]){											
					if(posi>0){
						posi+=2;			
					}else{
						if(tx.charAt(i-1)=='!'||tx.charAt(i-1)==','||tx.charAt(i-1)=='.'||tx.charAt(i-1)=="'"||tx.charAt(i-1)==':'||tx.charAt(i-1)=='-'){
						 if(mj!=0){
							posi+=2;								
						 }
						}
					}					
					if(tx.charAt(i)=='m'||tx.charAt(i)=='w'){
						posi+=1;
					}else if(tx.charAt(i)=='!'||tx.charAt(i)==','||tx.charAt(i)=="'"||tx.charAt(i)=="."){
						posi-=1;
					}
					this.canv.drawImage(this.font,j*this.width,0,this.width,this.height,x+posi,y+(line*this.height),this.width,this.height);
					if(tx.charAt(i)=='m'||tx.charAt(i)=='n'||tx.charAt(i)=='w'){
						posi+=1;
					}else if(tx.charAt(i)=='!'||tx.charAt(i)==','||tx.charAt(i)=='1'||tx.charAt(i)=="'"||tx.charAt(i)=="."||tx.charAt(i)=='-'){
						posi-=1;
					}else if(tx.charAt(i)==':'){
						posi-=2;
					}
				}						
			}
			mj++;
			if(i>=tx.length){						
				this.tleposi=0;				
			}
			if(posi+(this.width*3)>=nagasa&line*(this.height*2)>=takasa){								
					this.tleposi=i+1;
					i=tx.length;				
					posi+=4;		
					
				}else if(posi+(this.width+(this.width/2))>=nagasa){
					line++;
					mj=0;
					if(line*this.height>=takasa){										
						i=tx.length;											
					}
					posi=0;					
				}else{
					posi+=2;			
				}
			
		}				
		this.canv.restore();
		line=0;						
	}		
}
var waku=new Object();
waku.yoko=window.innerWidth;
waku.tate=window.innerHeight;
waku.bai=3;
waku.bgm=true;
waku.cyoko=150;
waku.ctate=100;
waku.sute='koto';
waku.sutet='koto';
waku.chenji=false;
waku.chenjic=0;
waku.gen='jp';
waku.mode='aruku';
waku.aite='';
waku.ani=1;waku.anit=4;
var nezu={osu:false,x:0,y:0,tx:0,ty:0};
var rifu;

var kyan=document.createElement('canvas');
kyan.height=waku.ctate*waku.bai;
kyan.width=waku.cyoko*waku.bai;
kyan.style.borderRadius='7px';
document.body.appendChild(kyan);
kyan.style.position='absolute';
var kya=kyan.getContext('2d');
kya.scale(waku.bai,waku.bai);
kya.imageSmoothingEnabled=false;
kyan.style.left=(waku.yoko/2)-((waku.cyoko*waku.bai)/2);
kyan.style.top=(waku.tate/2)-((waku.ctate*waku.bai)/2);

kya.fillStyle='#443333';
kya.fillRect(0,0,200,200);
kya.fillStyle='#110000';
kya.font='25px arial';
kya.fillText('Loading...',8,35);
//sounds
var bgm1=new Audio('isekai/bgm1.wav');
bgm1.loop=true;
var bgm2=new Audio('isekai/bgm2.wav');
bgm2.loop=true;
var bgm=bgm1;
var okuri=new Oto('isekai/click.wav');
var osuta=new Oto('isekai/suta.wav');
var oban=new Oto('isekai/ban.wav');
var okosu=new Oto('isekai/kosu.wav');
var onuchu=new Oto('isekai/nuchu.wav');
var okaze=new Oto('isekai/wind.wav');
var othud=new Oto('isekai/thud.wav');
var osuup=new Oto('isekai/sukiup.wav');
var otinre=new Oto('isekai/tinrebe.wav');
//sprite
var bgintro=new Dotto('bgintro',150,100,kya,'isekai/bg_intro.png');
bgintro.kazu=0;
var mobu=new Dotto('mobu',60,60,kya,'isekai/mobu.png');
mobu.id='mobu';mobu.x=60;mobu.y=80;mobu.hou='hidari';nezu.tx=mobu.x;nezu.ty=mobu.y;
mobu.mode='stop';mobu.hp=10;mobu.hp0=10;mobu.hpx=3;mobu.hpmotikae=2;
mobu.tinrebe=0;mobu.tinrebet=10;mobu.hpmaho=4;
mobu.kane=0;mobu.kusa=0;mobu.hana=0;
mobu.oto(osuta,1,3);
var mobureda=new Dotto('mobuRda',60,60,kya,'isekai/mobu_regda.png');
mobureda.oto(oban,1);
var mobuatt=new Dotto('mobu',60,60,kya,'isekai/mobu_attack.png');
mobuatt.oto(othud,2,7);

var bgicon=new Dotto('icons',10,10,kya,'isekai/bg_icon.png');

var bgover=new Dotto('bgover',150,100,kya,'isekai/bg_over.png');
bgover.kazu=0;bgover.kazu2=0;
var bgatabu=new Dotto('atbuttons',34,12,kya,'isekai/bg_attack.png');
var bgmap=new Dotto('map',150,100,kya,'isekai/bg_map.png');
var bgkoto=new Dotto('gengo',150,100,kya,'isekai/bg_koto.png');
bgkoto.kazu=0;
var bgnomi=new Dotto('nomiya',150,100,kya,'isekai/bg_nomiya.png');
bgnomi.kazu=0;bgnomi.biru=2;
var bgnomitable={x:50,y:46,namae:'table1',id:'table1'}
var bgnomitable2={x:50,y:95,namae:'table2',id:'table2'}
var nagi=new Dotto('nagi',60,60,kya,'isekai/nagi.png');
nagi.mode='talk';nagi.id='nagi';nagi.x=15;nagi.y=80;
nagi.suki=0;nagi.sukit=2;nagi.kane=3;nagi.tin=1;nagi.hppan=2;nagi.hpx=3;nagi.hpxx=4;

var fujii=new Dotto('fujii',60,60,kya,'isekai/fujii.png');

var bgmori=new Dotto('mori',150,100,kya,'isekai/bg_mori.png');
bgmori.kusa=5;bgmori.kusat=5;bgmori.kusakane=2;bgmori.kusact=100;bgmori.kusac=0;bgmori.hana=3;bgmori.hanat=3;bgmori.hanact=100;bgmori.hanac=0;
var bgmoki1={x:0,y:48,id:'ki1',namae:'ki1'};
var bgishi={x:0,y:26,id:'ishi',namae:'ishi'};
var surai=new Dotto('surai',60,60,kya,'isekai/suraimu.png');
surai.id='surai';surai.x=40;surai.y=60;surai.dmg=10;surai.mode='stop';
var suraiatt=new Dotto('surai',60,60,kya,'isekai/suraimu_attack.png');
suraiatt.oto(oban,3);

var erufu=new Dotto('erufu',60,60,kya,'isekai/erufu.png');
erufu.x=80;erufu.y=96;erufu.mode='talk';erufu.suki=0;erufu.sukit=2;erufu.kane=10;erufu.tin=0;erufu.hppan=2;erufu.hpx=3;erufu.hpxx=5
var erufusurai=new Dotto('erufu',60,60,kya,'isekai/erufu_surai.png');
erufusurai.oto(onuchu,4);
erufusurai.oto(oban,5);
erufusurai.oto(osuta,1);
var erufusuraib=new Dotto('er_surai',60,60,kya,'isekai/erufu_suraib.png');
var erufumob=new Dotto('er_mob',60,60,kya,'isekai/erufu_mobu.png');
erufumob.oto(onuchu,1);
erufumob.oto(oban,3);

mobu.party=erufu;

var mori=new Sou('moriSou');
mori.tasu(mobu,erufu,bgmoki1,bgishi,surai);
mori.koushin();

var nomiya=new Sou('nomiyaSou');
nomiya.tasu(nagi,mobu,bgnomitable,bgnomitable2);
nomiya.koushin();

//areas
var hbgm=new Hitoa(1,1,12,12);
var hsusu=new Hitoa(132,2,145,13);

var hsuta=new Hitoa(55,63,93,74);
var hanime=new Hitoa(61,75,87,83);
var hjp=new Hitoa(1,84,36,98);
var hen=new Hitoa(37,84,72,98);
var hgma=new Hitoa(79,84,101,98);
var hgpu=new Hitoa(127,84,148,98);

var hmori=new Hitoa(1,14,81,53);
var hkusa=new Hitoa(1,53,25,66);
var hhana=new Hitoa(26,53,38,66);
var hsurai=new Hitoa(surai.x-70,surai.y-10,surai.x+20,surai.y+7);

var hnomi=new Hitoa(9,80,26,98);
var hnomit=new Hitoa(0,32,150,100);
var hneru=new Hitoa(12,0,43,34);
var hnagi=new Hitoa(nagi.x-5,nagi.y-4,nagi.x+25,nagi.y+5);
var hfujii=new Hitoa(80,32,96,48);
var hhime=new Hitoa(65,88,91,96);

var hkane=new Hitoa(115,12,149,22);
var htinata=new Hitoa(115,25,149,36);
var hnige=new Hitoa(115,37,149,49);
var hsen4=new Hitoa(115,50,149,60);

var hderu=new Hitoa(145,80,150,100);

var hanima=new Hitoa(114,90,126,100);
var hanipu=new Hitoa(136,90,150,100);
var haniba=new Hitoa(102,90,113,100);
//moji
var logs=new Array();
var letter=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','.',',','!','?',"'",'1','2','3','4','5','6','7','8','9','0','(',')',':','-'];
var moji=['あ','い','う','え','お','か','き','く','け','こ','さ','し','す','せ','そ','た','ち','つ','て','と','な','に','ぬ','ね','の','は','ひ','ふ','へ','ほ','ま','み','む','め','も','や','ゆ',"よ",'ら','り','る','れ','ろ','わ','を','ん','が','ぎ','ぐ','げ','ご','ざ','じ','ず','ぜ','ぞ','だ','ぢ','づ','で','ど','ば','び','ぶ','べ','ぼ','ぱ','ぴ','ぷ','ぺ','ぽ','ゃ','ゅ','ょ','。','、','！','？','0','1','2','3','4','5','6','7','8','9','っ','ぁ','ぃ','ぅ','ぇ','ぉ','（','）','「','」','：','ー'];
var hira=new Balloon('isekai/hira.png',8,7,kya);
hira.letter(moji,100,74);
hira.dialog(logs);
hira.fukif('isekai/bg_balloon.png');

var hirab=new Balloon('isekai/hira.png',8,7,kya);
hirab.letter(moji,100,74);
hirab.fukif('isekai/bg_balloon.png');

var roma=new BalloonEn('isekai/alpha.png',5,7,kya);
roma.letter(letter,45,26);
roma.dialog(logs);
roma.fukif('isekai/bg_balloon.png');

var romab=new BalloonEn('isekai/alpha.png',5,7,kya);
romab.letter(letter,45,26);
romab.fukif('isekai/bg_balloon.png');

var se=hira;
var ko=hirab;

logs['jpintro1']='もぶ：　。。。なんだこれ。。。かんかくが　ふわふわしてる。。。';
logs['jpintro2']='もぶ：　そうだ！　ちかくの　こんびにに　いったら　くるまに。。。ぁぁ　さいあくだ。。。';
logs['jpintro3']='かみさま：　これから　あなたは　ちがう　せかいに　てんせい　されるんです、　なにか　ほしいもの　ありますか？';
logs['jpintro4']='もぶ：　いせかい　てんせい！！　やばい！';
logs['jpintro5']='もぶ：　ちーど　すきる　とか　いいよな、　いや　おれ　えっち　いっかいも　しないままで　しんじゃった。。。';
logs['jpintro6']='もぶ：　はでな　こうげきとか　ぜんぜん　いらないけど　ちんこの　れべる　あげれば　どんな　おんなとでも　えっちが　できるように　なりたい！';
logs['jpintro7']='もぶ：　おねがいしまーす！';
logs['jpintro8']='かみさま：　そうします、　あたらしい　じんせいを　たのしんでください！';
logs['enintro1']="Mob: ... what's happening...I feel so weird...";
logs['enintro2']="Mob: Yeah! I was going to the convenience store then a car...oh shit...";
logs['enintro3']="God: Soon you're going to reincarnate into another world,  is anything you want?";
logs['enintro4']="Mob: Another world reincarnation! Oh yeah!!";
logs['enintro5']="Mob: Yeah, some kind of special skill would be sweet, but wait, in my previous life I never had sex...";
logs['enintro6']="Mob: I don't need any fancy attack just need my 'cock level' enabling me to fuck any girl, that would be great!";
logs['enintro7']="Mob: Please!";
logs['enintro8']="God: So it will be, enjoy your new life!";

logs['jpnaginosou1']='なぎ：　いやだよ、　あんた　みたいな　やつと　えっち　したくないわ';
logs['ennaginosou1']="Nagi: No way, I'm not fucking someone like you";

logs['jpnaginopan1']='なぎ：　かね　もらっても　ぱんつ　みせないよ！';
logs['ennaginopan1']="Nagi: Come on, even you give me money you won't see my panties";

logs['jpnaginokanepan1']='なぎ：　おかねも　ないのに　なに　いってんの！';
logs['ennaginokanepan1']="Nagi: You don't even have money, beat it!";

logs['jpneru1']='もぶ：　ちょっと　やすもうか。。。';
logs['jpneru2']='えいちぴーが　かんぜん　かいふく';
logs['enneru1']="Mob: I'm gonna rest a little...";
logs['enneru2']="Your hp is fully restored";

logs['jpkusatori1']='やくそうを　しゅうしゅう';
logs['enkusatori1']="Collecting medicinal herbs";

logs['jphanatori1']='はなを　つむ';
logs['enhanatori1']="Picking flowers";

logs['jpsurai1']='すらいむが　あらわれた';
logs['ensurai1']="A slime has appeared";

logs['jpsuraiata1']='すらいむを　こうげきちゅう';
logs['ensuraiata1']="Attacking the slime";

logs['jperos1']='ぱーてぃー　めんばーに　こっそり　えろへいと　まほうを　かけた';
logs['jperos2']='てきが　けんじゃに　なって　たたかわずに　さっていく';
logs['eneros1']="You used stealthily 'erotic hate' magic on your party member";
logs['eneros2']="Your enemy became a 'sage' and gone away";

logs['jpmembaoka1']='もぶ：　えるふちゃん　の　あなる　すっごい　きもちいぃぃ！';
logs['enmembaoka1']="Mob: Mann, elf-chan's butt feels so good!!";

logs['jpmembamotikae1']='もぶ：　へや　まで　もちかえって　やすませようか。。。';
logs['enmembamotikae1']="Mob: mm, I'll bring her back to her room and let her rest...";

logs['jpmembakaifuku1']='えるふ：　よくねれたわ、　かんぜん　かいふくできた　ありがとうね！';
logs['enmembakaifuku1']="Elf: I slept so well I'm fully recovered, thank you!";

logs['jpmembakaisan1']='もりで　おきざりに　された　ぱーてぃーめんばーは　おこって　ぱーてぃーを　ぬけた';
logs['enmembakaisan1']="The party member left at the forest got angry and left the party";

logs['jphp01']='えいちぴーが　ぜろに　なりました';
logs['enhp01']="your HP is zero";

logs['jphime1']='ひめ：　ひとりに　してください。。。';
logs['enhime1']="Princess: Just let me alone...";

logs['jpfujii1']='ふじい：　ここ　いい　みせだね　たまにきます';
logs['enfujii1']="Fujii: I love this place, yeah sometimes I come here";

//function
function mobuMoAru(x,y){
	if(hderu.d(x,y)){
		nezu.osu=true;
		waku.chenji=true;
		waku.sutet='map';		
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;
		mobu.mode='stop';
	}else if(hsurai.d(x,y)&surai.mode!='away'){	
		waku.mode='serifu';				
		mobu.mode='surai';		
		waku.aite=surai;
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;
		if(waku.bgm){
			bgm.pause();
			bgm=bgm2;
			bgm.currentTime=0;
			bgm.play();
		}
	}else if(hhana.c(x,y)&bgmori.hana>0){
		waku.mode='attack';		
		mobu.mode='hana';		
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;
	}else if(hkusa.c(x,y)&bgmori.kusa>0){				
		waku.mode='attack';			
		mobu.mode='kusa';		
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;
	}else if(mobu.party.mode=='oka'&Math.abs(x-mobu.party.x)<35&Math.abs(y-mobu.party.y)<4){
		waku.mode='attack';
		mobu.mode='memba';
		waku.aite=mobu.party;
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;
	}else{
		return false
	}
};

function mobuAruku(x,y){
	if(hnagi.c(x,y)){
		waku.mode='attack';							
		waku.aite=nagi;
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;	
		mobu.mode='stop';		
	}else if(hfujii.d(x,y)){		
		waku.mode='serifu';
		mobu.mode='fujii';
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;			
	}else if(hhime.d(x,y)){		
		waku.mode='serifu';
		mobu.mode='hime';		
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;			
	}else if(hneru.c(x,y)){		
		waku.mode='serifu';
		mobu.mode='neru';		
		mobu.hp=mobu.hp0;
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;			
	}else if(hderu.d(x,y)){
		nezu.osu=true;
		waku.chenji=true;
		waku.sutet='map';
		nezu.tx=mobu.x;
		nezu.ty=mobu.y;
		mobu.mode='stop';		
	}else{
		return false
	}
};
function zero(){
	mobureda.koma=0;	
	erufusurai.koma=0;
	erufusuraib.koma=0;	
};
function rifuF(){
	kya.fillStyle='#443333';
	kya.fillRect(0,0,200,200);
	
	if(bgmori.kusa<bgmori.kusat){
		bgmori.kusac++;
		if(bgmori.kusac>=bgmori.kusact){
			if(bgmori.kusa<bgmori.kusat){
				bgmori.kusa++;				
			}
			bgmori.kusac=0;
		}
	}
	if(bgmori.hana<bgmori.hanat){
		bgmori.hanac++;
		if(bgmori.hanac>=bgmori.hanact){
			if(bgmori.hana<bgmori.hanat){
				bgmori.hana++;
			}
			bgmori.hanac=0;
		}
	}
	
	if(waku.sute=='koto'){
		bgkoto.haikei(0,0);		
		bgkoto.kazu++;
		if(bgkoto.kazu>=30){
			bgkoto.kazu=0;
		}
		kya.save();
		if(bgkoto.kazu<=20&bgkoto.kazu>4){
			kya.globalAlpha=bgkoto.kazu/20;
		}else{
			kya.globalAlpha=0.2;
		}
		if(waku.gen=='jp'){
			bgkoto.haikei(0,0,0,1);
		}else{
			bgkoto.haikei(0,0,0,2);
		}
		kya.restore();
		
		if(waku.gen=='jp'){
			if(hsuta.c(nezu.x,nezu.y)){
				bgkoto.haikei(0,0,0,4);
			}else{
				bgkoto.haikei(0,0,0,3);
			}
			if(hanime.c(nezu.x,nezu.y)){
				bgkoto.haikei(0,0,0,6);
			}else{
				bgkoto.haikei(0,0,0,5);
			}
		}else{
			if(hsuta.c(nezu.x,nezu.y)){
				bgkoto.haikei(0,0,0,14);
			}else{
				bgkoto.haikei(0,0,0,13);
			}
			if(hanime.c(nezu.x,nezu.y)){
				bgkoto.haikei(0,0,0,16);
			}else{
				bgkoto.haikei(0,0,0,15);
			}
		}
		
		if(hgpu.c(nezu.x,nezu.y)){
			bgkoto.haikei(0,0,0,8);
		}else if(hgma.c(nezu.x,nezu.y)){
			bgkoto.haikei(0,0,0,9);
		}else{
			bgkoto.haikei(0,0,0,7);
		}
		
		if(hjp.c(nezu.x,nezu.y)){
			bgkoto.haikei(0,0,0,11);
		}else if(hen.c(nezu.x,nezu.y)){
			bgkoto.haikei(0,0,0,12);
		}else{
			bgkoto.haikei(0,0,0,10);
		}				
		
		romab.koto('Hoodie Corp 2026',85,2,150,20,1);
	}else if(waku.sute=='map'){
		bgmap.haikei(0,0);		
		if(hnomi.c(nezu.x,nezu.y)){
			bgmap.haikei(0,0,0,2);
		}else if(hmori.c(nezu.x,nezu.y)){
			bgmap.haikei(0,0,0,4);
		}
		if(waku.gen=='jp'){
			hirab.koto('もり',45,8,150,20,1);			
			hirab.koto('やどや',7,70,150,20,1);
		}else{
			romab.koto('forest',40,8,150,20,1);			
			romab.koto('tavern',4,70,150,20,1);
		}
		
		if(waku.bgm){
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,7);
			}else{
				bgicon.kyara(5,11,0,6);
			}
		}else{
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,5);
			}else{
				bgicon.kyara(5,11,0,4);
			}
		}		
	}else if(waku.sute=='mori'){
		if(waku.mode=='aruku'){
			if(Math.abs(mobu.y-nezu.ty)>5){
				if(mobu.y<nezu.ty){
					if(!mobuMoAru(mobu.x,mobu.y+5)){					
						mobu.y+=5;
						mobu.hou='migi';
					}
				}else{
					if(!mobuMoAru(mobu.x,mobu.y-5)){						
						mobu.y-=5;
						mobu.hou='hidari';
					}
				}				
			}
			if(Math.abs(mobu.y-nezu.ty)>0&Math.abs(mobu.y-nezu.ty)<=5){
				if(!mobuMoAru(mobu.x,nezu.ty)){					
					mobu.y=nezu.ty;
				}
			}
			if(Math.abs(mobu.x-nezu.tx)>5){
				if(mobu.x<nezu.tx){
					if(!mobuMoAru(mobu.x+5,mobu.y)){						
						mobu.x+=5;		
						mobu.hou='migi';
					}
				}else{
					if(!mobuMoAru(mobu.x-5,mobu.y)){						
						mobu.x-=5;
						mobu.hou='hidari';
					}
				}				
			}
			if(Math.abs(mobu.x-nezu.tx)>0&Math.abs(mobu.x-nezu.tx)<=5){
				if(!mobuMoAru(nezu.tx,mobu.y)){				
					mobu.x=nezu.tx;
				}
			}	
			if(erufu.mode=='talk'){
				erufu.x=mobu.x+15;
				erufu.y=mobu.y-10;			
			}
		}
		
		mori.koushin();
		
		bgmori.haikei(0,0);		
		
		bgnomi.kazu++;
		if(bgnomi.kazu<7){			
			kya.save();
			kya.globalAlpha=0.5;
			bgnomi.haikei(0,0,0,3);	
			kya.restore();
		}else{			
			if(bgnomi.kazu>=13){
				bgnomi.kazu=0;
			}
		}
		
		if(waku.mode=='aruku'){
			if(mobu.x==nezu.tx&mobu.y==nezu.ty){
				mobu.kyara(nezu.tx,nezu.ty,1,1);
				if(waku.mode=='aruku'){
					mobu.mode='stop';
				};
			}else{
				mobu.kyara(nezu.tx,nezu.ty,1);
			}
		}
		if(waku.aite!=''){
			kya.save();
			kya.globalAlpha=0.6;
			nagi.prompt(waku.aite.x,waku.aite.y,2);
			kya.restore();
		}		
		
		if(bgmori.kusa==1){
			bgmori.haikei(0,0,0,4);
		}else if(bgmori.kusa==2){
			bgmori.haikei(0,0,0,5);
		}else if(bgmori.kusa==3){
			bgmori.haikei(0,0,0,6);
		}else if(bgmori.kusa==4){
			bgmori.haikei(0,0,0,7);
		}else if(bgmori.kusa==5){
			bgmori.haikei(0,0,0,8);
		}
		if(bgmori.hana==1){
			bgmori.haikei(0,0,0,9);
		}else if(bgmori.hana==2){
			bgmori.haikei(0,0,0,10);
		}else if(bgmori.hana==3){
			bgmori.haikei(0,0,0,11);
		}
		
		for(var mp=0;mp<mori.main.length;mp++){
			switch(mori.main[mp].namae){								
				case 'mobu':
					if(mobu.mode=='membaoka'){
					}else if(mobu.mode=='kusatori'|mobu.mode=='hanatori'){
						mobu.talk(mobu.x,mobu.y,13);
					}else if(mobu.mode=='aruku'){
						if(mobu.hou=='hidari'){
							mobu.ani(mobu.x,mobu.y,2);
						}else{
							mobu.ani(mobu.x,mobu.y,3);
						}
					}else if(mobu.mode=='suraiata'){
						mobuatt.ani(mobu.x,mobu.y);
					}else if(mobu.mode=='hp0'){
							mobu.talk(mobu.x,mobu.y,10);
					}else{
						if(mobu.hou=='hidari'){
							mobu.talk(mobu.x,mobu.y,4);						
						}else{
							mobu.talk(mobu.x,mobu.y,5);
						}
					}
					break;
				case 'erufu':
					if(mobu.party==erufu){
						if(mobu.mode=='membaoka'){
							erufumob.ani(erufu.x,erufu.y);
						}else if(erufu.mode=='oka'){
							erufu.talk(erufu.x,erufu.y,5);
						}else if(mobu.mode=='kusatori'){
							erufu.talk(erufu.x,erufu.y,1);
						}else if(mobu.mode=='aruku'){						
							if(mobu.hou=='hidari'){
								erufu.ani(erufu.x,erufu.y,3);
							}else{
								erufu.ani(erufu.x,erufu.y,4);
							}
						}else if(mobu.mode=='eros'){
							erufusurai.ani(erufu.x,erufu.y);
							kya.save();
							kya.globalAlpha=0.8;
							erufusuraib.ani(erufu.x,erufu.y);
							kya.restore();
						}else{
							if(mobu.hou=='hidari'){
								erufu.talk(erufu.x,erufu.y,1);
							}else{
								erufu.talk(erufu.x,erufu.y,2);
							}
						}
					}
					break;				
				case 'surai':					
					if(surai.mode=='stop'){
						kya.save();
						kya.globalAlpha=0.8;
						surai.talk(surai.x,surai.y,1);
						kya.restore();
					}else if(surai.mode=='kougeki'){
						kya.save();
						kya.globalAlpha=0.8;
						suraiatt.ani(surai.x,surai.y);
						kya.restore();
					}					
					break;				
				case 'ki1':					
					bgmori.haikei(0,0,0,2);
					break;				
				case 'ishi':					
					bgmori.haikei(0,0,0,1);
					break;				
				default:
					break;
			}
		};
		bgmori.haikei(0,0,0,3);		
		
		if(waku.mode=='serifu'){			
			se.seri(waku.gen+mobu.mode,15,82,114,9,0.7);
		}
		if(waku.mode=='attack'){
			if(mobu.mode=='memba'){
				if(hkane.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,23,0,2);
				}else{
					bgatabu.kyara(132,23,0,3);
				}
				if(htinata.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,36,0,12);
				}else{
					bgatabu.kyara(132,36,0,13);
				}			
				if(hnige.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,49,0,4);
				}else{
					bgatabu.kyara(132,49,0,5);
				}
			}else if(mobu.mode=='kusa'){
				if(hkane.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,23,0,16);
				}else{
					bgatabu.kyara(132,23,0,17);
				}
				if(htinata.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,36,0,4);
				}else{
					bgatabu.kyara(132,36,0,5);
				}	
				
			}else if(mobu.mode=='hana'){
				if(hkane.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,23,0,18);
				}else{
					bgatabu.kyara(132,23,0,19);
				}
				if(htinata.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,36,0,4);
				}else{
					bgatabu.kyara(132,36,0,5);
				}	
				
			}else{				
				if(hkane.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,23,0,8);
				}else{
					bgatabu.kyara(132,23,0,9);
				}
				if(mobu.party!=''&mobu.mode!='oka'&erufu.mode!='oka'){
					if(htinata.c(nezu.x,nezu.y)){
						bgatabu.kyara(132,36,0,10);
					}else{
						bgatabu.kyara(132,36,0,11);
					}	
				}				
				if(hnige.c(nezu.x,nezu.y)){
					bgatabu.kyara(132,49,0,4);
				}else{
					bgatabu.kyara(132,49,0,5);
				}
			}
		}
		
		if(waku.bgm){
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,7);
			}else{
				bgicon.kyara(5,11,0,6);
			}
		}else{
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,5);
			}else{
				bgicon.kyara(5,11,0,4);
			}
		}
	}else if(waku.sute=='nomiya'){
		if(waku.mode=='aruku'){
			if(Math.abs(mobu.y-nezu.ty)>5){
				if(mobu.y<nezu.ty){
					if(!mobuAruku(mobu.x,mobu.y+5)){					
						mobu.y+=5;
						mobu.hou='migi';
					}
				}else{
					if(!mobuAruku(mobu.x,mobu.y-5)){						
						mobu.y-=5;
						mobu.hou='hidari';
					}
				}				
			}
			if(Math.abs(mobu.y-nezu.ty)>0&Math.abs(mobu.y-nezu.ty)<=5){
				if(!mobuAruku(mobu.x,nezu.ty)){					
					mobu.y=nezu.ty;
				}
			}
			if(Math.abs(mobu.x-nezu.tx)>5){
				if(mobu.x<nezu.tx){
					if(!mobuAruku(mobu.x+5,mobu.y)){						
						mobu.x+=5;
						mobu.hou='migi';
					}
				}else{
					if(!mobuAruku(mobu.x-5,mobu.y)){						
						mobu.x-=5;
						mobu.hou='hidari';
					}
				}				
			}
			if(Math.abs(mobu.x-nezu.tx)>0&Math.abs(mobu.x-nezu.tx)<=5){
				if(!mobuAruku(nezu.tx,mobu.y)){				
					mobu.x=nezu.tx;
				}
			}			
		}
		
		nomiya.koushin();
		
		bgnomi.haikei(0,0);	
		bgnomi.kazu++;
		if(bgnomi.kazu<7){
			bgnomi.haikei(0,0,0,4);
			kya.save();
			kya.globalAlpha=0.5;
			if(waku.gen=='jp'){
				bgnomi.haikei(0,0,0,3);	
			}else{
				bgnomi.haikei(0,0,0,11);
			}
			kya.restore();
		}else{
			bgnomi.haikei(0,0,0,5);
			kya.save();
			kya.globalAlpha=0.5;
			if(waku.gen=='jp'){
				bgnomi.haikei(0,0,0,10);	
			}else{
				bgnomi.haikei(0,0,0,12);
			}
			kya.restore();
			if(bgnomi.kazu>=13){
				bgnomi.kazu=0;
			}
		}

		if(mobu.mode!='neru'){			
			if(mobu.x==nezu.tx&mobu.y==nezu.ty){
				mobu.kyara(nezu.tx,nezu.ty,1,1);				
				if(waku.mode=='aruku'){
					mobu.mode='stop';
				}
			}else{
				mobu.kyara(nezu.tx,nezu.ty,1);
			}
			if(waku.aite!=''){
				kya.save();
				kya.globalAlpha=0.6;
				nagi.prompt(waku.aite.x,waku.aite.y,2);
				kya.restore();
			}
		}		
		for(var mp=0;mp<nomiya.main.length;mp++){
			switch(nomiya.main[mp].namae){								
				case 'mobu':
					if(mobu.mode=='stop'|mobu.mode=='hime'|mobu.mode=='fujii'){
						if(mobu.hou=='hidari'){
							mobu.talk(mobu.x,mobu.y,8);
						}else{
							mobu.talk(mobu.x,mobu.y,9);
						}
					}else if(mobu.mode=='damage'){
							mobureda.ani(mobu.x,mobu.y,0,4,'talk');
					}else if(mobu.mode=='hp0'){
							mobu.talk(mobu.x,mobu.y,10);
					}else if(mobu.mode=='aruku'){
						if(mobu.hou=='hidari'){
							mobu.ani(mobu.x,mobu.y,6);
						}else{
							mobu.ani(mobu.x,mobu.y,7);
						}
					}else if(mobu.mode=='bi-ru'){
						mobu.talk(mobu.x,mobu.y,12);
					}else if(mobu.mode=='45'){
						mobu.talk(mobu.x,mobu.y,11);
					}
					break;
				case 'nagi':
					if(nagi.mode=='talk'|nagi.mode=='hp0'){
						nagi.talk(nagi.x,nagi.y,1);
					}else{
						nagi.talk(nagi.x,nagi.y,3);
					}
					break;
				case 'table1':
					bgnomi.haikei(0,0,0,1);
					if(bgnomi.kazu<5){
						bgnomi.haikei(0,0,0,6);
					}else{
						bgnomi.haikei(0,0,0,7);
					}
					fujii.talk(83,45,1);
					break;
				case 'table2':
					bgnomi.haikei(0,0,0,2);
					if(bgnomi.kazu<8){
						bgnomi.haikei(0,0,0,8);
					}else{
						bgnomi.haikei(0,0,0,9);
					}
					fujii.talk(78,94,2);
					break;
				default:
					break;
			}
		};
		if(waku.mode=='serifu'){			
			if(waku.aite==''|mobu.mode=='hp0'){
				se.seri(waku.gen+mobu.mode,15,82,114,9,0.7);
			}else{
				se.seri(waku.gen+waku.aite.mode,15,82,114,9,0.7);
			}
		}
		if(waku.mode=='attack'){
			if(hkane.c(nezu.x,nezu.y)){
				bgatabu.kyara(132,23,0,0);
			}else{
				bgatabu.kyara(132,23,0,1);
			}
			if(htinata.c(nezu.x,nezu.y)){
				bgatabu.kyara(132,36,0,2);
			}else{
				bgatabu.kyara(132,36,0,3);
			}			
			if(hnige.c(nezu.x,nezu.y)){
				bgatabu.kyara(132,49,0,14);
			}else{
				bgatabu.kyara(132,49,0,15);
			}			
			if(hsen4.c(nezu.x,nezu.y)){
				bgatabu.kyara(132,62,0,4);
			}else{
				bgatabu.kyara(132,62,0,5);
			}			
		}
		if(waku.bgm){
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,7);
			}else{
				bgicon.kyara(5,11,0,6);
			}
		}else{
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,5);
			}else{
				bgicon.kyara(5,11,0,4);
			}
		}
	}else if(waku.sute=='sichou'){
		bgnomi.haikei(0,0);
		
		if(waku.ani==1){		
			nagi.talk(nagi.x,nagi.y,1);
		}else if(waku.ani==2){		
			erufu.talk(80,62,1);			
		}else if(waku.ani==3){
			erufusurai.ani(80,64);
			kya.save();
			kya.globalAlpha=0.8;
			erufusuraib.ani(80,64);
			kya.restore();
		}else if(waku.ani==4){
			erufumob.ani(80,64);
		}
		
		if(haniba.c(nezu.x,nezu.y)){
			bgicon.kyara(108,100,0,14);
		}else{
			bgicon.kyara(108,100,0,13);
		}
		
		if(hanima.c(nezu.x,nezu.y)){
			bgicon.kyara(120,100,0,10);
		}else{
			bgicon.kyara(120,100,0,9);
		}
		if(hanipu.c(nezu.x,nezu.y)){
			bgicon.kyara(143,100,0,12);
		}else {
			bgicon.kyara(143,100,0,11);
		}
		romab.koto(''+waku.ani,126,91,15,15);
		
		if(waku.bgm){
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,7);
			}else{
				bgicon.kyara(5,11,0,6);
			}
		}else{
			if(hbgm.c(nezu.x,nezu.y)){
				bgicon.kyara(5,11,0,5);
			}else{
				bgicon.kyara(5,11,0,4);
			}
		}		
	}else if(waku.sute=='intro'){
		if(bgintro.kazu<3){
			bgintro.haikei(0,0);
		}else if(bgintro.kazu<6){
			bgintro.haikei(0,0,0,1);
		}else if(bgintro.kazu<9){
			bgintro.haikei(0,0,0,2);
		}else{
			bgintro.haikei(0,0,0,3);
		}
		bgintro.kazu++;
		if(bgintro.kazu>=12){
			bgintro.kazu=0;
		}
		if(!nezu.osu){
			se.seri(waku.gen+'intro',15,82,114,9,0.7);
		}
		if(hsusu.c(nezu.x,nezu.y)){
			bgicon.kyara(140,12,0,16);
		}else{
			bgicon.kyara(140,12,0,15);
		}
	}else{
		bgover.haikei(0,0);		
		bgover.haikei(0,0,0,1);		
		
		bgover.kazu2++;
		if(bgover.kazu2<3){
			bgover.haikei(0,0,0,3);
		}else if(bgover.kazu2<6){
			bgover.haikei(0,0,0,4);
		}else{
			bgover.haikei(0,0,0,5);
			if(bgover.kazu2>=7){
				bgover.kazu2=0;
			}
		}
		
		bgover.haikei(0,0,0,6);
		
		if(!waku.chenji){
			if(bgover.kazu<30){
				bgover.kazu++;
			}else{
				nezu.osu=true;
				waku.sutet='koto';
				waku.chenji=true;
			}
		}		
	}
	if(waku.sute!='koto'&waku.sute!='over'&waku.sute!='sichou'&waku.sute!='intro'){		
		kya.save();
		kya.fillStyle='#ffffff';
		kya.globalAlpha=0.6;
		kya.fillRect(60,0,89,9);
		kya.restore();
		bgicon.kyara(66,10,0,1);
		romab.koto(''+mobu.hp,71,2,15,15);		
		bgicon.kyara(84,10,0,2);
		romab.koto(''+mobu.tinrebe,88,2,15,15);
		bgicon.kyara(101,10,0,0);
		romab.koto(''+mobu.kane,104,2,15,15);		
		bgicon.kyara(118,10,0,3);
		romab.koto(''+mobu.kusa,122,2,15,15);		
		bgicon.kyara(136,10,0,8);
		romab.koto(''+mobu.hana,140,2,15,15);
	}
	if(waku.chenji){		
		kya.save();
		if(waku.chenjic>10){
			kya.globalAlpha=Math.abs((waku.chenjic/10)-2);
			bgm.volume=(waku.chenjic/10)-1;
		}else{
			kya.globalAlpha=waku.chenjic/10;
			bgm.volume=1-waku.chenjic/10;
		}
		kya.fillStyle='#000000';
		kya.fillRect(0,0,200,200);
		kya.restore();
		waku.chenjic++;
		if(waku.chenjic==10){
			bgm.pause();			
			waku.sute=waku.sutet;
			waku.mode='aruku';
			waku.aite='';
			nagi.mode='talk';
			mobu.hou='hidari';
			if(waku.sute=='nomiya'){				
				if(mobu.mode=='membamotikae'){
					mobu.mode='neru';					
					waku.aite=erufu;
					waku.aite.suki++;					
					waku.aite.mode='membakaifuku';
					waku.mode='serifu';
					mobu.x=32;mobu.y=37;
					nezu.tx=mobu.x;nezu.ty=mobu.y;
				}
			}
			if(waku.sute=='mori'){												
				nezu.tx=mobu.x;nezu.ty=mobu.y;
				surai.mode='stop';
			}			
			if(waku.sute=='koto'){				
				bgmori.kusa=bgmori.kusat;bgmori.hana=bgmori.hanat;
				mobu.mode='stop';mobu.hp=mobu.hp0;mobu.tinrebe=0;mobu.kusa=0;mobu.kane=0;mobu.hana=0;
				mobu.party=erufu;
				erufu.mode='talk';erufu.suki=0;				
				nagi.suki=0;nagi.mode='';				
			}
			if(waku.sute=='over'){
				bgover.kazu=0;
			}
			bgm.currentTime=0;
			if(waku.bgm&waku.sute!='intro'&waku.sute!='koto'){
				bgm.play();
			}			
		}else if(waku.chenjic==20){
			waku.chenjic=0;
			waku.chenji=false;
			nezu.osu=false;
		}		
	}	
};

onmousemove=function(e){
	if(Math.floor(e.clientX-((waku.yoko/2)-((waku.cyoko*waku.bai)/2)))<=0){
		nezu.x=0
	}else if(Math.floor(e.clientX-((waku.yoko/2)-((waku.cyoko*waku.bai)/2)))/waku.bai>=waku.cyoko){
		nezu.x=waku.cyoko;
	}else{
		nezu.x=Math.floor((e.clientX-((waku.yoko/2)-((waku.cyoko*waku.bai)/2)))/waku.bai);
	}
	if(e.clientY-((waku.tate/2)-((waku.ctate*waku.bai)/2))<=0){
		nezu.y=0;
	}else if(Math.floor((e.clientY-((waku.tate/2)-((waku.ctate*waku.bai)/2)))/waku.bai)>=waku.ctate){
		nezu.y=waku.ctate;
	}else{
		nezu.y=Math.floor((e.clientY-((waku.tate/2)-((waku.ctate*waku.bai)/2)))/waku.bai);
	};
};

onmousedown=function(e){	
	waku.yoko=window.innerWidth;
	waku.tate=window.innerHeight;
	
	if(Math.floor(e.clientX-((waku.yoko/2)-((waku.cyoko*waku.bai)/2)))<=0){
		nezu.x=0
	}else if(Math.floor(e.clientX-((waku.yoko/2)-((waku.cyoko*waku.bai)/2)))/waku.bai>=waku.cyoko){
		nezu.x=waku.cyoko;
	}else{
		nezu.x=Math.floor((e.clientX-((waku.yoko/2)-((waku.cyoko*waku.bai)/2)))/waku.bai);
	}
	if(e.clientY-((waku.tate/2)-((waku.ctate*waku.bai)/2))<=0){
		nezu.y=0;
	}else if(Math.floor((e.clientY-((waku.tate/2)-((waku.ctate*waku.bai)/2)))/waku.bai)>=waku.ctate){
		nezu.y=waku.ctate;
	}else{
		nezu.y=Math.floor((e.clientY-((waku.tate/2)-((waku.ctate*waku.bai)/2)))/waku.bai);
	};
	
	kya.imageSmoothingEnabled=false;
	kyan.style.left=(waku.yoko/2)-((waku.cyoko*waku.bai)/2);
	kyan.style.top=(waku.tate/2)-((waku.ctate*waku.bai)/2);
	okuri.p();
	
	if(!nezu.osu){		
		if(waku.sute=='map'){
			if(hbgm.c(nezu.x,nezu.y)){
				if(waku.bgm){
					waku.bgm=false;
					bgm.pause();
				}else{
					waku.bgm=true;
					bgm.play();
				}
			}else{
				if(hmori.c(nezu.x,nezu.y)){
					nezu.osu=true;
					waku.sutet='mori';
					waku.chenji=true;
					mobu.x=120;mobu.y=95;
					nezu.tx=mobu.x;
					nezu.ty=mobu.y;
				}else if(hnomi.c(nezu.x,nezu.y)){				
					nezu.osu=true;
					waku.sutet='nomiya';
					waku.chenji=true;				
					mobu.x=120;mobu.y=95;
					nezu.tx=mobu.x;
					nezu.ty=mobu.y;
				}		
			}
		}else if(waku.sute=='nomiya'){
			if(hbgm.c(nezu.x,nezu.y)){
				if(waku.bgm){
					waku.bgm=false;
					bgm.pause();
				}else{
					waku.bgm=true;
					bgm.play();
				}
			}else{
				if(waku.mode=='aruku'){
					nezu.tx=nezu.x;
					if(hnomit.c(nezu.tx,nezu.y)){
						nezu.ty=nezu.y;			
					}else{
						if(nezu.y<=hnomit.y){
							nezu.ty=hnomit.y+1;
						}else{
							nezu.ty=hnomit.y1;
						}
					}				
					mobu.mode='aruku';
				}else if(waku.mode=='serifu'){
					if(se.nx){
						se.next();
					}else{
						se.reset();						
						if(mobu.hp>0){
							if(mobu.mode=='neru'&mobu.party.mode=='oka'){								
								mobu.party.mode='kirai';
								mobu.party='';
								mobu.mode='membakaisan';
							}else{
								waku.mode='aruku';
								waku.aite.mode='talk';
								waku.aite='';
								mobu.mode='';
							}
						}else if(mobu.mode!='hp0'){
							mobu.mode='hp0';
							waku.aite.mode='hp0'
						}else{
							nezu.osu=true;
							waku.sutet='over';
							waku.chenji=true;
						}
					};
				}else{
					if(htinata.c(nezu.x,nezu.y)){						
						waku.aite.mode=waku.aite.namae+'nosou';						
						mobu.mode='damage';
						if(mobu.hp-waku.aite.hpx>0){
							mobu.hp-=waku.aite.hpx;							
						}else{							
							mobu.hp=0;							
						}
						waku.mode='serifu';
						zero();
					}else if(hkane.c(nezu.x,nezu.y)){						
						waku.aite.mode=waku.aite.namae+'nokanepan';						
						mobu.mode='damage';
						if(mobu.hp-waku.aite.hppan>0){
							mobu.hp-=waku.aite.hppan;							
						}else{
							mobu.hp=0;												
						}						
						zero();
						waku.mode='serifu';
					}else if(hnige.c(nezu.x,nezu.y)){
						waku.mode='serifu';
						zero();						
						waku.aite.mode=waku.aite.namae+'nokanepan';						
					}else if(hsen4.c(nezu.x,nezu.y)){
						waku.mode='aruku';
						waku.aite='';										
					}
				}
			}
		}else if(waku.sute=='mori'){
			if(hbgm.c(nezu.x,nezu.y)){
				if(waku.bgm){
					waku.bgm=false;
					bgm.pause();
				}else{
					waku.bgm=true;
					bgm.play();
				}
			}else{
				if(waku.mode=='serifu'){
					if(se.nx){
						se.next();
					}else{
						se.reset();
						zero();
						if(mobu.mode=='surai'){
							waku.mode='attack';						
						}else if(mobu.mode=='suraiata'){
							surai.mode='stop';							
							if(mobu.hp>0){
								waku.mode='attack';
								mobu.mode='stop';
							}else{
								waku.mode='serifu';
								mobu.mode='hp0'
							}
						}else if(mobu.mode=='eros'){
							if(waku.bgm){
								bgm.pause();
								bgm=bgm1;
								bgm.currentTime=0;
								bgm.play();
							}
							waku.mode='aruku';						
							mobu.mode='stop';
							erufu.mode='oka';
							waku.aite='';
						}else if(mobu.mode=='membamotikae'){
							nezu.osu=true;
							waku.chenji=true;
							waku.sutet='nomiya';						
						}else if(mobu.mode=='membaoka'){
							if(mobu.tinrebe<mobu.tinrebet){
								mobu.tinrebe++;
								otinre.p();
							}
							if(mobu.hp>mobu.hpx){
								mobu.hp-=mobu.hpx;
								mobu.mode='stop';
								waku.mode='aruku';
								waku.aite='';
							}else{
								mobu.hp=0;
								waku.mode='serifu';
								mobu.mode='hp0'
							}
						}else if(mobu.mode=='hp0'){
							if(waku.bgm){
								bgm.pause();
								bgm=bgm1;
								bgm.currentTime=0;
								bgm.play();
							}
							nezu.osu=true;
							waku.chenji=true;
							waku.sutet='over';
						}else{
							if(mobu.hp<=0){
								mobu.mode='hp0';
							}else{
								waku.mode='aruku';	
								mobu.mode='stop';	
								waku.aite='';
							}
						}
					}
				}else if(waku.mode=='attack'){
					if(mobu.mode=='memba'){
						if(hkane.c(nezu.x,nezu.y)){
							mobu.mode='membaoka';							
							waku.mode='serifu';
						}else if(htinata.c(nezu.x,nezu.y)){
							waku.mode='serifu';
							mobu.mode='membamotikae';
							if(mobu.hp>mobu.hpmotikae){
								mobu.hp-=mobu.hpmotikae;
							}else{
								mobu.hp=0;
							}
						}else if(hnige.c(nezu.x,nezu.y)){
							waku.mode='aruku';
							mobu.mode='aruku';
							waku.aite='';
						}
					}else if(mobu.mode=='kusa'){
						if(hkane.c(nezu.x,nezu.y)){
							mobu.mode='kusatori';
							waku.mode='serifu';
							if(mobu.kusa<99){
								mobu.kusa++;
								otinre.p();								
							}		
							bgmori.kusa-=1;	
						}else if(htinata.c(nezu.x,nezu.y)){
							waku.mode='aruku';
							mobu.mode='aruku';
							waku.aite='';
						}
					}else if(mobu.mode=='hana'){
						if(hkane.c(nezu.x,nezu.y)){
							mobu.mode='hanatori';
							waku.mode='serifu';
							if(mobu.hana<99){
								mobu.hana++;
								otinre.p();								
							}		
							if(bgmori.hana>0){
								bgmori.hana-=1;
							}
						}else if(htinata.c(nezu.x,nezu.y)){
							waku.mode='aruku';
							mobu.mode='aruku';
							waku.aite='';
						}
					}else{
						if(hkane.c(nezu.x,nezu.y)){
							waku.mode='serifu';
							mobu.mode='suraiata';
							surai.mode='kougeki';
							if(mobu.hp-surai.dmg>0){
								mobu.hp-=surai.dmg;
							}else{
								mobu.hp=0;														
							}
						}else if(htinata.c(nezu.x,nezu.y)&mobu.party!=''&mobu.party.mode!='oka'){
							if(mobu.hp>mobu.hpmaho){
								mobu.hp-=mobu.hpmaho;
								mobu.mode='eros';
								surai.mode='away';
								waku.aite='';
							}else{
								mobu.mode='hp0';
							}
							waku.mode='serifu';
							
						}else if(hnige.c(nezu.x,nezu.y)){
							if(waku.bgm){
								bgm.pause();
								bgm=bgm1;
								bgm.currentTime=0;
								bgm.play();
							}
							waku.mode='aruku';
							mobu.mode='aruku';
							waku.aite='';
						}
					}
				}else{
					nezu.tx=nezu.x;
					nezu.ty=nezu.y;
					mobu.mode='aruku';
					waku.aite='';				
				}
			}
		}else if(waku.sute=='sichou'){
			if(hbgm.c(nezu.x,nezu.y)){
				if(waku.bgm){
					waku.bgm=false;
					bgm.pause();
				}else{
					waku.bgm=true;
					bgm.play();
				}
			}else if(hanipu.c(nezu.x,nezu.y)){
				zero();
				if(waku.ani<waku.anit){					
					waku.ani++;
				}else{
					zero();
					waku.ani=1;
				}
			}else if(hanima.c(nezu.x,nezu.y)){
					zero();
					if(waku.ani>1){
						waku.ani--;
					}else{
						waku.ani=waku.anit;
					}
			}else if(haniba.c(nezu.x,nezu.y)){
				waku.ani=1;
				nezu.osu=true;
				waku.chenji=true;
				waku.sutet='koto';
			}
		}else if(waku.sute=='intro'){
			if(hsusu.c(nezu.x,nezu.y)){
				se.reset();
				nezu.osu=true;
				waku.chenji=true;
				waku.sutet='map';
			}else{
				if(se.nx){
					se.next();
				}else{
					se.reset();
					nezu.osu=true;
					waku.chenji=true;
					waku.sutet='map';
				}
			}
		}else if(waku.sute=='koto'){
			if(hsuta.c(nezu.x,nezu.y)){
				nezu.osu=true;
				waku.chenji=true;
				waku.sutet='intro';
			}else if(hanime.c(nezu.x,nezu.y)){
				nezu.osu=true;
				waku.chenji=true;
				waku.sutet='sichou';
				zero();
			}else if(hgpu.c(nezu.x,nezu.y)){				
				if(waku.cyoko*(waku.bai+1)<waku.yoko&waku.ctate*(waku.bai+1)<waku.tate){
					waku.bai++;
					kyan.height=waku.ctate*waku.bai;
					kyan.width=waku.cyoko*waku.bai;
					kya.scale(waku.bai,waku.bai);
					kya.imageSmoothingEnabled=false;
					kyan.style.left=(waku.yoko/2)-((waku.cyoko*waku.bai)/2);
					kyan.style.top=(waku.tate/2)-((waku.ctate*waku.bai)/2);
				}
			}else if(hgma.c(nezu.x,nezu.y)){
				if(waku.bai-1>0){
					waku.bai--;
					kyan.height=waku.ctate*waku.bai;
					kyan.width=waku.cyoko*waku.bai;
					kya.scale(waku.bai,waku.bai);
					kya.imageSmoothingEnabled=false;
					kyan.style.left=(waku.yoko/2)-((waku.cyoko*waku.bai)/2);
					kyan.style.top=(waku.tate/2)-((waku.ctate*waku.bai)/2);
				}
			}else if(hjp.c(nezu.x,nezu.y)){
				waku.gen='jp';
				se=hira;
				document.title='最弱異世界転生者はちんレベしか上がらない（体験版）';
			}else if(hen.c(nezu.x,nezu.y)){
				waku.gen='en';
				se=roma;
				document.title="Another world's weakest Reincarnated can only level up his cock(Trial Version)";
			}			
		}
	
	}
};

window.onload=function(){
	rifu=setInterval(rifuF,100);	
};
