Ext.override(Ext.Window,{
	show : function(animateTarget, cb, scope){
        if(!this.rendered){
            this.render(Ext.getBody());
        }
         var h=this.height;
         var w=this.width;
         var innerH=this.getInnerHeight();
         var innerW=this.getInnerWidth();
         
         if(!h){
         	h=innerH;
         }
         if(!w){
         	w=innerW;
         }
       var vW=document.body.clientWidth;
       var vH=document.body.clientHeight;
         if(h>=vH){
         	h=vH-10;
         	this.setHeight(h);
         	if(!this.autoHeight){
         		this.autoHeight=true;
         	}
         	this.y=5;
         }
         if(w>=vW){
         	w=vW-10;
         	this.setWidth(w);
         	if(!this.autoHeight){
         		this.autoHeight=true;
         	}
         	this.x=5;
         }
         this.doLayout();
        if(this.hidden === false){
            this.toFront();
            return;
        }
        if(this.fireEvent("beforeshow", this) === false){
            return;
        }
        if(cb){
            this.on('show', cb, scope, {single:true});
        }
        this.hidden = false;
        if(animateTarget !== undefined){
            this.setAnimateTarget(animateTarget);
        }
        this.beforeShow();
        if(this.animateTarget){
            this.animShow();
        }else{
            this.afterShow();
        }
    }
});

Ext.grid.CheckColumn = function(config){
    Ext.apply(this, config);
    if(!this.id){
        this.id = Ext.id();
    }
    this.renderer = this.renderer.createDelegate(this);
};
Ext.grid.CheckColumn.prototype ={
    init : function(grid){
        this.grid = grid;
        this.grid.on('render', function(){
            var view = this.grid.getView();
            view.mainBody.on('mousedown', this.onMouseDown, this);
        }, this);
    },
    onMouseDown : function(e, t){
        if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
            e.stopEvent();
            var index = this.grid.getView().findRowIndex(t);
            var cindex = this.grid.getView().findCellIndex(t);
            var record = this.grid.store.getAt(index);
            var field = this.grid.colModel.getDataIndex(cindex);
            var e = {   
                grid : this.grid,
                record : record,
                field : field,
                originalValue : record.data[this.dataIndex],
                value : !record.data[this.dataIndex],
                row : index,
                column : cindex,
                cancel : false
            };   
            if (this.grid.fireEvent("validateedit", e) !== false && !e.cancel) {   
                delete e.cancel;
                record.set(this.dataIndex, !record.data[this.dataIndex]);
                this.grid.fireEvent("afteredit", e);
            }
        }
    },
    renderer : function(v, p, record){
        p.css += ' x-grid3-check-col-td'; 
        //the old version of return by itself.
//        return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'">&#1600000;</div>';
       //changed by haipeng,2010.5.13
       return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"></div>';
    }
};
