{
    xtype: 'menu',
    onInitialize : function(owner,obj, type){
        var me = this;
		var recs = obj.records;
		var records = [];
		var entityForm = type == "form" ? Ext.getCmp(obj.formId) : {};
		var parentGrid = Ext.getCmp(obj.parentId);
		var store = parentGrid.getStore();

		for(var i = 0; i < recs.length;i++){
			var r = recs[i];
			var record = store.getById(r.getId());
			records.push(record);
		}
		var items= [
			{
					xtype : type == "grid" ? "menuitem" : "button",
					text: ip2.i18n({
						'en': 'Resend',
						'da': 'Send igen'
					}),
					itemId : "itmResend",
					iconCls : "icon-resend",
					handler: function(item) {
						var msg = "<br>";
						for(var i = 0; i < records.length;i++){
							var record = records[i];
							
							var timestamp = ip2.createIsoTimeStamp();
							record.set("NTFSTS",0);
							record.set("NTFUPDTS",timestamp);

							
							if(type == "form"){
								var form = entityForm.getForm();
								form.setValues({
									"NTFUPDTS" : timestamp,
									"NTFSTS" : 0
								});
							}
							store.proxy.extraParams.action = "updateRow";
							store.proxy.extraParams.fullresponse = true;
							if(i+1 != records.length){
								msg += "ID:" + record.get("NTFNTFTKN") + " " +record.get("NTFSBJ")+ ip2.i18n({
																										'en': ' to ',
																										'da': ' til '
																									})  +record.get("NTFRCP")+"<br>"
							}
							else
							{
								msg += "ID:" + record.get("NTFNTFTKN") + " " +record.get("NTFSBJ") + ip2.i18n({
																										'en': ' to ',
																										'da': ' til '
																									})  +record.get("NTFRCP");
							}
						}
						store.sync(false);

						Ext.Msg.show({
							 title:'Info',
							 msg: ip2.i18n({
								'en': 'Following has been resendt:'+ msg +'<br>',
								'da': 'Følgende er gensendt:<br>'+ msg +'<br>'
							}),
							buttons: Ext.Msg.OK,
							icon: Ext.Msg.QUESTION,
							fn: function(buttonId) {
								if (buttonId === "ok") {
									Ext.Ajax.request({
										url: '/wsh-services/popnotifications.aspx',
										method: 'GET',
										success: function(res){
											store.load();
										}
									});
								}
							}
					});

				}
			},
			{
				xtype : type == "grid" ? "menuitem" : "button",
				text:  ip2.i18n({
					'en': 'Forward',
					'da': 'Videresend'
				}),
				itemId : "itmForward",
				iconCls : "icon-forward",
				handler: function(item) {
					var wndEdit = Ext.create("Ext.window.Window",{
						width: 600,
						height: 130,
						closable : true,
						title:  ip2.i18n({
							'en': 'Enter e-mail',
							'da': 'Indtast e-mail'
						}),
						layout : "fit",
						modal : true,
						closed : false,
						listeners: {
							destroy: function(){
								if(!wndEdit.closed){
									Ext.Ajax.request({
										url: '/wsh-services/popnotifications.aspx',
										method: 'GET',
										success: function(res){
											store.load();
										}
									});
								}
							}
						},
						items :[
							{
								xtype:"panel",
								bodyPadding: 5,
								layout: {
									type:"hbox",
									align: 'middle'
								},
								items:[
									{
										xtype: "textfield",
										fieldLabel:  ip2.i18n({
											'en': 'E-mail',
											'da': 'E-mail'
										}),
										flex: 1,
										allowBlank : false,
										itemId:  "txtEmail",
										msgTaget:'side',
										vtype : 'email'
									}
								]
							}
						],
						buttons :[
							{
								text:  ip2.i18n({
									'en': 'OK',
									'da': 'OK'
								}),
								handler : function(item){
									var txt = wndEdit.down("#txtEmail");
									var msg = "";
									if(txt.isValid()){
										for(var i = 0;  i < records.length; i++){
											var r = records[i].copy();
											var rc = r.data;
											var timestamp = ip2.createIsoTimeStamp();
											rc.NTFNTFTKN = null;
											rc.NTFCRTTS = timestamp;
											rc.NTFUPDTS = timestamp;
											rc.NTFSTS = null;
											rc.NTFRCP = txt.getValue();
											store.add(rc);

											if(i+1 != records.length){
											msg += record.get("NTFSBJ") + ip2.i18n({
																			'en': ' to ',
																			'da': ' til '
																		})  +txt.getValue()+"<br>"
											}
											else
											{
												msg += record.get("NTFSBJ") + ip2.i18n({
																				'en': ' to ',
																				'da': ' til '
																			})  +txt.getValue();
											}

										}

										store.proxy.extraParams.action = "updateRow";
										store.proxy.extraParams.fullresponse = true;
										
										Ext.Msg.show({
											 title:'Info',
											 msg: ip2.i18n({
												'en': 'Following has been forward:<br>'+ msg +'<br>',
												'da': 'Følgende er videresendt:<br>'+ msg +'<br>'
											}),
											buttons: Ext.Msg.OK,
											icon: Ext.Msg.QUESTION,
											fn: function(buttonId) {
												if (buttonId === "ok") {
													store.sync(false);
													wndEdit.close();
												}
											}
										});
										
									}
								}
							},
							{
								text:  ip2.i18n({
									'en': 'Close',
									'da': 'Luk'
								}),
								handler : function(item){
									wndEdit.closed = true;
									wndEdit.close();
								}
							}
						]
					});
					wndEdit.show();
				}
			}
		]

        return items;
    }
}