Listing 1

<DIV ID="wctl" onmousedown=_nwWindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/corner-tl.gif);
	CLIP: rect(0px 16px 16px 0px);
	CURSOR: move; HEIGHT: 16px;
	LEFT: 0px; POSITION: absolute;
	TOP: 0px; VISIBILITY: visible;
	WIDTH: 16px; repeat: no"></DIV>
<DIV ID="wctr" onmousedown=_nwWindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/corner-tr.gif);
	CLIP: rect(0px 16px 16px 0px);
	CURSOR: move; HEIGHT: 16px;
	LEFT:  284px; POSITION: absolute;
	TOP: 0px; VISIBILITY: visible;
	WIDTH: 16px; repeat: no"></DIV>
<DIV ID="wcbl" onmousedown=_nwWindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/corner-bl.gif);
	CLIP: rect(0px 16px 16px 0px);
	CURSOR: move; HEIGHT: 16px;
	LEFT:  0px; POSITION: absolute;
	TOP: 184px;	VISIBILITY: visible;
	WIDTH: 16px; repeat: no"></DIV>
<DIV ID="wcbr" onmousedown=_nwWindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/corner-br.gif);
	CLIP: rect(0px 16px 16px 0px);
	CURSOR: move; HEIGHT: 16px;
	LEFT: 284px; POSITION: absolute;
	TOP: 184px; VISIBILITY: visible; WIDTH: 16px; repeat: no">
	</DIV>
<DIV ID="wEdgeLeft" onmousedown=_nwWindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/border-v.gif);
	CLIP: rect(0px 6px 168px 0px);
	CURSOR: w-resize; HEIGHT: 168px;
	LEFT: 0px; POSITION: absolute;
	TOP: 16px; VISIBILITY: visible;
	WIDTH: 6px; repeat: yes"></DIV>
<DIV ID="wEdgeTop" onmousedown=_nwWindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/border-h.gif);
	CLIP: rect(0px 268px 6px 0px);
	CURSOR: n-resize; HEIGHT: 6px;
	LEFT: 16px; POSITION: absolute;
	TOP: 0px; VISIBILITY: visible;
	WIDTH: 268px; repeat: yes"></DIV>
<DIV ID="wEdgeBtm" onmousedown=_nwWaindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/border-h.gif);
	CLIP: rect(0px 268px 6px 0px);
	CURSOR: s-resize; HEIGHT: 6px;
	LEFT: 16px; POSITION: absolute;
	TOP: 194px; VISIBILITY: visible;
	WIDTH: 268px; repeat: yes"></DIV>
<DIV ID="wEdgeRight" onmousedown=_nwWindowMouseDown(this)
	onselectstart="event.cancelBubble=true;return true;"
	STYLE="BACKGROUND-IMAGE: url(../images/border-v.gif);
	CLIP: rect(0px 6px 168px 0px);
	CURSOR: e-resize; HEIGHT: 168px;
	LEFT: 294px; POSITION: absolute;
	TOP: 16px; VISIBILITY: visible;
	WIDTH: 6px; repeat: yes"></DIV>
<iframe id="wContentFrame" NAME="wContentFrame"
	STYLE="BACKGROUND-COLOR: #76efb1;
	CLIP: rect(0px 288px 142px 0px); HEIGHT: 142px;
	LEFT: 6px; POSITION: absolute; TOP: 31px; VISIBILITY: visible; WIDTH: 288px"
	SRC="about:blank"></iframe>
<DIV ID="wTitleBar"
	onselectstart="event.cancelBubble=true;return false;"
	STYLE="CLIP: rect(0px 288px 24px 0px);
	CURSOR: default; HEIGHT: 24px; LEFT: 6px;
	POSITION: absolute; TOP: 6px; VISIBILITY: visible; WIDTH: 288px">
<DIV ID="wClose" onmouseup="_nwWindowMouseDown(this)"
	title="click here to close the window"
	STYLE="CLIP: rect(0px 20px 20px 0px);
	HEIGHT: 20px; LEFT: 268px; POSITION: absolute;
	TOP: 0px; VISIBILITY: visible; WIDTH: 20px"><A
	href="JavaScript://"><IMG border=0 id=wCloseImg
	onselectstart="event.cancelBubble=true;return false;"
	src="../images/close0.gif" width="20" height="20"></img></a></DIV>
