//
// /tj/2002-02/ SAPGUI for HTML Window and Frame Management
//


var __wgu_dbg_frames5050 = false;

var __wgu_winframe_static = {
	_mimeurl		        : ((typeof document.webguiMimeURL != "undefined") ? document.webguiMimeURL : "/sap/its/mimes"),
	_imghourglass	      : this._mimeurl + "/webgui/99/images/img/hourglass.gif",
	_emptypage		      : this._mimeurl + "/system/99/page/webgui_empty.html",
	_emptystatuswinpage : this._mimeurl + "/system/99/page/webguistatuswin_empty.html"
}



////////////////////////////////////////////////////////////////////////////////
//
// Generic Tools
//
// Interface:
//		Function		wgu_IsObject ()
//								wgu_NewUniqueWindowName ()
//								wgu_IsWindowAccessible ()
//								wgu_IsParentAccessible ()
//								wgu_TrySetDocumentDomainParentDependend ()
//								wgu_waitForParentAccess ()
//								wgu_waitForParentJSObjectAccess ()
//
////////////////////////////////////////////////////////////////////////////////


function wgu_IsObject ( in_element )
{
	if (in_element != null)
		return eval( "typeof( " + in_element + ") == 'object'");
	else
		return null;
}	// wgu_IsObject()


function wgu_NewUniqueWindowName ()
{
	return( "wguwin_" + (""+Math.random()).substr( 2));
}	// wgu_NewUniqueWindowName()


function wgu_IsWindowAccessible ( in_winRef )
{
	if (in_winRef != null) {
		if (typeof( in_winRef.document) == "object")
			return true;
		else
			return false;
	}
	else return void( 0);
}	// wgu_IsWindowAccessible()


function wgu_IsParentAccessible()
{
	if (parent != null) {
		if (wgu_IsObject( "parent.document"))
			return true;
		else
			return false;
	}
	else return void( 0);
}	// wgu_IsParentAccessible()


function wgu_IsOpenerAccessible()
{
	if (opener != null) {
		if (wgu_IsObject( "opener.document"))
			return true;
		else
			return false;
	}
	else return void( 0);
}	// wgu_IsOpenerAccessible()


function wgu_TrySetDocumentDomainParentDependend ()
{	var rc = true;
	var strDomain = document.domain;
	var i;
	while (!wgu_IsParentAccessible ()) {
		if (strDomain == '') {
			rc = false;
			break;
		}
		i = strDomain.indexOf( '.');
		if ( i == -1 || i == strDomain.lastIndexOf( '.')) {
			strDomain = '';
			try { document.domain = strDomain; } catch (e) { rc = false; break; }
			continue;
		}
		else {
			strDomain = strDomain.substr( i+1);
			document.domain = strDomain;
		}
	}	// while ()
	return rc;
}	// wgu_TrySetDocumentDomainParentDependend()


function wgu_TrySetDocumentDomainOpenerDependend ()
{	var rc = true;
	var strDomain = document.domain;
	var i;
	while (!wgu_IsOpenerAccessible ()) {
		if (strDomain == '') {
			rc = false;
			break;
		}
		i = strDomain.indexOf( '.');
		if ( i == -1 || i == strDomain.lastIndexOf( '.')) {
			strDomain = '';
			try { document.domain = strDomain; } catch (e) { rc = false; break; }
			continue;
		}
		else {
			strDomain = strDomain.substr( i+1);
			document.domain = strDomain;
		}
	}	// while ()
	return rc;
}	// wgu_TrySetDocumentDomainOpenerDependend()


function wgu_waitForParentAccess ()
{
	if (wgu_waitForParentAccess._tries++ == 0)
		wgu_TrySetDocumentDomainParentDependend ();

	if (!wgu_waitForParentAccess._accesssuccess)
		if (wgu_IsParentAccessible())
			wgu_waitForParentAccess._accesssuccess = true;
		else if (wgu_waitForParentAccess._tries < wgu_waitForParentAccess._maxTries)
			setTimeout( "wgu_waitForParentAccess()", wgu_waitForParentAccess._timetowait);
		else wgu_waitForParentAccess._accesssuccess = false;
	return wgu_waitForParentAccess._accesssuccess;
}
wgu_waitForParentAccess._accesssuccess	= null;
wgu_waitForParentAccess._tries			= 0;
wgu_waitForParentAccess._maxTries		= 10;
wgu_waitForParentAccess._timetowait		= 100;


