easyXDM={version:"1.5.3.32",apply:function(c,b){if(!b){return}for(var a in b){if(b.hasOwnProperty(a)){c[a]=b[a]}}},Interface:function(b,c,g){var f;var i=0,h={};function e(k,j){if(typeof k.scope==="undefined"){k.scope=window}if(k.isVoid){return function(){var l=Array.prototype.slice.call(arguments,0);window.setTimeout(function(){f.sendData({name:j,params:l})},0)}}else{return function(){h[""+(++i)]=arguments[arguments.length-1];var l={name:j,id:(i),params:Array.prototype.slice.call(arguments,0,arguments.length-1)};window.setTimeout(function(){f.sendData(l)},0)}}}function d(j,m,l,k){if(!l){throw new Error("The method "+j+" is not implemented.")}if(l.isAsync){k.push(function(n){f.sendData({id:m,response:n})});l.method.apply(l.scope,k)}else{if(l.isVoid){l.method.apply(l.scope,k)}else{f.sendData({id:m,response:l.method.apply(l.scope,k)})}}}b.converter=JSON2;b.onData=function(k,j){if(k.name){d(k.name,k.id,c.local[k.name],k.params)}else{h[k.id](k.response);delete h[k.id]}};this.destroy=function(){f.destroy();for(var j in this){if(this.hasOwnProperty(j)){delete this[j]}}};if(c.remote){for(var a in c.remote){if(c.remote.hasOwnProperty(a)){this[a]=e(c.remote[a],a)}}}window.setTimeout(function(){f=new easyXDM.Channel(b,g)},5)},Channel:function(a,c){if(!a.converter){throw new Error("No converter present. You should use the easyXDM.transport classes directly.")}a.onMessage=function(e,d){this.onData(this.converter.parse(e),d)};this.transport=null;this.destroy=function(){this.transport.destroy()};this.sendData=function(d){this.transport.postMessage(a.converter.stringify(d))};var b=this;window.setTimeout(function(){b.transport=new easyXDM.transport.BestAvailableTransport(a,c)},5)}};easyXDM.DomHelper={createFrame:function(b,a,c){var e;var d=document.getElementsByTagName("FRAMESET");if(!a&&d&&d.length>0){e=document.createElement("FRAME");e.src=b;if(c){this.addEventListener(e,"load",function(){c(e.contentWindow)})}d[0].appendChild(e)}else{e=document.createElement("IFRAME");e.src=b;if(c){this.addEventListener(e,"load",function(){c(e.contentWindow)})}if(a){a.appendChild(e)}else{e.style.display="none";document.body.appendChild(e)}}return e},addEventListener:function(d,b,c,a){if(window.addEventListener){easyXDM.DomHelper.addEventListener=function(h,f,g,e){h.addEventListener(f,g,e)}}else{easyXDM.DomHelper.addEventListener=function(e,g,f){e.attachEvent("on"+g,f)}}easyXDM.DomHelper.addEventListener(d,b,c)},removeEventListener:function(e,b,d,a){var c;if(window.removeEventListener){c=function(i,g,h,f){i.removeEventListener(g,h,f)}}else{c=function(f,h,g){f.detachEvent("on"+h,g)}}c(e,b,d);easyXDM.DomHelper.removeEventListener=c},requiresJSON:function(a){if(typeof JSON=="undefined"||!JSON2){document.write('<script type="text/javascript" src="'+a+'"><\/script>')}}};easyXDM.transport={BestAvailableTransport:function(a,d){if(a.local){a.channel=(a.channel)?a.channel:"default"}else{var c=easyXDM.Url.Query();a.channel=c.channel;a.remote=c.endpoint}var b="HashTransport";if(window.postMessage){b="PostMessageTransport"}return new easyXDM.transport[b](a,d)},PostMessageTransport:function(a,e){if(!window.postMessage){throw"This browser does not support window.postMessage"}var j,d=easyXDM.Url.getLocation(a.remote),g;function b(k){if(k.origin){return k.origin}if(k.uri){return easyXDM.Url.getLocation(k.uri)}if(k.domain){return location.protocol+"//"+k.domain}throw"Unable to retrieve the origin of the event"}function c(){if(e){window.setTimeout(e,5)}}function h(k){g(k)}easyXDM.DomHelper.addEventListener(window,"message",h);function i(l){var k=b(l);if(k==d&&l.data.substring(0,a.channel.length+1)==a.channel+" "){a.onMessage(l.data.substring(a.channel.length+1),k)}}function f(k){if(k.data==a.channel+"-ready"){g=i;c()}}this.destroy=function(){easyXDM.DomHelper.removeEventListener(window,"message",h);if(a.local){j.parentNode.removeChild(j);j=null}};this.postMessage=(function(){if(a.local){g=f;j=easyXDM.DomHelper.createFrame(easyXDM.Url.appendQueryParameters(a.remote,{endpoint:easyXDM.Url.resolveUrl(a.local),channel:a.channel}),a.container);return function(k){j.contentWindow.postMessage(a.channel+" "+k,d)}}else{g=i;window.parent.postMessage(a.channel+"-ready",d);c();return function(k){window.parent.postMessage(a.channel+" "+k,d)}}}())},HashTransport:function(c,i){var d,a=c.interval||300,e;var g="#"+c.channel,n=0,f,k;var m,b=easyXDM.Url.getLocation(c.remote);if(c.local){var j={endpoint:easyXDM.Url.resolveUrl(c.local),channel:c.channel};e=(typeof c.container!=="undefined");if(e){j.poll=1}m=easyXDM.Url.appendQueryParameters(c.remote,j)}else{f=window;e=(typeof easyXDM.Url.Query().poll!=="undefined");m=c.remote+"#"+c.channel}function l(){try{if(f.location.hash&&f.location.hash!=g){g=f.location.hash;c.onMessage(decodeURIComponent(g.substring(g.indexOf("_")+1)),b)}}catch(o){}}function h(){if(c.local){f=easyXDM.transport.HashTransport.getWindow(c.channel)}if(e){d=window.setInterval(function(){l()},a)}else{easyXDM.DomHelper.addEventListener(f,"resize",l)}if(i){window.setTimeout(i,10)}}this.postMessage=function(o){k.src=m+"#"+(n++)+"_"+encodeURIComponent(o);if(!e){k.width=k.width>75?50:100}};this.destroy=function(){if(e){window.clearInterval(d)}else{easyXDM.DomHelper.removeEventListener(f,"resize",l)}k.parentNode.removeChild(k);k=null};if(c.local){easyXDM.transport.HashTransport.registerOnReady(c.channel,h)}k=easyXDM.DomHelper.createFrame(m,c.container,(c.local)?null:h)}};easyXDM.transport.HashTransport.callbacks={};easyXDM.transport.HashTransport.windows={};easyXDM.transport.HashTransport.registerOnReady=function(a,b){easyXDM.transport.HashTransport.callbacks[a]=b};easyXDM.transport.HashTransport.channelReady=function(c,a){easyXDM.transport.HashTransport.windows[c]=a;var b=easyXDM.transport.HashTransport.callbacks[c];if(b){b();delete easyXDM.transport.HashTransport.callbacks[c]}};easyXDM.transport.HashTransport.getWindow=function(a){return easyXDM.transport.HashTransport.windows[a]};easyXDM.Url={Query:function(){if(this._query){return this._query}this._query={};var f,d,e,c=location.search.substring(1).split("&");for(var b=0,a=c.length;b<a;b++){f=c[b];d=f.substring(0,f.indexOf("="));e=f.substring(d.length+1);this._query[d]=e}return this._query},getDomainName:function(a){var c=a.substring(a.indexOf("//")+2);c=c.substring(0,c.indexOf("/"));var b=c.indexOf(":");if(b!=-1){c=c.substring(0,b)}return c},getLocation:function(a){var b=a.indexOf("//");var c=a.substring(b+2);c=c.substring(0,c.indexOf("/"));return a.substring(0,b+2)+c},resolveUrl:function(a){if(a.match(/^(http||https):\/\//)){return a}if(a.substring(0,1)=="/"){return location.protocol+"//"+location.host+a}return location.href.substring(0,location.href.lastIndexOf("/")+1)+a},appendQueryParameters:function(a,c){var d="";for(var b in c){if(c.hasOwnProperty(b)){d+=b+"="+c[b]+"&"}}return a+((a.indexOf("?")==-1)?"?":"&")+d.substring(0,d.length-1)}};easyXDM.serializing={hashTableSerializer:{stringify:function(c){var b="";for(var a in c){if(c.hasOwnProperty(a)){b+=a+"="+escape(c[a])+"&"}}return b.substring(0,b.length-1)},parse:function(e){var g={};var j=e.split("&");var h,c,f;for(var b=0,a=j.length;b<a;b++){h=j[b];c=h.substring(0,h.indexOf("="));f=h.substring(c.length+1);g[c]=unescape(f)}return g}}};var JSON2=JSON2||{};(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON2!=="function"){Date.prototype.toJSON2=function(key){return this.valueOf()?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON2=Number.prototype.toJSON2=Boolean.prototype.toJSON2=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON2==="function"){value=value.toJSON2(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON2.stringify!=="function"){JSON2.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON2.stringify")}return str("",{"":value})}}if(typeof JSON2.parse!=="function"){JSON2.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON2.parse")}}}());var RF;if(RF==undefined){RF={}}if(!RF._initialized){RF.GetViewportHeight=function(){var a=0;if(document.documentElement&&document.documentElement.clientHeight&&document.documentElement.clientHeight!=0){viewportHeight=document.documentElement.clientHeight}else{viewportHeight=document.body.clientHeight}return viewportHeight};if(!("bind" in Function)){Function.prototype.bind=function(b){var a=this;return function(){return a.apply(b,[])}}}RF.defined=function(a){return !((a==undefined)||(a==null))};RF.addEventListener=function(c,b,d,a){if("addEventListener" in c){c.addEventListener(b,d,a)}else{if("attachEvent" in c){c.attachEvent("on"+b,d)}else{c["on"+b]=d}}};RF._initialized=true}RF.JIM=function(c){if(!("reframeit" in window)){window.reframeit={}}window.reframeit.jim=this;this.protocol=document.location.protocol;this.options=RF.defined(c)?c:{};this.margin_html='<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">  <head>    <title>Reframe It - Margin 2.0</title>    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />    <meta http-equiv="X-UA-Compatible" content="IE=7" />    <link href="http://reframeit.s3.amazonaws.com/margin/v2/skin/classic/margin.css" media="screen" rel="Stylesheet" type="text/css" />    <script src="http://reframeit.s3.amazonaws.com/margin/v2/scripts/compressed_rpc.js" type="text/javascript"><\/script>    <script src="http://reframeit.s3.amazonaws.com/margin/v2/scripts/compressed_margin.js" type="text/javascript"><\/script>    </head>  <body>     <div id="canvas"></div>    <script type="text/javascript">function loadMargin() {try { var margin = new Margin(true);window.parent.margin = margin;margin.onDOMLoaded(window.parent.location.href, window.parent);} catch(e) { setTimeout(loadMargin, 1000); }} loadMargin();<\/script>  </body></html>';this.margin_position=("margin_position" in this.options)?this.options.margin_position:"right";this.margin_width=("margin_width" in this.options)?this.options.margin_width:"300px";this.tab_position=("tab_position" in this.options)?this.options.tab_position:"25%";this.margin_open=("margin_open" in this.options)?this.options.margin_open:true;this.margin_asset_host=("margin_asset_host" in this.options)?this.options.margin_asset_host:"cdn.reframeit.com/margin/v2/";this.jim_asset_host=("jim_asset_host" in this.options)?this.options.jim_asset_host:"cdn.reframeit.com/jim/v2/";var b=(this.margin_open)?this.margin_width:"0";this.document_original_padding=document.body.style.paddingRight;document.body.style.paddingRight=b;this.marginFrame=document.createElement("iframe");this.marginFrame.setAttribute("id","rfjim_iframe");this.marginFrame.style.width=b;this.marginFrame.style.height="100%";this.marginFrame.scrolling="no";this.marginFrame.style.zIndex="16777271";if(("attachEvent" in this.marginFrame)&&(document.compatMode=="BackCompat")){this.marginFrame.style.position="absolute";this.marginFrame.style.setExpression("top","((document.documentElement.scrollTop || document.body.scrollTop) + (!this.offsetHeight && 0)) + 'px'")}else{this.marginFrame.style.position="fixed";this.marginFrame.style.top="0"}this.marginFrame.style.right="0";this.marginFrame.style.border="0";this.marginFrame.style.paddingLeft="5px";document.body.appendChild(this.marginFrame);RF.addEventListener(this.marginFrame,"readystatechange",this.onReadyStateChange.bind(this),false);try{if(this.marginFrame.contentDocument){var f=this.marginFrame.contentDocument}else{if(this.marginFrame.contentWindow){var f=this.marginFrame.contentWindow.document}else{if(this.marginFrame.document){var f=this.marginFrame.document}else{document.body.removeChild(this.marginFrame)}}}f.write(this.margin_html);f.close()}catch(d){}this.tab=document.createElement("a");this.tab.setAttribute("id","rfjim_tab");this.tab.style.backgroundImage="url("+this.getJIMAssetHost()+"images/right_tab.png)";this.tab.style.width="30px";this.tab.style.height="70px";this.tab.style.zIndex="16777271";if(("attachEvent" in this.tab)&&(document.compatMode=="BackCompat")){this.tab.style.position="absolute";var a=parseInt(this.tab_position.match(/^\d+/)[0]);var g="";if(this.tab_position.indexOf("%")!=-1){g="document.body.clientHeight * ."+a}else{g=a}this.tab.style.setExpression("top","(("+g+") + (document.documentElement.scrollTop || document.body.scrollTop) + (!this.offsetHeight && 0)) + 'px'")}else{this.tab.style.position="fixed";this.tab.style.top=this.tab_position}this.tab.style.color="#5885A2";this.tab.style.right=b;document.body.appendChild(this.tab);RF.addEventListener(this.tab,"click",this.onTabClick.bind(this),false);this.postCountSpan=document.createElement("span");this.postCountSpan.style.fontSize="10px";this.postCountSpan.style.display="block";this.postCountSpan.style.marginTop="22px";this.postCountSpan.appendChild(document.createTextNode(""));this.setPostCount(0);this.tab.appendChild(this.postCountSpan)};RF.JIM.prototype={getMarginAssetHost:function(){return this.protocol+"//"+this.margin_asset_host},getJIMAssetHost:function(){return this.protocol+"//"+this.jim_asset_host},onMarginFrameLoad:function(){window.margin.onDOMLoaded(window.location.href,window)},onReadyStateChange:function(){if(this.marginFrame.readyState=="complete"){if(this.marginFrame.contentDocument){var a=this.marginFrame.contentDocument}else{if(this.marginFrame.contentWindow){var a=this.marginFrame.contentWindow.document}else{if(this.marginFrame.document){var a=this.marginFrame.document}else{document.body.removeChild(this.marginFrame)}}}if(a.getElementById("canvas")){return}a.write(this.margin_html);a.close()}},onTabClick:function(){if(this.isMarginOpen()){this.closeMargin()}else{this.openMargin()}},closeMargin:function(){this.tab.style.right=this.marginFrame.style.width="0px";document.body.style.paddingRight=this.document_original_padding;if(window.margin!=null){window.margin.onMarginToggle()}},openMargin:function(){document.body.style.paddingRight=this.margin_width;this.tab.style.right=this.marginFrame.style.width=this.margin_width;if(window.margin!=null){window.margin.onMarginToggle()}},isMarginOpen:function(){var a=parseInt(this.marginFrame.style.width.match(/^\d+/)[0]);return(a!=0)},hideTab:function(){this.tab.style.display="none"},showTab:function(){this.tab.style.display="block"},isTabVisible:function(){return(this.tab.style.display!="none")},setPostCount:function(a){this.postCountSpan.firstChild.nodeValue=a;if(a<10){this.postCountSpan.style.marginLeft="13px"}else{if(a>=10&&a<100){this.postCountSpan.style.marginLeft="11px"}else{if(a>=100&&a<1000){this.postCountSpan.style.marginLeft="8px"}}}},_getMargin:function(){return window.margin},GetSetting:function(b,c,d){if(!("localStorage" in window)){return c}var a=window.localStorage.getItem(b);return(a==null)?c:a},PutSetting:function(a,b,c){if("localStorage" in window){window.localStorage.setItem(a,b)}},SetStatusFrameText:function(a){this.setPostCount(a.match(/^(\d+)/)[0])},Broadcast:function(a,b){},BroadcastMsg:function(){},MarginVisible:function(a){if(a){this.openMargin()}else{this.closeMargin()}},GetOptions:function(){if(RF.defined(window.reframeit.jim.options)){var a=JSON2.stringify(window.reframeit.jim.options)}else{var a="{}"}return a}};