<DIV ID="wMax" onmouseup="_nwWindowMouseDown(this)"
	title="click here to maximize the window"
	STYLE="CLIP: rect(0px 20px 20px 0px); HEIGHT: 20px;
	LEFT: 248px; POSITION: absolute; TOP: 0px; VISIBILITY: visible; WIDTH: 20px"><A
	href="JavaScript://"><IMG border=0 id=wMaxImg
	onselectstart="event.cancelBubble=true;return false;"
	src="../images/max0.gif" width="20" height="20"></a></DIV>
<DIV ID="wMin" onmouseup="_nwWindowMouseDown(this)"
	title="click here to minimize the window"
	STYLE="CLIP: rect(0px 20px 20px 0px); HEIGHT: 20px;
	LEFT: 228px; POSITION: absolute; TOP: 0px; VISIBILITY: visible; WIDTH: 20px"><A
	href="JavaScript://"><IMG border=0 id=wMinImg
	onselectstart="event.cancelBubble=true;return false;"
	src="../images/min0.gif" width="20" height="20"></a></DIV>
<nobr>
<DIV ID="wTitle" onselectstart="event.cancelBubble=true;return false;"
	STYLE="CLIP: rect(0px 208px 24px 0px);
	FONT-FAMILY: Arial; FONT-SIZE: 14px;
	FONT-WEIGHT: bold; HEIGHT: 24px; LEFT: 20px;
	POSITION: absolute; TOP: 0px; VISIBILITY: visible; WIDTH: 208px"> <SPAN
	ID="wTitleText" onselectstart="event.cancelBubble=true;return false;">Loading...</SPAN></DIV>
</nobr>
<DIV ID="wIcon"
	STYLE="CLIP: rect(0px 20px 20px 0px);
	HEIGHT: 20px; LEFT: 0px; POSITION: absolute;
	TOP: 0px; VISIBILITY: visible; WIDTH: 20px"><A
	href="JavaScript://"><IMG border=0 id=wIconImg
	onselectstart="event.cancelBubble=true;return false;"
	src="../images/icon.gif" width="20" height="20"></a></DIV>
</DIV>
<DIV ID="wTitleSep"
	STYLE="BACKGROUND-COLOR: #62659c;
	CLIP: rect(0px 288px 1px 0px);
	CURSOR: default; HEIGHT: 1px; LEFT: 6px; POSITION: absolute;
	TOP: 30px; VISIBILITY: visible; WIDTH: 288px"></DIV>
<nobr>
<DIV ID="wStatus" onselectstart="event.cancelBubble=true;return false;"
	STYLE="BACKGROUND-COLOR: #e2e2e2;
	CLIP: rect(0px 288px 20px 0px);
	CURSOR: default; FONT-FAMILY: Arial; FONT-SIZE: 12px; HEIGHT: 20px;
	LEFT: 6px; POSITION: absolute; TOP: 174px; VISIBILITY: visible; WIDTH: 288px"> <SPAN
	ID="wStatusText" onselectstart="event.cancelBubble=true;return false;">Status</SPAN></DIV>
</nobr>
<DIV ID="wStatusSep"
	STYLE="BACKGROUND-COLOR: #62659c;
	CLIP: rect(0px 288px 1px 0px); HEIGHT: 1px; LEFT: 6px;
	POSITION: absolute; TOP: 173px; VISIBILITY: visible; WIDTH: 288px"></DIV>

Listing 2

