var contentWin;
function OpenWindow(sWindowName, sWindowTitle, sClassVisible, sClassHidden, sContainer) {
	if (contentWin != null) {
		Dialog.alert("Close the window before opening it again!", {windowParameters:{ width:200, height:130}}); 
	}
	else {
		$(sWindowName).className = sClassVisible;
		contentWin = new Window(sWindowName + "_container", {className: "alphacube", maximizable: false, width: 500, height: 300, resizable: false, title: sWindowTitle, showEffect:Effect.Appear, hideEffect: Effect.Fade, draggable:true});
		contentWin.setContent(sWindowName);
		contentWin.toFront();
		contentWin.setDestroyOnClose();
		contentWin.showCenter();	
	
		// Set up a windows observer, check ou debug window to get messages
		myObserver = {
			onDestroy: function(eventName, win) {
				if (win == contentWin) {
					$(sWindowName).className = sClassHidden;
					$(sContainer).appendChild($(sWindowName));
					contentWin = null;
					Windows.removeObserver(this);
				}
			}
		}
		Windows.addObserver(myObserver);
	}
	return false;
}
