<PUBLIC:COMPONENT
    lightWeight = true
>

<PUBLIC:DEFAULTS
    contentEditable = false
    tabStop = true
/>

<PUBLIC:attach event="ondocumentready" onevent="initElement()" />
<PUBLIC:attach event="ondetach" onevent="cleanupElement()" />
<PUBLIC:attach event="oncontextmenu" onevent="elementOnContextMenu()" />
<PUBLIC:attach event="onpropertychange" onevent="elementOnPropertyChange()" />

<PUBLIC:property name="left" value=0 />
<PUBLIC:property name="top" value=0 />
<PUBLIC:property name="height" value=200 />
<PUBLIC:property name="width" value=250 />
<PUBLIC:property name="src" value="" />
<PUBLIC:property name="caption" value="" />
<PUBLIC:property name="windowState" value="NORMAL" />
<PUBLIC:property name="menuState" />
<PUBLIC:property name="windowsSettingState" value=false />
<PUBLIC:property name="parentId" value="" />

<PUBLIC:method   name="hideMenu" />
<PUBLIC:method   name="getContentWindow" />

<PUBLIC:event    name="OnSetWindowState" id="fireOnSetWindowState" />

<script language="jscript">

// ----------------------------------------------------
// 2k3Widgets: 2k3Window
// 
// Copyright ©2002-2004 Stedy Software and Systems     
// Please see http://www.stedy.com for terms of use.   
// ----------------------------------------------------

var isIE6 = ((window.navigator.appVersion).indexOf("MSIE 6.") != -1) ;

var inDrag = false ;
var inSize = false ;

var orgX ;
var orgY ;
var orgTop ;
var orgLeft ;
var orgHeight ;
var orgWidth ;
var orgDirection ;
var orgBorder ;
var orgState ;

var saveTop ;
var saveLeft ;
var saveHeight ;
var saveWidth ;
var saveOffsetHeight ;
var saveOffsetWidth ;
var saveBorder ;
var saveState ;

var objWindowCaption = null ;
var objCaptionImage = null ;
var objMinimizeButton = null ;
var objMaximizeButton = null ;
var objCloseButton = null ;
var objContentWindow = null ;

var objMenu = null ;

var objCurrentButton = null ;

internalSettingProperties = false ;

// ----------------------------------------------------
// initialize/terminate functions   
// ----------------------------------------------------

