function openSendRestaurantPhone(rest_id) {
	//config***********************************************************************************
	var validationDelayInMillis = 2000;
	
	//Create error window*****************************************************************************
    var errWindow = new Ext.Window({
        title: '<span style="font-size:12px;">Invalid input!</span>',
        width: 350,
        height:'auto',
        layout: 'fit',
        plain:true,
        bodyStyle:'padding:5px;',
        buttonAlign:'center',
        closeAction: 'hide',
        html: '',

        buttons: [{
            text: 'Close',
            handler: function(){errWindow.hide()},
            scope: this
        }]
    });
	var errMsg = '';
	errWindow.on('show', function(){
		this.body.dom.innerHTML = "<div style='padding:10px;color:red;font-size:12px;'>" + errMsg + "</div>";
	});
	
    var doSend = function() {
    	var isVCodeValid = Ext.getCmp('request-form-vcode').isValid();
    	var isMobileValid = Ext.getCmp('request-form-mobile').isValid();
    	var isMobileCtryCodeValid = Ext.getCmp('request-form-mobile_ctry_code').isValid();
    	if (!isVCodeValid || !isMobileValid || !isMobileCtryCodeValid) {
    		errMsg = 'Some fields contain errors. Please correct them first.';
    		errWindow.show();
    		return;
    	}
		Ext.getCmp('send-restaurant-phone-btn').disable();
		sendForm.getForm().submit({
			waitMsg:'Sending...', 
			reset: false, 
			failure: function(form, action) { 
				Ext.getCmp('send-restaurant-phone-btn').enable();
				var msg = action.result.msg;
				Ext.Msg.show({
					title: 'Failure', 
					msg: '<span style="color:red">'+msg+'</span>',
					buttons: Ext.Msg.OK,
					minWidth: 400
				});
			}, 
			success: function(form, action) {
				Ext.Msg.show({
					title: 'Success', 
					msg: "<span style='color:green'>The phone number of restaurant '"+restStore.getAt(0).get('name')+"' has been sent to " +
							"(+"+Ext.getCmp('request-form-mobile_ctry_code').getValue()+")" +
							+ Ext.getCmp('request-form-mobile').getValue() + "</span>",
					buttons: Ext.Msg.OK,
					minWidth: 450
				});
				Ext.getCmp('send-restaurant-phone-form').destroy();
			} 
		});
    }

	//define stores*******************************************************************************************
    var restStore = new Ext.data.JsonStore({
    	url: '/RestaurantServlet?action=getRestaurantSummary&rest-id='+rest_id
       ,root: 'results'
       ,totalProperty: 'totalCount'
       ,id: 'id'
       ,fields: ['id', 'name', 'address']
       ,autoLoad: true
    });

	var restTpl = new Ext.XTemplate(
	    '<tpl for="."><div style="padding-left:15px;width:450px;">',
	    	'<div style="line-height:18px;">',
		    	'<table width="100%" cellspacing="3">',
		    		'<tr valign="top">',
		    			'<td width="25%">Restaurant:</td>',
		    			'<td width="75%">{name}</td>',
		    		'</tr>',
		    		'<tr valign="top">',
		    			'<td>Address:</td>',
		    			'<td>{address}</td>',
		    		'</tr>',
		    	'</table>',
	    	'</div>',
	    '</div></tpl>'
	);

	RestSummaryPanel = Ext.extend(Ext.DataView, {
		frame: true
		,loadingText: 'loading...'
		,itemSelector: 'table'
		,tpl: restTpl
	});

	var sendForm = new Ext.FormPanel({
		url: '/RestaurantServlet?action=sendRestaurantPhone',
        labelWidth: 110, // label settings here cascade unless overridden
        labelAlign:'left',
		layout:'column',
		items:[
            {//******************************header 1********************************************
        		columnWidth:1,
		        border: false,
		        style:'padding:10px 5px 3px;font-size:12px;font-weight:bold;',
		        html:'Phone number of the following restaurant will be sent to mobile phone'
            }
	        ,new RestSummaryPanel({
	            store: restStore
	        })
            ,{
            	columnWidth:1,
		        border: false,
		        style:'line-height:1px;',
		        html:'&nbsp;'
            }
            ,{//******************************mobile no********************************************
        		columnWidth:.36,
		        border: false,
        		layout:'form',
        		style:'padding-left:18px;',
        		items:[
        			{
        				xtype:'numberfield',
		                fieldLabel: 'Mobile no',
	                    width: 40,
						maxLength: 3,
						allowBlank:false,
		                allowDecimals: false,
		                allowNegative: false,
						name: 'request-form-mobile_ctry_code',
		                id: 'request-form-mobile_ctry_code',
		                value:'65'
        			}
        		]
            }
            ,{
            	columnWidth:.64,
		        border: false,
            	layout: 'form',
                labelWidth: 1,
                items: [{
                    xtype:'numberfield',
                    width: 113,
                    fieldLabel: '',
                    labelSeparator: '',
                    maxLength: 16,
					allowBlank:false,
	                allowDecimals: false,
	                allowNegative: false,
                    id: 'request-form-mobile',
                    name: 'request-form-mobile'
                }]
            }
            ,{
            	columnWidth:1,
		        border: false,
		        style:'line-height:1px;',
		        html:'&nbsp;'
            }
            ,{//******************************verification code********************************************
        		columnWidth:.37,
		        border: false,
        		style:'padding-left:18px;',
        		layout:'form',
        		items:[
        			{
        				xtype:'textfield',
		                fieldLabel: 'Verification code',
		                validationDelay: validationDelayInMillis,
		                allowBlank: false,
        				width: 40,
        				minLength: 4,
        				minLengthText: 'Length must be 4.',
        				maxLength: 4,
        				maxLengthText: 'Length must be 4.',
        				name: 'request-form-vcode',
		                id: 'request-form-vcode'
        			}
        		]
            }
            ,{
        		columnWidth:.63,
		        border: false,
        		items:[
        			{
	                	xtype:'panel',
				        border: false,
	                	style:'font-size:12px;',
	                    html: '<img src="/ValidationJPGServlet?action=send_restaurant_phone" width="116" height="23" align="top" border="0" />'
        			}
        		]
            }
            ,{//******************************verification code********************************************
        		columnWidth:1,
		        border: false,
        		layout:'form',
        		items:[
        			{
        				xtype:'hidden',
        				value:rest_id,
        				name: 'request-form-rest_id',
		                id: 'request-form-rest_id'
        			}
        		]
            }
            ,{
            	columnWidth:1,
		        border: false,
		        style:'line-height:10px;',
		        html:'&nbsp;'
            }
		]
        ,keys: [{
            key: Ext.EventObject.ENTER,
            fn: doSend
        }]
	});
    var send_form = new Ext.Window({
    	id: 'send-restaurant-phone-form',
        title: '<span style="font-size:12px;">Send restaurant phone</span>',
        width: 500,
        height:'auto',
        draggable:true,
        autoScroll:true,
        border:false,
        buttonAlign:'center',
		items:[
			sendForm
		]
		,buttons: [
			{
				id:'send-restaurant-phone-btn',
				text:'<b>Send</b>',
				handler:doSend
			}
			,{
				text:'<b>Cancel</b>',
				handler: function() {
					send_form.destroy();
				}
			}
		]
    });

	var userStore = new Ext.data.JsonStore({
		url: '/RestaurantServlet?action=getUserInfoForRestaurantBooking'
	   ,root: 'results'
	   ,fields: ['mobile_ctry_code', 'mobile']
	});
	
	send_form.on('render', function(){
		userStore.load({
			params: {
		    },
		    callback: function(records){
		    	if (records && records.length != 0) {
		            var mobile_ctry_code = records[0].get('mobile_ctry_code');
		            Ext.getCmp('request-form-mobile_ctry_code').setValue(mobile_ctry_code);
		            
		            var mobile = records[0].get('mobile');
		            Ext.getCmp('request-form-mobile').setValue(mobile);
		    	}
		    }
			
		});
	});

    send_form.show();
    
}