function NWindow(title,parentLayer,x,y,w,h,pwin,windowDefinitionFile)
{
    this.jPanel=JPanel;
    this.jPanel(parentLayer,x,y,w,h,null,true,null,true,true,pwin);
    objectManager.add(this);

    if(!windowDefinitionFile)
    	windowDefinitionFile="../client_lib/windowTemplate.html";
    this.load(windowDefinitionFile);


    this.title=title;
    this.titleBarHeight=24;
    this.statusBarHeight=20;
    this.statusText="Copyright(C)1996-2005, Coach Wei (<a href='http://www.coachwei.com'>blog</a>).  Open Source
	 licensed.";
    this.borderWidth=6;
    this.iconWidth=20;
    this.iconLength=200;
    this.iconized=false;
    this.winIcon="../images/icon.gif";
    this.corner=16;
    this.separator=1;
    this.color = new Object();
    this.color.titleUnfocused = '#cdceff';
    this.color.titleFocused='#00ffff';
    this.color.iconFocused='#aaffff';
    this.color.iconUnfocused="#bbbbbb";
    this.color.tileTextUnfocused="menu";
    this.color.titleTextFocused="highlighttext";
    this.className="NWindow";
    this.initWindow=_nWindowInitWindow;
    this.onMouseDown=_nwWindowMouseDown;
    this.onMouseUp=_nWindowOnMouseUp;
    this.onFocus=_nWindowOnFocus;
    this.onBlur=_nWindowOnBlur;
    this.repaintResize=_nWindowRePaintResize;
    this.addToTaskbar=_nWindowAddToTaskbar;
    this.startResize=_nwWindowStartResize;
    this.resize=_nWindowSetSize;
    this.iconize=_nWindowIconize;
    this.onClose=_nWindowOnClose;
    this.onMaximize=_nWindowOnMaximize;
    this.onMinimize=_nWindowOnMinimize;
    this.setTitle=_nWindowSetTitle;
    this.setIcon=_nWindowSetIcon;
    this.setStatus=_nWindowSetStatus;
    this.sizeContent=_nWindowSizeContent;
    this.loadContent=_nWindowLoad;
    this.getWindowSize=_getBrowserWindowSize;
}

function _nWindowInitWindow(win)
{
    if(!win||!win.document) return;
    this.doc=win.document;
    this.wctl=this.getJPanelFor("wctl",win);
    this.wctl.domObj.parentCtrl=this;
    this.wctr=this.getJPanelFor("wctr",win);
    this.wctr.domObj.parentCtrl=this;
    this.wcbr=this.getJPanelFor("wcbr",win);
    this.wcbr.domObj.parentCtrl=this;
    this.wcbl=this.getJPanelFor("wcbl",win);
    this.wcbl.domObj.parentCtrl=this;
    this.wEdgeTop=this.getJPanelFor("wEdgeTop",win);
    this.wEdgeTop.domObj.parentCtrl=this;
    this.wEdgeBtm=this.getJPanelFor("wEdgeBtm",win);
    this.wEdgeBtm.domObj.parentCtrl=this;
    this.wEdgeLeft=this.getJPanelFor("wEdgeLeft",win);
    this.wEdgeLeft.domObj.parentCtrl=this;
    this.wEdgeRight=this.getJPanelFor("wEdgeRight",win);
    this.wEdgeRight.domObj.parentCtrl=this;
    this.wTitleBar=this.getJPanelFor("wTitleBar",win);
    this.wTitleBar.domObj.parentCtrl=this;
    this.wIcon=this.getJPanelFor("wIcon",win);
    this.wTitle=this.getJPanelFor("wTitle",win);
    this.wTitle.domObj.parentCtrl=this;
    this.wClose=this.getJPanelFor("wClose",win);
    this.wClose.domObj.parentCtrl=this;
    this.wMax=this.getJPanelFor("wMax",win);
    this.wMax.domObj.parentCtrl=this;
    this.wMin=this.getJPanelFor("wMin",win);
    this.wMin.domObj.parentCtrl=this;
    this.wTitleSep=this.getJPanelFor("wTitleSep",win);
    this.wStatus=this.getJPanelFor("wStatus",win);
    this.wStatusSep=this.getJPanelFor("wStatusSep",win);
    this.wContent=this.getJPanelFor("wContentFrame",win,false,true);
    if(this.wContent.domObj) this.wContent.domObj.parentCtrl=this;
    this.wTitleText=win.document.all["wTitleText"];
    this.wStatusText=win.document.all["wStatusText"];
    this.wIconImg=win.document.all["wIconImg"];
    this.setDragable(true);

top.dragManager.setGrab(this,this.borderWidth,this.borderWidth,this.getWidth()-3*
this.iconWidth-2*this.borderWidth,this.titleBarHeight);
    if(this.resize) this.resize(this.w,this.h);
    if(top._initSystemEvent)
    {
        top._initSystemEvent(win);
        top._initSystemEvent(this.wContent.iframe.frame);
    }
}


Listing 3

function _nWindowSetTitle(title)
{
    this.title=title;
    if(!this.wTitleText)
    {
        requestManager.request(this,"setTitle",25,new Array(title));
        return;
    }
    this.wTitleText.innerHTML=title;
}

function _nWindowSetStatus(s)
{
    if(!this.wStatusText)
    {
        requestManager.request(this,"setStatus",25,new Array(s));
        return;
    }
    this.wStatusText.innerHTML=s;
    this.statusText=s;
}

