var emailSending = function(){
	return {		
     	 showForm :function(image){
			var form = new Ext.form.FormPanel({
						labelWidth: 60,
						bodyStyle: "padding: 5px",
						height: 300,						
						width: 500,                        
						scope: this,
						labelAlign: 'left',
						baseCls: "x-plain",
						bodyBorder: false,
						items: [ {xtype:'textfield',fieldLabel:'From',allowBlank:false,name: 'name',width:250},								 
								 {xtype:'textfield',fieldLabel: 'Email', allowBlank:false, vtype:'email', name: 'email',width:250},  								
								 {xtype:'textarea',fieldLabel: 'Message',  name: 'msg',width:400,height:200}  
						],
						buttons: [
							{
								text: "Send",
									handler: function(){
									
										form.getForm().submit({
											waitTitle: "Connecting...",
											waitMsg : "Message Sending...",
											method: "POST",
											params:{
												image:image
											},
											url: baseurl + "index.php/home/emailVisitor/", 											
											success: function () {											
												  Ext.MessageBox.alert('Status', 'Message has been Sent',function(btn){
														if(btn == 'ok'){
															win.close();
														}
												  })
											},failure: function () {
												
													Ext.MessageBox.show ({
														title: "Error",
														msg : "Please try again",
														buttons: Ext.MessageBox.OK,
														icon: Ext.MessageBox.ERROR
													})
												
											}
										})
									}
							},{
								text: "Cancel",
								handler: function () {
									win.close();
								}
							}
							
						]
					});
					
		var win = new Ext.Window({
						title: 'Send Coupon',                   
						autoWidth:true,					
						items:form,
						modal: true,                  
						autoheight:true,                 
						bodyStyle: 'border-color:#fff; background-color:white; position:relative;',
						labelWidth:10
						
					})
					win.show();
		}
	}
}();
