    /**
     * @class Ext.ensible.cal.MonthViewTemplate
     * @extends Ext.XTemplate
     * This is the template used to render the {@link Ext.ensible.cal.MonthView MonthView}. Internally this class defers to an
     * instance of {@link Ext.calerndar.BoxLayoutTemplate} to handle the inner layout rendering and adds containing elements around
     * that to form the month view.
     * This template is automatically bound to the underlying event store by the
     * calendar components and expects records of type {@link Ext.ensible.cal.EventRecord}.
     * @constructor
     * @param {Object} config The config object
     */
    Ext.ensible.cal.MonthViewTemplate = function(config){

        Ext.apply(this, config);

        this.weekTpl = new Ext.ensible.cal.BoxLayoutTemplate(config);
        this.weekTpl.compile();

        var weekLinkTpl = this.showWeekLinks ? ' ' : '';

        Ext.ensible.cal.MonthViewTemplate.superclass.constructor.call(this,
    	    '',
                '',
                    weekLinkTpl,
    		        '',
    		            '',
                            '',
                                '',
    		                        '{name}',
    		                    '',
                            '',
    		            '',
    		        '',
                '',
    	        '{weeks}',
            ''
        );
    };

    Ext.extend(Ext.ensible.cal.MonthViewTemplate, Ext.XTemplate, {
        /**
         * @cfg {String} dayHeaderFormat
         * The date format to use for day headers, if used (defaults to 'D', e.g. 'Mon' for Monday)
         */
        dayHeaderFormat: 'D',
        /**
         * @cfg {String} dayHeaderTitleFormat
         * The date format to use for the day header's HTML title attribute displayed on mouseover
         * (defaults to 'l, F j, Y', e.g. 'Monday, December 27, 2010')
         */
        dayHeaderTitleFormat: 'l, F j, Y',

        // private
        applyTemplate : function(o){
            var days = [],
                weeks = this.weekTpl.apply(o),
                dt = o.viewStart;

            for(var i = 0; i < 7; i++){
                var d = dt.add(Date.DAY, i);
                days.push({
                    name: d.format(this.dayHeaderFormat),
                    title: d.format(this.dayHeaderTitleFormat)
                });
            }

            var extraClasses = this.showHeader === true ? '' : 'ext-cal-noheader';
            if(this.showWeekLinks){
                extraClasses += ' ext-cal-week-links';
            }

            return Ext.ensible.cal.MonthViewTemplate.superclass.applyTemplate.call(this, {
                days: days,
                weeks: weeks,
                extraClasses: extraClasses
            });
        }
    });

    Ext.ensible.cal.MonthViewTemplate.prototype.apply = Ext.ensible.cal.MonthViewTemplate.prototype.applyTemplate;