function wgu_waitForParentJSObjectAccess ( in_JSObjectName )
{
	wgu_waitForParentAccess ();

	if (!wgu_waitForParentJSObjectAccess._accesssuccess)
		if (eval("typeof(parent." + in_JSObjectName + ")") != "undefined" && eval("parent." + in_JSObjectName) != null)
			wgu_waitForParentJSObjectAccess._accesssuccess = true;
		else if (wgu_waitForParentJSObjectAccess._tries < wgu_waitForParentJSObjectAccess._maxTries)
			setTimeout( "wgu_waitForParentJSObjectAccess(" + in_JSObjectName + ")", wgu_waitForParentJSObjectAccess._timetowait);
		else wgu_waitForParentJSObjectAccess._accesssuccess = false;
	return wgu_waitForParentJSObjectAccess._accesssuccess;
}
wgu_waitForParentJSObjectAccess._accesssuccess	= null;
wgu_waitForParentJSObjectAccess._tries			= 0;
wgu_waitForParentJSObjectAccess._maxTries		= wgu_waitForParentAccess._maxTries;
wgu_waitForParentJSObjectAccess._timetowait		= wgu_waitForParentAccess._timetowait;

////////////////////////////////////////////////////////////////////////////////
// Generic Tools END
////////////////////////////////////////////////////////////////////////////////








////////////////////////////////////////////////////////////////////////////////
//
//
// WGU Window & Frame Interface
//
//
////////////////////////////////////////////////////////////////////////////////








////////////////////////////////////////////////////////////////////////////////
//
// Class wguObjWindow
//
// Interface:
//		Constructor				wguObjWindow ()
//		Methods					wguObjWindow.SetName ()
//								wguObjWindow.SetParentRef ()
//								wguObjWindow.SetConfirmed ()
//								wguObjWindow.SetParentAccessable ()
//								wguObjWindow.SetSelfRef ()
//								wguObjWindow.SetType ()
//								wguObjWindow.SetRelation ()
//								wguObjWindow.SetFrameNo ()
//								wguObjWindow.SetVisibility ()
//								wguObjWindow.GetId ()
//								wguObjWindow.GetName ()
//								wguObjWindow.GetType ()
//								wguObjWindow.IsaWindow ()
//								wguObjWindow.IsaFrame ()
//								wguObjWindow.IsanIFrame ()
//								wguObjWindow.GetRelation ()
//								wguObjWindow.GetFrameNo ()
//								wguObjWindow.GetSelfRef ()
//								wguObjWindow.GetParentRef ()
//								wguObjWindow.IsParentAccessible ()
//								wguObjWindow.IsVisible ()
//								wguObjWindow.IsConfirmed ()
//								wguObjWindow.UniqueName ()
//								wguObjWindow.Show ()
//								wguObjWindow.Hide ()
//
////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////
//	Args:
//		in_name:		the name used to access the window
//		in_initialName:	the name the window got at opening
//		in_type:		[ "window" | "frame" | "iframe" ]
//		in_relation:	[ "self" | "parent" | "child" | "other" ]
//
//	Returns:
//		this
//
function wguObjWindow( in_id, in_name, in_relation )
{
	this._id				= (in_id != null) ? in_id : window.name;
	this._name				= (in_name != null) ? in_name : window.name;
	this._relation			= (in_relation != null) ? in_relation.toLowerCase() : "other";
	this._self				= null;
	this._parent			= (parent != self) ? parent : null;
	this._isparentAccess	= false;
	this._isVisible			= true;

	// frameset information
	this._isconfirmed	= false;
	this._frameNo		= -1;
	this._type			= "unknown";

	return this;
}	// Constructor wguWindow()


// Static function
wguObjWindow.prototype.IsValidType = function ( in_type ) {
	var rc = true;
	var lType = (in_type != null) ? in_type.toLowerCase() : "";
	if (lType != "window" && lType != "frame" && lType != "iframe")
		rc = false;
	return rc;
}	// wguObjWindow.IsValidType()