function initElement() {
	with (element) {
		attachEvent("onselectstart", elementOnSelect) ;
		attachEvent("onmousedown", elementOnMouseDown) ;
		attachEvent("onmouseup", elementOnMouseUp) ;
		attachEvent("onmousemove", elementOnMouseMove) ;
		attachEvent("onresize", windowOnResize) ;
		attachEvent("onactivate", elementOnActivate) ;
		attachEvent("ondeactivate", elementOnDeactivate) ;
		for (var i = 0; i < children.length; i++) {
			switch (element.children[i].className) {
				case "windowCaption":
					objWindowCaption = children[i] ;
					objWindowCaption.attachEvent("onmousedown", captionOnMouseDown)
					objWindowCaption.attachEvent("ondblclick", captionOnDoubleClick)
					element.caption = objWindowCaption.innerHTML ;
					break ;
				case "captionImage":
					objCaptionImage = children[i] ;
					objCaptionImage.attachEvent("onmousedown", captionImageOnMouseDown)
					objCaptionImage.attachEvent("ondblclick", captionImageOnDoubleClick)
					break ;
				case "windowButtonMinimize":
					objMinimizeButton = children[i] ;
					objMinimizeButton.title = "Minimize"
					objMinimizeButton.children[0].setAttribute("src", currentStyle.minimizeImageUrl)
					objMinimizeButton.attachEvent("onmousedown", buttonOnMouseDown)
					objMinimizeButton.attachEvent("onmouseup", buttonOnMouseUp)
					break ;
				case "windowButtonMaximize":
					objMaximizeButton = children[i] ;
					objMaximizeButton.title = "Maximize"
					objMaximizeButton.children[0].setAttribute("src", currentStyle.maximizeImageUrl)
					objMaximizeButton.attachEvent("onmousedown", buttonOnMouseDown)
					objMaximizeButton.attachEvent("onmouseup", buttonOnMouseUp)
					break ;
				case "windowButtonClose":
					objCloseButton = children[i] ;
					objCloseButton.title = "Close"
					objCloseButton.children[0].setAttribute("src", currentStyle.closeImageUrl)
					objCloseButton.attachEvent("onmousedown", buttonOnMouseDown)
					objCloseButton.attachEvent("onmouseup", buttonOnMouseUp)
					break ;
				case "windowContent":
					objContentWindow = children[i] ;
					objContentWindow.attachEvent("onload", contentOnLoad)
					objContentWindow.setAttribute("src", src)
					break ;
			}
		}
		left = left ;
		saveState = element.windowState ;
		if (element.windowState == "MAXIMIZED") {
			internalSettingProperties = true ;
			setWindowState() ;
			internalSettingProperties = false ;
		}
	}
	objMenu = createNewMenu("mnu" + element.id) ;
	with (insertNewMenuItem(objMenu, currentStyle.restoreImageUrl, "Restore")) {
		id = "subMnu" + element.id + "Restore" ;
		onclick = function() { windowState = "NORMAL"; } ;
	}
	with (insertNewMenuItem(objMenu, currentStyle.blankImageUrl, "Move")) {
		id = "subMnu" + element.id + "Move" ;
		onclick = function() { hideMenu(); } ;
	}
	with (insertNewMenuItem(objMenu, currentStyle.blankImageUrl, "Size")) {
		id = "subMnu" + element.id + "Size" ;
		onclick = function() { hideMenu(); } ;
	}
	with (insertNewMenuItem(objMenu, currentStyle.minimizeImageUrl, "Minimize")) {
		id = "subMnu" + element.id + "Minimize" ;
		onclick = function() { windowState = "MINIMIZED"; } ;
	}
	with (insertNewMenuItem(objMenu, currentStyle.maximizeImageUrl, "Maximize")) {
		id = "subMnu" + element.id + "Maximize" ;
		onclick = function() { windowState = "MAXIMIZED"; } ;
	}
	insertNewMenuSeperator(objMenu) ;
	with (insertNewMenuItem(objMenu, currentStyle.closeImageUrl, "Close")) {
		id = "subMnu" + element.id + "Close" ;
		onclick = function() { windowState = "CLOSED";} ;
	}
	objMenu.className = "2k3Menu" ;
	window.document.body.insertAdjacentElement("afterBegin", objMenu) ;
}

function cleanupElement() {
	with (element) {
		detachEvent("onselectstart", elementOnSelect)
		detachEvent("onmousedown", elementOnMouseDown)
		detachEvent("onmouseup", elementOnMouseUp)
		detachEvent("onmousemove", elementOnMouseMove)
		detachEvent("onresize", windowOnResize) ;
		detachEvent("onactivate", elementOnActivate) ;
		detachEvent("ondeactivate", elementOnDeactivate) ;
	}
	with (objWindowCaption) {
		detachEvent("onmousedown", captionOnMouseDown)
		detachEvent("ondblclick", captionOnDoubleClick)
		objWindowCaption = null ;
	}
	with (objCaptionImage) {
		detachEvent("onmousedown", captionImageOnMouseDown)
		detachEvent("ondblclick", captionImageOnDoubleClick)
		objCaptionImage = null ;
	}
	with (objMinimizeButton) {
		detachEvent("onmousedown", buttonOnMouseDown)
		detachEvent("onmouseup", buttonOnMouseUp)
		objMinimizeButton = null ;
	}
	with (objMaximizeButton) {
		detachEvent("onmousedown", buttonOnMouseDown)
		detachEvent("onmouseup", buttonOnMouseUp)
		objMaximizeButton = null ;
	}
	with (objCloseButton) {
		detachEvent("onmousedown", buttonOnMouseDown)
		detachEvent("onmouseup", buttonOnMouseUp)
		objCloseButton = null ;
	}
	with (objContentWindow) {
		detachEvent("onload", contentOnLoad)
		objContentWindow = null ;
	}
	if (objMenu != null) {
		objMenu.removeNode(true) ;
	}
	objMenu = null ;
}


