function TLayer()
{
  this.name='';
  this.x1=0;
  this.y1=0;
  this.x2=100;
  this.y2=100;
  this.layerNr=100;
  this.time=1;
  this.styl="";
  this.bgColor=-1;
  this.shown=false;
  this.positionType="static";
  this.created=false;
  this.opened=false;
  this.showOnMouseOver=false;
  this.hideOnMouseOut=false;

  this.Define=Define;
  this.Open=Open;
  this.Close=Close;
  this.Create=Create;
  this.Put=Put;
  this.Remove=Remove;
  this.SetPos=SetPos;
  this.SetPositionType=SetPositionType;
  this.ChangeContent=ChangeContent;
  this.SetShowOnMouseOver=SetShowOnMouseOver;
  this.SetHideOnMouseOut=SetHideOnMouseOut;
  //----------------------------------------------------
  function Define(name,x1,y1,sizeX,sizeY,layerNr,time,styl,bgColor)
  {
  if (!layerNr) layerNr=0;
  if (!time) time=0;
  if (!bgColor) bgColor=-1;
  if (!styl) styl=0;

  this.name=name;
  this.x1=x1;
  this.y1=y1;
  this.x2=x1+sizeX;
  this.y2=y1+sizeY;
  this.layerNr=layerNr;
  this.time=time;
  this.styl=styl;
  this.bgColor=bgColor;
  }
  //----------------------------------------------------
  
  function SetHideOnMouseOut(hide)
  {
    this.hideOnMouseOut=hide;
  }
  
  function SetShowOnMouseOver(show)
  {
    this.showOnMouseOver=show;
  }

  function Open()
  {
   var sizeX=(this.x2)-(this.x1);
   var sizeY=(this.y2)-(this.y1);

   if (sizeX<=0||sizeY<=0) alert('ERROR: Size <=0 : [sizeX:'+this.sizeX+',sizeY:'+this.sizeY+'](TLayer::Open())');

   if (!this.styl) this.styl='';
   var hideStr='';
   var showStr='';
   if (this.hideOnMouseOut) hideStr=' onmouseout=\'javascript:'+this.name+'.Remove();\'';
   if (this.showOnMouseOver) showStr=' onmouseover=\'javascript:'+this.name+'.Put();\'';

   if (this.bgColor==-1)
   {
     if (!Netscape()&&!Opera()) document.write('<div id="'+this.name+'"  '+this.styl+showStr+hideStr+' style="position: '+this.positionType+'; visibility: hidden; top: '+this.y1+'; left: '+this.x1+'; width: '+sizeX+'; height: '+sizeY+'; z-index: '+this.layerNr+'; filter:blendTrans(Duration='+this.time+')";>');
//     else if (Mozilla()) document.write('<layer name="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hidden; width:'+sizeX+';height:'+sizeY+';\" top='+this.y1+' left='+this.x1+' visibility=hide z-index='+this.layerNr+'>');
     else if (Mozilla()) document.write('<div id="'+this.name+'"  '+this.styl+showStr+hideStr+' style="position: '+this.positionType+'; visibility: hidden; top: '+this.y1+'; left: '+this.x1+'; width: '+sizeX+'; height: '+sizeY+'; z-index: '+this.layerNr+'; filter:blendTrans(Duration='+this.time+')";>');
//     else if (Opera()) document.write('<layer id="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hidden; width:'+sizeX+';height:'+sizeY+';top:'+this.y1+';left:'+this.x1+'\" z-index='+this.layerNr+'>');
     else if (Opera()) document.write('<div id="'+this.name+'"  '+this.styl+showStr+hideStr+' style="position: '+this.positionType+'; visibility: hidden; top: '+this.y1+'; left: '+this.x1+'; width: '+sizeX+'; height: '+sizeY+'; z-index: '+this.layerNr+'; filter:blendTrans(Duration='+this.time+')";>');
     else document.write('<layer name="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';\" top='+this.y1+' left='+this.x1+' width='+sizeX+' height='+sizeY+' visibility=hide z-index='+this.layerNr+'>');
   }
   else
   {
     if (!Netscape()&&!Opera()) document.write('<div id="'+this.name+'"  '+this.styl+showStr+hideStr+' style="background-color:'+this.bgColor+';position: '+this.positionType+'; visibility: hidden; top: '+this.y1+'; left: '+this.x1+'; width: '+sizeX+'; height: '+sizeY+'; z-index: '+this.layerNr+'; filter:blendTrans(Duration='+this.time+')";>');
//     else if (Mozilla()) document.write('<layer id="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hidden; width:'+sizeX+';height:'+sizeY+';background-color:'+this.bgColor+';\" top='+this.y1+' left='+this.x1+' z-index='+this.layerNr+'>');
//     else if (Mozilla()) document.write('<layer id="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hidden; width:'+sizeX+';height:'+sizeY+';background-color:'+this.bgColor+';top:'+this.y1+';left:'+this.x1+'\" z-index='+this.layerNr+'>');
//     else if (Mozilla()) document.write('<layer id="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hide; width:'+sizeX+'px;height:'+sizeY+'px;background-color:'+this.bgColor+';top:'+this.y1+';left:'+this.x1+'\" z-index='+this.layerNr+'>');     

     else if (Mozilla()) document.write('<div id="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hidden; width:'+sizeX+'px;height:'+sizeY+'px;background-color:'+this.bgColor+';top:'+this.y1+';left:'+this.x1+'\" z-index='+this.layerNr+'>');

//     else if (Opera()) document.write('<layer id="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hidden; width:'+sizeX+';height:'+sizeY+';background-color:'+this.bgColor+';top:'+this.y1+';left:'+this.x1+'\">');
//     else if (Opera()) document.write('<div id="'+this.name+'"  '+this.styl+showStr+hideStr+' style="background-color:'+this.bgColor+';position: '+this.positionType+'; visibility: hidden; top: '+this.y1+'; left: '+this.x1+'; width: '+sizeX+'; height: '+sizeY+'; z-index: '+this.layerNr+';">');
     else if (Opera()) document.write('<div id="'+this.name+'" '+this.styl+showStr+hideStr+' style=\"position:'+this.positionType+';visibility:hidden; width:'+sizeX+'px;height:'+sizeY+'px;background-color:'+this.bgColor+';top:'+this.y1+';left:'+this.x1+'\" z-index='+this.layerNr+'>');
     else document.write('<layer name="'+this.name+'" '+this.styl+showStr+hideStr+' bgColor='+this.bgColor+' style=\"position:'+this.positionType+';" top='+this.y1+' left='+this.x1+' width='+sizeX+' height='+sizeY+' visibility=hide z-index='+this.layerNr+'>');
     
   }
   this.opened=true;
  }
  //----------------------------------------------------
  function Close()
  {
//    if (!Netscape()&&!Opera()) document.write('</div>');
    if (!Netscape()||Mozilla()) document.write('</div>');
    else if (Opera()) document.write('</div>');
    else document.write('</layer>');
    this.created=true;
  }
  //----------------------------------------------------
  function Create()
  {
    this.Open();
    document.write('&nbsp');
    this.Close();
  }
  //----------------------------------------------------
  function Put()
  {
   if (this.shown) return;
   if (!Netscape()&&!Opera())
   {
     document.all[''+this.name].filters.blendTrans.Apply();
     document.all[''+this.name].style.visibility="visible";
     document.all[''+this.name].filters.blendTrans.Play();
   }
   else
   {
     if (Mozilla()||Opera()) eval('document.getElementById("'+this.name+'").style.visibility="visible";');
     else document.layers[this.name].visibility="show";
   }
   this.shown=true;
  }
  //----------------------------------------------------
  function Remove()
  {
   if (!this.shown) return;
   if (!Netscape()&&!Opera())
    {
     document.all[''+this.name].filters.blendTrans.Apply();
     document.all[''+this.name].style.visibility="hidden";
     document.all[''+this.name].filters.blendTrans.Play();
    }
   else
    {
     if (Mozilla()||Opera()) eval('document.getElementById("'+this.name+'").style.visibility="hidden";');
     else document.layers[''+this.name].visibility="hide";
    }
   this.shown=false;
  }
  //----------------------------------------------------
  function SetPos(x,y)
  {
  var sizeX=this.x2-this.x1;
  var sizeY=this.y2-this.y1;

    this.x1=x;
    this.y1=y;
    this.x2=x+sizeX;
    this.y2=y+sizeY;

    if (!Netscape())
    {
      document.all[''+this.name].style.pixelLeft=x;
      document.all[''+this.name].style.pixelTop=y;
    }
    else
    {
      if (Mozilla())
      {
        eval('document.getElementById("'+this.name+'").style.left=x;');
        eval('document.getElementById("'+this.name+'").style.top=y;');
      }
      else
      {
        document.layers[''+this.name].left=x;
        document.layers[''+this.name].top=y;
      }
    }
  }
  
  function SetPositionType(posType)
  {
    this.positionType=posType;
  }

  function ChangeContent(content)
  {
    if (!this.opened) alert("Can't change content. Open layer before!");
    if (!this.created) document.write(content);
    else
    {
      if (!Netscape()) document.all[this.name].innerHTML=content;
      else
      {
        if (!Mozilla())
        {
          document.layers[this.name].document.open();
          document.layers[this.name].document.write(content);
          document.layers[this.name].document.close();
        }
        else document.getElementById(this.name).innerHTML=content;
      }
    }
  }
}