// Static function
wguObjWindow.prototype.IsValidRelation = function ( in_relation ) {
	var rc = false;
	var lRel = (in_relation != null) ? in_relation.toLowerCase() : "";
	if (lRel != "self" && lRel != "parent" && lRel != "child")
		rc = false;
	return rc;
}	// wguObjWindow.SetRelation()


wguObjWindow.prototype.SetName		= function ( in_name )		{ this._name = in_name; }
wguObjWindow.prototype.SetParentRef	= function ( in_parentRef )	{ this._parent = in_parentRef; }
wguObjWindow.prototype.SetConfirmed	= function ( in_bool )		{ this._isconfirmed = (in_bool == true) ? true : false; }
wguObjWindow.prototype.SetParentAccessable	= function ( in_isParentAccessable )	{ this._parentAccess = (in_isParentAccessable == true) ? true : false; }
wguObjWindow.prototype.SetSelfRef	= function ( in_winRef )	{ this._self = in_winRef; }

wguObjWindow.prototype.SetType = function ( in_type ) {
	if (this.IsValidType( in_type))
		return (this._type = in_type.toLowerCase());
	else
		return (this._type = "unknown", null);
}	// wguObjWindow.SetType()

wguObjWindow.prototype.SetRelation = function ( in_relation ) {
	if (this.IsValidRelation( in_relation))
		return (this._relation = in_relation.toLowerCase());
	else
		return (this._type = "unknown", null);
}	// wguObjWindow.SetRelation()

wguObjWindow.prototype.SetFrameNo = function ( in_frameNo ) {
	this._frameNo = (in_frameNo != null && in_frameNo >= 0) ? in_frameNo : -1;
	return this._frameNo;
}	// wguObjWindow.SetFrameNo()

wguObjWindow.prototype.SetVisibility		= function ( in_bool )		{ this._isVisible = in_bool; }
wguObjWindow.prototype.GetId				= function () { return this._id; };
wguObjWindow.prototype.GetName				= function () { return this._name; };
wguObjWindow.prototype.GetType				= function () { return this._type; };
wguObjWindow.prototype.IsaWindow			= function () { return ( this.GetType() == "window"); };
wguObjWindow.prototype.IsaFrame				= function () { return ( this.GetType() == "frame"); };
wguObjWindow.prototype.IsanIFrame			= function () { return ( this.GetType() == "iframe"); };
wguObjWindow.prototype.GetRelation			= function () { return this._relation; };
wguObjWindow.prototype.GetFrameNo			= function () { return this._frameNo; };
wguObjWindow.prototype.GetSelfRef			= function () { return this._self; };
wguObjWindow.prototype.GetParentRef			= function () { return this._parent; };
wguObjWindow.prototype.IsParentAccessible	= function () { return this._parentAccess; };
wguObjWindow.prototype.IsVisible			= function () { return this._isVisible; };
wguObjWindow.prototype.IsConfirmed			= function () { return this._isconfirmed; };
wguObjWindow.prototype.UniqueName			= wgu_NewUniqueWindowName;

wguObjWindow.prototype.Show = function () {
	var lwasVisible = this._isVisible;
	if (!this._isVisible) {
		this.SetVisibility( true);
	}	// if (!isVisible)
	else {
	}
	return (lwasVisible);
};	// wguObjWindow.Show()

wguObjWindow.prototype.Hide = function () {
	var lwasVisible = this._isVisible;
	if (this._isVisible) {
		this.SetVisibility( false);
	}	// if (!isVisible)
	else {
	}
	return (lwasVisible);
};	// wguObjWindow.Show()

////////////////////////////////////////////////////////////////////////////////
// Class wguObjWindow END
////////////////////////////////////////////////////////////////////////////////








