(function(){"use strict";var e;page.using={texts:["net_expand_text"],types:["ExpandOptionProvider","ExpandView","GoogleAnalyticsProvider"]};page.onLoad=function(){var e=page.url.get("gotoAfterSave");if(e&&!page.commandBindings["Save"]){page.commandBindings["Save"]=page.getUrlHandler(e)}u8.services.expandOptionProvider.buildFromPage(page,a)};function a(a){var d="Expand";if(a&&a.model&&a.model.uid&&a.model.uid.infoAreaId){var t=a.model.uid.infoAreaId;u8.services.googleAnalyticsProvider.sendCRMDataToGA(t,d)}var s=page.getHistory("expand");if(s&&u8.isValidRecordUid(s.uid)){if(a.model.mode=="New"){a.model.mode="Show"}a.model.uid=s.uid}var u=page.id+"_expand";u8.services.publisher.subscribe("record",n,u);page.bind("Unload",function(){u8.services.publisher.unsubscribe("record",u)});var p=page.url;var g=p.get("proceed","onSaveAndDelete");if(/on.*Save/.test(g)){a.onSave=r.bind(this)}if(/on.*Delete/.test(g)){a.onDelete=o.bind(this)}if(p.get("onCancel")){a.onCancel=i.bind(this)}a.parent=page;a.showBreadCrumbs="publish";a.isDefault=true;var c=p.getBoolean("autoSave");var f=$("#header,#expand");a.onCreate=function(e){if(c){e.save()}f.css("visibility","inherit");e.focus()};if(p.has("createNewPopup")){a.onError=function(e,a){a.message.buttons=["Close"]}}a.id=page.id+"_expand";e=u8.widget("ExpandView",$el("expand"),a)}function i(e,a){$command(page,"Cancel")}function n(a,i){if(a!=e){return}t(i.data&&i.data.uid)}function r(a,i){t(i.uid);d("Save",i,{savedUid:u8.recordUidToString(i.uid),SavedInfoArea:i.uid.infoAreaId,SavedRecID:i.uid.recordId});if(e&&e.page&&e.page.refreshManager&&u8.session.webConfigValues.getBoolean("Expand.RefreshCurrentTabOnSave",false)&&e.page.process==null){e.page.refreshManager.refreshCurrentTab()}}function o(e,a){d("Delete",a)}function d(e,a,i){$command(page,e,{parameters:i,stopPropagationAt:"Page"},function(i,n){if(n.stopPropagation){return}if(page.process){n.cancel=true}page.proceed({uid:a.uid,command:e})})}function t(e){if(!u8.isValidRecordUid(e)){return}var a=page.getHistory("expand");if(a){a.uid=e}var i=page.url;if(i.has("uid")){i.set("uid",u8.recordUidToString(e));page.setUrl(i)}}})();