(function() { if (typeof HostedEmailSocializer !== 'undefined') return; HostedEmailSocializer = Class.create({ FacebookPopupState: { Exposed: 1, Hidden: 0 }, initialize: function() { if (typeof HostedEmailSocializer.instance !== 'undefined') return; HostedEmailSocializer.instance = this; this.initializeAddThis(); this.initializeFacebook(); this.initializeLinkedIn(); }, initializeLinkedIn: function() { document.observe('dom:loaded', function(e) { //$('linkedin').down('a').observe('click', function(e) { // this.fireEvent('linkedin_share'); //}.bind(this)); }.bind(this)); }, initializeAddThis: function() { addthis.addEventListener('addthis.menu.share', function(event) { this.fireEvent(event.data.service + '_share'); }.bind(this)); }, initializeFacebook: function() { FB.Event.subscribe('edge.create', function(href, widget) { this.fireEvent('facebook_like'); this.hideFacebookPopup(); }.bind(this)); var channelUrl = document.location.protocol + '//' + document.location.host + '/facebook_channel.html'; FB.init({ channelUrl: channelUrl, xfbml: false, version: 'v2.2' }); this.facebookPopupState = this.FacebookPopupState.Hidden; if (window.location.hash == '#like') { document.observe('dom:loaded', this.exposeFacebookPopup.bind(this)); } else { document.observe('dom:loaded', function() { FB.XFBML.parse(); }); } }, hideFacebookPopup: function() { if (this.facebookPopupState != this.FacebookPopupState.Exposed) return; Element.remove(this.likeElm); Element.remove(this.backgroundElm); Element.remove(this.maskElm); this.facebookPopupState = this.FacebookPopupState.Hidden; }, exposeFacebookPopup: function() { if (this.facebookPopupState != this.FacebookPopupState.Hidden) return; // Mask (background shader) this.maskElm = new Element('div', { 'class': 'vr_hosted_email_socializer_like_mask', 'style': 'width: ' + this.getViewportForAllBrowsers()[0] + 'px; ' + 'height: ' + this.getViewportForAllBrowsers()[1] + 'px' }); // Popup background this.backgroundElm = new Element('div', { 'class': 'vr_hosted_email_socializer_like_popup' }); // Popup this.likeElm = new Element('div', { 'class': 'vr_hosted_email_socializer_like_content' }); this.likeElm.innerHTML = '