var wbp=480;
var hbp="320";

//いらなくなり
if(!aaanime_films){
var aaanime_films =new Object();
}else{
//alert("二重読み込み")
}


//AA the mov クラス
var AAAnime = function(mid){
	this.mid = mid;
	this.run = false;
	this.fs  = new Array("test0","test1","test2");
	this.f =-1;
	this.f_msec=1000;
}
//エレメント取得系
AAAnime.prototype.gid = function(id){
	return document.getElementById(id);
}
AAAnime.prototype.setDisplay = function(id,v){
	var eid = document.getElementById(id);
	if(eid != null){
		if(v){
			eid.style.display="inline";
		}else{
			eid.style.display="none";
		}
	}
}


//次へ
AAAnime.prototype.next= function() {
	this.f++;
	if (this.f >= this.fs.length) {this.f = 0;}
	this.gid("aaanime_disp_"+this.mid).innerHTML=this.fs[this.f];
}
AAAnime.prototype.pre= function() {
	this.f--;
	if (this.f > this.fs.length) {this.f = this.fs.length -1;}
	if (this.f < 0 ) {this.f = this.fs.length-1;}
	this.gid("aaanime_disp_"+this.mid).innerHTML=this.fs[this.f];

}

//コマ送り
AAAnime.prototype.next_f= function() {
this.run=false;
this.next();
}
//コマ戻し
AAAnime.prototype.pre_f= function(){
this.run=false;
this.pre();
}




AAAnime.prototype.setRun= function(p) {
	this.run=p;
	this.updateCtrl();
}
AAAnime.prototype.updateCtrl= function() {
	if(this.run){
		this.setDisplay("aaanime_ctrl_play_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_stop_"+this.mid,true);
		this.setDisplay("aaanime_ctrl_pause_"+this.mid,true);
		this.setDisplay("aaanime_ctrl_next_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_pre_"+this.mid,false);

		this.setDisplay("aaanime_ctrl_play_h_"+this.mid,true);
		this.setDisplay("aaanime_ctrl_stop_h_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_pause_h_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_next_h_"+this.mid,true);
		this.setDisplay("aaanime_ctrl_pre_h_"+this.mid,true);

	}else{
		this.setDisplay("aaanime_ctrl_play_"+this.mid,true);
		this.setDisplay("aaanime_ctrl_stop_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_pause_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_next_"+this.mid,true);
		this.setDisplay("aaanime_ctrl_pre_"+this.mid,true);

		this.setDisplay("aaanime_ctrl_play_h_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_stop_h_"+this.mid,true);
		this.setDisplay("aaanime_ctrl_pause_h_"+this.mid,true)
		this.setDisplay("aaanime_ctrl_next_h_"+this.mid,false);
		this.setDisplay("aaanime_ctrl_pre_h_"+this.mid,false);
;
	}

}


//次へ
AAAnime.prototype.reset= function() {
	this.setRun(false);
	this.f=0;
	this.gid("aaanime_disp_"+this.mid).innerHTML=this.fs[this.f];
}
AAAnime.prototype.stat= function() {
	this.setRun(!this.run);
	if (this.run) {this.show();}
}

AAAnime.prototype.show= function() {
	if (!this.run){return false;}
	this.next();
	funcstr ="aaanime_films['"+this.mid+"'].show()";
	if (this.run) setTimeout(funcstr,this.f_msec);

}

AAAnime.prototype.upcurrentfilm=function(){
	if (!this.run){
		if (this.f >= this.fs.length) {this.f = 0;}
		this.gid("aaanime_disp_"+this.mid).innerHTML=this.fs[this.f];
	}
}
AAAnime.prototype.setFmsec=function(msec){
	this.f_msec=msec;
}
AAAnime.prototype.setFontSize=function(size){
	disp = this.gid("aaanime_disp_"+this.mid);
	if(size ==""){
		size=10;
	}
	disp.style.fontSize=size+"pt";
 	return size;
}
AAAnime.prototype.setFontFamilly=function(type){
	disp = this.gid("aaanime_disp_"+this.mid);
	if(type=="t"){
		disp.style.fontFamily="ＭＳ ゴシック";
	}else{
		disp.style.fontFamily='"Mona","IPA MONAPGOTHIC","MS PGothic","ＭＳ Ｐゴシック","MS Pｺﾞｼｯｸ","MS Pゴシック",sans-serif';

	}
	return disp.style.fontFamily;
}

AAAnime.prototype.setFontColor=function(col){
	disp = this.gid("aaanime_disp_"+this.mid);
	if(col ==""){
		col="000000";
	}
	disp.style.color="#"+col;
 	return col;
}
AAAnime.prototype.setBgColor=function(col){
	disp = this.gid("aaanime_disp_"+this.mid);
	if(col ==""){
		col="FFFFFF";
	}
	disp.style.background="#"+col;
 	return col;
}
AAAnime.prototype.setBorderColor=function(col){
	disp = this.gid("aaanime_disp_"+this.mid);

	if(col ==""){
		col="000000";
	}
	disp.style.border=" 1px solid #"+col;
 	return col;
}

AAAnime.prototype.setDispWidth=function(size){
	disp = this.gid("aaanime_disp_"+this.mid);
	if(size ==""){
		size=320;
	}
	disp.style.width=size+"px";
 	return size;

}
AAAnime.prototype.setDispHeight=function(size){
	disp = this.gid("aaanime_disp_"+this.mid);
	if(size ==""){
		size=240;
	}
	disp.style.height=size+"px";
 	return size;

}
AAAnime.prototype.setFilm=function(film){

film = film.replace(/\r/g,"");
film = film.replace(/&/g,"&amp;");
film = film.replace(/"/g,"&quot;");
film = film.replace(/'/g,"&#039;");

film = film.replace(/</g,"&lt;");
film = film.replace(/>/g,"&gt;");
film = film.replace(/\n/g,"<br/>");
film = film.replace(/ /g,"&nbsp;");
	
	this.fs = film.split("---split---<br/>");
	this.upcurrentfilm();
}

AAAnime.prototype.convHtmlEnt=function(str){
}


AAAnime.prototype.onload=function(){
	this.f= -1;
//	this.next();//1枚目をセット

	if (!this.run){	this.next();}

	this.show();
	this.updateCtrl();
	
}
