(function(){var n=!1,t=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.PortholeClass=function(){};PortholeClass.extend=function(i){function u(){!n&&this.init&&this.init.apply(this,arguments)}var e=this.prototype,f,r;n=!0;f=new this;n=!1;for(r in i)f[r]=typeof i[r]=="function"&&typeof e[r]=="function"&&t.test(i[r])?function(n,t){return function(){var r=this._super,i;return this._super=e[n],i=t.apply(this,arguments),this._super=r,i}}(r,i[r]):i[r];return u.prototype=f,u.prototype.constructor=u,u.extend=arguments.callee,u}})(),function(n){var t={debug:!1,trace:function(t){this.debug&&n.console!==undefined&&n.console.log("Porthole: "+t)},error:function(t){n.console!==undefined&&n.console.error("Porthole: "+t)}};t.WindowProxy=function(){};t.WindowProxy.prototype={post:function(){},addEventListener:function(){},removeEventListener:function(){}};t.WindowProxyBase=PortholeClass.extend({init:function(t){t===undefined&&(t="");this.targetWindowName=t;this.origin=n.location.protocol+"//"+n.location.host;this.eventListeners=[]},getTargetWindowName:function(){return this.targetWindowName},getOrigin:function(){return this.origin},getTargetWindow:function(){return t.WindowProxy.getTargetWindow(this.targetWindowName)},post:function(t,i){i===undefined&&(i="*");this.dispatchMessage({data:t,sourceOrigin:this.getOrigin(),targetOrigin:i,sourceWindowName:n.name,targetWindowName:this.getTargetWindowName()})},addEventListener:function(n){return this.eventListeners.push(n),n},removeEventListener:function(n){var t;try{t=this.eventListeners.indexOf(n);this.eventListeners.splice(t,1)}catch(i){this.eventListeners=[]}},dispatchEvent:function(n){for(var t=0;t<this.eventListeners.length;t++)try{this.eventListeners[t](n)}catch(i){}}});t.WindowProxyLegacy=t.WindowProxyBase.extend({init:function(n,i){this._super(i);n!==null?(this.proxyIFrameName=this.targetWindowName+"ProxyIFrame",this.proxyIFrameLocation=n,this.proxyIFrameElement=this.createIFrameProxy()):(this.proxyIFrameElement=null,t.trace("proxyIFrameUrl is null, window will be a receiver only"),this.post=function(){throw new Error("Receiver only window");})},createIFrameProxy:function(){var n=document.createElement("iframe");return n.setAttribute("id",this.proxyIFrameName),n.setAttribute("name",this.proxyIFrameName),n.setAttribute("src",this.proxyIFrameLocation),n.setAttribute("frameBorder","1"),n.setAttribute("scrolling","auto"),n.setAttribute("width",30),n.setAttribute("height",30),n.setAttribute("style","position: absolute; left: -100px; top:0px;"),n.style.setAttribute&&n.style.setAttribute("cssText","position: absolute; left: -100px; top:0px;"),document.body.appendChild(n),n},dispatchMessage:function(i){var u=n.encodeURIComponent,r;this.proxyIFrameElement&&(r=this.proxyIFrameLocation+"#"+u(t.WindowProxy.serialize(i)),this.proxyIFrameElement.setAttribute("src",r),this.proxyIFrameElement.height=this.proxyIFrameElement.height>50?50:100)}});t.WindowProxyHTML5=t.WindowProxyBase.extend({init:function(n,t){this._super(t);this.eventListenerCallback=null},dispatchMessage:function(n){this.getTargetWindow().postMessage(t.WindowProxy.serialize(n),n.targetOrigin)},addEventListener:function(t){if(this.eventListeners.length===0){var i=this;n.addEventListener?(this.eventListenerCallback=function(n){i.eventListener(i,n)},n.addEventListener("message",this.eventListenerCallback,!1)):n.attachEvent&&(this.eventListenerCallback=function(){i.eventListener(i,n.event)},n.attachEvent("onmessage",this.eventListenerCallback))}return this._super(t)},removeEventListener:function(t){this._super(t);this.eventListeners.length===0&&(n.removeEventListener?n.removeEventListener("message",this.eventListenerCallback):n.detachEvent&&(typeof n.onmessage=="undefined"&&(n.onmessage=null),n.detachEvent("onmessage",this.eventListenerCallback)),this.eventListenerCallback=null)},eventListener:function(n,i){var r=t.WindowProxy.unserialize(i.data);r&&(n.targetWindowName===""||r.sourceWindowName==n.targetWindowName)&&n.dispatchEvent(new t.MessageEvent(r.data,i.origin,n))}});n.postMessage?(t.trace("Using built-in browser support"),t.WindowProxy=t.WindowProxyHTML5.extend({})):(t.trace("Using legacy browser support"),t.WindowProxy=t.WindowProxyLegacy.extend({}));t.WindowProxy.serialize=function(n){if(typeof JSON=="undefined")throw new Error("Porthole serialization depends on JSON!");return JSON.stringify(n)};t.WindowProxy.unserialize=function(n){if(typeof JSON=="undefined")throw new Error("Porthole unserialization dependens on JSON!");try{var t=JSON.parse(n)}catch(i){return!1}return t};t.WindowProxy.getTargetWindow=function(t){return t===""?parent:t==="top"||t==="parent"?n[t]:n.frames[t]};t.MessageEvent=function(n,t,i){this.data=n;this.origin=t;this.source=i};t.WindowProxyDispatcher={forwardMessageEvent:function(){var i,f=n.decodeURIComponent,u,r;document.location.hash.length>0&&(i=t.WindowProxy.unserialize(f(document.location.hash.substr(1))),u=t.WindowProxy.getTargetWindow(i.targetWindowName),r=t.WindowProxyDispatcher.findWindowProxyObjectInWindow(u,i.sourceWindowName),r?r.origin===i.targetOrigin||i.targetOrigin==="*"?r.dispatchEvent(new t.MessageEvent(i.data,i.sourceOrigin,r)):t.error("Target origin "+r.origin+" does not match desired target of "+i.targetOrigin):t.error("Could not find window proxy object on the target window"))},findWindowProxyObjectInWindow:function(n,t){var i;if(n)for(i in n)if(Object.prototype.hasOwnProperty.call(n,i))try{if(n[i]!==null&&typeof n[i]=="object"&&n[i]instanceof n.Porthole.WindowProxy&&n[i].getTargetWindowName()===t)return n[i]}catch(r){}return null},start:function(){n.addEventListener?n.addEventListener("resize",t.WindowProxyDispatcher.forwardMessageEvent,!1):n.attachEvent&&n.postMessage!=="undefined"?n.attachEvent("onresize",t.WindowProxyDispatcher.forwardMessageEvent):document.body.attachEvent?n.attachEvent("onresize",t.WindowProxyDispatcher.forwardMessageEvent):t.error("Cannot attach resize event")}};typeof n.exports!="undefined"?n.exports.Porthole=t:n.Porthole=t}(this);var ClientWebAPIMessage=function(){function n(){this.ClientWebWindowProxy=null;this.PopulateProperties();this.BindUIEvents();this.SubscribeToEvents();this.InitialisePorthole()}return n.prototype.PopulateProperties=function(){var n=document.getElementById("clientweb-root");this.ClientWebRoot=n.value},n.prototype.SubscribeToEvents=function(){},n.prototype.BindUIEvents=function(){var n=this},n.prototype.InitialisePorthole=function(){this.ClientWebWindowProxy=new Porthole.WindowProxy(this.ClientWebRoot+"/portholeproxy");var n=document.getElementById("clientweb-message");n&&this.ClientWebWindowProxy.post(JSON.parse(n.value))},n}(),clientWebAPIMessage=new ClientWebAPIMessage