Xsn.ExportDialog = function(config) {
    Ext.apply(this, config);
    this.init();
} 

Ext.extend(Xsn.ExportDialog, Ext.util.Observable, {

	init : function(){
		dlg = new Ext.LayoutDialog("export-dlg", { 
                autoTabs:true,
                modal:true,
                autoCreate: true,
                closable:false,
                draggable:false,
                collapsible:false,
                resizable:false,                
                animateTarget:null,                
                title: 'Contactpersonen exporteren',
                width:300,
                height:180,
                resizable:false,
                shadow:true,
                north: {
					titlebar:false,
					initialSize:33	
				},
                center: {
					titlebar:false,
					autoScroll:false
				}
        });
        
		var label = dlg.getLayout().getEl().createChild();		
		label.createChild({style:'padding:5px;background-color:#d6dff7;margin:1px 1px 0 1px;border-bottom:1px solid #adbed6'}).dom.innerHTML = 'Welke contactpersonen wilt u exporteren?';
		
		var panel = dlg.getLayout().getEl().createChild();

		var form = new Ext.form.Form({
			labelAlign:'top',
			hideLabels: true				
		});
    	form.add(
    	    	
	        new Ext.form.Radio({
	            boxLabel: 'Alle contactpersonen',
	            name: 'export-contacts',
	            inputValue: 'alle',
	            checked:true
	        }),
	        new Ext.form.Radio({
	            boxLabel: 'De geselecteerde groep',
	            name: 'export-contacts',
	            inputValue: 'groep'
	        })
	    );
	    form.end();
	    form.applyIfToFields({
	        width:250
	    });
	    form.render(panel);

        dlg.addKeyListener(27, dlg.hide, dlg);
        dlg.addButton('Ok', function(){
			this.callback(form.findField('export-contacts').getGroupValue(), this.group);
		}, this);	            
        dlg.addButton('Annuleer', dlg.hide, dlg);

        dlg.getLayout().add('north',new Ext.ContentPanel(label, {fitToFrame:true}));
        dlg.getLayout().add('center',new Ext.ContentPanel(panel, {fitToFrame:true}));
		dlg.getLayout().getRegion('center').getEl().setStyle('border-top', '0px');
		dlg.getLayout().getRegion('north').getEl().setStyle('border-bottom', '0px');        

        this.dlg = dlg;
       
	},
	
	show : function(callback, group){
	 	this.callback = callback;
	 	this.group = group;
		this.dlg.show();						
	},
	
	hide : function(){
		this.dlg.hide();
	}

});