// ----------------------------------------------------
// document functions   
// ----------------------------------------------------

function documentOnMouseDown() {
	if (getRealItem(window.event.srcElement).className != "2k3MenuItemOver") {
		if (window.event.srcElement != objCaptionImage && window.event.srcElement != objWindowCaption) {
			if (element.menuState) {
				hideMenu() ;
			}
		}
	}
}


// ----------------------------------------------------
// element functions   
// ----------------------------------------------------

function elementOnMouseDown() {
	var ev = window.event ;
	element.setActive() ;
	if (ev.srcElement == element) {
		if (ev.button == 1 && orgDirection != "") {
			inSize = true
			orgX = ev.clientX ;
			orgY = ev.clientY ;
			orgTop = element.offsetTop ;
			orgLeft = element.offsetLeft ;
			orgHeight = element.offsetHeight ;
			orgWidth = element.offsetWidth ;
			element.setCapture() ;
			with (ev) {
				returnValue = false ;
				cancelBubble = true ;
			}
		}
	}
	ev = null ;
}

function elementOnMouseUp() {
	if (inSize) {
		inSize = false ;
		element.releaseCapture() ;
	}
}

function elementOnMouseMove() {
	if (inDrag) {
		return ;
	}
	if (inSize) {
		var btnWidth = objCloseButton.offsetWidth ;
		with (window.event) {
			var cliX = clientX ;
			var cliY = clientY ;
			returnValue = false ;
			cancelBubble = true ;
		}
		if (element.menuState) {
			hideMenu() ;
		}
		if (orgDirection.indexOf("e") != -1) {

			var intX = orgWidth + cliX - orgX ;
			if (intX < 100) {
				intX = 100 ;
			}
			element.style.width = intX ;
			intX -= 8 ;
			objCloseButton.style.left = intX - btnWidth ;
			objMaximizeButton.style.left = intX - (btnWidth * 2) - 2 ;
			objMinimizeButton.style.left = intX - (btnWidth * 3) - 2 ;
			objContentWindow.style.width = intX ;
			objContentWindow.style.height = objContentWindow.offsetHeight ;
		}
		if (orgDirection.indexOf("s") != -1) {
			var intY = orgHeight + cliY - orgY ;
			if (intY < objContentWindow.offsetTop + 5) {
				intY = objContentWindow.offsetTop + 5 ;
			}
			element.style.height = intY ;
			intY = intY - objWindowCaption.offsetHeight - 10 ;
			if (intY < 0) {
				intY = 0 ;
			}
			objContentWindow.style.height = intY ;
		}
		if (orgDirection.indexOf("w") != -1) {
			var intX = orgWidth - cliX + orgX ;
			var intL = orgLeft + cliX - orgX ;
			if (intX < 100) {
				intX = 100 ;
				intL = orgLeft + orgWidth - 100 ;
			}
			element.style.left = intL ;
			element.style.width = intX ;
			intX -= 8 ;
			objCloseButton.style.left = intX - btnWidth ;
			objMaximizeButton.style.left = intX - (btnWidth * 2) - 2 ;
			objMinimizeButton.style.left = intX - (btnWidth * 3) - 2 ;
			objContentWindow.style.width = intX ;
			objContentWindow.style.height = objContentWindow.offsetHeight ;
		}
		if (orgDirection.indexOf("n") != -1) {
			var intY = orgHeight - cliY + orgY ;
			var intT = orgTop + cliY - orgY ;
			if (intY < objContentWindow.offsetTop + 5) {
				intY = objContentWindow.offsetTop + 5 ;
				intT = orgTop + orgHeight - (objContentWindow.offsetTop + 5) ;
			}
			with (element.style) {
				top = intT ;
				height = intY ;
			}
			intY = intY - objWindowCaption.offsetHeight - 10 ;
			if (intY < 0) {
				intY = 0 ;
			}
			objContentWindow.style.height = intY ;
		}
	}
	else {
		if (window.event.srcElement == element) {
			if (element.windowState == "NORMAL") {
				orgDirection = getResizeDirection() ;
				if (orgDirection == "") {
					var strCursor = "default" ;
				}
				else {
					var strCursor = orgDirection + "-resize" ;
				}
				element.style.cursor = strCursor ;
			}
		}
	}
}

