  
  var win;
  var isReady = false;
  Ext.onReady(function() {
    isReady = true;
  });
  
  function addNavItem(el,ID,parentID){
    if (!isReady){
      setTimeout("addNavItem(" + parentID + ")", 1000);
      return false;
    }
    
    dialogHeight = 500;
		
    var addNavItem = {
		title: "Navigation Item", 
		height: dialogHeight, 
		html: '<iframe src="/ajax.cfm?frame=true&a=menu&mode=item&id=' + ID + '&parentID=' + parentID + '&s=' + currentSchoolAlias + '" style="width: 100%; border: 0; height: 100%"></iframe>'
		};

    
    var tabHolder = new Ext.TabPanel({
                                        activeTab: 0,                                   
                                        region: 'center',
                                        height: dialogHeight,
                                        items:[
                                         addNavItem
                                        ]
                                    });

		var modTitle = "Add Item";			

		var infoBox = {region: 'north', baseCls: '', cls: 'dialogHelpTitle', height: 48, border: 0, html: '<strong style="font-size: 13px; font-weight: bold">' + modTitle + '</strong><br /><a href="#">Click here to learn more about Left Navigation</a>'};

		var helpText = "<strong>Title</strong> will be displayed in the navigation.<br /><br/><br />...";
		var helpBox = {region: 'east', title: 'Help', split: true, width: 150, minSize: 150, layout:'fit', collapsible: true,  cls: 'dialogHelp', items: [{bodyStyle: 'padding: 10px; font-size: 1.4em', html: helpText}]};

    win = new Ext.Window({
      title: "Navigation Item Editor",
      minWidth: 320,
      width: 800,
			layout:'fit',
      height: dialogHeight + 48,
      layout: 'border',
      modal: true,
      maximizable: true,
      closeAction: 'hide',
      buttons: [],
      items: [infoBox, tabHolder, helpBox],
	  buttons: [{
				text: 'Finish',
				handler: function(){
					win.hide();
          processWindowUpdate();
				}
			}],
      keys: {
        key: 27, // Esc key
        handler: function(){ win.hide(); processWindowUpdate();},
        scope: this
      }
    });
    win.show();
  }
  
   
function addNavContainer(el,ID){
    if (!isReady){
      setTimeout("addNavContainer(" + ID + ")", 1000);
      return false;
    }
    
    dialogHeight = 500;
		
    var addNavContainer = {
		title: "Left Navigation", 
		height: dialogHeight, 
		html: '<iframe src="/ajax.cfm?frame=true&a=menu&mode=container&id=' + ID + '&s=' + currentSchoolAlias + '" style="width: 100%; border: 0; height: 100%"></iframe>'
		};

    
    var tabHolder = new Ext.TabPanel({
                                        activeTab: 0,                                   
                                        region: 'center',
                                        height: dialogHeight,
                                        items:[
                                         addNavContainer
                                        ]
                                    });

		var modTitle = "Add Widget";			

		var infoBox = {region: 'north', baseCls: '', cls: 'dialogHelpTitle', height: 48, border: 0, html: '<strong style="font-size: 13px; font-weight: bold">' + modTitle + '</strong><br /><a href="#">Click here to learn more about Left Navigation</a>'};

		var helpText = "<strong>Title</strong> will be displayed in the navigation and heading.<br /><br/><br />...";
		var helpBox = {region: 'east', title: 'Help', split: true, width: 150, minSize: 150, layout:'fit', collapsible: true,  cls: 'dialogHelp', items: [{bodyStyle: 'padding: 10px; font-size: 1.4em', html: helpText}]};

    win = new Ext.Window({
      title: "Widget Editor",
      minWidth: 320,
      width: 800,
			layout:'fit',
      height: dialogHeight + 48,
      layout: 'border',
      modal: true,
      maximizable: true,
      closeAction: 'hide',
      buttons: [],
      items: [infoBox, tabHolder, helpBox],
	  buttons: [{
				text: 'Finish',
				handler: function(){
					win.hide();
          processWindowUpdate();
				}
			}],
      keys: {
        key: 27, // Esc key
        handler: function(){ win.hide(); processWindowUpdate();},
        scope: this
      }
    });
    win.show();
  }
  

