
  function windowModuleConfig(modSettings){
    this._module = modSettings;
    var types= {
      hide_thumbnails: {},
      action_type: {},
      AJAX_SWITCHER: {},
      CAL_WIDTH: {},
      CELL_HEIGHT: {},
      HIDE_COMMENTS: {},
      HIDE_KEYWORDS: {},
      HIDE_META: {},
      LIST_MODE: {},
      maxitems: {},
      MINI_MODE: {},
      MINI_TITLE: {},
      MODE: {},
      MODULEACTION: {},
      NO_FIRST_SPACE: {},
      SHOW_CAT_IMAGE: {},
      TRUNCATE_TEXT: {}
    };
    
    var modTypes = {    
      /* PAGE */
      page: {
        layouts: [['default', '(Default)']],
        settings: {
          layout: {visible: false, value: 'default'}
        }
      },
      
      iframe: {
        layouts: [['default', '(Default)']],
        settings: {
          layout: {visible: false, value: 'default'},
          url: {visible: true, value: 'http://'},
          set_height: {visible: true, value: '200'}
        }
      },

      event: {
        layouts: [
          ['default', 'Month View'],
          ['week', 'Week View'],
          ['weekwithdays', 'Week w/Days'],
          ['weekdaysonly', 'Week (Days Only)'],
          ['day', 'Day View'],
          ['list', 'List View'],
          ['year', 'Year View']
          ],
        settings: {
          dateoffset: {visible: true, value: 0, type: 'int'},
          maxcalendarlistdays: {visible: true, value: 0, type: 'int'},
          maxcalendarlistitems: {visible: true, value: 0, type: 'int'},
          show_comments: {visible: true, value: true, type: 'bool'},
          layout: {visible: false, value: 'default'}
        }
      },

      /* BLOG */
      blog: {
        layouts: [['default', '(Default)']],
        settings: {
          widgetpagertop: {visible: true, value: true, type: 'bool'},
          widgetpagerbottom: {visible: true, value: true, type: 'bool'},
          max_items_per_page: {visible: true, value: 10, type: 'int'},
          truncate_text: {visible: true, value: 0, type: 'int'},
          image_size: {visible: true, value: 0, type: 'int'},
          strip_tags: {visible: true, value: true, type: 'bool'},
          hide_list_thumbnails: {visible: true, value: false, type: 'bool'},
          hide_post_thumbnails: {visible: true, value: true, type: 'bool'},
          hide_posted_date: {visible: true, value: false, type: 'bool'},
          hide_author: {visible: true, value: false, type: 'bool'},
          hide_footer_links: {visible: true, value: false, type: 'bool'},
          show_comments: {visible: true, value: true, type: 'bool'},
          layout: {visible: false, value: 'default'}
        }
      },
			
      /* ASSIGNMENT */
      assignment: {
        layouts: [
          ['default', 'Thumbnail Left of Post & Title'],
          ['undertitle', 'Thumbnail Left of Post Under Title'],
          ['wrap', 'Wrap Text around Thumbnail'],
          ['header', 'Header Image Above Title'],
          ['subheader', 'Header Image Below Title'],
          ['noheader', 'Header Image Only (No Text)'],
          ['nothumb', 'No Thumbnail']
        ],
        settings: {
          widgetpagertop: {visible: true, value: true, type: 'bool'},
          widgetpagerbottom: {visible: true, value: true, type: 'bool'},
          max_items_per_page: {visible: true, value: 10, type: 'int'},
          truncate_text: {visible: true, value: 0, type: 'int'},
          image_size: {visible: true, value: 0, type: 'int'},
          strip_tags: {visible: true, value: true, type: 'bool'},
          hide_list_thumbnails: {visible: true, value: false, type: 'bool'},
          hide_post_thumbnails: {visible: true, value: true, type: 'bool'},
          hide_posted_date: {visible: true, value: false, type: 'bool'},
          hide_author: {visible: true, value: false, type: 'bool'},
          hide_footer_links: {visible: true, value: false, type: 'bool'},
          show_comments: {visible: true, value: true, type: 'bool'},
          layout: {visible: false, value: 'default'}
        }
      },
			 /* SCOPE AND SEQUENCE */
      scope: {
        layouts: [['default', '(Default) Left Scrolling'],['listview', ' Subject List View']],
        settings: {
          layout: {visible: false, value: 'default'}
        }
      },
      /* PODCAST */
      podcast: {
        layouts: [['default', '(Default)']],
        settings: {
          widgetpagertop: {visible: true, value: true, type: 'bool'},
          widgetpagerbottom: {visible: true, value: true, type: 'bool'},
          max_items_per_page: {visible: true, value: 10, type: 'int'},
          truncate_text: {visible: true, value: 0, type: 'int'},
          image_size: {visible: true, value: 0, type: 'int'},
          strip_tags: {visible: true, value: true, type: 'bool'},
          hide_list_thumbnails: {visible: true, value: false, type: 'bool'},
          hide_post_thumbnails: {visible: true, value: true, type: 'bool'},
          hide_posted_date: {visible: true, value: false, type: 'bool'},
          hide_author: {visible: true, value: false, type: 'bool'},
          hide_footer_links: {visible: true, value: false, type: 'bool'},
          show_comments: {visible: true, value: true, type: 'bool'},
          layout: {visible: false, value: 'default'}
        }
      },
      
      /* NEWS */
      news: {
        notice: {msg: '<strong>Notice:</strong> Modifications to the size of thumbnails or header images should be performed by someone with html/css experience as it may break the layout. Modify at your own risk. '},
        layouts: [
          ['default', 'Thumbnail Left of Post & Title'],
          ['undertitle', 'Thumbnail Left of Post Under Title'],
          ['wrap', 'Wrap Text around Thumbnail'],
          ['header', 'Header Image Above Title'],
          ['subheader', 'Header Image Below Title'],
          ['noheader', 'Header Image Only (No Text)'],
          ['nothumb', 'No Thumbnail']
        ],
        settings: {
          widgetpagertop: {visible: true, value: true, type: 'bool'},
          widgetpagerbottom: {visible: true, value: true, type: 'bool'},
          
          max_items_per_page: {visible: true, value: 10, type: 'int'},
          truncate_text: {visible: true, value: 0, type: 'int'},
          
          thumbnail_width: {visible: true, value: '90'},
          thumbnail_height: {visible: true, value: '80'},
          header_width: {visible: true, value: '100%'},
          header_height: {visible: true, value: '80'},
          
          strip_tags: {visible: true, value: true, type: 'bool'},
          hide_list_thumbnails: {visible: true, value: false, type: 'bool'},
          hide_post_thumbnails: {visible: true, value: true, type: 'bool'},
          hide_posted_date: {visible: true, value: false, type: 'bool'},
          hide_author: {visible: true, value: false, type: 'bool'},
          hide_footer_links: {visible: true, value: false, type: 'bool'},
          show_comments: {visible: true, value: true, type: 'bool'},
          layout: {visible: false, value: 'default'}
        }
      },
      
      /* WEATHER */
      weather: { 
        layouts: [['default', '(Default)'], ['compact', 'Compact'], ['detail', 'Detailed']],
        settings: {
          zipcode: {visible: true, value: currentZipCode!=''?currentZipCode:'93313'},
          layout: {visible: false, value: 'default'}
        }
      },
      /* Slide Show */
      slideshow: { 
        layouts: [['None','None'],['Blur','Blur'],['Cross Fade','Cross Fade'], ['Dissolve','Dissolve'], ['Drop','Drop'], ['Lens','Lens'], ['Photo Flash','Photo Flash'], ['Push','Push'], ['Wipe','Wipe'], ['Wipe and Fade','Wipe and Fade']],
        settings: {
          set_width: {visible: false, value: '100%'}, //besure to re-add argument to common/ext/portlet.js
          set_height: {visible: true, value: '200'},
          disable_panzoom: {visible: true, value: false, type: 'bool'},
          layout: {visible: false, value: 'Cross Fade'},
          album_select: {visible: true, type: 'btn'}
        }
      },
      /* Header Slide Show */
      header_slideshow: { 
        layouts: [['None','None'],['Blur','Blur'],['Cross Fade','Cross Fade'], ['Dissolve','Dissolve'], ['Drop','Drop'], ['Lens','Lens'], ['Photo Flash','Photo Flash'], ['Push','Push'], ['Wipe','Wipe'], ['Wipe and Fade','Wipe and Fade']],
        settings: {
          disable_panzoom: {visible: true, value: false, type: 'bool'},
          layout: {visible: false, value: 'Cross Fade'}
        }
      },
      /* Members */
      members: { 
        layouts: [['default', 'Picture View'], ['compact', 'List View'], ['detail', 'List View With Bio']],
        settings: {
          layout: {visible: false, value: 'default'},
          show_user_email: {visible: true, value: true, type: 'bool'},
          show_user_phone: {visible: false, value: false, type: 'bool'},
          show_user_picture: {visible: true, value: true, type: 'bool'},
          strip_tags: {visible: true, value: true, type: 'bool'},
          truncate_text: {visible: true, value: 0, type: 'int'}
        }
      },
      /* RSS */
      rss: { 
        layouts: [['default', '(Default)'], ['compact', 'Compact']],
        settings: {
          feedurl: {visible: true, value: ''},
          max_items_total: {visible: true, value: 0, type: 'int'},
          truncate_text: {visible: true, value: 0, type: 'int'},
          strip_tags: {visible: true, value: true, type: 'bool'},
          hide_post_thumbnails: {visible: true, value: true, type: 'bool'},
          hide_posted_date: {visible: true, value: false, type: 'bool'},
          hide_author: {visible: true, value: false, type: 'bool'},
          hide_footer_links: {visible: true, value: false, type: 'bool'},
          layout: {visible: false, value: 'default'}
        }
      }
    };
    var propertyNames = {
        show_comments: ["Enable Commenting"],
        
        feedurl: ["Feed Url"],
        url: ["iFrame Url"],
        album_select: ["Select Photos"],
        widgetpagertop:    ["Show Pager at Top"],
        widgetpagerbottom: ["Show Pager at Bottom "],
        hide_list_thumbnails: ["Hide Thumbnail in List"],
        hide_post_thumbnails: ["Hide Thumbnail in Post"],
        max_items_per_page: ["Max Items per Page"],
        max_items_total: ["Max Items", "Specify 0 for all"],
        strip_tags: ["Strip HTML Tags"],
        image_size: ["Set image size", "Specify pixels"],

        header_width: ["Header Image Width", "Specify pixels or percentages"],
        header_height: ["Header Image Height", "Specify pixels or percentages"],
                  
        thumbnail_width: ["Thumbnail Wrap Width", "Specify pixels or percentages"],
        thumbnail_height: ["Thumbnail Wrap Height", "Specify pixels or percentages"],
        
        strip_tags_all: ["Strip All Tags"],
        hide_links: ["Strip Links in Content"],
        hide_posted_date: ["Hide Posted Date"],
        hide_author: ["Hide Author Link"],
        disable_panzoom: ["Disable PanZoom"],
        hide_footer_links: ["Hide Footer Links"],
        set_width: ["Width"],
        set_height: ["Height"],
        truncate_text: ["Truncate Length", "Specify 0 for all"],
        zipcode: ["ZIP Code"],
        dateoffset: ["Date Offset", "Specify in Days"],
        maxcalendarlistdays: ["Max Days in List View", "Specify 0 for all"],
        maxcalendarlistitems: ["Max Items in List View", "Specify 0 for all"],
        
        show_user_email: ["Show Users Email Address"],
        show_user_phone: ["Show Users Phone Number"],
        show_user_picture: ["Show Picture On List View"]
    };
    
    var propertyGroups = {
        show_comments: "general",
        
        disable_panzoom: "advanced",
        feedurl: "external",
        url: "general",
        album_select: "general",
        widgetpagertop:    "widgetonly",
        widgetpagerbottom: "widgetonly",
        hide_list_thumbnails: "listview",
        hide_post_thumbnails: "postview",
        max_items_per_page: "listview",
        max_items_total: "listview",
        strip_tags: "general",
        image_size: "thumbnail",

        header_width: "header",
        header_height: "header",
                  
        thumbnail_width: "thumbnail",
        thumbnail_height: "thumbnail",
        
        strip_tags_all: "general",
        hide_links: "general",
        hide_posted_date: "general",
        hide_author: "general",
        hide_footer_links: "general",
        set_width: "general",
        set_height: "general",
        truncate_text: "general",
        zipcode: "external",
        dateoffset: "advanced",
        maxcalendarlistdays: "advanced",
        maxcalendarlistitems: "advanced",
        
        show_user_email:"general",
        show_user_phone:"general",
        show_user_picture:"general"
    };

    var groupNames = {
      general : "General Settings",
      advanced: "Advanced Settings",
      external: "Additional Information",
      thumbnail: "Thumbnail",
      header: "Header",
      widgetonly: "Widget Only",
      listview: "List Settings",
      postview: "Post Settings"
    };
    
    if (!modTypes[this._module.storeParams.keyword]){
      Ext.Msg.alert('Error', 'This module doesn\'t have any settings available.');
      return false;
    }
    var curModType = modTypes[this._module.storeParams.keyword];
    
    var customEditors = {};
    var tmpOptions = {};
    var tmpOptionEls = {};    
    var _self = this;
    
    var meinItems = [];
    var meinNotice = curModType.notice && curModType.notice.msg ? curModType.notice.msg : '';
    var tmpOptionsLayout = this._module.values['layout'];
    // meinItems nowl!
    tmpOptionEls['general'] = {
      xtype: 'fieldset',
      autoHeight: true,
      title: groupNames['general'],
      items: []
    };
    var widgetTitle = this._module.values['__alias'] && this._module.values['__alias'] != '' ? this._module.values['__alias'] : Ext.util.Format.trim(this._module.title);
    tmpOptionEls['general'].items.push({
                      xtype: (currentPageAction != 'portal' && currentPageAction != 'classes' && currentPageAction != 'departments' )?'hidden':'textfield',
                      //id: 'layoutTitle_' + this._module.storeParams.id,
                      name: '__alias',
                      fieldLabel: 'Title',
                      value: widgetTitle
                    });
    tmpOptionEls['general'].items.push({
                      xtype: 'combo',
                      //id: 'layoutCombo_' + this._module.storeParams.id,
                      name: 'layout_combo',
                      fieldLabel: 'Layout',
                      typeAhead: true,
                      forceSelection: true,
                      triggerAction: 'all',
                      lazyRender:true,
                      mode: 'local',
                      store: new Ext.data.ArrayStore({
                          id: 0,
                          fields: [
                              'myId',
                              'displayText'
                          ],
                          data: curModType.layouts
                      }),
                      value: tmpOptionsLayout,
                      valueField: 'myId',
                      hiddenName: 'layout',
                      displayField: 'displayText'
                    });


    for(moduleKey in curModType.settings){
      if (curModType.settings[moduleKey].visible){
        var curModValue = curModType.settings[moduleKey].value;
        //if(typeof( this._module.values[moduleKey] ) != "undefined" && this._module.values[moduleKey]!==''){
        curModValue = this._module.values[moduleKey];
        var curGroup = propertyGroups[moduleKey];
        if (!tmpOptionEls[curGroup]){
          tmpOptionEls[curGroup] = {
            xtype: 'fieldset',
            autoHeight: true,
            title: groupNames[curGroup],
            items: []
          };
        }
          
        var moduleKeyName = curModType.settings[moduleKey].type + "__" + moduleKey;
        switch(curModType.settings[moduleKey].type){
          case "int":
            //curModValue = parseInt(curModValue);
            tmpOptionEls[curGroup].items.push({
              xtype: 'numberfield',
              name: moduleKeyName,
              width: 60,
              fieldLabel: propertyNames[moduleKey][0],
              value: curModValue
            });
            if (propertyNames[moduleKey][1] != undefined){
              tmpOptionEls[curGroup].items.push({
                xtype: 'displayfield',
                html: propertyNames[moduleKey][1]
              });
            }
            break;
            
          case "bool":
            tmpModValue = this._module.values[moduleKey];
            if (tmpModValue || tmpModValue == "true" || tmpModValue == "1")
              curModValue = true;
            else
              curModValue = false;
              
            tmpOptionEls[curGroup].items.push({
              xtype: 'checkbox',
              name: moduleKeyName,
              hideLabel: true,
              boxLabel: propertyNames[moduleKey][0],
              checked: curModValue
            });
            break;
            
            case "btn":
            tmpModValue = this._module.values[moduleKey];
            tmpModSettings = this._module.storeParams;
            if (tmpModValue || tmpModValue == "true" || tmpModValue == "1")
              curModValue = true;
            else
              curModValue = false;
            tmpOptionEls[curGroup].items.push({
                        xtype: 'button',
                        text:'Click To Open',
                        margin:10,
                        name: moduleKeyName,
                        fieldLabel: propertyNames[moduleKey][0],
                        listeners:{
                          click: function(btn,evnt){
                            //curModType.settings[moduleKey].action();
                            albumSetID = tmpModSettings.portletID;
                            AlbumPickShared({gcdID:0, slideID: albumSetID, schoolID: currentSchool.id}, true);
                           }
                        }
                    });
            break;
            
          default:
          //if(window.console && console.info) console.info(moduleKey);
            tmpOptionEls[curGroup].items.push({
              xtype: 'textfield',
              name: moduleKeyName,
              width: 120,
              fieldLabel: propertyNames[moduleKey][0],
              value: this._module.values[moduleKey]
            });
            if (propertyNames[moduleKey][1] != undefined){
              tmpOptionEls[curGroup].items.push({
                xtype: 'displayfield',
                html: propertyNames[moduleKey][1]
              });
            }
            break;
        }
        //}
        //alert(moduleKey + ' - ' + curModValue);
        //tmpOptions[moduleKey] = curModValue;
      }else{
        switch (moduleKey){
          case "layout":
            tmpOptionsLayout = this._module.values[moduleKey];
            break;
        }
      }
    }
                    
    var tmpOptionElsArr = [];
    for(el in groupNames)
      if (tmpOptionEls[el] && tmpOptionEls[el].items && tmpOptionEls[el].items.length > 0)
        tmpOptionElsArr.push(tmpOptionEls[el]);
    
    var formHolderPanel = new Ext.Panel({
                                  padding: 10,
                                  ref: '../../generalTab',
                                  title: 'General',
                                  items: tmpOptionElsArr
                                });


    var tabPanels = [formHolderPanel];
    if (this._module.storeParams.keyword == "podcast"){
      var modulePresets = new CS2.video.selectVideoPresetsForModule({
        moduleID  : _self._module.storeParams.id,
        portletID : _self._module.storeParams.portletID,
        gcdID     : currentPageGCDID
      });
      tabPanels.push({
        title: 'Video Presets',
        ref: '../../videoPresets',
        padding: 10,
        items: [
                modulePresets
              ]
      });
    }
    
    var formPanel = new Ext.FormPanel({
                      ref: '../mainForm',
                      border: false,
                      layout: 'border',
                      region: 'center',
                      items:
                        new Ext.TabPanel({
                          ref: '../tabby',
                          deferredRender: false,
                          region: 'center',
                          activeTab: 0,
                          defaults: {
                            autoScroll: true
                          },
                          items: tabPanels
                        })
                    })
    
    var winModuleEdit = new Ext.Window({
          width:400,
          height:450,
          title: 'Widget Settings - ' + this._module.storeParams.alias,
          layout:'border',
          closeAction:'close',
          modal:true,
          maximizable:true,
          closable:true,
          border:false,
          items: [
                    formPanel,
                    {
                      region: 'south',
                      padding: 5,
                      bodyStyle: 'text-align: center; background: #fc3; border-bottom: 1px solid #99BBE8;',
                      hidden: meinNotice != '' ? false : true,
                      html: meinNotice
                    }
                  ],
          //buttonAlign: 'left',
          buttons: [{
            text: 'Save',
            handler: function(){
              //alert(_self._module.storeParams.id);
              
                Ext.Msg.wait('Please Wait...', 'Saving Settings');
                Ext.Ajax.request({
                   url: '/ajax/portals/updateSetting.cfm',
                   method: 'POST',
                   params: {
                     id: _self._module.storeParams.id,
                     pid: _self._module.storeParams.portletID,
                     gcdID: currentPageGCDID,
                     data: Ext.encode(formPanel.getForm().getValues())
                   },
                   reader : new Ext.data.JsonReader({
                    success : '@success'
                   }),
                   success: function(response, opts) {
                      var obj = Ext.decode(response.responseText);
                      if (obj.success){
                        Ext.Msg.hide();
                        if (_self._module.storeFN){
                          //if (window.console && window.console.firebug){console.info(obj.moduleVars)}
                          _self._module.values = obj.moduleVars;
                          //_self._module.storeParams = Ext.extend(_self._module.storeParams, {alias: _self._module.values['__alias']});
                          _self._module.setTitle("Applying Changes...");
                          _self._module.storeFN(_self._module);
                          winModuleEdit.close();
                        }else{
                          //Ext.MessageBox.wait('Saving Settings...', 'Please wait');
                          winModuleEdit.close();
                          window.location.reload(true);
                          //loadLastPage();
                        }
                      }else{
                        Ext.Msg.hide();
                        Ext.Msg.alert('Error Saving Settings', 'There was an error saving your settings. Please try again.');

                      }
                   },
                   failure: function(response, opts) {
                    Ext.Msg.hide();
                    Ext.Msg.alert('Error Saving Settings', 'There was a problem communicating with the server. Please check your internet connection and try again.');
                   }
                });   
              
              
              
              return false;
              /*
              var tmpLT = Ext.getCmp('layoutTitle_' + _self._module.storeParams.id);
              var tmpLC = Ext.getCmp('layoutCombo_' + _self._module.storeParams.id);
              var tmpPG = Ext.getCmp('propertyGrid_' + _self._module.storeParams.id);
              var tmpSetData = tmpPG.source;
              var tmpSets = Object.extend(tmpSetData, {layout: tmpLC.value});
              var tmpSettings = Object.extend(tmpSets, {__alias: tmpLT.getValue()});
              setTimeout(function(){
                Ext.Msg.wait('Please Wait...', 'Saving Portal Settings');
                Ext.Ajax.request({
                   url: '/ajax/portals/updateSetting.cfm?id='+_self._module.storeParams.id+'&pid='+_self._module.storeParams.portletID+'&gcdID='+currentPageGCDID,
                   method: 'POST',
                   params: tmpSettings,
                   reader : new Ext.data.JsonReader({
                    success : '@success'
                   }),
                   success: function(response, opts) {
                      var obj = Ext.decode(response.responseText);
                      if (obj.success){
                        Ext.Msg.hide();
                        if (_self._module.storeFN){
                          _self._module.values = tmpSets;
                          _self._module.storeParams = Object.extend(_self._module.storeParams, {alias: tmpLT.getValue()});
                          _self._module.setTitle("Applying Changes...");
                          _self._module.storeFN(_self._module);
                          winModuleEdit.close();
                        }else{
                          Ext.MessageBox.wait('Saving Settings...','Please wait');
                          winModuleEdit.close();
                          window.location.reload(true);
                        }
                      }else{
                        Ext.Msg.hide();
                        Ext.Msg.alert('Error Creating Portal', 'There was an error creating the specified portal. Please try again.');
                      }
                   },
                   failure: function(response, opts) {
                    Ext.Msg.hide();
                    Ext.Msg.alert('Error Creating Portal', 'There was a problem communicating with the server. Please check your internet connection and try again.');
                   }
                });   
              }, 500);
              */
              
            }
          },{ text: 'Cancel', handler: function(){ winModuleEdit.close(); } }]
      });
    winModuleEdit.show(this);

  }
  

  function windowModuleLayout(modSettings){
    this._module = modSettings;
    var _self = this;
    
    var tmpOptionsOpacity = this._module.storeParams.myOpacity;
    var tmpOptionsLayout = this._module.storeParams.myLayout;

    var opacities = [];
    opacities.push([0, '0%']);
    opacities.push([5, '5%']);
    opacities.push([10, '10%']);
    opacities.push([15, '15%']);
    opacities.push([20, '20%']);
    opacities.push([25, '25%']);
    opacities.push([30, '30%']);
    opacities.push([35, '35%']);
    opacities.push([40, '40%']);
    opacities.push([45, '45%']);
    opacities.push([50, '50%']);
    opacities.push([55, '55%']);
    opacities.push([60, '60%']);
    opacities.push([65, '65%']);
    opacities.push([70, '70%']);
    opacities.push([75, '75%']);
    opacities.push([80, '80%']);
    opacities.push([85, '85%']);
    opacities.push([90, '90%']);
    opacities.push([95, '95%']);
    opacities.push([100, '100%']);
    
    var layouts = [];
    layouts.push(['', 'Default Blue']); //x-portlet
    layouts.push(['plain', 'Basic Panel']); //x-portlet x-portlet-plain x-portlet-plain-75
    layouts.push(['borderless', 'Basic Panel (Borderless)']); //x-portlet x-portlet-borderless x-portlet-borderless-75');
    layouts.push(['titleless', 'Titleless Panel']); //x-portlet x-portlet-edgeless x-portlet-edgeless-75');
    layouts.push(['edgeless', 'Titleless & Edgeless Panel']); //x-portlet x-portlet-edgeless x-portlet-edgeless-75');
	layouts.push(['boxless', 'Boxless']); //x-portlet x-portlet-boxless x-portlet-custom1-75
	layouts.push(['custom1', 'Custom Panel']); //x-portlet x-portlet-custom1 x-portlet-custom1-75
	layouts.push(['custom2', 'Custom-2 Panel']); //x-portlet x-portlet-custom1 x-portlet-custom1-75
    
    var winModuleLayout = new Ext.Window({
          width:300,
          title: 'Widget Style - ' + this._module.storeParams.alias,
          layout:'form',
          closeAction:'close',
          modal:true,
          border: true,
          sizable: false,
          closable:true,
          items: new Ext.FormPanel({
                  xtype:'fieldset',
                  padding: 5,
                  autoHeight:true,
                  labelAlign: 'top',
                  border: false,
                  labelWidth: 150,
                  defaults: {
                      anchor: '0'
                    },
                  defaultType: 'textfield',
                  items :[{
                            xtype: 'combo',
                            id: 'layoutCombo_' + this._module.storeParams.id,
                            fieldLabel: 'Layout',
                            typeAhead: true,
                            forceSelection: true,
                            triggerAction: 'all',
                            lazyRender:true,
                            mode: 'local',
                            store: new Ext.data.ArrayStore({
                                id: 0,
                                fields: [
                                    'myId',
                                    'displayText'
                                ],
                                data: layouts
                            }),
                            value: tmpOptionsLayout,
                            valueField: 'myId',
                            displayField: 'displayText'
                          },{
                            xtype: 'combo',
                            id: 'opacityCombo_' + this._module.storeParams.id,
                            fieldLabel: 'Background Transparency',
                            typeAhead: true,
                            forceSelection: true,
                            triggerAction: 'all',
                            lazyRender:true,
                            mode: 'local',
                            store: new Ext.data.ArrayStore({
                                id: 0,
                                fields: [
                                    'myId',
                                    'displayText'
                                ],
                                data: opacities
                            }),
                            value: tmpOptionsOpacity,
                            valueField: 'myId',
                            displayField: 'displayText'
                          }]
              }),
          //buttonAlign: 'left',
          buttons: [{
            text: 'Save',
            handler: function(){
              var tmpLC = Ext.getCmp('layoutCombo_' + _self._module.storeParams.id);
              var tmpPG = Ext.getCmp('opacityCombo_' + _self._module.storeParams.id);
              setTimeout(function(){
                Ext.Msg.wait('Please Wait...', 'Saving Portal Layout');
                Ext.Ajax.request({
                   url: '/ajax/portals/updateWidgetLayout.cfm?id='+_self._module.storeParams.id+'&pid='+_self._module.storeParams.portletID+'&gcdID='+currentPageGCDID,
                   method: 'POST',
                   params: {layout: tmpLC.value, opacity: tmpPG.value},
                   reader : new Ext.data.JsonReader({
                    success : '@success'
                   }),
                   success: function(response, opts) {
                      var obj = Ext.decode(response.responseText);
                      if (obj.success){
                        Ext.Msg.hide();
                        Ext.MessageBox.wait('Refreshing Page...','Saving Portal Layout');
                        winModuleLayout.close();
                        window.location.reload(true);
                      }else{
                        Ext.Msg.hide();
                        Ext.Msg.alert('Error Saving Portal Layout', 'There was an error applying the selected style to this portal. Please try again.');
                      }
                   },
                   failure: function(response, opts) {
                    Ext.Msg.hide();
                    Ext.Msg.alert('Error Saving Portal Layout', 'There was a problem communicating with the server. Please check your internet connection and try again.');
                   }
                });   
              }, 500);
              
            }
          },{ text: 'Cancel', handler: function(){ winModuleLayout.close(); } }]
      });
    winModuleLayout.show(this);

  }