function elementOnSelect() {
	with (window.event) {
		cancelBubble = true ;
		returnValue = false ;
	}
	return false ;
}

function elementOnContextMenu() {
	with (window.event) {
		cancelBubble = true ;
		returnValue = false ;
	}
	return false ;
}

function elementOnActivate() {
	objWindowCaption.fireEvent("onclick") ;
	objWindowCaption.style.backgroundColor = "activecaption" ;
	element.style.zIndex = window.document.all("2k3WindowsObject").topWindowzIndex + 2 ;
	window.document.all("2k3WindowsObject").topWindowzIndex += 2 ;
}

function elementOnDeactivate() {
	objWindowCaption.style.backgroundColor = "inactivecaption" ;
	element.style.zIndex = window.document.all("2k3WindowsObject").topWindowzIndex - 1 ;
}

function windowOnResize() {
	if (element.menuState) {
		hideMenu() ;
	}
	with (element) {
		var h = offsetHeight ;
		var w = offsetWidth ;
	}
	if (element.windowState == "MAXIMIZED") {
		objCloseButton.style.left = w - objCloseButton.offsetWidth  - 3 ;
		objMaximizeButton.style.left = objCloseButton.offsetLeft - objCloseButton.offsetWidth - 2 ;
		objMinimizeButton.style.left = objMaximizeButton.offsetLeft - objMaximizeButton.offsetWidth ;
		with (objContentWindow.style) {
			width = objWindowCaption.offsetWidth ;
			height = h - objWindowCaption.offsetHeight - 6 ;
		}
	}
}

function elementOnPropertyChange() {
	if (internalSettingProperties) {
		return ;
	}
	internalSettingProperties = true ;
	switch (window.event.propertyName) {
		case "caption":
			objWindowCaption.innerHTML = element.caption ;
			var objWindowMenuItem = window.document.getElementById((element.id).replace("2k3Window_", "windowMenuItem_")) ;
			if (objWindowMenuItem != null) {
				objWindowMenuItem.children(2).innerText = element.caption ;
			}
			objWindowMenuItem = null ;
			break ;
		case "src":
			objContentWindow.setAttribute("src", element.src) ;
			break ;
		case "left":
		case "top":
		case "width":
		case "height":
			if (inDrag || inSize) {
				internalSettingProperties = false ;
				return ;
			}
			with (element) {
				style.left = left ;
				style.top = top ;
				style.width = width ;
				style.height = height ;
			}
			with (objWindowCaption) {
				var capWidth = offsetWidth ;
				var capHeight = offsetHeight ;
				var capTop = offsetTop ;
			}
			with (objCloseButton) {
				var btnWidth = offsetWidth ;
				var btnHeight = offsetHeight ;
				style.top = (capHeight / 2) - (btnHeight / 2) + capTop ;
				style.left = capWidth - btnWidth ;
			}
			with (objMaximizeButton) {
				style.top = objCloseButton.offsetTop ;
				style.left = capWidth - (btnWidth * 2) - 2 ;
			}
			with (objMinimizeButton) {
				style.top = objCloseButton.offsetTop ;
				style.left = capWidth - (btnWidth * 3) - 2 ;
			}
			with (objCaptionImage) {
				var imgHeight = objCaptionImage.offsetHeight ;
				style.top = (capHeight / 2) - (imgHeight / 2) + capTop ;
			}
			with (objContentWindow) {
				style.width = capWidth ;
				style.height = element.offsetHeight - capHeight - 10 ;
			}
			break ;
		case "windowState":
			if (element.menuState) {
				hideMenu() ;
			}
			setWindowState() ;
			break ;
	}
	internalSettingProperties = false ;
}


