var comment = function(){
	return {		
     	 showForm :function(id){
			var form = new Ext.form.FormPanel({
						labelWidth: 60,
						height: 300,						
						width: 500,                        
						scope: this,
						bodyStyle:'padding:10px 0 0 10px',	 
						labelAlign: 'left',
					//	baseCls: "x-plain", 
						border:false, 
						bodyBorder: false,
						items: [ {xtype:'textfield',fieldLabel:'Name',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: "Post",
									handler: function(){
									
										form.getForm().submit({
											waitTitle: "Connecting...",
											waitMsg : "Message Sending...",
											method: "POST",							
											url: baseurl + "index.php/home/addComment/", 
											params:{
													id:id
											},
											success: function () {		
											
												  Ext.MessageBox.alert('Status', 'Message has been Sent',function(btn){
														if(btn == 'ok'){
															win.close();
															window.location.href = baseurl + "index.php/home/blogpost/"+ id +"/";
														}
												  })
											},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: 'Post Comment',                   
						autoWidth:true,					
						items:form,
						modal: true,  
											
						autoheight:true,                 
						bodyStyle: 'border-color:#fff; background-color:white; position:relative;',
						labelWidth:10
						
					})
					win.show();
		}
	}
}();
