(function(j,g,k,p,O,P){function y(a,b){var c=typeof a[b];return"function"==c||!!("object"==c&&a[b])||"unknown"==c}function Q(){try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");D=Array.prototype.slice.call(a.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1);K=9<parseInt(D[0],10)&&0<parseInt(D[1],10);return!0}catch(b){return!1}}function E(){if(!v){v=!0;for(var a=0;a<F.length;a++)F[a]();F.length=0}}function w(a,b){v?a.call(b):F.push(function(){a.call(b)})}function X(){var a=parent;
if(""!==B)for(var b=0,c=B.split(".");b<c.length;b++)a=a[c[b]];return a.easyXDM}function n(a){var b=a.toLowerCase().match(G),a=b[2],c=b[3],b=b[4]||"";if("http:"==a&&":80"==b||"https:"==a&&":443"==b)b="";return a+"//"+c+b}function C(a){a=a.replace(Y,"$1/");if(!a.match(/^(http||https):\/\//)){var b="/"===a.substring(0,1)?"":k.pathname;"/"!==b.substring(b.length-1)&&(b=b.substring(0,b.lastIndexOf("/")+1));a=k.protocol+"//"+k.host+b+a}for(;R.test(a);)a=a.replace(R,"");return a}function z(a,b){var c="",
d=a.indexOf("#");-1!==d&&(c=a.substring(d),a=a.substring(0,d));var d=[],f;for(f in b)b.hasOwnProperty(f)&&d.push(f+"="+P(b[f]));return a+(S?"#":-1==a.indexOf("?")?"?":"&")+d.join("&")+c}function x(a){return"undefined"===typeof a}function o(a,b,c){var d,f;for(f in b)b.hasOwnProperty(f)&&(f in a?(d=b[f],"object"===typeof d?o(a[f],d,c):c||(a[f]=b[f])):a[f]=b[f]);return a}function u(a){if(x(L)){var b=g.body.appendChild(g.createElement("form")),c=b.appendChild(g.createElement("input"));c.name=r+"TEST"+
T;L=c!==b.elements[c.name];g.body.removeChild(b)}L?b=g.createElement('<iframe name="'+a.props.name+'"/>'):(b=g.createElement("IFRAME"),b.name=a.props.name);b.id=b.name=a.props.name;delete a.props.name;a.onLoad&&s(b,"load",a.onLoad);"string"==typeof a.container&&(a.container=g.getElementById(a.container));a.container||(o(b.style,{position:"absolute",top:"-2000px"}),a.container=g.body);c=a.props.src;delete a.props.src;o(b,a.props);b.border=b.frameBorder=0;b.allowTransparency=!0;a.container.appendChild(b);
b.src=c;a.props.src=c;return b}function U(a){var b=a.protocol,c;a.isHost=a.isHost||x(q.xdm_p);S=a.hash||!1;a.props||(a.props={});if(a.isHost)a.remote=C(a.remote),a.channel=a.channel||"default"+T++,a.secret=Math.random().toString(16).substring(2),x(b)&&(n(k.href)==n(a.remote)?b="4":y(j,"postMessage")||y(g,"postMessage")?b="1":a.swf&&y(j,"ActiveXObject")&&Q()?b="6":"Gecko"===navigator.product&&"frameElement"in j&&-1==navigator.userAgent.indexOf("WebKit")?b="5":a.remoteHelper?(a.remoteHelper=C(a.remoteHelper),
b="2"):b="0");else{a.channel=q.xdm_c;a.secret=q.xdm_s;a.remote=q.xdm_e;var b=q.xdm_p,d;if(d=a.acl){a:{d=a.acl;var f=a.remote;"string"==typeof d&&(d=[d]);for(var h,l=d.length;l--;)if(h=d[l],h=RegExp("^"==h.substr(0,1)?h:"^"+h.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$"),h.test(f)){d=!0;break a}d=!1}d=!d}if(d)throw Error("Access denied for "+a.remote);}a.protocol=b;switch(b){case "0":o(a,{interval:100,delay:2E3,useResize:!0,useParent:!1,usePolling:!1},!0);if(a.isHost){if(!a.local){b=k.protocol+"//"+
k.host;c=g.body.getElementsByTagName("img");for(f=c.length;f--;)if(d=c[f],d.src.substring(0,b.length)===b){a.local=d.src;break}a.local||(a.local=j)}b={xdm_c:a.channel,xdm_p:0};a.local===j?(a.usePolling=!0,a.useParent=!0,a.local=k.protocol+"//"+k.host+k.pathname+k.search,b.xdm_e=a.local,b.xdm_pa=1):b.xdm_e=C(a.local);a.container&&(a.useResize=!1,b.xdm_po=1);a.remote=z(a.remote,b)}else o(a,{channel:q.xdm_c,remote:q.xdm_e,useParent:!x(q.xdm_pa),usePolling:!x(q.xdm_po),useResize:a.useParent?!1:a.useResize});
c=[new e.stack.HashTransport(a),new e.stack.ReliableBehavior({}),new e.stack.QueueBehavior({encode:!0,maxLength:4E3-a.remote.length}),new e.stack.VerifyBehavior({initiate:a.isHost})];break;case "1":c=[new e.stack.PostMessageTransport(a)];break;case "2":c=[new e.stack.NameTransport(a),new e.stack.QueueBehavior,new e.stack.VerifyBehavior({initiate:a.isHost})];break;case "3":c=[new e.stack.NixTransport(a)];break;case "4":c=[new e.stack.SameOriginTransport(a)];break;case "5":c=[new e.stack.FrameElementTransport(a)];
break;case "6":D||Q(),c=[new e.stack.FlashTransport(a)]}c.push(new e.stack.QueueBehavior({lazy:a.lazy,remove:!0}));return c}function V(a){for(var b,c={incoming:function(a,b){this.up.incoming(a,b)},outgoing:function(a,b){this.down.outgoing(a,b)},callback:function(a){this.up.callback(a)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}},d=0,f=a.length;d<f;d++)b=a[d],o(b,c,!0),0!==d&&(b.down=a[d-1]),d!==f-1&&(b.up=a[d+1]);return b}function Z(a){a.up.down=a.down;a.down.up=a.up;
a.up=a.down=null}var H=this,T=Math.floor(1E4*Math.random()),M=Function.prototype,G=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/,R=/[\-\w]+\/\.\.\//,Y=/([^:])\/\//g,B="",e={},$=j.easyXDM,r="easyXDM_",L,S=!1,D,K,s,A;if(y(j,"addEventListener"))s=function(a,b,c){a.addEventListener(b,c,!1)},A=function(a,b,c){a.removeEventListener(b,c,!1)};else if(y(j,"attachEvent"))s=function(a,b,c){a.attachEvent("on"+b,c)},A=function(a,b,c){a.detachEvent("on"+b,c)};else throw Error("Browser not supported");var v=!1,F=[],I;"readyState"in
g?(I=g.readyState,v="complete"==I||~navigator.userAgent.indexOf("AppleWebKit/")&&("loaded"==I||"interactive"==I)):v=!!g.body;if(!v){if(y(j,"addEventListener"))s(g,"DOMContentLoaded",E);else if(s(g,"readystatechange",function(){"complete"==g.readyState&&E()}),g.documentElement.doScroll&&j===top){var W=function(){if(!v){try{g.documentElement.doScroll("left")}catch(a){p(W,1);return}E()}};W()}s(j,"load",E)}var q=function(a){for(var a=a.substring(1).split("&"),b={},c,d=a.length;d--;)c=a[d].split("="),
b[c[0]]=O(c[1]);return b}(/xdm_e=/.test(k.search)?k.search:k.hash),N=function(){var a={},b={a:[1,2,3]};if("undefined"!=typeof JSON&&"function"===typeof JSON.stringify&&'{"a":[1,2,3]}'===JSON.stringify(b).replace(/\s/g,""))return JSON;Object.toJSON&&'{"a":[1,2,3]}'===Object.toJSON(b).replace(/\s/g,"")&&(a.stringify=Object.toJSON);"function"===typeof String.prototype.evalJSON&&(b='{"a":[1,2,3]}'.evalJSON(),b.a&&3===b.a.length&&3===b.a[2]&&(a.parse=function(a){return a.evalJSON()}));return a.stringify&&
a.parse?(N=function(){return a},a):null};o(e,{version:"2.4.15.118",query:q,stack:{},apply:o,getJSONObject:N,whenReady:w,noConflict:function(a){j.easyXDM=$;(B=a)&&(r="easyXDM_"+B.replace(".","_")+"_");return e}});e.DomHelper={on:s,un:A,requiresJSON:function(a){"object"==typeof j.JSON&&j.JSON||g.write('<script type="text/javascript" src="'+a+'"><\/script>')}};(function(){var a={};e.Fn={set:function(b,c){a[b]=c},get:function(b,c){var d=a[b];c&&delete a[b];return d}}})();e.Socket=function(a){var b=V(U(a).concat([{incoming:function(b,
c){a.onMessage(b,c)},callback:function(b){if(a.onReady)a.onReady(b)}}])),c=n(a.remote);this.origin=n(a.remote);this.destroy=function(){b.destroy()};this.postMessage=function(a){b.outgoing(a,c)};b.init()};e.Rpc=function(a,b){if(b.local)for(var c in b.local)if(b.local.hasOwnProperty(c)){var d=b.local[c];"function"===typeof d&&(b.local[c]={method:d})}var f=V(U(a).concat([new e.stack.RpcBehavior(this,b),{callback:function(b){if(a.onReady)a.onReady(b)}}]));this.origin=n(a.remote);this.destroy=function(){f.destroy()};
f.init()};e.stack.SameOriginTransport=function(a){var b,c,d,f;return b={outgoing:function(a,b,c){d(a);c&&c()},destroy:function(){c&&(c.parentNode.removeChild(c),c=null)},onDOMReady:function(){f=n(a.remote);a.isHost?(o(a.props,{src:z(a.remote,{xdm_e:k.protocol+"//"+k.host+k.pathname,xdm_c:a.channel,xdm_p:4}),name:r+a.channel+"_provider"}),c=u(a),e.Fn.set(a.channel,function(a){d=a;p(function(){b.up.callback(!0)},0);return function(a){b.up.incoming(a,f)}})):(d=X().Fn.get(a.channel,!0)(function(a){b.up.incoming(a,
f)}),p(function(){b.up.callback(!0)},0))},init:function(){w(b.onDOMReady,b)}}};e.stack.FlashTransport=function(a){function b(a){p(function(){d.up.incoming(a,h)},0)}function c(b){var c=a.swf+"?host="+a.isHost,d="easyXDM_swf_"+Math.floor(1E4*Math.random());e.Fn.set("flash_loaded"+b.replace(/[\-.]/g,"_"),function(){e.stack.FlashTransport[b].swf=l=i.firstChild;for(var a=e.stack.FlashTransport[b].queue,c=0;c<a.length;c++)a[c]();a.length=0});a.swfContainer?i="string"==typeof a.swfContainer?g.getElementById(a.swfContainer):
a.swfContainer:(i=g.createElement("div"),o(i.style,K&&a.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0}),g.body.appendChild(i));var f="callback=flash_loaded"+b.replace(/[\-.]/g,"_")+"&proto="+H.location.protocol+"&domain="+H.location.href.match(G)[3]+"&port="+(H.location.href.match(G)[4]||"")+"&ns="+B;i.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+d+"' data='"+
c+"'><param name='allowScriptAccess' value='always'></param><param name='wmode' value='transparent'><param name='movie' value='"+c+"'></param><param name='flashvars' value='"+f+"'></param><embed type='application/x-shockwave-flash' FlashVars='"+f+"' allowScriptAccess='always' wmode='transparent' src='"+c+"' height='1' width='1'></embed></object>"}var d,f,h,l,i;return d={outgoing:function(b,c,d){l.postMessage(a.channel,b.toString());d&&d()},destroy:function(){try{l.destroyChannel(a.channel)}catch(b){}l=
null;f&&(f.parentNode.removeChild(f),f=null)},onDOMReady:function(){h=a.remote;e.Fn.set("flash_"+a.channel+"_init",function(){p(function(){d.up.callback(!0)})});e.Fn.set("flash_"+a.channel+"_onMessage",b);a.swf=C(a.swf);var i=a.swf.match(G)[3],m=function(){e.stack.FlashTransport[i].init=!0;l=e.stack.FlashTransport[i].swf;l.createChannel(a.channel,a.secret,n(a.remote),a.isHost);a.isHost&&(K&&a.swfNoThrottle&&o(a.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"}),o(a.props,{src:z(a.remote,
{xdm_e:n(k.href),xdm_c:a.channel,xdm_p:6,xdm_s:a.secret}),name:r+a.channel+"_provider"}),f=u(a))};e.stack.FlashTransport[i]&&e.stack.FlashTransport[i].init?m():e.stack.FlashTransport[i]?e.stack.FlashTransport[i].queue.push(m):(e.stack.FlashTransport[i]={queue:[m]},c(i))},init:function(){w(d.onDOMReady,d)}}};e.stack.PostMessageTransport=function(a){function b(b){var d;if(b.origin)d=n(b.origin);else if(b.uri)d=n(b.uri);else if(b.domain)d=k.protocol+"//"+b.domain;else throw"Unable to retrieve the origin of the event";
d==h&&b.data.substring(0,a.channel.length+1)==a.channel+" "&&c.up.incoming(b.data.substring(a.channel.length+1),d)}var c,d,f,h;return c={outgoing:function(b,c,d){f.postMessage(a.channel+" "+b,c||h);d&&d()},destroy:function(){A(j,"message",b);d&&(f=null,d.parentNode.removeChild(d),d=null)},onDOMReady:function(){h=n(a.remote);if(a.isHost){var e=function(h){h.data==a.channel+"-ready"&&(f="postMessage"in d.contentWindow?d.contentWindow:d.contentWindow.document,A(j,"message",e),s(j,"message",b),p(function(){c.up.callback(!0)},
0))};s(j,"message",e);o(a.props,{src:z(a.remote,{xdm_e:n(k.href),xdm_c:a.channel,xdm_p:1}),name:r+a.channel+"_provider"});d=u(a)}else s(j,"message",b),f="postMessage"in j.parent?j.parent:j.parent.document,f.postMessage(a.channel+"-ready",h),p(function(){c.up.callback(!0)},0)},init:function(){w(c.onDOMReady,c)}}};e.stack.FrameElementTransport=function(a){var b,c,d,f;return b={outgoing:function(a,b,c){d.call(this,a);c&&c()},destroy:function(){c&&(c.parentNode.removeChild(c),c=null)},onDOMReady:function(){f=
n(a.remote);a.isHost?(o(a.props,{src:z(a.remote,{xdm_e:n(k.href),xdm_c:a.channel,xdm_p:5}),name:r+a.channel+"_provider"}),c=u(a),c.fn=function(a){delete c.fn;d=a;p(function(){b.up.callback(!0)},0);return function(a){b.up.incoming(a,f)}}):(g.referrer&&n(g.referrer)!=q.xdm_e&&(j.top.location=q.xdm_e),d=j.frameElement.fn(function(a){b.up.incoming(a,f)}),b.up.callback(!0))},init:function(){w(b.onDOMReady,b)}}};e.stack.NameTransport=function(a){function b(b){i.contentWindow.sendMessage(b,a.remoteHelper+
(l?"#_3":"#_2")+a.channel)}function c(){l?(2===++m||!l)&&h.up.callback(!0):(b("ready"),h.up.callback(!0))}function d(a){h.up.incoming(a,g)}function f(){t&&p(function(){t(!0)},0)}var h,l,i,j,m,t,g,J;return h={outgoing:function(a,c,d){t=d;b(a)},destroy:function(){i.parentNode.removeChild(i);i=null;l&&(j.parentNode.removeChild(j),j=null)},onDOMReady:function(){l=a.isHost;m=0;g=n(a.remote);a.local=C(a.local);l?(e.Fn.set(a.channel,function(b){l&&"ready"===b&&(e.Fn.set(a.channel,d),c())}),J=z(a.remote,
{xdm_e:a.local,xdm_c:a.channel,xdm_p:2}),o(a.props,{src:J+"#"+a.channel,name:r+a.channel+"_provider"}),j=u(a)):(a.remoteHelper=a.remote,e.Fn.set(a.channel,d));i=u({props:{src:a.local+"#_4"+a.channel},onLoad:function ba(){var b=i||this;A(b,"load",ba);e.Fn.set(a.channel+"_load",f);(function da(){"function"==typeof b.contentWindow.sendMessage?c():p(da,50)})()}})},init:function(){w(h.onDOMReady,h)}}};e.stack.HashTransport=function(a){function b(){if(g){var a=g.location.href,b="",d=a.indexOf("#");-1!=
d&&(b=a.substring(d));b&&b!=e&&(e=b,c.up.incoming(e.substring(e.indexOf("_")+1),k))}}var c,d,f,h,e,i,g,m,t,k;return c={outgoing:function(b){m&&(b=a.remote+"#"+i++ +"_"+b,(d||!t?m.contentWindow:m).location=b)},destroy:function(){j.clearInterval(f);(d||!t)&&m.parentNode.removeChild(m);m=null},onDOMReady:function(){d=a.isHost;h=a.interval;e="#"+a.channel;i=0;t=a.useParent;k=n(a.remote);if(d){a.props={src:a.remote,name:r+a.channel+"_provider"};if(t)a.onLoad=function(){g=j;f=setInterval(b,h);c.up.callback(!0)};
else{var J=0,aa=a.delay/50;(function ca(){if(++J>aa)throw Error("Unable to reference listenerwindow");try{g=m.contentWindow.frames[r+a.channel+"_consumer"]}catch(d){}g?(f=setInterval(b,h),c.up.callback(!0)):p(ca,50)})()}m=u(a)}else g=j,f=setInterval(b,h),t?(m=parent,c.up.callback(!0)):(o(a,{props:{src:a.remote+"#"+a.channel+new Date,name:r+a.channel+"_consumer"},onLoad:function(){c.up.callback(!0)}}),m=u(a))},init:function(){w(c.onDOMReady,c)}}};e.stack.ReliableBehavior=function(){var a,b,c=0,d=0,
f="";return a={incoming:function(h,e){var i=h.indexOf("_"),g=h.substring(0,i).split(","),h=h.substring(i+1);g[0]==c&&(f="",b&&b(!0));0<h.length&&(a.down.outgoing(g[1]+","+c+"_"+f,e),d!=g[1]&&(d=g[1],a.up.incoming(h,e)))},outgoing:function(e,g,i){f=e;b=i;a.down.outgoing(d+","+ ++c+"_"+e,g)}}};e.stack.QueueBehavior=function(a){function b(){if(a.remove&&0===d.length)Z(c);else if(!f&&!(0===d.length||g)){f=!0;var e=d.shift();c.down.outgoing(e.data,e.origin,function(a){f=!1;e.callback&&p(function(){e.callback(a)},
0);b()})}}var c,d=[],f=!0,e="",g,i=0,j=!1,m=!1;return c={init:function(){x(a)&&(a={});a.maxLength&&(i=a.maxLength,m=!0);a.lazy?j=!0:c.down.init()},callback:function(a){f=!1;var d=c.up;b();d.callback(a)},incoming:function(b,d){if(m){var f=b.indexOf("_"),g=parseInt(b.substring(0,f),10);e+=b.substring(f+1);0===g&&(a.encode&&(e=O(e)),c.up.incoming(e,d),e="")}else c.up.incoming(b,d)},outgoing:function(e,f,h){a.encode&&(e=P(e));var g=[],l;if(m){for(;0!==e.length;)l=e.substring(0,i),e=e.substring(l.length),
g.push(l);for(;l=g.shift();)d.push({data:g.length+"_"+l,origin:f,callback:0===g.length?h:null})}else d.push({data:e,origin:f,callback:h});j?c.down.init():b()},destroy:function(){g=!0;c.down.destroy()}}};e.stack.VerifyBehavior=function(a){function b(){d=Math.random().toString(16).substring(2);c.down.outgoing(d)}var c,d,e;return c={incoming:function(h,g){var i=h.indexOf("_");-1===i?h===d?c.up.callback(!0):e||(e=h,a.initiate||b(),c.down.outgoing(h)):h.substring(0,i)===e&&c.up.incoming(h.substring(i+
1),g)},outgoing:function(a,b,e){c.down.outgoing(d+"_"+a,b,e)},callback:function(){a.initiate&&b()}}};e.stack.RpcBehavior=function(a,b){function c(a){a.jsonrpc="2.0";g.down.outgoing(j.stringify(a))}function d(a,b){var d=Array.prototype.slice;return function(){var e=arguments.length,f,g={method:b};0<e&&"function"===typeof arguments[e-1]?(1<e&&"function"===typeof arguments[e-2]?(f={success:arguments[e-2],error:arguments[e-1]},g.params=d.call(arguments,0,e-2)):(f={success:arguments[e-1]},g.params=d.call(arguments,
0,e-1)),k[""+ ++i]=f,g.id=i):g.params=d.call(arguments,0);a.namedParams&&1===g.params.length&&(g.params=g.params[0]);c(g)}}function e(a,b,d,f){if(d){var g,h;b?(g=function(a){g=M;c({id:b,result:a})},h=function(a,d){h=M;var e={id:b,error:{code:-32099,message:a}};d&&(e.error.data=d);c(e)}):g=h=M;"[object Array]"===Object.prototype.toString.call(f)||(f=[f]);try{var i=d.method.apply(d.scope,f.concat([g,h]));x(i)||g(i)}catch(j){h(j.message)}}else b&&c({id:b,error:{code:-32601,message:"Procedure not found."}})}
var g,j=b.serializer||N(),i=0,k={};return g={incoming:function(a){a=j.parse(a);if(a.method)b.handle?b.handle(a,c):e(a.method,a.id,b.local[a.method],a.params);else{var d=k[a.id];a.error?d.error&&d.error(a.error):d.success&&d.success(a.result);delete k[a.id]}},init:function(){if(b.remote)for(var c in b.remote)b.remote.hasOwnProperty(c)&&(a[c]=d(b.remote[c],c));g.down.init()},destroy:function(){for(var c in b.remote)b.remote.hasOwnProperty(c)&&a.hasOwnProperty(c)&&delete a[c];g.down.destroy()}}};H.easyXDM=
e})(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent);