// ----------------------------------------------------
// caption image functions   
// ----------------------------------------------------

function captionImageOnMouseDown() {
	element.setActive() ;
	with (window.event) {
		cancelBubble = true ;
		returnValue = false ;
	}
	if (element.menuState) {
		hideMenu() ;
	}
	else {
		if (window.event.button != 1) {
			return ;
		}
		showMenu(window.event.clientX + 1, window.event.clientY + 1) ;
	}
}

function captionImageOnDoubleClick() {
	element.windowState = "CLOSED" ;
}


// ----------------------------------------------------
// caption functions   
// ----------------------------------------------------

function captionOnMouseDown() {
	element.setActive() ;
	if (element.menuState) {
		hideMenu() ;
	}
	if (element.windowState == "MAXIMIZED") {
		return ;
	}
	with (window.event) {
		if (button != 1) {
			showMenu(clientX, clientY) ;
			cancelBubble = true ;
			returnValue = false ;
			return false ;
		}
		inDrag = true ;
		orgX = clientX - element.style.pixelLeft ;
		orgY = clientY - element.style.pixelTop ;
	}
	element.setCapture() ;
	with (window.document) {
		attachEvent("onmouseup", captionOnMouseUp) ;
		attachEvent("onmousemove", captionOnMouseMove) ;
	}
}

function captionOnMouseUp() {
	with (window.event) {
		cancelBubble = true ;
		returnValue = false ;
	}
	inDrag = false ;
	element.releaseCapture() ;
	with (window.document) {
		detachEvent("onmouseup", captionOnMouseUp) ;
		detachEvent("onmousemove", captionOnMouseMove) ;
	}
}

function captionOnMouseMove() {
	if (inDrag) {
		with (window.event) {
			if (clientX > 0 && clientX < element.parentElement.offsetWidth) {
				element.style.left = clientX - orgX ;
			}
			if (clientY > 0 && clientY < element.parentElement.offsetHeight) {
				element.style.top = clientY - orgY ;
			}
			returnValue = false ;
			cancelBubble = true ;
		}
	}
}

function captionOnDoubleClick() {
	with (window.event) {
		cancelBubble = true ;
		returnValue = false ;
	}
	orgState = element.windowState ;
	switch (orgState) {
		case "MINIMIZED":
			element.windowState = "NORMAL" ;
			break;
		case "MAXIMIZED":
			element.windowState = "NORMAL" ;
			break;
		case "NORMAL":
			element.windowState = "MAXIMIZED" ;
			break;
	}
}

// ----------------------------------------------------
// window button functions   
// ----------------------------------------------------

function buttonOnMouseDown() {
	if (element.menuState) {
		hideMenu() ;
	}
	element.setActive() ;
	with (window.event) {
		cancelBubble = true ;
		returnValue = false ;
		if (button != 1) {
			return ;
		}
		var el = srcElement ;
	}
	if (el.tagName == "IMG") {
		el = el.parentElement ;
	}
	showPressed(el, el.children[0]) ;
	el.setCapture() ;
	objCurrentButton = el ;
	el = null ;
}