////////////////////////////////////////////////////////////////////////////////
//
// Class wguObjFrameset
//
// Interface:
//		Constructor				wguObjFrameset ()
//		Methods					wguObjFrameset.GetNoOfFrames ()
//								wguObjFrameset.CountAllFrames ()
//								wguObjFrameset.GetFrameToggleSkip ()
//								wguObjFrameset.SetSkipFrameToggle ()
//								wguObjFrameset.ResetSkipFrameToggle ()
//								wguObjFrameset.SetVisible ()
//								wguObjFrameset.SetInvisible ()
//								wguObjFrameset.CheckFrameType ()
//								wguObjFrameset.CountFramesByType ()
//								wguObjFrameset.FindWindowById ()
//								wguObjFrameset.FindWindowByName ()
//								wguObjFrameset.Confirm ()
//								wguObjFrameset.AddFrame ()
//								wguObjFrameset.GetFrameNameById ()
//								wguObjFrameset.ToggleFrames ()
//								wguObjFrameset.ToggleFramesByObj ()
//								wguObjFrameset.GetNextWindowObjByType ()
//								wguObjFrameset.GetFirstVisibleFrame ()
//								wguObjFrameset.ShowNextFrameHideOthers ()
//								wguObjFrameset.ShowFrameHideOthersById ()
//								wguObjFrameset. ()
//								wguObjFrameset. ()
//
//
// User has to declare mandatory variable * gwguFrameset *, e. g.
//	var gwguFrameset = new wguObjFrameset( "Frame", "WGUFrame1", "WGUFrame2" );
//

////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////
// Constructor of class wguObjFrameset
//
function wguObjFrameset ( in_frameType, in_frameName1, in_frameName2 )	// in_frameName3, ...
{
	this._maxFrames			= wguObjFrameset.arguments.length - 1;
	this._aFrames			= new Array( this._maxFrames + 1);
	this._skipFrameToggle	= false;

	var w = this._aFrames[ 0] = new wguObjWindow( self.name, self.name, "Self");
	w.SetParentRef( (parent == self) ? null : parent);
	if (parent == self) {
		w.SetParentRef( null);
		w.SetParentAccessable ( false)
	} else {
		w.SetParentRef( parent);
		w.SetParentAccessable ( wgu_IsParentAccessible())
	}

	for (var i = 1; i <= this._maxFrames; i++) {
		w = this._aFrames[ i] = new wguObjWindow( wguObjFrameset.arguments[ i], wgu_NewUniqueWindowName(), "Child");
		w.SetType( in_frameType);
		w.SetFrameNo( i-1);				// start counting from 0
		w.SetParentRef( self);			// window.self is creator and thus parent of frame
		w.SetParentAccessable( false);	// not yet checked for accessability
		w.SetVisibility( false);		// not visible (logically)
	}	// for (i)
}	// wguObjFrameset() Constructor


wguObjFrameset.prototype.GetNoOfFrames		= function ()	{ return (this._maxFrames); }
wguObjFrameset.prototype.CountAllFrames		= function ()	{ return (this._aFrames.length); }
wguObjFrameset.prototype.GetFrameToggleSkip	= function ()	{ return (this._skipFrameToggle); }

wguObjFrameset.prototype.SetSkipFrameToggle		= function ()	{ var rc = this.GetFrameToggleSkip(); this._skipFrameToggle = true; return rc; }
wguObjFrameset.prototype.ResetSkipFrameToggle	= function ()	{ var rc = this.GetFrameToggleSkip(); this._skipFrameToggle = false; return rc; }


////////////////////////////////////////
// Static
//	Args:
//
wguObjFrameset.prototype.SetVisible = function ( in_winId )
{
	var rc = false;
	var w = this.FindWindowById( in_winId);
	if (w != null)
		rc = w.SetVisibility( true);
	return rc;
}	// wguObjFrameset.CheckFrameType()

////////////////////////////////////////
// Static
//	Args:
//
wguObjFrameset.prototype.SetInvisible = function ( in_winId )
{
	var rc = false;
	var w = this.FindWindowById( in_winId);
	if (w != null)
		rc = w.SetVisibility( false);
	return rc;
}	// wguObjFrameset.CheckFrameType()

