///////////////////////////////////////////////////////////////////CONSTRUCTOR
function Label(n, s, f, t)
//label object
//////////////////////////////////////////////////////////////////////////////
{
	this.name=n;
  this.type ="label"
	this.style=s;
	this.text=t;	
	this.Write=lWrite;
	this.Draw=lWrite;  
	this.StyleWrite=lStyleWrite;
	this.SetText=lSetText;
	this.Move=lMove;
  this.Hide=mHide;

	this.Resize=lResize;
	if(f)
		this.frame=f;
  this.GetDivName = lGetDivName;
  this.GetDiv = lGetDiv;  
}
  //////////////////////////////////////////////////////////////////////method
  function lGetDivName()
  //
  ////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==NS)
      d = ("self.document." + this.name + "div");
    else if(browsertype==MOZILLA || browsertype == SAFARI) // KRG
      d = document.getElementById(this.name+"div").id;
    else
      d = ("self." + this.name + "div");    
    return d;
  }
  //////////////////////////////////////////////////////////////////////method
  function lGetDiv()
  //
  ////////////////////////////////////////////////////////////////////////////
  {
    if(browsertype==MOZILLA || browsertype == SAFARI) // KRG
      return document.getElementById(this.name+"div");
    else
      return eval(this.GetDivName());
  }
  //////////////////////////////////////////////////////////////////////method  
	function lResize(x,y)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		this.style.height=y;
		this.style.width=x;
		DivSize(this.frame, this.name+"div", x, y);
    DivClip(this.frame, this.name+"div", 0,x,y,0);

    this.SetText(this.text);
	}
  //////////////////////////////////////////////////////////////////////method
	function lMove(x, y)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		this.style.y=y;
		this.style.x=x;
		DivMoveByName(this.frame, this.name+"div", y, x);
	}
  //////////////////////////////////////////////////////////////////////method
	function lStyleWrite(f)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		this.style.WriteHeader(f);
	}
  //////////////////////////////////////////////////////////////////////method
	function lWrite(f)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		if(f)
			this.frame=f;
		else
			f=this.frame;
		d=this.frame.document;

    if(browsertype==NS)
      d.write('<layer name="' + this.name + 'div"  ' + this.style.layerstyle() + '" >');
    else
		  d.write("<div id='" + this.name + "div' class='" + this.style.name + "'>");
      
		if(!this.text)
      this.text = "&nbsp;";
    
	
	  d.write("<table bgcolor='" + this.style.backgroundcolor + "' height='" + this.style.height + "' width='" + this.style.width + "' cellpadding=0 cellspacing=0>");
  	d.write("<tr><td align=center valign=center  height='" + this.style.height + "' width='" + this.style.width + " bgcolor='" + this.style.backgroundcolor + "'>");
  	d.write("<font class='" + this.style.fontcss + "'>")		
  	if(this.style.fstyle=="bold")
  		d.write("<b>");
  	d.write(this.text);
  	d.write("</font>");
  	d.write("</td></tr>");		
  	d.write("</table>");
    if(browsertype=="NS")
  	d.write("</LAYER>");
    else
    	d.write("</div>");
      
      
	}
  //////////////////////////////////////////////////////////////////////method
	function lSetText(t)
  //
  ////////////////////////////////////////////////////////////////////////////
	{
		var anchorstr;
		var textstr;
		var endanchorstr;
		
		///////argghhh... if this is a html string, parse through it so we get our font stuff right
		if(t.indexOf(">") > -1)
		{
			
			t=t.replace(/>/, "><font class='" + this.style.fontcss + "'>");
			t=t.replace(/</, "</font><");			
		}
		else
		{
			t="<font class='" + this.style.fontcss + "'>" + t + "</font>";
		}
		
		this.text=t;
		
		t="<table bgcolor='" + this.style.backgroundcolor + "' height='" + this.style.height + "' width='" + this.style.width + "'>";
		t+="<tr><td bgcolor='" + this.style.backgroundcolor + "'>";
		if(this.style.fstyle=="bold")
			t+="<b>";
		t+=this.text;
		t+="</td></tr>";		
		t+="</table>";
		DivWrite(this.GetDiv(), t);

	}