function buttonOnMouseUp() {
	with (window.event) {
		cancelBubble = true ;
		returnValue = false ;
		if (button != 1) {
			return ;
		}
		var el = srcElement ;
	}
	if (el.tagName == "IMG") {
		el = el.parentElement ;
	}
	showRaised(objCurrentButton, objCurrentButton.children[0]) ;
	objCurrentButton.releaseCapture() ;
	if (el == objCurrentButton) {
		switch (el.className) {
			case "windowButtonMinimize":
				if (element.windowState == "MINIMIZED") {
					element.windowState = "NORMAL" ;
				}
				else {
					element.windowState = "MINIMIZED" ;
				}
				break ;
			case "windowButtonMaximize":
				if (element.windowState == "MAXIMIZED") {
					element.windowState = "NORMAL" ;
				}
				else {
					element.windowState = "MAXIMIZED" ;
				}
				break ;
		}
	}
	objCurrentButton = null ;
	el = null ;
}


// ----------------------------------------------------
// iframe functions   
// ----------------------------------------------------

function contentOnLoad() {
	try {
		if (window.event.srcElement.contentWindow.document.title != "") {
			element.caption = window.event.srcElement.contentWindow.document.title ;
		}
	}
	catch(e) { return ; }
}


// ----------------------------------------------------
// menu functions   
// ----------------------------------------------------

function createNewMenu(id) {
	var objNewMenu = window.document.createElement("<table id='mnu" + id + "' cellspacing='0' cellpadding='0'>") ;
	with (objNewMenu.createTHead()) {
		with (insertRow()) {
			with (insertCell()) {
				colSpan = "5" ;
			}
		}
	}
	with (objNewMenu.createTFoot()) {
		with (insertRow()) {
			with (insertCell()) {
				colSpan = "5" ;
			}
		}
	}
	return objNewMenu ;
}

function insertNewMenuItem(objMenu, imgURL, mnuCaption) {
	var objNewMenuItem = objMenu.tBodies[0].insertRow() ;
	with (objNewMenuItem) {
		className = "2k3MenuItem" ;
		with (insertCell()) {
			className = "2k3MenuVerticalSpacerLeft" ;
		}
		with (insertCell()) {
			className = "2k3MenuImage" ;
			innerHTML = "<img src='" + imgURL + "' height='13' width='14'>" ;
		}
		with (insertCell()) {
			className = "2k3MenuCaption" ;
			innerHTML = mnuCaption ;
		}
		with (insertCell()) {
			className = "2k3MenuNoMore" ;
			innerHTML = "4" ;
		}
		with (insertCell()) {
			className = "2k3MenuVerticalSpacerRight" ;
		}
	}
	return objNewMenuItem ;
}

function insertNewMenuSeperator(objMenu) {
	with (objMenu.tBodies[0].insertRow()) {
		className = "2k3MenuSeperator" ;
		with (insertCell()) {
			className = "2k3MenuImage" ;
			colSpan = "2" ;
		}
		with (insertCell()) {
			className = "2k3MenuCaption" ;
			colSpan = "3" ;
			innerHTML = "<img>" ;
		}
	}
}

function showMenu(x, y) {
	with (window.document.body) {	
		var intRightEdge = clientWidth - x ;
		var intBottomEdge = clientHeight - y ;
		var intscrollLeft = scrollLeft + x ;
		var intscrollTop = scrollTop + y ;
	}
	element.menuState = true ;
	with (objMenu) {
		if (intRightEdge < offsetWidth) {
			var mnuX = intscrollLeft - offsetWidth ;
		}
		else {
			var mnuX = intscrollLeft ;
		}
		if (intBottomEdge < offsetHeight) {
			var mnuY = intscrollTop - offsetHeight ;
		}
		else {
			var mnuY = intscrollTop ;
		}
		style.zIndex = element.zIndex + 1 ;
	}
	switch (element.windowState) {
		case "MINIMIZED":
			with (objMenu) {
				setMenuEnabled("subMnu" + element.id + "Restore", true) ;
				setMenuEnabled("subMnu" + element.id + "Minimize", false) ;
				setMenuEnabled("subMnu" + element.id + "Maximize", true) ;
			}
			break ;
		case "NORMAL":
			with (objMenu) {
				setMenuEnabled("subMnu" + element.id + "Restore", false) ;
				setMenuEnabled("subMnu" + element.id + "Minimize", true) ;
				setMenuEnabled("subMnu" + element.id + "Maximize", true) ;
			}
			break ;
		case "MAXIMIZED":
			with (objMenu) {
				setMenuEnabled("subMnu" + element.id + "Restore", true) ;
				setMenuEnabled("subMnu" + element.id + "Minimize", true) ;
				setMenuEnabled("subMnu" + element.id + "Maximize", false) ;
			}
			break ;
	}
	objMenu.showMenu(mnuX, mnuY, 0) ;
	window.document.attachEvent("onmousedown", documentOnMouseDown) ;
}

