Ext.namespace("Ext.ss.widget");

Ext.ss.widget.Window = Ext.extend(Ext.Window, {
	checkChangesOnClose: true,
	collapsible: true,
	animCollapse: false,
	layout: 'fit',
	iconCls: 'bogus',
	initComponent : function() {
		if(this.width) {
			this.minWidth = this.width;
		}
		if(this.height) {
			this.minHeight = this.height;
		}
		this.addListener('beforeclose',this.beforeWindowClose,this);
		
		Ext.ss.widget.Window.superclass.initComponent.call(this);
	},
	beforeWindowClose : function (panel) {
		var store = this.store;
			
		if(store) {
			var window = this;
			if(store.getModifiedRecords().length > 0) {
				this.app.getDesktop().confirmBox(Ext.ss.locale.Common.prototype.closeConfirmTitleText,Ext.ss.locale.Common.prototype.closeConfirmText,function(btn){
					if (btn == 'yes'){
						store.rejectChanges();
						window.close();
				    	return true;
				    }
				});
				return false;
			}
		}
		return true;
	}
});