////////////////////////////////////////
// Static
//	Args:
//
wguObjFrameset.prototype.CheckFrameType = function ( in_frameType )
{
	var rc = false;
	return (wguObjWindow.IsValidType( in_frameType));
}	// wguObjFrameset.CheckFrameType()

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.CountFramesByType = function ( in_frameType ) {
	var rv = 0;
	var l  = this.CountAllFrames();

	for (i = 1; i < l; i++)
		if (this._aFrames[ i].GetType() == in_frameType) rv++;

	return rv++;
}	// wguObjFrameset.()

////////////////////////////////////////
//	Args:
//
wguObjFrameset.prototype.FindWindowById = function ( in_winId ) {
	var l = this.CountAllFrames();
	var f = this._aFrames;
	for (i = 0; i < l; i++) {
		if (f[ i].GetId() == in_winId) return f[ i];
	}	// for (i)
	return null;
}	// wguObjFrameset.FindWindowById()

////////////////////////////////////////
//	Args:
//
wguObjFrameset.prototype.FindWindowByName = function ( in_name ) {
	var l = this.CountAllFrames();
	var f = this._aFrames;
	for (i = 0; i < l; i++) {
		if (f[ i].GetName() == in_name) return f[ i];
	}	// for (i)
	return null;
}	// wguObjFrameset.FindWindowByName()

////////////////////////////////////////
// Frame confirms its creation
//	Usage:	In creator window create a variable wguFrameset;
//			On frame creation call parent.wguFrameset.Confirm()
//	Args:
//		in_winId	- Id of the frame (window.name)
//	Return:
//		Reference of wguWindow
//
wguObjFrameset.prototype.Confirm = function ( in_winId ) {
	var w = this.FindWindowById( in_winId);
	if (w != null) {
		w.SetConfirmed( true);
		w.SetParentAccessable( true);
	}
	return w;
}	// wguObjFrameset.Confirm()

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.AddFrame = function ( in_initialName, in_frameType ) {
	// to do
}	// wguObjFrameset.AddFrame()

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.GetFrameNameById = function ( in_winId ) {
	var name = null;
	var w = this.FindWindowById( in_winId);
	if (w != null)
		name = w.GetName();
	return name;
}	// wguObjFrameset.GetFrameNameById()

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.ToggleFrames = function ( in_makeActiveWinId ) {
	var rc = false;
	if (!this.GetFrameToggleSkip()) {
		var w = this.FindWindowById( in_makeActiveWinId);
		if (w != null) {
			if (w.IsaFrame()) {
				var sep			= "",
					rows		= "",
					notfound	= true;
				var l = this.CountAllFrames();
				for (var i = 1; i < l; i++) {
					w = this._aFrames[ i];
					if (w.IsaFrame()) {
						if (notfound && w.GetId() == in_makeActiveWinId) {
							rows = rows + sep + "*";
							w.SetVisibility( true);
							rc = bo = true;
						}
						else {
							rows = rows + sep + "0";
							w.SetVisibility( false);
							//if (w._self != null) w._self.document.body.onresize = null;
						}
						sep = ",";
					}	// if ("frame")
				}	// for (i)
				if (bo)
          if (__wgu_dbg_frames5050)
  					self.document.getElementById('ITSFrameset').rows = "50%,50%";
          else
					  self.document.getElementById('ITSFrameset').rows = rows;
			}	// if (ftype == "frame")
		}	// if (w)
	}	// if (!skip frame toggle)
	return rc;
}

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.ToggleFramesByObj = function ( in_winObjRef ) {
	var rc = false;
	if (!this.GetFrameToggleSkip()) {
    if (__wgu_dbg_frames5050) return true;
		var w = in_winObjRef;
		if (w != null) {
			if (w.IsaFrame()) {
				var sep			= "",
					rows		= "",
					notfound	= true;
				var l = this.CountAllFrames();
				for (var i = 1; i < l; i++) {
					w = this._aFrames[ i];
					if (w.IsaFrame()) {
						if (notfound && w.GetId() == in_makeActiveWinId) {
							rows = rows + sep + "*";
							w.SetVisibility( true);
							rc = bo = true;
						}
						else {
							rows = rows + sep + "0";
							w.SetVisibility( false);
						}
						sep = ",";
					}	// if ("frame")
				}	// for (i)
				if (bo)
          if (__wgu_dbg_frames5050)
  					self.document.getElementById('ITSFrameset').rows = "50%,50%";
          else
  					self.document.getElementById('ITSFrameset').rows = rows;
			}	// if (ftype == "frame")
		}	// if (w)
	}	// if (!skip frame toggle)
	return rc;
}

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.GetNextWindowObjByType = function ( in_frameobj, in_type ) {
	var w,
		first = -1,
		actfound = 0,
		l = this.CountAllFrames();
	// find in_frameobj in array
	for (var i = 0; i < l; i++) {
		w = this._aFrames[ i];
		if (w.GetType() == in_type) {
			if (first == -1) first = i;
			if (w == in_frameobj) actfound = 1;
			else if (actfound == 1) {
				actfound = 2;
				break;
			}
		}
	}	// for (i)
	if (actfound == 0) w = null;
	else if (actfound == 1) w = this._aFrames[ first];
	return w;
}	// wguObjFrameset.GetNextFrameObjByType()

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.GetFirstVisibleFrame = function () {
	var w,
		l = this.CountAllFrames();
	for (var i = 1; i < l; i++) {
		w = this._aFrames[ i];
		if (w.IsaFrame() && w.IsVisible())
			return w;
	}
	return null;

}	// wguObjFrameset.GetVisibleFrame()

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.ShowNextFrameHideOthers = function () {
	var rc = false;
	var w = this.GetFirstVisibleFrame ();
	if (w != null) {
		w = this.GetNextWindowObjByType( w, "frame");
		rc = this.ToggleFrames( w.GetId());
	}
	return rc;
}	// wguObjFrameset.ShowNextFrameHideOthers()