function hideMenu() {
	window.document.detachEvent("onmousedown", documentOnMouseDown) ;
	objMenu.hideMenu() ;
	element.menuState = false ;
}


// ----------------------------------------------------
// internal functions   
// ----------------------------------------------------

function getContentWindow() {
	return objContentWindow ;
}


// ----------------------------------------------------
// internal functions   
// ----------------------------------------------------

function showRaised(el, elImage) {
	with (el.style) {
		borderLeft   = "1px solid buttonhighlight" ;
		borderRight  = "1px solid threeddarkshadow" ;
		borderTop    = "1px solid buttonhighlight" ;
		borderBottom = "1px solid threeddarkshadow" ;
	}
	with (elImage.style) {
		borderLeft   = "" ;
		borderRight  = "1px solid buttonshadow" ;
		borderTop    = "" ;
		borderBottom = "1px solid buttonshadow" ;
	}
}

function showPressed(el, elImage) {
	with (el.style) {
		borderLeft   = "1px solid threeddarkshadow" ;
		borderRight  = "1px solid buttonhighlight" ;
		borderTop    = "1px solid threeddarkshadow" ;
		borderBottom = "1px solid buttonhighlight" ;
	}
	with (elImage.style) {
		borderLeft   = "1px solid buttonshadow" ;
		borderRight  = "" ;
		borderTop    = "1px solid buttonshadow" ;
		borderBottom = "" ;
	}
}

