//
//	(c)2004 GE Medical Systems
//

var _rgctlMgr = new Array();

//
// ControlMgr
//
function ControlMgr(strID)
{
	this._rgelement			= new Array();
	this._rgproperty		= new Object();
	this._strID				= strID;
	this._subjectSettings	= null;
	this._observerSettings	= null;
	this._stateHTML			= new Object();
	this._bControlShown     = true;
}


//
// ControlMgr.prototype.OnClick
//
function ControlMgr.prototype.OnClick(event)
{ with (this) {
	Invoke(event);
}}


//
// ControlMgr.prototype.Invoke
//
function ControlMgr.prototype.Invoke(e)
{ with (this) {
}}


//-------------------------- Print control manager ------------------------------------

DeriveFrom(CtlPrint, ControlMgr);

//
//	ctor()
//
function CtlPrint(element)
{ 
	this.CtorControlMgr(element.id);
	this._strHeader	= "";
	this._strBody	= "";
	this._element	= element;
}

//
//	SetState()
//
function CtlPrint.prototype.SetState(bDisable)
{ with (this) {
	_element.disabled		= bDisable;
	_element.className		= bDisable == true ? 'disabled' : 'enabled';
}}


//
// CtlPrint.prototype.OnNotifyReport
//
function CtlPrint.prototype.OnNotifyReport(report)
{ with (this) {
	if (report == null || report._strBody == null)
	{
		_strHeader = "";
		_strBody = "";
		SetState(true);
		return;
	}

	_strHeader = report._strHeader;
	_strBody   = report._strBody;
	SetState(false);
}}


//
// CtlPrint.prototype.Invoke
//
function CtlPrint.prototype.Invoke()
{ with (this) {

	var strSettings = "dialogwidth:100px; dialogheight:100px; scroll:yes; help:no; status:no";
	showModalDialog("dialog.htm", this, strSettings);
}}


//
// CtlPrint.prototype.OnLoadDialog
//
function CtlPrint.prototype.OnLoadDialog(windowDlg)
{ with (this) {
	var bClient = (_strBody.indexOf("OnloadClientReport") != -1);

	var strHtml;

	if (bClient)
		strHtml = "<TABLE style='width:100%; height:100%;'><TR height=1><TD>" + _strHeader +
			"</TD></TR><TR><TD>" + _strBody + "</TD></TR></TABLE>";
	else
		strHtml = _strHeader + '<div id="divPrintReportBody">' + _strBody + '</div>';

	windowDlg.SetHTML(strHtml);
	windowDlg.BeginPrintWindow(bClient);
}}


//
// CtlPrint.prototype.OnAfterPrintWindow
//
function CtlPrint.prototype.OnAfterPrintWindow(windowDlg)
{ with (this) {

	windowDlg.CloseWindow();
}}


//
// CtlPrint.prototype.GetDialogTitle
//
function CtlPrint.prototype.GetDialogTitle()
{ with (this) {

	return GetApp().GetLocaleString('msgPrintTitle');
}}


//
// CtlPrint.prototype.GetStyleSheetLink
//
function CtlPrint.prototype.GetStyleSheetLink()
{ with (this) {

	var strLink = '<LINK HREF="' + 'print.css"';
	strLink += 'REL="stylesheet" TYPE="text/css"></LINK>';

	return strLink;
}}


