/****************************************************************************
*	
*	Class:		CWindowFrame
*
*	Purpose:	Window Frame
*
*	Author:		Sky Stebnicki, sky.stebnicki@aereus.com
*				Copyright (c) 2006 Aereus Corporation. All rights reserved.
*
*****************************************************************************/
function CWindowFrame(label, width, padding, context)
{
	// WFOuter
	this.m_div = ALib.m_document.createElement("div");
	ALib.Dom.styleSetClass(this.m_div, "CWindowFrameOuter");
	if (width)
		ALib.Dom.styleSet(this.m_div, "width", width);
	
	var lbl_div = ALib.Dom.createElement("div", this.m_div);
	this.m_lbl_div = lbl_div;
	ALib.Dom.styleSetClass(lbl_div, "CWindowFrameLabel");

	// Context content is displayed to the right of the label - commonly used for pagination
	var con_div = ALib.Dom.createElement("div", lbl_div);
	ALib.Dom.styleSetClass(con_div, "CWindowFrameContext");
	this.m_context_div = con_div;
	if (context && lbl_div)
	{
		// WFLabel
		con_div.innerHTML = context;
	}

	if (label)
	{
		if (typeof label == "string")
		{
			var sp = ALib.Dom.createElement("span", lbl_div);
			sp.innerHTML = label;
		}
		else
		{
			lbl_div.appendChild(label);
		}
	}
	
	// Content
	var cell_pad = (padding) ? padding : '3px';
	this.m_con_div = ALib.m_document.createElement("div");
	ALib.Dom.styleSetClass(this.m_con_div, "CWindowFrameContent");
	ALib.Dom.styleSet(this.m_con_div, "padding", cell_pad);
	this.m_div.appendChild(this.m_con_div);
}

CWindowFrame.prototype.getCon = function ()
{
	return this.m_con_div;
}

CWindowFrame.prototype.getTitleCon = function ()
{
	return this.m_lbl_div;
}

CWindowFrame.prototype.getContextCon = function ()
{
	return this.m_context_div;
}

CWindowFrame.prototype.getFrame = function()
{
	return this.m_div;
}

CWindowFrame.prototype.print = function(div_parent)
{
	if (div_parent)
		div_parent.appendChild(this.getFrame());
	else
		document.write(this.m_div.outerHTML);
}