////////////////////////////////////////
//
//	Args:
//
wguObjFrameset.prototype.ShowFrameHideOthersById = function ( in_frameId ) {
	var rc = false;
	var w = this.GetFirstVisibleFrame ();
	if (w != null) {
		w = this.GetNextWindowObjByType( w, "frame");
		rc = this.ToggleFrames( w.GetId());
	}
	return rc;
}	// wguObjFrameset.ShowNextFrameHideOthers()



////////////////////////////////////////////////////////////////////////////////
// Tools for external access


/*

var webguiSmartView = false;
	
    if (parent!=null && parent!=self && typeof(parent.gwguFrameset)=="object") {
        var w = parent.gwguFrameset.Confirm( self.name);
        if (w != null) w.SetSelfRef( self);
        webguiSmartView = true;
    }

    function showme ()
    {
      if ( window.webguiSmartView == true) {
        if (parent != null && parent != self) {
          var f = parent.gwguFrameset;
          if (f != null && self.name.substr(0,8) == "itsframe" && f.ToggleFrames( self.name)) {
            var w = f.GetFirstVisibleFrame();
            if (w != null)
              if ((w = f.GetNextWindowObjByType( w, "frame")) != null)
                if ((w = w.GetSelfRef()) != null)
                  ;
          }
        }
      }
    }

    if (typeof( document.releaseCapture) != "undefined")
		document.releaseCapture();

*/


////////////////////////////////////////////////////////////////////////////////
// Class wguObjFrameset END
////////////////////////////////////////////////////////////////////////////////







////////////////////////////////////////////////////////////////////////////////
//
// Class wguObjStatusWindow
//
// Interface:
//		Constructor				wguObjStatusWindow ()
//		Methods					wguObjStatusWindow. ()
//								wguObjStatusWindow. ()
//								wguObjStatusWindow. ()
//								wguObjStatusWindow. ()
//								wguObjStatusWindow. ()
//								wguObjStatusWindow. ()
//								wguObjStatusWindow. ()
//
//
// created /tj/2002-01-23
// changed /tj/2002-04-17
//
////////////////////////////////////////////////////////////////////////////////