function _nWindowSetIcon(iconURL)
{
    if(!this.wIconImg)
    {
        requestManager.request(this,"setIcon",105,new Array(iconURL));
        return;
    }
    this.wIconImg.src=iconURL;
    this.winIcon=iconURL;
}

Listing 4

<html>
<head>
<title>Progressbar</title>
<SCRIPT TYPE="text/JavaScript" SRC="../client_lib/is.js"></SCRIPT>
<Script TYPE="text/JavaScript"> 
	var nexArray=new Array("Event Synchronization",
	"Request Management","Object Management","Event Management", 
	"Drap and Drop","Application Infrastructure","Advanced Windows System",
	"Server Communcation","Cascade Menu", "Interactive Dialog",
	"Empower the Next Generation Web","Web-based File Management",  
	"Messaging","Empower the Next Generation Software",
	"Web-based Word Processing","The Webpage is the Software", 
	"Extending Your OS to the Web"); 

	var currentProgress=0;
	function loadProgress1() {
		currentProgress++;
		var pro=Math.floor(currentProgress*100/nexArray.length);
		if(pro>99) pro=100;
		pro=pro/100;
		if(currentProgress>nexArray.length)
		currentProgress=nexArray.length; if(is.ns) {if(window.progress) progress(pro);}
		else { if(parent.progress) parent.progress(pro,nexArray[currentProgress-1]);} } </script>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</SCRIPT>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/JEvent.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/NRequestManager.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/JObjectManager.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/JEventManager.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/JDragManager.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/JPanel.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/NWindow.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nServer.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwMenu.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwDialog.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwToolbar.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwFileDialog.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwMsgDialog.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwFixedTable.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwEditCtrl.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nwTabPanel.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
<SCRIPT TYPE="text/JavaScript" SRC="../ajaxword/nwWord.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">loadProgress1();</script>
</head>
</body>
</html>

Listing 5

<HTML>
<HEAD>
<TITLE>Welcome to AjaxWord</TITLE>
<SCRIPT TYPE="text/JavaScript" SRC="../client_lib/is.js"></SCRIPT>
<SCRIPT TYPE="text/JavaScript">
	_nxLoadActiveX("../client_lib","JEvent", "JObjectManager",
	"JEventManager","JPanel","JDragManager","NRequestManager","nwDialog");
</SCRIPT>
<SCRIPT TYPE="text/JavaScript">
var topPanel; var contentPanel; //var dialogPanel;
function initDoc() {
	pageWidth = (is.ns4)? window.innerWidth: document.body.offsetWidth;
	pageHeight = (is.ns4)? window.innerHeight : document.body.offsetHeight;
	topPanel=new JPanel(null,0,0,pageWidth,66,null,null,null,true,true,window);
	contentPanel=new JPanel(null,0,66,pageWidth,pageHeight-66,null,null,null,true,true,window);
	topPanel.paint();
	contentPanel.paint();    //alert(topPanel.html);
    topPanel.load("nwWordIEMenubar.html");
    contentPanel.load("nwWordBg.html");  
   }

</SCRIPT>
</HEAD>
<body
	style="BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BORDER-RIGHT: 0px; BORDER-TOP: 0px; MARGIN: 0px"
	scroll=no onload="initDoc();">
<iframe id="nServer1" name="nServer1" height=0 width=0></iframe>
<iframe id="nServer2" name="nServer2" height=0 width=0></iframe>
<iframe id="nServer3" name="nServer3" height=0 width=0></iframe>
<iframe id="nServer4" name="nServer4" height=0 width=0></iframe>

<form id="nServerPost1" name="nServerPost1" method="post"
	ENCTYPE="multipart/form-data">
	<input type="hidden" name="user">
	<input type="hidden" name="nwRequestID">
	<input type="hidden" name="sessionID">
	<input type="hidden" name=postData>
	<input type="hidden" name="postName">
	<input type="hidden" name="name2">
	<input type="hidden" name="data2">
</form>

<form id="nServerPost2" name="nServerPost2" method="post"
	ENCTYPE="multipart/form-data">
	<input type="hidden" name="user">
	<input type="hidden" name="nwRequestID">
	<input type="hidden" name="sessionID">
	<input type="hidden" name=""postName"">
	<input type="hidden" name="postData">
	<input type="hidden" name="name2">
	<input type="hidden" name="data2">
