{
	xtype: "menu",
	onInitialize : function(i_owner, o_config, s_type){

		var i_self = this;
		var i_parent = Ext.getCmp(o_config.parentId || o_config.formId);
		var i_record = o_config.records[0];
		var a_items = [];
		var o_entity = i_parent.entity;
		var s_entity = Ext.isString(o_entity) ? o_entity : o_entity.name;
		var s_dmd = i_parent.dmdName;

		if(s_type == "grid"){
			if (ip2.isAccessible("app." + s_dmd + ".functions." + s_entity + "preview")) {

				a_items.push("-");

				a_items.push ({
					xtype: "themedbutton",
					itemId: "itm_preview",
					tooltip: ip2.i18n({
						da: "Preview",
						en: "Preview"
					}),
					iconCls : "preview_off",
					handler: function(item) {
						var i_token = i_record.get(i_record.idProperty);
						ip2.getSiteConfig(function (serversetting) {

							var s_src = "http://{0}/{1}/product/{2}";
							var s_host = serversetting.http_host;
							var b_multi = serversetting.language_usingmulti;
							var s_language = ip2.session.getLanguage();

							s_src = s_src.replace("{0}",s_host). replace("{2}",i_token);

							if (b_multi) {
								s_src = s_src.replace("{1}",s_language);
							}
							else {
								s_src = s_src.replace("{1}/","");
							}

							var i_window = Ext.widget("previewwindow",{
								state : 0,
								title : ip2.i18n({
									da: "Preview af produkt",
									en: "Preview off product"
								}),
								layout: "fit",
								items : [
									{
										xtype: "containeriframe",
										src: s_src
									}
								]
							});

							i_window.show();
						});
					}
				});
			}
		}

		return a_items;
	}
};
