/*1326131485,169775814*/ if (window.CavalryLogger) { CavalryLogger.start_js(["D3NYq"]); } function ConnectSocialWidget(a,b){ConnectSocialWidget.setInstance(b,this);ConnectSocialWidget.delayUntilDisplayed(function(){this.initializeObject.call(this,a,b);}.bind(this));}copy_properties(ConnectSocialWidget,{OPT_IN_FACEBOOK_APP_ID:'127760087237610',TYPE_ACTIVITY:'A',TYPE_RECOMMENDATIONS:'R',TYPE_LIKEBOX:'L',instances:{},setInstance:function(b,a){ConnectSocialWidget.instances[b]=a;},getInstance:function(a){return ConnectSocialWidget.instances[a];},popups:{},login:function(a,b){ConnectSocialWidget.popups[b]={popup:PlatformOptInPopup.open('login','opt.in')};},aDelayedFunctions:[],delayUntilDisplayed:function(a){ConnectSocialWidget.aDelayedFunctions.push(a);if(ConnectSocialWidget.aDelayedFunctions.length===1){if(!ConnectSocialWidget.ndTestDim){var b=document.createElement('div'),c={position:'absolute',width:'1px',height:'1px',overflow:'hidden',top:'0px'};for(var d in c)if(typeof c[d]==='string')CSS.setStyle(b,d,c[d]);document.body.appendChild(b);ConnectSocialWidget.ndTestDim=b;}ConnectSocialWidget.testForD isplay();}},testForDisplay:function(){var a=Vector2.getElementDimensions(ConnectSocialWidget.ndTestDim).y;if(a!==0){ConnectSocialWidget.aDelayedFunctions.forEach(function(b){b();});ConnectSocialWidget.aDelayedFunctions=[];}else ConnectSocialWidget.testForDisplay.defer(100);},listenForLogin:function(){if(!ConnectSocialWidget.listenerAttached){Arbiter.subscribe('platform/socialplugins/login',function(a){if(a.user!==Env.user)document.location.reload();});ConnectSocialWidget.listenerAttached=true;}}});copy_properties(ConnectSocialWidget.prototype,{initializeObject:function(e,g){var d=DOM.scry(document.body,e.sOverflowContainerSelector)[0],c=DOM.scry(d,'.fbConnectWidgetFooter')[0],a=c?Vector2.getElementDimensions(c).y:0,f=e.sOverflowItemsSelector,b=DOM.scry(document.body,e.sStreamContainerSelector)[0];this.fRemoveOverflowElements=this.removeOverflowElements.bind(this,d,b,f,-a);copy_properties(this,{bInitialized:true,sWidgetId:g,iFooterHeight:a,ndTop:d,ndFooter:c,ndContentContainer:b,oQueryParams:new URI(window.lo cation.href).getQueryData(),bComboMode:e.bComboMode,sOverflowItemsSelector:f});copy_properties(this.oQueryParams,{post_form_id:Env.post_form_id,user:Env.user});this.fRemoveOverflowElements();CSS.setStyle(b,'visibility','visible');animation(b).from('opacity',0).to('opacity',1).duration(200).go();ConnectSocialWidget.listenForLogin();new ClickThroughMonitor({ndTop:this.ndContentContainer,fValidateLink:this.getElementTop.bind(this),fGetMonitorData:function(h){var i={site:this.oQueryParams.site,type:this.getLinkType(),plugin:this.getPluginType(),social:(DOM.scry(h,'^div.fbSocial').length>0),pos:this.getItemPosition(this.getElementTop(h)),signature:this.getItemSignature(this.getElementTop(h))};if(this.oQueryParams.api_key)i.api_key=this.oQueryParams.api_key;return i;}.bind(this)});},getElementTop:function(b){var a=DOM.scry(b,'^'+this.sOverflowItemsSelector);return a[0];},getItemPosition:function(d){var a=DOM.scry(this.ndContentContainer,this.sOverflowItemsSelector),c=a.length,b=a.indexOf(d)+1;return b+'/'+c;},getI temSignature:function(c){var a=c.className.split(' ');for(var b=0;b0&&(f=$(a.pop()))&&(Vector2.getElementDimensions(f).y+Vector2.getElementPosition(f).y)>e)DOM.remove(f);},login:function(){ConnectSocialWidget.login(this.appID,this.sWidgetId);},toggleLogin:function(){DOM.scry(this.ndTop,'.fbToggleLogin').forEach(function(a){CSS.toggle(a);});this.fRemoveOverflowElements();}});function ActivityWidget(a,b){this.parent.construct(this,a,b);}Class.extend(ActivityWidget,'ConnectSocialWidget');ActivityWidget.REQUEST_INTERVAL=15*1000;ActivityWidget.ACTIVITY_HEIGHT=45;ActivityWidget.MAX_INTERVAL=30;ActivityWidget.MAX_ITEMS=24;copy_properties(ActivityWidget.prototype,{initializeObject:function(a,b){this.parent.initializeObject.call(this,a,b);this.oQue ryParams.nb_activities=Math.min(ActivityWidget.MAX_ITEMS,Math.round((this.oQueryParams.height||300)/ActivityWidget.ACTIVITY_HEIGHT));this.oQueryParams.newest=a.iNewestStoryTime||0;},getLinkType:function(){return ConnectSocialWidget.TYPE_ACTIVITY;},getPluginType:function(){return ConnectSocialWidget.TYPE_ACTIVITY;},removeOverflowElements:function(){if(this.bComboMode&&!this.bFirstRound){this.bFirstRound=true;var d=Vector2.getElementPosition(this.ndTop).y,b=Vector2.getElementDimensions(document.body).y-(d+this.iFooterHeight),c=Math.round(b/2),a=$A(arguments);a[a.length]=c;ConnectSocialWidget.prototype.removeOverflowElements.apply(this,a);}else ConnectSocialWidget.prototype.removeOverflowElements.apply(this,arguments);},hasFriendsActivity:function(){return DOM.scry(this.ndContentContainer,'div.fbFriendsActivity')[0].childNodes.length>0;},hasContent:function(){return DOM.scry(this.ndTop,this.sOverflowItemsSelector).length>0;},getEmptyMessage:function(){return DOM.find(this.ndContentContainer,'div.fbEmptyWidget') ;},showEmptyMessage:function(){var a=this.getEmptyMessage();if(a)CSS.show(a);}});function RecommendationsWidget(a,b){this.parent.construct(this,a,b);}Class.extend(RecommendationsWidget,'ConnectSocialWidget');copy_properties(RecommendationsWidget.prototype,{getLinkType:function(){return ConnectSocialWidget.TYPE_RECOMMENDATIONS;},getPluginType:function(){return this.sActivityParent?ConnectSocialWidget.TYPE_ACTIVITY:ConnectSocialWidget.TYPE_RECOMMENDATIONS;},initializeObject:function(a,b){this.parent.initializeObject.call(this,a,b);this.sActivityParent=a.sActivityParent;this.cropImages(DOM.scry(this.ndContentContainer,".fbImageContainer img"),RecommendationsWidget.IMAGE_HEIGHT,true);this.cropImages(DOM.scry(this.ndContentContainer,"img.fbGalleryImage"),RecommendationsWidget.GALLERY_IMAGE_HEIGHT,false);},cropImages:function(a,d,b){if(a.length>0){var c=function(event){RecommendationsWidget.image_resize({image:event.getTarget(),dimension:d,centerimage:b});};a.forEach(function(e){if(e.complete){RecommendationsWidge t.image_resize({image:e,dimension:d,centerimage:b});}else Event.listen(e,'load',c);});}},hasContent:function(){return this.ndContentContainer.childNodes.length>0;},getParent:function(){if(this.sActivityParent)return ConnectSocialWidget.getInstance(this.sActivityParent);},showRecommendationsSeparator:function(){var b=this.getParent();if(b&&b.hasContent()){var a=DOM.scry(this.ndTop,'div.fbRecommendationsSeparator')[0];CSS.show(a);CSS.setStyle(a,'visibility','visible');}return this;},removeOverflowElements:function(){ConnectSocialWidget.prototype.removeOverflowElements.apply(this,arguments);if(this.sActivityParent&&!this.hasContent()){var a=DOM.scry(this.ndTop,'div.fbRecommendationsSeparator')[0];CSS.hide(a);}}});RecommendationsWidget.IMAGE_HEIGHT=35;RecommendationsWidget.GALLERY_IMAGE_HEIGHT=105;function LikeBoxWidget(a,b){this.parent.construct(this,a,b);}Class.extend(LikeBoxWidget,'ConnectSocialWidget');copy_properties(LikeBoxWidget.prototype,{getLinkType:function(){return ConnectSocialWdiget.TYPE_LIKEBOX;},g etPluginType:function(){return ConnectSocialWidget.TYPE_LIKEBOX;}});RecommendationsWidget.image_resize=function(l){var j=l.image,k=Vector2.getElementDimensions(j),c=k.y,i=k.x,g=l.dimension,m=g+'px',a=l.centerimage;if(c<=5||i<=5)return;var f=c/i;if(f<.5||f>2)return;if(c===i){CSS.setStyle(j,'width',m);}else if(c0){this.adminLinks=[];for(var a=0;a0?j[0]:null;if(i.showFaces&&i.viewer>0){var e=DOM.scry(this.widget,'div.connect_widget_logged_ in_user');this.loggedInUserPhotoDiv=e.length>0?e[0]:null;}}if(this.layout===ExternalNodeConnectWidget.SIMPLE_LAYOUT){this.originalButtonWidth=this.computeButtonDimensions().width;this.summaryIncluding=DOM.find(this.widget,'td.connect_widget_simple_including');this.supportCommenting=false;this.usingInlineCommenting=false;}this.setQueryData();if(this.pageId)copy_properties(this.popupOptInParams,{connect_id:this.pageId});this.errorSpans=DOM.scry(this.widget,'span.connect_widget_error_span');if(this.errorSpans.length>0){this.errorLinks=[];for(var b=0;b0){this.confirmLinks=[];for(var d=0;d0;},updateConnectionWithComment:function(event){Event.kill(event);if(this.commentButtonIsActive){this.postInlineComment();this.resetInlineComment();this.closeInlineComment();}},postInlineComment:function(){this.postUserComment(this.inlineCommentInput.value.trim(),false,'iframe');},resetInlineComment:function(){this.concealCommentButton();var a=this.inlineCommentInput.getAttribute('placeholder');this.inlineCommentInput.value=a;},showInlineComment:function(event){Event.kill(event);if (!this.inlineCommentFlyoutOpen||this.inlineCommentFlyoutVisible||this.showConfirm||this.error)return;this.inlineCommentFlyoutVisible=true;CSS.show(this.inlineCommentFlyout);},hideInlineComment:function(event){if(event)Event.kill(event);if(this.inlineCommentFocused||!this.inlineCommentFlyoutOpen||!this.inlineCommentFlyoutVisible)return;if(event&&DOM.contains(this.inlineCommentFlyout,event.getRelatedTarget()))return;var b=this.inlineCommentInput.value.trim();var a=this.inlineCommentInput.getAttribute('placeholder');if(b.length>0&&b!=a)return;this.inlineCommentFlyoutVisible=false;CSS.hide(this.inlineCommentFlyout);},closeInlineComment:function(){this.inlineCommentFlyoutVisible=false;this.inlineCommentFlyoutOpen=false;CSS.hide(this.inlineCommentFlyout);this.resetInlineComment();},concealCommentButton:function(){CSS.addClass(this.inlineCommentButton,'hidden_elem');CSS.setStyle(this.inlineCommentInput,'width',this.textInputWidthWithoutButton+'px');CSS.setStyle(this.inlineCommentInput,'margin-right',0);},positionIn lineCommentFlyout:function(){CSS.addClass(this.inlineCommentFlyout,'comment_widget_offscreen');CSS.removeClass(this.inlineCommentFlyout,'hidden_elem');var b=0;var a=this.computeButtonDimensions();var e=a.height;var d=this.grayOut?b:b+20;var g=intl_locale_is_rtl()?'right':'left';if(this.showFaces){var k=DOM.scry(this.widget,'span.connect_widget_text')[0];var h=intl_locale_is_rtl()?'paddingRight':'paddingLeft';var l=CSS.getStyle(k,h);d=this.grayOut?b:b+parseInt(l,10);var i=Vector2.getElementDimensions(this.sampleConnections).y;e=i-3;}var j=Vector2.getElementDimensions(this.summaryText).y;if(j>15)e+=2;CSS.setStyle(this.inlineCommentFlyout,g,d+'px');CSS.setStyle(this.inlineCommentFlyout,'top',(-e)+'px');var n=Vector2.getElementPosition(this.widget,'document').x;var m=Vector2.getElementDimensions(this.widget).x;var o=n+m-d-5;CSS.setStyle(this.inlineCommentFlyout,'width',o+'px');CSS.removeClass(this.inlineCommentButton,'hidden_elem');var f=Vector2.getElementDimensions(this.inlineCommentButton).x;CSS.addClass(this. inlineCommentButton,'hidden_elem');var c=(this.inlineCommentClose)?15:0;this.textInputWidthWithoutButton=o-24-c;this.textInputWidthWithButton=this.textInputWidthWithoutButton-f-this.textInputMarginWithButton-1;CSS.setStyle(this.inlineCommentInput,'width',this.textInputWidthWithoutButton+'px');CSS.setStyle(this.inlineCommentInput,'margin-right',0);CSS.removeClass(this.inlineCommentFlyout,'comment_widget_offscreen');CSS.addClass(this.inlineCommentFlyout,'hidden_elem');},postUserComment:function(a,c,d){var b={href:this.externalUrl,node_type:this.nodeType,edge_type:this.edgeType,page_id:this.pageId,connect_text:this.connectText,story_fbid:this.connectStoryFbid,comment:a,widget_type:d||'xfbml',own_product:c};new AsyncRequest().setURI(this.getCommentAjaxEndpoint()).setData(b).setNectarModuleDataSafe().setNectarImpressionIdSafe().send();this.closeCommentWidget();},closeCommentWidget:function(){if(this.commentWidgetOpen){delete this.inGracePeriod;delete this.commentWidgetIsExpanded;this.commentWidgetVisible=false;th is.commentWidgetOpen=false;UnverifiedXD.send({type:'dismissEdgeCommentDialog'});}},presentAdminPage:function(){var a='_blank';window.open(this.adminUrl.toString(),a);},presentErrorDialog:function(){if(!this.error.errorUri)return;var b='_blank';var a='toolbar=0, status=0, width=960, height=300';window.open(this.error.errorUri.toString(),b,a);},presentConfirmDialog:function(){var b='_blank';var a='toolbar=0,status=0,width=450,height=200,scrollbars=0,location=0,menubar=0';if(!window.confirmDialogReturn)window.confirmDialogReturn={};window.confirmDialogReturn[this.widgetID]=this;var c=this.getConfirmURL();window.open(c,b,a);},returnFromConfirmDialog:function(a){if(a){this.showConfirm=null;this.confirmedConnect=a;this.connectToNode(!this.alreadyConnected);}else this.updateWidget({nowConnected:this.alreadyConnected,showConfirm:null,isAdmin:this.viewerIsAdmin},false);},syncWidgetDisplay:function(){var a=this.alreadyConnected;this.setButtonState(a);this.showElementIf(this.connectedMessage,a);this.showElementIf(this. notConnectedMessage,!a);if(this.adminSpans)for(var b=0;b'));setTimeout(function(){this.tombstoneCross=DOM.find(this.widget,'div.tombstone_cross');CSS.removeClass(this.tombstoneCross,'tombstone_cross_static');Event.listen(this.tombstoneCross,'click',this.connectToNodeOnClick.bind(this));}.bind(this),1000);},_clickLocked:false,connectToNodeOnClick:function(event){Event.kill(event);if(!this._clickLocked){this._clickLocked=true;setTimeout(function(){this._clickLocked=false;}.bind(this),1000);if(this.viewerID==0||this.userOptedOut){this.presentOptIn();}else this.connectToNode(!this.alreadyConnected);}},connectToNode:function(d){if(!d){if(this.layout===ExternalNodeConnectWidget.SIMPLE_LAYOUT)return;if(this.layout===ExternalNodeConnectWidget.STANDARD_LAYOUT&&!this.usingConnectLibrary){CSS.addClass(this.userActionTextSpan,'hidden_elem');CSS.removeClass(this.summaryTextSpan,'hidden_elem');CSS.setStyle(this.summaryTextSpan,'opacity',1);}if(this.shareCommentSpans)for(var b=0;b0)this.inlineCommentClose=this.inlineCommentClose[0];this.commentButtonIsActive=false;Event.listen(this.inlineCommentInput,'keyup',this.conditionallyActivateButton.bind(this));Event.listen(this.inlineCommentInput,'focus',function(){this.inlineCommentFocused=true;this.exposeCommentButton();}.bind(this));Event.listen(this.inlineCommentButto n,'click',this.updateConnectionWithComment.bind(this));Event.listen(this.inlineCommentInput,'blur',function(){this.inlineCommentFocused=false;this.hideInlineComment();}.bind(this));Event.listen(this.widget,'mouseout',this.hideInlineComment.bind(this));Event.listen(this.widget,'mouseover',this.showInlineComment.bind(this));if(this.inlineCommentClose)Event.listen(this.inlineCommentClose,'click',function(event){for(var a=0;a0){f=f[0];var e=50;var d=Vector2.getElementDimensions(f);var g=e/d.x;if(g<1){CSS.setStyle(f,'width',e);CSS.setStyle(f,'height',d.y*g);}}}this.setupCommentHooks(this.commentDocument);this.commentWidgetIsExpanded=!this.inlineUnlikeLink;var b=this.getCommentActivatingComponent();b.onmouseout=this.commentDocument.body.onmouseout=this.onCommentMouseOut.bind(this);b.onmouseover=this.commentDocument.body.onmouseover=this.onCommentMouseOver.bind(this);this.inGracePeriod=false;},onCommentMouseOut:function(a){if(this.mouseclickToDismiss){this.mouseOutside=true;return true;}else return this.hideCommentWidget();},onCommentMouseOver:function(a){if(this.mouseclickToDismiss){this.mouseOutside=false;return true;}else return this.showCommentWidget();},setupCommentHooks:function(a){this.placeholderInputRegion=DOM.find(a,'div.connect_comment_widget_placeholder_input_region');this.placeholderInput=DOM.fi nd(this.placeholderInputRegion,'input.connect_comment_widget_placeholder_input');this.fullInputRegion=DOM.find(a,'div.connect_comment_widget_full_input_region');this.fullInputTextarea=DOM.find(this.fullInputRegion,'textarea.connect_comment_widget_full_input_textarea');this.ownProductCheckbox=DOM.scry(a,'.connect_comment_widget_own_product_checkbox');if(this.ownProductCheckbox.length>0)this.ownProductCheckbox=this.ownProductCheckbox[0];this.widgetButtonRegion=DOM.find(a,'div.connect_comment_widget_button_region');this.postToFacebookButton=DOM.scry(this.widgetButtonRegion,'.connect_comment_widget_post_button input');if(this.postToFacebookButton.length>0){this.postToFacebookButton=this.postToFacebookButton[0];this.postToFacebookButton.onclick=this.updateUserComment.bind(this);}this.closeButton=DOM.scry(this.widgetButtonRegion,'.connect_comment_widget_close_button input');if(this.closeButton.length>0){this.closeButton=this.closeButton[0];this.closeButton.onclick=this.closeCommentWidget.bind(this);this.sendOnEnte r=true;}this.mouseclickToDismiss=CSS.hasClass(this.widgetButtonRegion,'mouseclicktodismiss');this.inlineUnlikeLink=DOM.scry(a,'a.connect_comment_widget_unlike_link');if(this.inlineUnlikeLink.length>0){this.inlineUnlikeLink=this.inlineUnlikeLink[0];this.inlineUnlikeLink.onclick=this.connectToNodeOnClick.bind(this);}this.defaultInputText=this.placeholderInput.value;this.placeholderInput.onfocus=this.transitionToFullInputMode.bind(this);this.fullInputTextarea.onfocus=this.removePlaceholderText.bind(this);this.fullInputTextarea.onblur=(function(b){this.restorePlaceholderText();if(this.mouseclickToDismiss&&this.mouseOutside)return this.hideCommentWidget();}).bind(this);if(this.inlineUnlikeLink)this.inlineUnlikeLink.onclick=this.connectToNodeOnClick.bind(this);if(this.closeButton)this.closeButton.onclick=this.closeCommentWidget.bind(this);this.sendOnEnter=(CSS.hasClass(this.widgetButtonRegion,'sendonenter')||this.sendOnEnter);if(this.sendOnEnter){this.fullInputTextarea.onkeydown=(function(b){b=b||window.event;if(! b)return true;if(this.sendOnEnter&&b.keyCode==13&&!(b.ctrlKey||b.shiftKey||b.altKey||b.metaKey)){this.updateUserComment();return false;}if(this.didResetOnKeydown)return true;this.removePlaceholderText();this.didResetOnKeydown=true;return true;}).bind(this);this.transitionToFullInputMode();}},getCommentActivatingComponent:function(){if(this.layout===ExternalNodeConnectWidget.BOX_COUNT_LAYOUT||this.layout===ExternalNodeConnectWidget.BUTTON_COUNT_LAYOUT){return this.widget;}else if(this.layout===ExternalNodeConnectWidget.SIMPLE_LAYOUT){return this.widget;}else if(this.grayOut){return DOM.find(this.widget,'table.connect_widget_interactive_area');}else return this.confirmationCell;},showCommentWidget:function(event){if(this.otherCommentWidgetOpen)return false;this.inGracePeriod=true;this.killCloseThread();if(this.commentWidgetOpen&&!this.commentWidgetVisible){this.commentWidgetVisible=true;CSS.show(this.commentDocument.body);UnverifiedXD.send({type:'showEdgeCommentDialog'});}return false;},hideCommentWidget:funct ion(event){if(this.otherCommentWidgetOpen)return false;this.inGracePeriod=false;if(this.commentWidgetOpen&&this.commentWidgetVisible){var a=function(){if(!this.inGracePeriod&&this.shouldHideExpandedWidget()){this.fullInputTextarea.blur();this.commentWidgetVisible=false;if(!this.socialBar)CSS.hide(this.commentDocument.body);UnverifiedXD.send({type:'hideEdgeCommentDialog'});}this.inGracePeriod=false;this.killCloseThread();}.bind(this);this.closeThreadID=setTimeout(a,100);}return false;},shouldHideExpandedWidget:function(){return !this.commentWidgetIsExpanded||this.fullInputTextarea.value===''||this.fullInputTextarea.value===this.defaultInputText;},killCloseThread:function(){if(this.closeThreadID){clearTimeout(this.closeThreadID);delete this.closeThreadID;}},transferCSSStyles:function(){var e=DOM.scry(window.document,'link');var f=DOM.scry(window.document,'style');var d=DOM.find(window.document,'html');var h=DOM.find(this.commentDocument,'html');var g=DOM.find(this.commentDocument,'head');for(var b=0;b0&&c<=5){CSS.setStyle(this.connectButton,'width',(b.button_width-parseInt(CSS.getStyle(this.connectButton,'paddingLeft'))-parseInt(CSS.getStyle(this.connectButton,'paddingRight'))-parseInt(CSS.getStyle(this.connectButton,'borderLeftWidth'))-parseInt(CSS.getStyle(this.connectButton,'borderRightWidth')))+'px');this.sizeNumberCloud();}if(this.layout===ExternalNodeConnectWidget.STANDARD_LAYOUT){var d=Vector2.getElementDimensions(this.widget).y;CSS.setStyle(this.widget,'height',(d+5)+'px');var e=ua.ie();var f=intl_locale_is_rtl();var g=f?'right':'left';if(e&&e<9){CSS.setStyle(this.connectButton,'position','absolute');CSS.setStyle(this.connectButton,g,-(b.button_width+10)+'px');}else{CSS.setS tyle(this.connectButton,'position','fixed');CSS.setStyle(this.connectButton,g,'0px');}if(e&&this.connectButtonSlider){CSS.setStyle(this.connectButtonSlider,g,b.button_width+'px');if(e<=7)this.fixIEButtonDoubleLineBug();}CSS.setStyle(this.confirmationCell,'position','absolute');CSS.setStyle(this.confirmationCell,g,(b.button_width+a+5)+'px');CSS.setStyle(this.confirmationCell,'top','5px');if(this.sampleConnections){CSS.setStyle(this.sampleConnections,'position','fixed');CSS.setStyle(this.sampleConnections,g,'0');}this.invertedButtons=true;this.repositionFacepileVertically();}},repositionFacepileVertically:function(){if(this.invertedButtons&&this.sampleConnections){var a=Vector2.getElementDimensions(this.summaryText).y;CSS.setStyle(this.sampleConnections,'margin-top',(5+a+5)+'px');}}}); function ConnectWidget(h,f,a,e,b){copy_properties(this,{channel_url:b,like_mode:e,profile_id:f,viewer_id:h,status:null,popup:null,busy:false,new_fan:null,user_profile:null});this.fan_hidden=[];this.fan_shown=[];var c=DOM.scry(document,'div.connections');if(c.length>0){c=c[0];this.user_profile=DOM.find(c,'div.user_profile');this.new_fan=DOM.find(c,'div.grid_item_plus');this.fan_shown.push(this.new_fan);this.fan_shown.push(DOM.find(c,'span.total_plus'));var g=DOM.scry(c,'span.total');var d=DOM.scry(c,'div.grid_item');if(d.length>1)this.fan_hidden.push(d[1]);this.fan_hidden.push(g[g.length-1]);}if(!this.like_mode){this.button=$(a);this.popup_uri=new URI('/login.php');this.popup_uri.addQueryData({connect_id:this.profile_id,popup:true});Event.listen(this.button,'click',this.connectClickHandler.bind(this));}else Arbiter.subscribe('platform/like/connection',this.updateWidgetFromLike.bind(this));ConnectWidget.instances[a]=this;if(this.channel_url)XD.init({channelUrl:this.channel_url});}ConnectWidget.instances={};Con nectWidget.is_connect=true;ConnectWidget.prototype.setLoggedIn=function(a){this.viewer_id=a;return this;};ConnectWidget.prototype.connectClickHandler=function(a){a.kill();if(this.viewer_id!=0){this.connect();}else this.popUpLogin();};ConnectWidget.prototype.connect=function(){if(!this.busy){this.busy=true;fbpage_set_fan_status(this.button,this.profile_id,true,false,this.connectDoneHandler.bind(this),this.connectErrorHandler.bind(this),this.getAsyncData());}};ConnectWidget.prototype.disconnect=function(){if(!this.busy){this.busy=true;fbpage_set_fan_status(this.button,this.profile_id,false,false,this.connectUndoneHandler.bind(this),function(){},this.getAsyncData());}};ConnectWidget.prototype.getAsyncData=function(){var a={source:'connect',is_connect:ConnectWidget.is_connect,fan_origin:'external_connect'};if(ge('post_form_id'))a.post_form_id=$('post_form_id').value;if(Env.fb_dtsg)a.fb_dtsg=Env.fb_dtsg;return a;};ConnectWidget.prototype.popUpLogin=function(){window.open(this.popup_uri.toString(),'_blank','toolba r=0,status=0,width=626,height=400');};ConnectWidget.prototype.updateWidgetFromLike=function(b,f){if(!f.userProfile)return;if(this.user_profile){var c=DOM.find(this.user_profile,'img');var a=DOM.find(this.user_profile,'a');var e=DOM.find(this.user_profile,'div.name');c.src=f.userProfile.pic_square;a.href=f.userProfile.profile_url;DOM.setContent(e,f.userProfile.name);}var d;if(f.nowConnected){d='likeboxLiked';this.showNewFan();}else{d='likeboxUnliked';this.hideNewFan();}if(this.channel_url)XD.send({type:d});};ConnectWidget.prototype.connectErrorHandler=function(b){if(b.error==1357001){this.viewer_id=0;this.popUpLogin();}else if(b.error==1357013){CSS.hide(this.button);var a=$N('a',{href:DOM.find(document,'div.name_block a').href,target:'_blank'},"\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430.");this.status=$N('span',{className:'connect_span'},a);DOM.insertAfter(th is.button,this.status);}else{CSS.hide(this.button);if(b.error==1431001){this.status=$N('span',{className:'connect_span'},"\u0412\u0430\u043c \u044d\u0442\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f.");}else this.status=$N('span',{className:'connect_span'},b.getErrorSummary()+': '+b.getErrorDescription());animation(this.status).from('opacity',0).to('opacity',1).go();DOM.insertAfter(this.button,this.status);}this.busy=false;};ConnectWidget.prototype.connectDoneHandler=function(c){var b=c.getPayload();if(!b||!b.feedback)return;this.status=$N('span',{className:'connect_span'},HTML(b.feedback));var d=$N('a',{className:'undo'},"\u041e\u0442\u043c\u0435\u043d\u0438\u0442\u044c");Event.listen(d,'click',function(e){e.kill();this.disconnect();}.bind(this));DOM.appendContent(this.status,d);animation(this.status).from('opacity',0).to('opacity',1).go();DOM.insertAfter(this.button,this.status);CSS.hide(this.button);if(this.new_fan!=null&&b.connect_fan_div){var a=$N('div',{},HTML(b.connect_fan_div));DOM.setConte nt(this.new_fan,DOM.find(a,'a'));}this.showNewFan();this.busy=false;};ConnectWidget.prototype.showNewFan=function(){this.fan_shown.forEach(function(b){if(!CSS.hasClass(b,'hidden_elem'))return;var a=CSS.getStyle(b,'width');CSS.setStyle(b,'width',0);CSS.setStyle(b,'opacity',0);CSS.show(b);animation(b).to('width',a).duration(100).checkpoint().to('opacity',1).duration(400).go();});this.fan_hidden.forEach(function(a){CSS.hide(a);});};ConnectWidget.prototype.connectUndoneHandler=function(b){var a=b.getPayload();DOM.remove(this.status);animation(this.button).from('opacity',0).to('opacity',1).go();CSS.show(this.button);this.hideNewFan();this.busy=false;};ConnectWidget.prototype.hideNewFan=function(){this.fan_shown.forEach(function(a){if(CSS.hasClass(a,'hidden_elem'))return;animation(a).to('opacity',0).duration(100).checkpoint(.25).to('width',0).duration(100).ondone(function(){CSS.setStyle(a,'width',null);CSS.hide(a);this.fan_hidden.forEach(function(b){CSS.show(b);});}.bind(this)).go();}.bind(this));};ConnectWidget.l oadStream=function(c,a,b){new AsyncRequest().setMethod('GET').setURI('/ajax/connect/connect_widget.php').setData({id:c,uniqid:a,force_wall:b}).setReadOnly(true).setErrorHandler(bagofholding).send();};ConnectWidget.loggedIn=function(c,a){if(ge('post_form_id')){DOM.replace($('post_form_id'),HTML(a));}else DOM.appendContent(DOM.find(document,'body'),HTML(a));for(var b in ConnectWidget.instances){ConnectWidget.instances[b].setLoggedIn(c);ConnectWidget.instances[b].connect();}};ConnectWidget.setIsConnect=function(a){ConnectWidget.is_connect=a;}; var ExternalPageLikeWidget=function(a){a.edgeType='like';this.parent.construct(this,a);this.unactionLink=DOM.scry(this.widget,'span.unlike_link')[0];if(this.unactionLink)Event.listen(this.unactionLink,'click',this.connectToNodeOnClick.bind(this));this.hasShowedInsights=false;this.showInsights();};Class.extend(ExternalPageLikeWidget,'ExternalNodeConnectWidget');ExternalPageLikeWidget.LIKE_EDGE_TYPE=0;ExternalPageLikeWidget.RECOMMEND_EDGE_TYPE=1;copy_properties(ExternalPageLikeWidget.prototype,{getSyncEndpointName:function(){var a=this.connectText?this.connectText:'like';if(a==ExternalPageLikeWidget.RECOMMEND_EDGE_TYPE)a='like';return 'platform/'+a+'/sync';},getConnectionEndpointName:function(){return 'platform/like/connection';},getPluginName:function(){return 'like';},presentInsightsPage:function(){var a;a='/insights/?inline_link=true&sk=';if(this.pageId){a+='po_'+this.pageId;}else a+='lo_'+this.domainId;window.open(a,'_blank');},showInsights:function(){if(this.hasShowedInsights||(!this.pageId&&!this.domainI d))return;var b=DOM.scry(this.widget,'a.connect_widget_insights_link');if(b)for(var a=0;a