// JavaScript Document
function anim1(_myName, _id, _width, _height) {
	this.isOver=true;
	//Variable de la classe
	this.myName	=_myName;
	this.id	=_id;
	this.xCur=0;
	this.yCur=20;
	this.xEnd=0;
	this.yEnd=0;
	this.wCur=0;
	this.hCur=0;
	this.wEnd=_width;
	this.hEnd=_height;
	this.continu=false;
	this.timer=null;
	this.cmd="";
	
	//Méthode de la classe	
	this.start= function() {
		if (document.all) {
			winX=screen.width;
			winH=screen.height;
		}
		else {
			winX=window.innerWidth;
			winH=window.innerHeight;
		}
		this.xEnd=((winX-this.wEnd)/1.5);
		this.yEnd=((winH-this.hEnd)/7);

		this.isOver=true;

		document.getElementById(this.id).style.display="block";
		this.cmd	=this.myName + ".isOver=false";
		this.startLoop();
	};
	
	this.end	= function() {
		if ( !this.isOver )
		{
			this.cmd	='document.getElementById(this.id).style.display="none";';
			this.endLoop();
		}
	};
	
	this.startLoop = function() {
		this.continu=false;
		this.calc("wCur+", ( this.wCur < this.wEnd ));
		this.calc("hCur+", ( this.hCur < this.hEnd ));
		this.calc("xCur+", ( this.xCur < this.xEnd ));
		this.calc("yCur+", ( this.yCur < this.yEnd ));
		this.flush("startLoop");
	};
	
	this.endLoop = function () {
		this.continu=false;
		this.calc("wCur-", ( this.wCur > 0 ));
		this.calc("hCur-", ( this.hCur > 0 ));
		this.calc("xCur-", ( this.xCur > -10 ));
		this.calc("yCur-", ( this.yCur > -10 ));
		this.flush("endLoop");
	};
	
	this.flush = function (action) {
		if ( this.continu )
		{
			document.getElementById(this.id).style.left=this.xCur + "px";
			document.getElementById(this.id).style.top=this.yCur + "px";
			document.getElementById(this.id).style.width=this.wCur + "px";
			document.getElementById(this.id).style.height=this.hCur + "px";
			this.timer=setTimeout(this.myName + "." + action + "()",10);
		}
		else
			eval(this.cmd);
	};
	
	this.calc = function (action, cond) {
		if ( cond )
		{
			eval(this.myName + "." + action + "=20");
			this.continu=true;
		}
	};
}