function TBannerLayer(objectName)
{
  this.objectName=objectName;
  this.height=0;
  this.width=0;
  this.timer=0;
  this.delayTimer=0;
  this.status=0;
  this.startPosY=0;
  this.startPosX=0;

  this.Init = Init;

  this.GetWindowSizeX = GetWindowSizeX;
  this.GetWindowSizeY = GetWindowSizeY;

  this.Init();

  function Init()
  {
  	this.timer=new TTimer(300);
  	this.delayTimer=new TTimer(0);
  }


  function GetWindowSizeX()
  {
   if (window.innerWidth) return window.innerWidth;
   else if (document.body && document.body.offsetWidth) return document.body.offsetWidth;
  }

  function GetWindowSizeY()
  {
   if (window.innerHeight) return window.innerHeight;
   else if (document.body && document.body.offsetHeight) return document.body.offsetHeight;
  }


  this.ShowBanner = function ShowBanner (left,top,width,height)
  {
    var wSizeX=parseInt(this.GetWindowSizeX());
    var wSizeY=parseInt(this.GetWindowSizeY());

    this.height=height;
    this.width=width;

    document.write("<div onmouseover=\"MoveBannerToFront();\" onmouseout=\"MoveBannerToBack();\"; id="+this.objectName+" style=\"position:absolute; z-index:3; left: "+left+"px; top: "+top+"px; border: 0px none #AAAAAA; visibility: visible\"><table cellspacing=0 cellpadding=0><tr><td>");
    document.write("<iframe id='bannerContent' name='bannerContent' marginwidth=0 marginheight=0 width="+width+" height="+height+" scrolling=\"no\" src='banner.php'></iframe>");
    document.write("</td></tr></table></div>");
  }

  this.MoveTo = function MoveTo(endPosX,endPosY,maxTi,minBHeight,minBWidth,maxDelayTi)
  {
   	var bannerLayerObj=document.getElementById(this.objectName);
  	var bannerContentObj=document.getElementById("bannerContent");

  	if (this.status==0)
  	{
  		this.delayTimer.SetMaxTi(maxDelayTi);
  		this.delayTimer.Start();
  		this.status=-1;
  	}

  	if (this.status==-1)
  	{
  		if (this.delayTimer.Check()==1)
  		{
  			this.status=1;
  			this.timer.SetMaxTi(maxTi);
  			this.timer.Start();
  		}
  	}

  	if (this.status==1)
  	{
  		this.startPosX=parseInt(bannerLayerObj.style.left);
  		this.startPosY=parseInt(bannerLayerObj.style.top);
 	  	this.startBHeight=parseInt(bannerLayerObj.clientHeight);
 		  this.startBWidth=parseInt(bannerLayerObj.clientWidth);

    	var timeFactor=this.timer.Check();
    	var curPosX=this.startPosX+(endPosX-this.startPosX)*timeFactor;
    	var curPosY=this.startPosY+(endPosY-this.startPosY)*timeFactor;
    	var curBHeight=this.startBHeight+(minBHeight-this.startBHeight)*timeFactor;
    	var curBWidth=this.startBWidth+(minBWidth-this.startBWidth)*timeFactor;

      bannerLayerObj.style.top=curPosY;
      bannerLayerObj.style.left=curPosX;
      bannerLayerObj.style.width=curBWidth;
      bannerLayerObj.style.height=curBHeight;
      if (timeFactor==1) this.status=0;
      return timeFactor;
    }
    return 0;
  }


  this.Redraw = function Redraw(a,b)
  {
  	location.reload();
  }
}
