//   ------------------------------------------------------------
//   Event.js
//   ------------------------------------------------------------
//   VCS INFO:
//   
//   $Revision:   1.2  $
//   $Date:   26 Jan 1999 13:38:28  $
//   $Author:   shsieh  $
//   $Workfile:   Event.js  $
//   ------------------------------------------------------------
//   INCLUDE DEPEDENCY:
//   WSCAPI/InitPage.js
//   ------------------------------------------------------------
//   All Rights Reserved.  Copyright (c) 1988-1999 FileNET Corp.
//   ------------------------------------------------------------

function IDMWSC_Event(type, obj, source, target)
{
	// Properties
	this.type = type;
	this.object = obj;
	this.source = source;
	this.target = target;
}

// Instance Methods
IDMWSC_Event.prototype.propagate = IDMWSC_Event_propagate;

function IDMWSC_Event_propagate()
{
	var target, current;
	
	if (this.current)
		current = this.current;
	else
		current = window;
	
	while (1) {
		if (current.parent && current.parent != current) // if a window has parent
			target = current.parent;
		else if (current.opener) // if a window is a popup
			target = current.opener;
		else
			break;

		if (target.IDMWSC_onEvent) // if the event handler is found
			break;
		else
			current = target;
		}
	
	if (target && target.IDMWSC_onEvent) {
		// an event handler is found, call the event handler.

		// record the current window within the propagation hierarchy
		this.current = target;

		return target.IDMWSC_onEvent(this);
		}
	else {
		// return for default processing.
		return true;
		}
}