////////////////////////////////////////
// Constructor of class wguObjStatusWindow
//
function wguObjStatusWindow ( in_idx, in_x, in_y, in_w, in_h, in_imgpath, in_title, in_message, in_timeout )
{
	var imgpath = __wgu_winframe_static._imghourglass;
	
	function Properties( in_idx,
						 in_isopen,
						 in_x, in_y, in_w, in_h,
						 in_imgpath,
						 in_title, in_message,
						 in_timeout )
	{	var now = new Date();
		this.idx	= in_idx;
		this.name	= "webguisw_" + in_idx + "_" + now.getTime();
		this.isopen	= in_isopen;
		this.posw = in_w == -1 ? 200 : Number( in_w);
		this.posh = in_h == -1 ? 100 : Number( in_h);
		this.posx = in_x == -1 ? (screen.availWidth - this.posw) / 2 : Number( in_x);
		this.posy = in_x == -1 ? (screen.availHeight - this.posh) / 3.2 : Number( in_y);
		if (in_imgpath == null || in_imgpath == "")
			this.img 	= imgpath;
		else
			this.img	= in_imgpath;
		this.title		= in_title;
		this.message	= in_message;
		this.timeout	= (in_timeout && in_timeout > 0) ? Number( in_timeout) : 0;
		this.domain		= self.document.domain;
		return( this);
	}	// Properties() constructor

	this.winref		= null;		// window reference
	this.property	= new Properties( 	in_idx, false, -1, -1, 200, 100,
									  	in_imgpath, in_title, in_message, in_timeout );
	return( this);
}	// wguObjStatusWindow()


////////////////////////////////////////
//
wguObjStatusWindow.prototype.Open = function ()
{	var rc = null;
	if (this.property != null) {
		var d;
		var winpropty	= "width="+this.property.posw+",height="+this.property.posh+",top="+this.property.posy+",left="+this.property.posx
		    			+ ",dependent=yes,resizable=no,scrollbars=no,toolbar=no,menubar=no,titlebar=no";
		var winname    = this.property.name;
		//if (document.domain == "" || document.domain == location.hostname) {
		//	this.winref = window.open("text/html", winname, winpropty);
		//	this.Write();
		//}
		//else {
			this.winref = window.open(__wgu_winframe_static._emptystatuswinpage, winname, winpropty);
		//}
		this.property.isopen = true;
		rc = this;
	}	// if (this.property)
	return( rc);
}	// wguObjStatusWindow.Open()


////////////////////////////////////////
//
wguObjStatusWindow.prototype.Close = function ()
{
	if (this.property != null) {
		if (this.property.isopen && this.winref != null) {
			this.property.isopen = false;
			this.winref.close();
			this.winref = null;
		}
	}	// if (this.property)
}	// wguObjStatusWindow.Close()


////////////////////////////////////////
//
wguObjStatusWindow.prototype.Kill = function ()
{
	if (this.property != null) {
		if (this.property.isopen && this.winref != null)
			this.winref.close();
		this.property	= null;
	}	// if (this.property)
}	// wguObjStatusWindow.Kill()


////////////////////////////////////////
//
wguObjStatusWindow.prototype.Write = function ()
{
	var d = this.winref.document;
	d.write("<html><head>\n<title>"+this.property.title+"</title>\n<!-- Name: "+this.property.name+" -->\n");
	d.write("<"+"script language='Javascript' src='"+document.webguiMimeURL+"/webgui/99/scripts/wgu_winframe.js'>\n");
  d.write("wgu_TrySetDocumentDomainOpenerDependend();\n");
	d.write("function killwin(){\n if (wgu_IsOpenerAccessible() && opener && opener.wguInterfaceStatusWindowGet) {\n");
	d.write("  var swintf = opener.wguInterfaceStatusWindowGet();\n  if (swintf && swintf._wguInterfaceStatusWindowCloseByName)\n   swintf._wguInterfaceStatusWindowCloseByName( window.name);\n  else self.close();\n");
	d.write(" }\n else self.close();\n}\n");
	d.write("</"+"script></"+"head>\n");
	d.write("<"+"body>\n<div align='center' valign='center'>");
	d.write("<table border='0' cellpadding='6'><tr valign='center'><td align='center'><img id='IMAGE' src='"+this.property.img+"' alt=''></td>\n");
	d.write("<td align='center'>\n");
	d.write("<p id='MESSAGE' style='background-color:#FFFFFF; color:#333399; text-align:center; font-family:arial,sans-serif; font-weight: bold; font-size:10pt;'>\n");
	d.write(this.property.message+"</p></td></tr></table></div>\n");
	if (this.property.timeout != null && this.property.timeout > 0) {
		d.write("<"+"script language='Javascript'>\n");
		d.write("window.setTimeout('killwin()',"+this.property.timeout+");\n");
		d.write("</"+"script>\n");
	}
	d.write("<"+"/body></"+"html>");
}	// wguObjStatusWindow.Write()



