window.onload = function() {
if ( obj=document.getElementById("JsLogin") )
{
ObjLogin=new anim1("ObjLogin", "JsLogin",400,300);
//~ document.body.appendChild(obj);
}
}

function anim1(_myName, _id, _width, _height) {
//Variable de la classe
this.myName =_myName;
this.id =_id;
this.xCur =0;
this.yCur =0;
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)/2);
this.yEnd=((winH-this.hEnd)/2);

document.getElementById(this.id).style.display="block";
this.cmd ="";
this.startLoop();
};

this.end = function() {
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 > 0 ));
this.calc("yCur-", ( this.yCur > 0 ));
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 + "()",20);
}
else
eval(this.cmd);
};

this.calc = function (action, cond) {
if ( cond )
{
eval(this.myName + "." + action + "=40");
this.continu=true;
}
};
}