var type;
var capa_vect;   

function CreateBody()
{
   var rdg_1 = new Ext.form.FieldSet(
					{    
                              border : false,
					     frame : false,
               		     height: 90,
               			width:  115,
               			defaultType: 'radio',
						hidenBorder: true,
						items: [{  
                                         xtype: 'radio',
								 boxLabel: 'GML',
								 hideLabel : true,
								 name: 'rb_file_type',
								 id:'rd_gml',
								 inputValue: 1,
								 listeners:{'check': function(checked)
										 		{
												   if(Ext.getCmp('rd_gml').getValue())
													{
														 Ext.getCmp('save').enable();
														 type = 'gml'; 
													}
												}	
										}
							},{
                                        xtype: 'radio',
								boxLabel: 'MAPINFO',
								hideLabel : true,
								name: 'rb_file_type',
								id:'rd_map_info' ,
								inputValue: 2,
								listeners:{'check': function(checked)
									 		{			                           
											    if(Ext.getCmp('rd_map_info').getValue())
												 { 
                                                                  Ext.getCmp('rd_tab').setValue(false);
				                                              Ext.getCmp('rd_mif').setValue(false); 
													 fp_filetype.findById('rdg_mapinfo').show();
													 Ext.getCmp('save').disable();
												  }
											    else
												  {
										 			fp_filetype.findById('rdg_mapinfo').hide();
												   }
											}	
										}
							},{
                                        xtype: 'radio',
								hideLabel : true,
								boxLabel: 'ESRI SHAPE',
								name: 'rb_file_type',
								id: 'rd_shape',
								inputValue: 3,
								listeners:{'check': function(checked)
											 {
												   if(Ext.getCmp('rd_shape').getValue())
													{
													  Ext.getCmp('save').enable();		
													  type = 'shp'; 
													}
											 }	
										}
							}]
                          
					});
                    	 

var rdg_2 = new Ext.form.FieldSet(
					{  
                              id :'rdg_mapinfo',
                              name:'rdg_mapinfo',
                              border : false,
						hidenBorder: true,
                              frame : false,
               		     height: 80,
               			width:  70,
               			defaultType: 'radio',
                              hidden : true,                             
						items: [{
                                        xtype: 'radio',
                                        hideLabel: true,  
								boxLabel: 'TAB',
								name: 'map_type',
                                        id:'rd_tab',
								inputValue: 1, 
								listeners:{'check': function(checked)
											{
												if(Ext.getCmp('rd_tab').getValue())
												{
													Ext.getCmp('save').enable();
													type = 'tab'; 
												}
											}	
										}
							    },{
								xtype: 'radio',
								hideLabel: true,
								boxLabel: 'MIF',
								name: 'map_type',
								id:'rd_mif',
								inputValue: 2,
								listeners:{'check': function(checked)
											{
											   if(Ext.getCmp('rd_mif').getValue())
												{
													Ext.getCmp('save').enable();
													type = 'mif'; 
												}
											}	
										}
								}]
                         });



fp_filetype = new Ext.FormPanel({
				frame: true,
                    border: true,
				autoWidth: true,
				autoHigth: true,
                    hidenBorder: true,
				items: [{
						 layout: 'column',
					    	 items:[{
								columnWidth: .60,
                                        hidenBorder: true, 
								items:[rdg_1]
							   },
							   {
								columnWidth: .40,
								hidenBorder: true,
								items: [rdg_2]
							   }]
					  }],
				 buttons: [{
				  text: 'Aceptar',
				  id: 'save',
				  disabled: true,
				  handler: function(){
					if(fp_filetype.getForm().isValid()){
					   File_Type_Loader(type);
                            capa_vect.close();  
					 }
				  }
				  },{
				  text: 'Cancelar',
				  handler: function(){
				   
					 fp_filetype.getForm().reset();
					 capa_vect.close();
					 type='';
				  }
			   }]
			});
}

function LoadFile()
{
	type='';
     CreateBody();
     capa_vect = new Ext.Window({
				   	      title	   : 'Tipo de Archivo',
                               renderTo    : document.body,
						 resizable   : false,
						 modal       : true,
						 width       : 230,
						 height      : 180,
						 closeAction :'close',
						 plain       : true,
						 items		: fp_filetype
	  				});
	capa_vect.show();
}
 