</form>

<SCRIPT TYPE="text/JavaScript"
	SRC="../client_lib/nServer.js"></SCRIPT>
</body>
</HTML>


Listing 6

function initWord()
{
    pageWidth = (is.ns4)? window.innerWidth: document.body.offsetWidth;
    pageHeight = (is.ns4)? window.innerHeight : document.body.scrollHeight;
    if(parent.handleResize) parent.handleResize(pageHeight);
    menubar=new nwToolbar('menubar');
    toolbar=new nwToolbar('shortcuts');

    menuListener =new nwWordGUIActionListener();
    flistener=new focusListener();
    eventManager.addEventListener("MenuClick",menuListener);
    eventManager.addEventListener("BUTTONCLICK",menuListener);
    eventManager.addEventListener("FOCUS",flistener);
    eventManager.addEventListener("BLUR",flistener);
    toolbar.setEnable('save',false);

    if(!dialogPanel)
    {
        dialogPanel=new nwDialog("A Dialog Window",200,100,400,200,true,parent);
        dialogPanel.paint();
     }

    window.onbeforeunload=_onWordExit;
    formatSelect=document.all['formatSelect'];
    fontSelect=document.all['fontSelect'];
    sizeSelect=document.all['sizeSelect'];
}


Listing 7

function nwWordGUIActionListener()
{
    this.id="I listen to Word Menu";
    this.onMenuClick=menuClicked;
    this.onButtonClick=menuClicked;
}
function menuClicked(je)
{
    if(!je) return;
    var cmd=je.getCommand();
    var srcObj=je.getSource();
    if(cmd) cmd=cmd.toLowerCase();
    if(srcObj)
    {
        if(srcObj.id && srcObj.id=="fgColorPick")
        {
            doFormat("ForeColor",false,cmd);
            return;
        }
        else if(srcObj.id=="bgColorPick")
        {
            doFormat("BackColor",false,cmd);
            return;
        }
        else if(srcObj.id=="bgcolor")
        {
            doFormat("BgColor",false,cmd);
            return;
        }
    }
    if(cmd=="new")
    {
        openFile();
    }
    else if (cmd=="open")
    {
        var jp=showFileDialog("Open");
        jp.setFileDialog(nwFileDialog.OPEN);
        jp.fileDialogCallBack=openFile;
    }
    else if(cmd=="close")
    {
        var cw=getFocusedWindow();
        if(cw && cw.nwEditCtrl)
        {
            cw.onClose();
        }
        return;
    }
    else if(cmd=="saveas")
    {
        var cw=getFocusedWindow();
        if(cw)
        {
            cw.filename=null;
            saveFile();
        }
    }
    else if(cmd=="save")
    {
        saveFile();
    }
    else if(cmd=="pagesetup")
    {
    }
    else if(cmd=="printpreview")
    {
        showPreview();
    }
    else if(cmd=="print")
    {
        showPreview();
    }
    else if(cmd=="exit")
    {
        if(_onWordExit())
        {
            if(window.parent) window.parent.close();
            else window.close();
        }
    }
    else if(cmd=="cut")
    {
        doFormat('Cut');
        return;
    }
    else if(cmd=="copy")
    {
        doFormat('Copy');
        return;
    }
    else if(cmd=="paste")
    {
        doFormat('Paste');
        return;
    }
    else if(cmd=="selectall")
    {
        doFormat('SelectAll');
        return;
    }
    else if(cmd=="clear")
    {
        doFormat('Unselect');
        return;
    }
    else if(cmd=="find")
    {
        doDialogAction("./nwFindReplace.html","Find and Replace",550,250);
        return;
    }
    else if(cmd=="replace")
    {
        doDialogAction("./nwFindReplace.html","Find and Replace",550,250);
        return;
    }
    else if(cmd=="normalview")
    {
        var cw=getFocusedWindow();
        if(cw && cw.nwEditCtrl)
        {
            cw.nwEditCtrl.init(true);
            cw.setFocus(true);
        }
        return;
    }
    else if(cmd=="browseview")
    {
        var cw=getFocusedWindow();
        if(cw && cw.nwEditCtrl)
        {
            cw.nwEditCtrl.init(false);
            cw.setFocus(true);
        }
        return;
    }
    else if(cmd=="preview")
    {
        showPreview();
        return;
    }
    else if(cmd=="pageview")
    {
    }
    else if(cmd=="bgimage")
    {
    }
    else if(cmd=="insertimage")
    {
        doInsert('InsertImage',true);
        return;
    }
    else if(cmd=="uploadtimage")
    {
        doDialogAction("nwUploadImage.html","Upload and Insert Image",420,160);
        return;
    }
    else if(cmd=="link")
    {
        doDialogAction(../ajaxword/nwInputLink.html","Insert HyperLink",420,160);
        return;
    }
    else if(cmd=="button")
    {
        doInsert('InsertButton',true);
    }
    else if(cmd=="inputbutton")
    {
        doInsert('InsertInputButton',true);
    }
    else if(cmd=="hr")
    {
        doInsert('InsertHorizontalRule',true);
    }
    else if(cmd=="select")
    {
        doInsert('InsertSelectDropdown',true);
    }
    else if(cmd=="password")
    {
        doInsert('InsertInputPassword',true);
    }
    else if(cmd=="listbox")
    {
        doInsert('InsertSelectListbox',true);
    }
    else if(cmd=="textarea")
    {
        doInsert('InsertTextArea',true);
    }
    else if(cmd=="checkbox")
    {
        doInsert('InsertInputCheckbox',true);
    }
    else if(cmd=="radiobtn")
    {
        doInsert('InsertInputRadio',true);
    }
    else if(cmd=="textbox")
    {
        doInsert('InsertInputText',true);
    }
    else if(cmd=="submit")
    {
        doInsert('InsertInputSubmit',true);
    }
    else if(cmd=="reset")
    {
        doInsert('InsertInputReset',true);
    }
    else if(cmd=="inserttable")
    {
        _nwDoInsertTable();
        return;
    }
    else if(cmd=="selectcell")
    {
    }
    else if(cmd=="selectrow")
    {
    }
    else if(cmd=="selectcol")
    {
    }
    else if(cmd=="selecttable")
    {
    }
    else if(cmd=="insertcel")
    {
        _nwTableInsertCel();
        return;
    }
    else if(cmd=="insertrow")
    {
        _nwTableInsertRow();
        return;
    }
    else if(cmd=="insertcol")
    {
        _nwTableInsertCol();
        return;
    }
    else if(cmd=="deleterow")
    {
        _nwTableDeleteRow();
        return;
    }
    else if(cmd=="deletecol")
    {
        _nwTableDeleteCol();
        return;
    }
    else if(cmd=="deletecel")
    {
        _nwTableDeleteCel();
        return;
    }
    else if(cmd=="minimizeall")
    {
        for(var i=0;i<winArray.length;i++)
        {
            var wi=winArray[i];
            if(wi.isVisible()) wi.iconize();
        }
    }
    else if(cmd=="arrangewindow")
    {
        var bx=20;
        var by=20;
        var wx=bx;
        wy=by;
        var pw=500;
        ph=500;
        for(var i=0;i<winArray.length;i++)
        {
            var wi=winArray[i];
            if(i==0)
            {
                pw = wi.winLevel.document.body.offsetWidth-4;
                ph = wi.winLevel.document.body.offsetHeight-4;
            }
            if(wi.isVisible())
            {
                wi.resize(500,300);
                objectManager.bringToFront(wi);
                wi.setLocation(wx,wy);
                wx+=50;
                wy+=50;
                if(wx>pw-200)
                {
                    bx+=70;
                    wx=bx;
                }
                if(wy>ph-200)
                {
                    by=50;
                    wy=by;
                }
                if(bx>pw-200) bx=20;
            }
        }
    }
    else if(cmd=="closeall")
    {
        for(var i=0;i<winArray.length;i++)
        {
            var wi=winArray[i];
            if(wi.isVisible())
            {
                if(wi.onClose) wi.onClose();
                else wi.setVisible(false);
            }
        }
    }
    else if(cmd=="help")
    {
    }
    else if(cmd=="about")
    {
     
        showMsgDlg("<CENTER>
		<H1>Ajax<i>W</i>ord</H1>Version: alpha<BR>
		Written and modified between 1996 and 2000.
		<BR><BR>Copyright(c)1996-2005 Coach Wei
		<a href='http://www.coachwei.com/' target=_blank>blog</a>.
		Open Source licensed.",
        "About AjaxWord", nwMsgDialog.OK,"../images/settings.gif");

    }
    else
    {
    }
}