  
  var win;
  var isReady = false;
  Ext.onReady(function () {
    isReady = true;
  });
  
  function profileEdit(el, userID){
    if (!isReady){
      setTimeout("profileEdit(" + userID + ")", 1000);
      return false;
    }
    
    dialogHeight = 500;
		
    var profileEdit = {
		title: "Profile Info", 
		height: dialogHeight, 
		html: '<iframe src="/ajax.cfm?frame=true&a=profile&mode=edit&id=' + userID + '&s=' + currentSchoolAlias + '" style="width: 100%; border: 0; height: 100%"></iframe>'
		};
    var PhotoUpload = {
		title: "Upload Photo", 
		height: dialogHeight, 
		html: '<iframe src="/ajax.cfm?frame=true&a=profile&mode=photo&id=' + userID + '&s=' + currentSchoolAlias + '" style="width: 100%; border: 0; height: 100%"></iframe>'
		};
    
    var tabHolder = new Ext.TabPanel({
                                        activeTab: 0,                                   
                                        region: 'center',
                                        height: dialogHeight,
                                        items:[
                                         profileEdit,
										 PhotoUpload
                                        ]
                                    });

		var modTitle = "Edit Profile";			

		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 staff administration</a>'};

		var helpText = "<strong>Username</strong> is how you will login to the site.<br/><br />Details and Qualifications are extra boxes to tell about yourself. if you leave them blank they will not appear in the profile tabs<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: "Staff 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(){
        processWindowUpdate();
					win.hide();
				}
			}],
      keys: {
        key: 27, // Esc key
          handler: function(){ 
          
          processWindowUpdate();
          win.hide(); },
        scope: this
      }
    });
    win.show();
  }
  
    function classEdit(el, gcdID, uID){
    if (!isReady){
      setTimeout("classEdit(" + gcdID + ")", 1000);
      return false;
    }
    
    dialogHeight = 500;
		
    var classEdit = {
		title: "Class Info", 
		height: dialogHeight, 
		html: '<iframe src="/ajax.cfm?frame=true&a=profile&mode=editclass&uid=' + uID + '&gcdID=' + gcdID + '" style="width: 100%; border: 0; height: 100%"></iframe>'
		};

    
    var tabHolder = new Ext.TabPanel({
                                        activeTab: 0,                                   
                                        region: 'center',
                                        height: dialogHeight,
                                        items:[
                                         classEdit
                                        ]
                                    });

		var modTitle = "Edit Class";
		if (gcdID == 0)
			modTitle = "Create a New Class";	

		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 staff administration</a>'};

		var helpText = "<strong>Username</strong> is how the user will login to the site.<br /><br /><strong>First Name</strong> of the user logging in<br /><br /><strong>Last Name</strong> of the user logging in<br /><br/><br />...";
		var helpBox = {region: 'east', title: 'Help', split: true, width: 200, minSize: 150, layout:'fit', collapsible: true,  cls: 'dialogHelp', items: [{bodyStyle: 'padding: 10px; font-size: 1.4em', html: helpText}]};

    win = new Ext.Window({
      title: "Class Editor",
      minWidth: 520,
      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(){
                    processWindowUpdate();
                        win.hide();
                    }
                }],
      keys: {
        key: 27, // Esc key
        handler: function(){ 
        processWindowUpdate();
        win.hide(); },
        scope: this
      }
    });
    win.show();
  }



  