function setWindowState() {
	objWindowCaption.title = "" ;
	switch (element.windowState) {
		case "CLOSED":
			internalSettingProperties = true ;
			objCloseButton.fireEvent("onmouseup") ;
			internalSettingProperties = false ;
			return ;
		case "MINIMIZED":
			with (element.style) {
				objWindowCaption.title = element.caption ;
				if (saveState != "MAXIMIZED") {
					saveTop = top ;
					saveLeft = left ;
					saveHeight = height ;
					saveWidth = width ;
					saveOffsetHeight = element.offsetHeight ;
					saveOffsetWidth = element.offsetWidth ;
				}
				if (element.parentId != "") {
					element.parentElement.style.border = window.document.all(element.parentId).parentBorder ;
				}
				border = "2px outset window" ;
				top = parentElement.offsetHeight - (objWindowCaption.offsetHeight + 12) ;
				left = parentElement.offsetLeft ;
				height = objWindowCaption.offsetHeight + 8 ;
				width = 160 ;
			}
			with (objCloseButton) {
				style.left = 153 - offsetWidth ;
			}
			with (objMaximizeButton) {
				children[0].setAttribute("src", element.currentStyle.maximizeImageUrl) ;
				title = "Maximize" ;
				style.left = objCloseButton.offsetLeft - objCloseButton.offsetWidth - 2 ;
			}
			with (objMinimizeButton) {
				children[0].setAttribute("src", element.currentStyle.restoreImageUrl) ;
				title = "Restore Window" ;
				style.left = objMaximizeButton.offsetLeft - objMaximizeButton.offsetWidth ;
			}
			break ;
		case "NORMAL":
			with (element.style) {
				border = "2px outset window" ;
				top = saveTop ;
				left = saveLeft ;
				height = saveHeight ;
				width = saveWidth ;
			}
			if (element.parentId != "") {
				element.parentElement.style.border = window.document.all(element.parentId).parentBorder ;
			}
			with (objCloseButton) {
				style.left = saveOffsetWidth - 8 - offsetWidth ;
			}
			with (objMaximizeButton) {
				children[0].setAttribute("src", element.currentStyle.maximizeImageUrl) ;
				title = "Maximize" ;
				style.left = objCloseButton.offsetLeft - objCloseButton.offsetWidth - 2 ;
			}
			with (objMinimizeButton) {
				children[0].setAttribute("src", element.currentStyle.minimizeImageUrl) ;
				title = "Minimize" ;
				style.left = objMaximizeButton.offsetLeft - objMaximizeButton.offsetWidth ;
			}
			with (objContentWindow) {
				style.width = saveOffsetWidth - 8 ;
				if (saveOffsetHeight - objWindowCaption.offsetHeight - 10 < 0) {
					style.height = 0 ;
				}
				else {
					style.height = saveOffsetHeight - objWindowCaption.offsetHeight - 10 ;
				}
			}
			break ;
		case "MAXIMIZED":
			with (element.style) {
				if (saveState != "MINIMIZED") {
					saveTop = top ;
					saveLeft = left ;
					saveHeight = height ;
					saveWidth = width ;
					saveOffsetHeight = element.offsetHeight ;
					saveOffsetWidth = element.offsetWidth ;
				}
				element.parentElement.style.border = "" ;
				border = "" ;
				top = 0 ;
				left = 0 ;
				height = "100%" ;
				width = "100%" ;
			}
			with (objCloseButton) {
				style.left = element.parentElement.offsetWidth - offsetWidth - 3 ;
			}
			with (objMaximizeButton) {
				children[0].setAttribute("src", element.currentStyle.restoreImageUrl) ;
				title = "Restore Window" ;
				style.left = objCloseButton.offsetLeft - objCloseButton.offsetWidth - 2 ;
			}
			with (objMinimizeButton) {
				children[0].setAttribute("src", element.currentStyle.minimizeImageUrl) ;
				title = "Minimize" ;
				style.left = objMaximizeButton.offsetLeft - objMaximizeButton.offsetWidth ;
			}
			with (objContentWindow) {
				style.width = objWindowCaption.offsetWidth ;
				style.height = element.offsetHeight - objWindowCaption.offsetHeight - 6 ;
			}
	}
	saveState = element.windowState ;
	if (!windowsSettingState || windowsSettingState == "false") {
		fireOnSetWindowState.fire() ;
	}
}

function getResizeDirection() {
	var sResult = "" ;
	var offSet = 8 ;
	with (window.event) {
		var xPos = offsetX ;
		var yPos = offsetY ;
	}
	if (yPos < offSet) {
		sResult += "n" ;
	}
	if (yPos > element.offsetHeight - offSet) {
		sResult += "s" ;
	}
	if (xPos < offSet) {
		sResult += "w" ;
	}
	if (xPos > element.offsetWidth - offSet) {
		sResult += "e" ;
	}
	return sResult ;
}

function getRealItem(el) {
	if (el != null) {
		if (el.tagName == "IMG") {
			return el.parentElement.parentElement.parentElement ;
		}
		if (el.tagName == "B") {
			el = el.parentElement ;
		}
		switch (el.className) {
			case "2k3MenuVerticalSpacerLeft":
				return el.parentElement ;
				break ;
			case "2k3MenuImage":
				return el.parentElement ;
				break ;
			case "2k3MenuCaption":
				return el.parentElement ;
				break ;
			case "2k3MenuMore":
				return el.parentElement ;
				break ;
			case "2k3MenuNoMore":
				return el.parentElement ;
				break ;
			case "2k3MenuVerticalSpacerRight":
				return el.parentElement ;
				break ;
			default:
				return el ;
				break ;
		}
	}
	else {
		return el ;
	}
}

</script>

</PUBLIC:COMPONENT>