////////////////////////////////////////
//
// external interface
//
////////////////////////////////////////



////////////////////////////////////////
// Initialize Status Window Object Interface
//
// Must be called once before usage of Status Windows
//
function wguInterfaceStatusWindowInit ()
{
	if (document._gwguStatusWindowInterface == null) {
		document._gwguStatusWindowInterface = new wguInterfaceStatusWindow();
	}
	return ( document._gwguStatusWindowInterface);
}	// wguInterfaceStatusWindowInit()


////////////////////////////////////////
// Retrieve Status Window Object Interface
function wguInterfaceStatusWindowGet ()
{
	if (document._gwguStatusWindowInterface  != null)
		return document._gwguStatusWindowInterface;
	else
		return null;
}	// wguInterfaceStatusWindowGet()


////////////////////////////////////////
// Constructor
//
function wguInterfaceStatusWindow ()
{
	this._aStatusWin = new Array();
	
	// initialize methods
	this.Open				= _wguInterfaceStatusWindowOpen;
	this.Close				= _wguInterfaceStatusWindowClose;
	this.CloseByName		= _wguInterfaceStatusWindowCloseByName;
	this.GetIdxByName		= _wguInterfaceStatusWindowGetIdxByName;
	this.GetWinrefByIdx		= _wguInterfaceStatusWindowGetWinrefByIdx;
}	// wguInterfaceStatusWindow()


////////////////////////////////////////
//
function _wguInterfaceStatusWindowOpen ( in_title, in_message, in_timeout )
{	
	var ar			= this._aStatusWin;
	var idx			= ar.length;
	var statuswin	= new wguObjStatusWindow ( idx, -1, -1, -1, -1, "", in_title, in_message, in_timeout );
	if (statuswin != null) {
		ar[ idx] = statuswin;
		statuswin.Open();
	}
	else idx = null;

	return idx;
}	// _wguInterfaceStatusWindowOpen()


////////////////////////////////////////
//
function _wguInterfaceStatusWindowClose ( in_statuswinidx )
{
	if (in_statuswinidx != null) {
		var ar = this._aStatusWin;
		if (ar != null) {
			var sw = ar[ in_statuswinidx];
			if (sw != null && typeof(sw) == "object") {
				sw.Close();
				sw.Kill();
			}
		}
	}
}	// _wguInterfaceStatusWindowClose()


////////////////////////////////////////
//
function _wguInterfaceStatusWindowCloseByName ( in_statuswinname )
{
	if (in_statuswinname != null) {
		var statuswin = this.GetWinrefByIdx( this.GetIdxByName( in_statuswinname));
		statuswin.Close();
		statuswin.Kill();
	}
}	// _wguInterfaceStatusWindowCloseByName()


////////////////////////////////////////
//
function _wguInterfaceStatusWindowGetIdxByName ( in_statuswinname )
{	
	var ar = this._aStatusWin;
	var i, idx = null;
	var statuswin;
	if (in_statuswinname != null && in_statuswinname != "")
		for (i in ar) {
			if (ar[ i].property && ar[ i].property.name == in_statuswinname) {
				idx = i;
				break;
			}
		}
	return idx;
}	// _wguInterfaceStatusWindowGetIdxByName()


////////////////////////////////////////
//
function _wguInterfaceStatusWindowGetWinrefByIdx ( in_idx )
{
	return (in_idx != null || in_idx >= 0) ? this._aStatusWin[ in_idx] : null;
}	// _wguInterfaceStatusWindowGetWinrefByIdx()


////////////////////////////////////////////////////////////////////////////////
// Class wguObjStatusWindow END
////////////////////////////////////////////////////////////////////////////////
