/**
 *  window class
 */

/**
 *  sets the content of the window
 */
function THWindow_set_content(new_content)
{
  if (typeof(new_content) == "string")
	{
    this.value = new_content;
		this.label.set(this.header + this.value + this.footer);
  }
} 

/**
 *  creates the body
 */
function THWindow_content()
{
  if (typeof(this.body) == "function")
	{
    this.body();                
  }
	else
	{
    document.write(this.body);
  }
}

/**
 *  creates the window content
 */
function THWindow_body()
{
  with (this)
	{
    this.label = new THLabel(this, "label", header + value + footer);
  }
}
 
/**
 *  constructor
 */
function THWindow(parent, name, x, y, width, height, value, header, footer, visible, effects, opacity, zindex)
{
  this.init(parent, name);
  this.x = x - 0;
  this.y = y - 0;
	this.content = THWindow_content;	
  this.width = width;
  this.height = (typeof(height) == "number") ? height : null;
  this.value = typeof(value) == "string" ? value : "";
	this.header = typeof(header) == "string" ? header : "";
	this.footer = typeof(footer) == "string" ? footer : "";
	this.body = THWindow_body;
  var j = THWindow.arguments.length;
  this.visible = (j > 7) ? visible : true;
  this.effects = (j > 8) ? effects : 0;
  this.opacity = (j > 9) ? opacity : 100;
  this.zindex  = (j > 10) ? zindex : null;
	this.setContent = THWindow_set_content;
  this.create();
}

THWindow.prototype = new THWndCtrl();
