(function(){var containers = [{"id":"grv-personalization-16","url":"http://rma-api.gravity.com/v1/api/intelligence/w2?sg=361837bc83c4c2cba7b350dff56a564f&pl=16&ug=&b=59&ad=&sp=332","width":"300px","height":"250px","siteGuid":"361837bc83c4c2cba7b350dff56a564f","placement":16,"userGuid":""}]; /* Provides GravityUtils.includeJs() to dynamically source JavaScripts. */ /* @param {String} url @param {Function} onSuccess Called on script load success. @param {Function} onError Called on script load error. */ if (!window.GravityUtils) { window.GravityUtils = {}; } if (!window.GravityUtils.includeJs) { window.GravityUtils.includeJs = function(url, onSuccess, onError) { var loadHandled, loadHandler, s, someScript; if (onSuccess == null) { onSuccess = (function() {}); } if (onError == null) { onError = (function() {}); } s = document.createElement('script'); s.async = true; loadHandled = false; loadHandler = function() { loadHandled = true; s.onreadystatechange = s.onload = null; return onSuccess(); }; s.onreadystatechange = function() { if (!loadHandled && (!this.readyState || this.readyState === 'complete' || this.readyState === 'loaded')) { return loadHandler(); } }; s.onload = function() { if (!loadHandled) { return loadHandler(); } }; if (s.addEventListener) { s.addEventListener('error', onError, false); } else if (s.attachEvent) { s.attachEvent('onerror', onError); } s.src = url; someScript = document.getElementsByTagName('script')[0]; return someScript.parentNode.insertBefore(s, someScript); }; } /* Provides GravityUtils.insertStyleBlock() to insert style blocks into the page. Especially useful in situations where external stylesheets aren't feasible, or when styles need to be introduced for async loaded elements that aren't present at the time of style determination. */ /* @param {String} css The inner CSS content of the style block. */ if (!window.GravityUtils) { window.GravityUtils = {}; } if (!window.GravityUtils.insertStyleBlock) { window.GravityUtils.insertStyleBlock = function(css) { var head, style; head = document.head || document.getElementsByTagName('head')[0]; style = document.createElement('style'); style.type = 'text/css'; if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } return head.appendChild(style); }; } /* Shows the attribution modal, lazily initting it if necessary. Can be called either from same window (JSONP widgets) or via postMessage from widget to widget loader (iframe widgets). @requires insertStyleBlock.coffee */ window.grvShowAttributionModal = function($) { var $box, $closeBtn, $document, $overlay, $window, bindOverlayEvents, closeDialog, closeOnEscape, maintainOverlaySize, openDialog, setOverlaySize, unbindOverlayEvents, _ref, _this = this; $window = $(window); $document = $(document); if ((_ref = this.isVisible) == null) { this.isVisible = false; } if (!this.$overlay) { GravityUtils.insertStyleBlock("#grv_attr_overlay {\n background: rgb(0,0,0);\n background: rgba(0,0,0,0.6);\n position: absolute;\n top: 0px;\n left: 0px;\n z-index: 1000;\n font-family: 'Source Sans Pro', 'helvetica neue', helvetica, sans-serif, arial;\n display: none;\n}\n#grv_attr_box {\n background: #fff url(http://i.api.grvcdn.com/personalization/gravity_com_logo.932f1275dd5d743c1ae799763120a12c.png) no-repeat center 30px;\n border-radius: 4px;\n -moz-border-radius: 4px;\n -webkit-border-radius: 4px;\n padding: 85px 30px 30px;\n width: 330px;\n text-align: center;\n position: absolute;\n display: none;\n}\n#grv_attr_box p.grv_p {\n font-size: 15px;\n line-height: 18px;\n margin-bottom: 10px;\n font-weight: 300;\n color: #505050;\n}\na.grv_btn_blue {\n background: #09f;\n border-radius: 4px;\n -moz-border-radius: 4px;\n -webkit-border-radius: 4px;\n color: #fff !important;\n font-size: 16px;\n font-weight: 200;\n padding: 6px 12px;\n outline: none;\n text-decoration: none !important;\n}\na.grv_btn_blue:hover {\n background: #f90;\n}\n#grv_attrib_close_btn {\n background: #505050;\n color: #fff;\n width: 30px;\n height: 30px;\n line-height: 30px;\n vertical-align: middle;\n text-align: center;\n font-size: 15px;\n font-weight: 100;\n position: absolute;\n top: -15px;\n right: -15px;\n display: block;\n border-radius: 30px;\n -moz-border-radius: 30px;\n -webkit-border-radius: 30px;\n cursor: pointer;\n}\n#grv_attrib_close_btn:hover {\n background: #09f;\n}"); this.$overlay = $("
\n
\n

These stories are recommended for you by Gravity.

\n

The recommendations may include stories from other partners, some of whom pay to include their content here.

\n Learn More\n
X
\n
\n
").hide().appendTo('body'); this.$box = $('#grv_attr_box'); this.$closeBtn = $('#grv_attrib_close_btn'); } $overlay = this.$overlay; $box = this.$box; $closeBtn = this.$closeBtn; setOverlaySize = function() { return $overlay.height($document.height()).width($document.width()); }; maintainOverlaySize = function() { var _this = this; if (this.resizeTimeoutHandle) { clearTimeout(this.resizeTimeoutHandle); } return this.resizeTimeoutHandle = setTimeout((function() { _this.resizeTimeoutHandle = null; return setOverlaySize(); }), 50); }; bindOverlayEvents = function() { $window.resize(maintainOverlaySize); $document.keyup(closeOnEscape); $overlay.add($closeBtn).click(closeDialog); return $box.click(function(e) { return e.stopPropagation(); }); }; unbindOverlayEvents = function() { $window.unbind('resize', maintainOverlaySize); $document.unbind('keyup', closeOnEscape); $overlay.add($closeBtn).unbind('click', closeDialog); return $box.unbind('click'); }; closeDialog = function() { _this.isVisible = false; unbindOverlayEvents(); return $box.stop().fadeOut('fast', function() { return $overlay.stop().fadeOut('slow'); }); }; closeOnEscape = function(e) { if (e.which === 27) { return closeDialog(); } }; openDialog = function() { _this.isVisible = true; setOverlaySize(); $box.add($overlay).css('opacity', 0).show(); $box.css('top', $window.scrollTop() + $window.height() / 2 - $box.outerHeight() / 2); $box.css('left', $window.scrollLeft() + $window.width() / 2 - $box.outerWidth() / 2); bindOverlayEvents(); return $overlay.animate({ opacity: 1 }, 'slow', function() { return $box.animate({ opacity: 1 }, 'fast', function() { if (window.focus) { window.focus(); } if (document.activeElement && document.activeElement.blur) { return document.activeElement.blur(); } }); }); }; if (this.isVisible) { return closeDialog(); } else { return openDialog(); } }; var documentElem, jqueryAssetUrl, loadWidgets, secure, _ref, _ref1, __hasProp = {}.hasOwnProperty; documentElem = window.document.documentElement; /* @param {Object} elem Native DOM element. @param {Number} inViewThreshold Square pixel area of element that must be in viewport in order to consider it in view. Default is 100x100 square. @param {Number} absMinViewThreshold If the entire widget area is less than inViewThreshold (i.e. a very small widget), this absolute min view threshold will be used instead considering that the widget would otherwise never be counted as "in view." @return {Boolean} */ if ((_ref = window.grvElemInView) == null) { window.grvElemInView = function(elem, inViewThreshold, absMinViewThreshold) { var elemArea, elemHeight, elemRect, elemWidth, heightInView, inView, widthInView, windowHeight, windowWidth; if (inViewThreshold == null) { inViewThreshold = 10000; } if (absMinViewThreshold == null) { absMinViewThreshold = 4000; } inView = false; elemRect = elem.getBoundingClientRect(); windowHeight = documentElem.clientHeight; elemWidth = elemRect.right - elemRect.left; elemHeight = elemRect.bottom - elemRect.top; elemArea = elemWidth * elemHeight; if ((absMinViewThreshold <= elemArea && elemArea <= inViewThreshold)) { inViewThreshold = absMinViewThreshold; } if ((elemRect.top >= 0 && elemRect.top < windowHeight) || (elemRect.bottom >= 0 && elemRect.bottom < windowHeight) || (elemRect.top < 0 && elemRect.bottom >= windowHeight)) { windowWidth = documentElem.clientWidth; if ((elemRect.left >= 0 && elemRect.left < windowWidth) || (elemRect.right >= 0 && elemRect.right < windowWidth) || (elemRect.left < 0 && elemRect.right >= windowWidth)) { widthInView = Math.min(elemRect.right, windowWidth) - Math.max(elemRect.left, 0); heightInView = Math.min(elemRect.bottom, windowHeight) - Math.max(elemRect.top, 0); if (widthInView * heightInView > inViewThreshold) { inView = true; } } } return inView; }; } if ((_ref1 = window.grvPageViewId) == null) { window.grvPageViewId = { widgetLoaderWindowUrl: window.location.href, timeMillis: new Date().getTime().toString(), rand: Math.random().toString().replace('.', '').replace(/^0+/, '') }; } loadWidgets = function($) { var $window, bindEvent, c, frameUrl, inputSourceUrl, isEmptyObject, lastHeight, msgDataToIframe, msgDataToIframeOnScroll, postMessageSupported, receiveMessage, showWidget, sourceUrl, _base, _base1, _fn, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7; bindEvent = function(eventName, handler) { if (window.addEventListener) { return window.addEventListener(eventName, handler, false); } else if (window.attachEvent) { return window.attachEvent("on" + eventName, handler); } }; $window = $(window); postMessageSupported = !!window.postMessage; msgDataToIframe = {}; msgDataToIframeOnScroll = {}; showWidget = function(container, iframe) { var cb, containerId, _i, _len, _ref2, _ref3; if ((_ref2 = window.grvWidgetSuccessCallbacks) != null ? _ref2.length : void 0) { containerId = container.attr('id'); _ref3 = window.grvWidgetSuccessCallbacks; for (_i = 0, _len = _ref3.length; _i < _len; _i++) { cb = _ref3[_i]; cb(containerId); } } return container.css({ position: 'static', left: 'auto', top: 'auto' }); }; if ((_ref2 = window.grvDestroyWidget) == null) { window.grvDestroyWidget = function(containerId) { var elem, iframeAndContainer, iframeCollection, iframeOnScroll, iframeOnScrollCollection, key, msgDataKey, _i, _j, _len, _len1, _ref3, _ref4, _ref5; if (typeof console !== "undefined" && console !== null) { if (typeof console.log === "function") { console.log("Gravity: Destroying widget " + containerId); } } elem = document.getElementById(containerId); if (elem != null ? (_ref3 = elem.parentNode) != null ? _ref3.removeChild : void 0 : void 0) { msgDataKey = null; _ref4 = window.grvDestroyWidget.grvIframeCollections; for (_i = 0, _len = _ref4.length; _i < _len; _i++) { iframeCollection = _ref4[_i]; for (key in iframeCollection) { if (!__hasProp.call(iframeCollection, key)) continue; iframeAndContainer = iframeCollection[key]; if (!(iframeAndContainer.filter('div')[0] === elem)) { continue; } msgDataKey = key; break; } } if (msgDataKey) { delete iframeCollection[msgDataKey]; _ref5 = window.grvDestroyWidget.grvIframeOnScrollCollections; for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) { iframeOnScrollCollection = _ref5[_j]; for (key in iframeOnScrollCollection) { if (!__hasProp.call(iframeOnScrollCollection, key)) continue; iframeOnScroll = iframeOnScrollCollection[key]; if (!iframeOnScrollCollection[msgDataKey]) { continue; } delete iframeOnScrollCollection[msgDataKey]; break; } } return elem.parentNode.removeChild(elem); } } }; } if ((_ref3 = (_base = window.grvDestroyWidget).grvIframeCollections) == null) { _base.grvIframeCollections = []; } if ((_ref4 = (_base1 = window.grvDestroyWidget).grvIframeOnScrollCollections) == null) { _base1.grvIframeOnScrollCollections = []; } window.grvDestroyWidget.grvIframeCollections.push(msgDataToIframe); window.grvDestroyWidget.grvIframeOnScrollCollections.push(msgDataToIframeOnScroll); isEmptyObject = function(obj) { var k; for (k in obj) { return false; } return true; }; lastHeight = null; receiveMessage = function(event) { var $iframe, cb, container, containerId, decimalPart, iframeAndContainer, iframeElem, iframeSrc, intPart, is_maybe_our_message, matches, messageDomainMatches, msg, msgData, msg_data, msg_placement, msg_siteguid, msg_userid, newHeight, unit, _base2, _i, _len, _ref5, _ref6, _ref7, _results; if (isEmptyObject(msgDataToIframe)) { if (window.removeEventListener) { window.removeEventListener('message', receiveMessage, false); } else if (window.detachEvent) { window.detachEvent('onmessage', receiveMessage); } return; } if (event.data && event.origin) { msg_data = typeof (_base2 = event.data).split === "function" ? _base2.split("|") : void 0; is_maybe_our_message = ((msg_data != null ? msg_data.length : void 0) || 0) >= 4; if (!is_maybe_our_message) { return; } msg_siteguid = msg_data[0], msg_placement = msg_data[1], msg_userid = msg_data[2], msg = msg_data[3]; msgData = "" + msg_siteguid + "|" + msg_placement + "|" + msg_userid; iframeAndContainer = msgDataToIframe[msgData]; iframeSrc = iframeAndContainer != null ? iframeAndContainer.find('[src]').attr('src') : void 0; messageDomainMatches = (iframeSrc != null ? iframeSrc.indexOf(event.origin) : void 0) === 0; if (messageDomainMatches) { $iframe = iframeAndContainer.filter('iframe'); iframeElem = $iframe[0]; if (!msgDataToIframeOnScroll[msgData]) { msgDataToIframeOnScroll[msgData] = function() { if (grvElemInView(iframeElem)) { $window.unbind('scroll', msgDataToIframeOnScroll[msgData]); return iframeElem.contentWindow.postMessage('widgetInView', '*'); } }; } if (msg === 'grv_show') { showWidget(iframeAndContainer.not('iframe'), iframeAndContainer.filter('iframe')); iframeElem.contentWindow.postMessage('widgetShown', '*'); $window.bind('scroll', msgDataToIframeOnScroll[msgData]); return msgDataToIframeOnScroll[msgData](); } else if (msg === 'showAttrib') { return window.grvShowAttributionModal($); } else if (((_ref5 = (matches = /^setHeight:(\d+)(\.\d+)?(px|%)?/.exec(msg))) != null ? _ref5[1] : void 0) != null) { intPart = matches[1]; decimalPart = matches[2] || ''; unit = matches[3] || 'px'; newHeight = intPart + decimalPart + unit; if (newHeight !== lastHeight) { iframeAndContainer.height(newHeight); iframeElem.contentWindow.postMessage('heightUpdated', '*'); if ($iframe.width() >= 2) { $iframe.css('opacity', 1); return msgDataToIframeOnScroll[msgData](); } } } else if (msg === 'grvWidgetError' && ((_ref6 = window.grvWidgetErrorCallbacks) != null ? _ref6.length : void 0)) { container = iframeAndContainer.not('iframe'); containerId = container.attr('id'); _ref7 = window.grvWidgetErrorCallbacks; _results = []; for (_i = 0, _len = _ref7.length; _i < _len; _i++) { cb = _ref7[_i]; _results.push(cb(containerId)); } return _results; } } } }; inputSourceUrl = (_ref5 = window.gravityInsightsParams) != null ? (_ref6 = _ref5.sourceUrl) != null ? (_ref7 = _ref6.match(/^http.*/)) != null ? _ref7[0] : void 0 : void 0 : void 0; sourceUrl = inputSourceUrl || window.location.href; frameUrl = window.location.href; _fn = function(c) { var aolOmniPassThrough, aolOmniPassThroughJson, clickCaptureCallbacks, container, glid, htmlEncodedUrl, iframe, iframeAndContainer, msgData, msgDelim, msgPrefix, msgPrefixLen, toJsonLite, url, wlClientTime, _ref10, _ref8, _ref9; aolOmniPassThroughJson = null; if ('0' === '1') { toJsonLite = function(obj) { var key, val; return '{' + ((function() { var _results; _results = []; for (key in obj) { if (!__hasProp.call(obj, key)) continue; val = obj[key]; _results.push('"' + key.replace(/"/g, '\\"') + '":"' + val.toString().replace(/"/g, '\\"') + '"'); } return _results; })()).join(',') + '}'; }; if (window.s_265) { aolOmniPassThrough = {}; if (window.s_265.prop1 != null) { aolOmniPassThrough.prop1 = window.s_265.prop1; } if (window.s_265.prop2 != null) { aolOmniPassThrough.prop2 = window.s_265.prop2; } if (window.s_265.prop14 != null) { aolOmniPassThrough.prop14 = window.s_265.prop14; } if (window.s_265.prop10 != null) { aolOmniPassThrough.prop10 = window.s_265.prop10; } if (window.s_265.pageURL != null) { aolOmniPassThrough.pageURL = window.s_265.pageURL; } if (window.s_265.prop56 != null) { aolOmniPassThrough.prop56 = window.s_265.prop56; } if (window.s_265.channel != null) { aolOmniPassThrough.prop23 = window.s_265.channel; } if (window.s_265.eVar14 != null) { aolOmniPassThrough.eVar14 = window.s_265.eVar14; } glid = (_ref8 = window.s_265) != null ? typeof _ref8.c_r === "function" ? _ref8.c_r('UNAUTHID') : void 0 : void 0; if (glid != null) { aolOmniPassThrough.glid = glid; } aolOmniPassThroughJson = toJsonLite(aolOmniPassThrough); } } wlClientTime = ''; clickCaptureCallbacks = ((_ref9 = window.grvArticleClickCaptureCbs) != null ? (_ref10 = _ref9[c.siteGuid || '']) != null ? _ref10[c.placement.toString() || ''] : void 0 : void 0) || []; url = ("" + c.url + "&sourceUrl=" + (encodeURIComponent(sourceUrl)) + "&frameUrl=" + (encodeURIComponent(frameUrl))) + ("&clientTime=" + (new Date().getTime()) + "&ci=" + (encodeURIComponent(c.id)) + "&") + $.param({ 'pageViewId[widgetLoaderWindowUrl]': window.grvPageViewId.widgetLoaderWindowUrl, 'pageViewId[timeMillis]': window.grvPageViewId.timeMillis, 'pageViewId[rand]': window.grvPageViewId.rand }) + (aolOmniPassThrough ? "&aopt=" + (encodeURIComponent(aolOmniPassThroughJson)) : '') + (wlClientTime ? "&wct=" + (encodeURIComponent(wlClientTime)) : '') + ((clickCaptureCallbacks != null ? clickCaptureCallbacks.length : void 0) && postMessageSupported ? '&cc' : ''); htmlEncodedUrl = $('

').text(url).html(); iframe = $("