RegReservationSysWindow = function(config){
	
	this.config = config;
	this.isRegionLoad = false;
	this.isGroupLoad = false;
	
	
	
	this.camping_list_uid = this.config.data.camping_list_uid;
	
	
	
	this.nameTextField = new Ext.form.TextField({
		//hideLabel: true,
		fieldLabel: '캠핑장',
		disabled:true,
		name: 'camping_list_name',
        anchor:'100%',
        allowBlank:false,
        disabled:true,
        value:this.config.data.camping_list_name
	});
	
		
	this.userTextField = new Ext.form.TextField({
		//hideLabel: true,
		fieldLabel: '신청자',
		name: 'camping_user_name',
        anchor:'100%',
        allowBlank:false,
        disabled:true,
        value:NAME
	});
	
	this.telTextField = new Ext.form.TextField({
		//hideLabel: true,
		fieldLabel: '연락처',
		blankText:'연락처를 입력해주세요',
		emptyText :'관리자 확인을 위해  연락처로 연락드립니다.',
		anchor:'100%',
		name: 'tel',
        allowBlank:false
	});
	
	
	this.descTextField = new Ext.form.TextField({
		//hideLabel: true,
		fieldLabel: '의견',
		blankText:'예약시스템 신청 기타 의견을 작성해 주십시오.',
		emptyText :'예약시스템 신청 에대한 기타 의견을 작성해 주십시오.',
		name: 'comment',
        anchor:'100%',
        allowBlank:true
	});
	/**
	this.homeTextField = new Ext.form.TextField({
		hideLabel: true,
		fieldLabel: '자체예약 시스템 주소',
		blankText:'자체예약 시스템 주소(http://)를 입력해 주세요.',
		emptyText :'자체예약 시스템 주소를 입력해 주세요.',
		anchor:'100%',
		name: 'homepage',
		allowBlank:false
	});

	
	
	var reservationTypeStore = new Ext.data.SimpleStore({
        fields: ['type', 'name'],
        data : [['Y','캠핑지도 예약시스템 사용'],['N','자체 예약시스템 사용']]
    });
	
	this.reservationTypeComboBox = new Ext.form.ComboBox({
		//hideLabel: true,
		fieldLabel: '예약방식',
		anchor:'100%',
		blankText:'예약 시스템 선택',
		emptyText :'예약 시스템 선택',
		store:reservationTypeStore,
		displayField:'name',
        editable:false,
        hiddenName:'type',
       	valueField:'type',
        typeAhead: true,
        triggerAction: 'all',
        allowBlank:false,
        selectOnFocus:true,
        typeAhead: true,
        mode: 'local'
    });
**/
	//this.nameTextField
	this.formPanel = new Ext.form.FormPanel({
		//labelAlign: 'top',
        labelWidth: 50,
        //baseCls: 'form',      
        frame:true,
        method: 'POST',
        bodyStyle:'padding:5px 5px 0',
	    //bodyStyle:'background-color: #e4e4e4',  userTextField
        items: [{
					layout:'column',//this.locationComboBox
		            border:false,
		            items:[{
				                columnWidth:1,
				                layout: 'form',
				                bodyStyle:'padding:0px 10px 0 5',
				                border:false,
				                items: [this.nameTextField]
		            }]
        		},{
		            layout:'column',//this.locationComboBox
		            //bodyStyle:'padding:5px 5px 0;background-color: #e4e4e4',
		            border:false,
		            items:[{
				                columnWidth:.3,
				                layout: 'form',
				                bodyStyle:'padding:0px 10px 0 5',
				                border:false,
				                items: [this.userTextField]
				          },{
				                columnWidth:.7,
				                layout: 'form',
				                bodyStyle:'padding:0px 10px 0 5',
				                border:false,
				                items: [this.telTextField]
				          }]
        		},{
					layout:'column',//this.locationComboBox
		            border:false,
		            items:[{
				                columnWidth:1,
				                layout: 'form',
				                bodyStyle:'padding:0px 10px 0 5',
				                border:false,
				                items: [this.descTextField]
				          }]
	    }
        ]   
    });//this.descTextField
    
    this.config.buttons = [
    	
        {
            text: '신청',
            type:'submit',
            scope:this,
            handler: this.submit
        },{
            text: '취소',
            type:'cancel',
            scope:this,
            handler: this.cancel
        }];
    
    this.config.items = this.formPanel;
    this.config.layout = 'fit';
    this.config.closable = true;
    this.config.plain = true;
    this.config.modal = true;
    this.config.buttonAlign ='right';
    this.config.closeAction ='close';
    
    
	
    RegReservationSysWindow.superclass.constructor.call(this, this.config);
	
	/**
	this.reservationTypeComboBox.on("select", function(combo, record, index){
	
		if(record.data.type == 'Y'){
			this.homeTextField.setVisible(false);
			this.homeTextField.allowBlank = true;
		}else{
			this.homeTextField.setVisible(true);
			this.homeTextField.allowBlank = false;
		}
				
	},this);
	
	 **/
	
	
	
};

Ext.extend(RegReservationSysWindow, Ext.Window, {

	submit : function(){
		
		
		if(this.formPanel.getForm().isValid()){
			this.formPanel.form.submit(
			{	waitMsg: '예약 시스템 신청 중...',
				url:'./src/api/Interface.php',
				params :{
							'class':'Reservation',
							method:'regReservationSystem',
							camping_list_uid:this.camping_list_uid
							
						},
				scope:this,
				success: function(form, action) {
                  	if(action.result.success){
                  		
                  		Ext.MessageBox.alert('안내', this.config.data.camping_list_name+' 관리자 확인을 위해 연락드리겠습니다. 감사합니다.');
						this.close();
						
                  	}else{
                  		
                  		Ext.MessageBox.alert('에러', '이미 예약 시스템을 사용하고 있습니다.')
                  	}
  										
				},
				failure: function(form, action) { 
					Ext.MessageBox.alert('Error', 'Error')
				}
			});
            		
		}
		
	},
	
	cancel : function(){
		this.close();
	}
	

});

