function initTopicWidget(){$(document).on("click",".secondReplyButton > .topic-reply",function(){WidgetsManager.SavedOpinion=this;CommonManager.ShowJoinTolunaModal();topicWidgetsManager.SecondReplyClicked($(this).parent()[0])})}function FacebookTwitterInfographicsGA(){var n=$("#pollPageSharingFB"),t=$("#pollPageSharingTwitter"),i=$("div.infographicsbtn");if(n.length>0)n.on("click",function(){GoogleAnalyticsManager.GaEvent("FacebookShare","Click")});if(t.length>0)t.on("click",function(){GoogleAnalyticsManager.GaEvent("TwitterShare","Click")});i.length>0&&GoogleAnalyticsManager.GaEvent("Infographics_Poll","Impression")}function WidgetScripts(n,t){function it(){function n(n){m_EmbedManager=EmbedManager;var t=$('input[name="WidgetAccessLevel"]',n).val();if(t=="Followers"){CommonManager.ShowGeneralMessage(_NG_Embed_PrivateContent);return}EmbedManager.ShowEmbedPopup(n)}CommonManager.doCufon();et();k();$(".WidgetContainerSpan .vote .AnswerImg ,.WidgetContainerSpan .vote .playVideoOverlay, .WidgetContainerSpan .vote .pollResAnswerImg").live("click",function(){return p($(this),!1)});$(".pollCbContainer, .answerBodyHolder").live("click",function(){var n=$(this).closest("table").find("input[type=checkbox]");WidgetsManager.PollAnsweredClicked(n)});$(".closeWidgetContainer .closeoptionLength li:not('.first')").click(function(){$(".closeoptionLength li").removeClass("On");$(this).addClass("On");var n=$(this).attr("id"),t=$(this).closest(".WidgetContainerSpan"),i=t.find(".WidgetContentIdHidden").val();CommonManager.PerformAjaxCall(__ChangeWidgetExpirationUrl,{i_ContentId:i,i_HowManyMonths:n},function(){})});$(document).on("click",".infographics_line .plus, .socialRuler .plus",function(){var t=$(this).closest(".WidgetContainerSpan");n(t)});$(".s_follow_icons .plus").hover(function(){var n=$(this).closest(".s_follow_icons");$(".embedtooltip",n).fadeIn("slow")},function(){var n=$(this).closest(".s_follow_icons");$(".embedtooltip",n).fadeOut("slow")});$(".s_follow_icons .plus").live("click",function(){var t=$(".youpage");n(t)});$(".closeWidgetContainer .changePrivacy").click(function(n){var t=$(this).find("input").val(),i=$(this).closest(".WidgetContainerSpan"),r=i.find(".WidgetContentIdHidden")[0].value;CommonManager.PerformAjaxCall(__ChangeWidgetAccessLevelUrl,{i_ContentId:r,i_Privacy:t},function(r){r.success=="true"&&($(".closeWidgetContainer .changePrivacy").show(),$(n.currentTarget).hide(),$('input[name="WidgetAccessLevel"]',i).val(t==="0"?"Public":t==="1"?"Private":"Followers"))})});$(".s_follow_icons .facebook").click(function(){$(this).hasClass("on")||$(".facebook").toggleClass("on")});$(".s_follow_icons .twitter").click(function(){$(this).hasClass("on")||$(".twitter").toggleClass("on")});e();a();w();$(".ignoreWidgetBtn").live("click",function(){var n=$(this),t=n.find(".contentIdHidden").val();WidgetsManager.IgnoreWidget(t,function(){var t=n.closest(".WidgetContainerSpan");t.next().hasClass("ModeratorPanelContainer")&&t.next().remove();t.next().hasClass("widgetsSeperatorLine")&&t.next().remove();t.hide()})});u();verticalAlign();$("i.social-place-dots").live("click",function(){$(this).toggleClass("focused");$(this).closest("div.vote-icons-container").find(".social-ruler-popup").toggle()});$("i.downvote").live("click",function(){var t,n,i;$(this).hasClass("selected")?$(this).removeClass("selected"):(t=$(this).parent().find("i.upvote").hasClass("selected"),$(this).parent().find("i").removeClass("selected"),$(this).addClass("selected"),t&&(n=$(this).parent().find("label"),i=parseInt(n.text()),n.text(i-1)))});$("i.upvote").live("click",function(){var n=$(this).parent().find("label"),t=parseInt(n.text());$(this).hasClass("selected")?($(this).removeClass("selected"),n.text(t-1)):($(this).parent().find("i").removeClass("selected"),$(this).addClass("selected"),n.text(t+1))});$(".bigpicWrapper.image .bigPicFrame, table.vote td.answer-media, .answerImageContainer").live("mouseenter",function(){var n=$(this);setTimeout(function(){n.find(".zoom-wrapper").fadeIn("200",null)},10)});$(".bigpicWrapper.image .bigPicFrame, table.vote td.answer-media, .answerImageContainer").live("mouseleave",function(){$(this).find(".zoom-wrapper").fadeOut("200",null)});$("div.icon-wrapper").live("click",function(){var n=$("#widgetImageZoomPopup");n.find("img").attr("src",$(this).parent().attr("original-src"));n.show();$("body").css("overflow","hidden")});$("#widgetImageZoomPopup").on("click",function(){$(this).hide();$(this).find("img").attr("src","");$("body").css("overflow","auto")});$("#widgetImageZoomPopup img").on("click",function(n){n.stopPropagation()})}function e(){if($(".ModeratorPanelContainer").length){$(".ModeratorPanelContainer .ModeratorIconsContainer .icon").unbind("click",null).on("click",rt);$(".ModeratorSubCatContainer .submit").unbind("click",null).on("click",i);$(".ModeratorReasonContainer .submit").unbind("click",null).on("click",i);$(".ModeratorAddToPopularContainer .submit").unbind("click",null).on("click",i);$(".ModeratorRankUpContainer .submit").unbind("click",null).on("click",$.throttle(500,i));$(".ModeratorPanelContainer").unbind("focus",null).on("focus",".addCommentTextBox",function(){$(this).val()==$(this).attr("data-value")&&$(this).val("")});$(".ModeratorPanelContainer").unbind("click",blur).on("blur",".addCommentTextBox",function(){$(this).val()==""&&$(this).val($(this).attr("data-value"))});CommonManager.setDefaultTextForElement($(".ModeratorReasonContainer .addCommentTextBox"),___ModeratorAddCommentText)}}function i(n,t){var e,r;t||(t=$(this));var f=t,i=f.closest(".ModeratorPanelContainer"),o=$(".ContentId",i).val(),u=$("input",f).val();u||(u=$(".icon.this",i).find("input").val());e=$(".reasonSelect",i).val();$(".reasonSelect",i).val($(".reasonSelect option:first",i).val());r=$(".addCommentTextBox",i).val();r==___ModeratorAddCommentText&&(r="");$(".addCommentTextBox",i).val(___ModeratorAddCommentText);var s=$(".subCatSelect option:selected",i).val(),h=$(".levelSelect").length>0?$(".levelSelect option:selected",i).val():0,l=$(".rankupSelect").length>0&&$(".rankupSelect").is(":visible")?$(".rankupSelect option:selected",i).val():0;$(".subCatSelect",i).val($(".subCatSelect option:first",i).val());CommonManager.PerformAjaxCall(__ModeratorAction,{i_ContentId:o,i_ModeratorActivity:u,i_Reason:e,i_Comment:r,i_Cat:s,level:h,rankUpPoints:l},function(n){n.Status==="error"&&CommonManager.ShowGeneralMessage(n.Message,null,null,null);$(".ModeratorContainer",i).hide();c.removeClass("this").addClass("On")},function(){})}function rt(){var n=$(this),t=n.closest(".ModeratorPanelContainer");if(!n.hasClass("On")){if(n.hasClass("this")){n.removeClass("this");$(".ModeratorReasonContainer",t).hide();$(".ModeratorSubCatContainer",t).hide();return}if($(".ModeratorPanelContainer .ModeratorIconsContainer .icon").removeClass("this"),n.addClass("this"),c=n,$(".ModeratorContainer",t).hide(),n.hasClass("reason")){$(".ModeratorReasonContainer",t).show();return}if(n.hasClass("subcat")){$(".ModeratorSubCatContainer",t).show();return}if(n.hasClass("popular")){$(".ModeratorAddToPopularContainer",t).show();return}if(n.hasClass("rankup")){$(".ModeratorRankUpContainer",t).show();return}i(null,n)}}function l(n){var t=$(n[0]).find(".upvotes-container").first();if(t.length){var r=$($(n).find("input:hidden[name=widgetContentIdHidden]")).val(),i=r.substring(1,r.length-1),e=function(){$(t.parents(".WidgetContainerSpan").find(".facebook")).click()},o=function(){$(t.parents(".WidgetContainerSpan").find(".twitter")).click()},s=function(){var n=$(t.parents(".WidgetContainerSpan").find(".likeIcon")).attr("data-currContentId");WidgetsManager.ToggleFollower(this,n);$(".s_follow_icons .saved").toggleClass("on")},h=function(){$(t.parents(".WidgetContainerSpan").find(".plus")).click()},c=function(){window.open($(t.parents(".WidgetContainerSpan").find(".abusive")).attr("href"),"_blank")},l=$(t.parents(".WidgetContainerSpan").find(".likeIcon")).attr("data-isFavorite")==="True",a=$(t.parents(".WidgetContainerSpan").find(".facebook")).length>0,v=$(t.parents(".WidgetContainerSpan").find(".twitter")).length>0,u=$(t.parents(".WidgetContainerSpan").find(".showSocialIcons")),y=u?u.val()==="True":v&&a;var p=function(n){var t={contentId:i,vote:n};window.reactApp.services.resource.put("/Voting/UpdateVote",null,t)},w=function(){CommonManager.ShowSignInModal()},d=$(t.parents(".WidgetContainerSpan").find(".plus")).length<=0,b="contentLink"+$(t.parents(".WidgetContainerSpan").find(".copy-to-clipboard")).attr("data-currContentId"),k={downvoteText:_NG_Voting_Downvote,upvoteText:_NG_Voting_Upvote,facbookToolTip:_NG_Wizard_Facebook,twitterToolTip:_NG_Wizard_Twitter,likeToolTip:_NG_SocialRuler_AddtoFavorite,addedLabel:_NG_SocialRuler_AddedToFavorites,copyToolTip:_NG_Voting_CopyToClipboard,embedToolTip:_NG_Voting_Embed,reportToolTip:_NG_Widgets_ReportBtn,confirmMessage:_NG_Voting_VoteSubmitted,thanksText:_NG_SocialRuler_Thanks,shareLabel:_NG_SocialRuler_Share},f=[];f.push(i);window.reactApp.services.resource.post("/Voting/GetVoting",f).then(function(n){var r=n.data[i].Up,u=n.data[i].CurrentUserVoting,f={onVoteUpdate:___IsGuest?w:p,hideEmbed:!0,upVotes:r,currentUserVoting:u,translations:k,onFacebookClick:e,onTwitterClick:o,onLikeClick:s,onEmbedClick:h,onReportClick:c,isLiked:l,showSocialIcons:y,textToCopy:CommonManager.copyToClipboardTextFromField(b),isGuest:___IsGuest};window.reactApp.uiModels.sharingBar(t[0],f)})}}function ut(n,t){var i=$(t).height(),r,f;i==0&&(i=$(t[0].children[0]).innerHeight());r=___IsProduction==!0?580:200;f=n.innerHeight();f>i?(n.css("height",$(n).height()+"px"),n.html(t.find(".WidgetContainerSpan").html()),o(n),$(n).waitForImages(function(){n.find(".autoResize").autoResize();CommonManager.GeneralRoundAsync();verticalAlign();u();$(n).offset().top+$(n).height()>$(window).height()+$(window).scrollTop()&&scrollBodyToElementBottom(n);n.animate({height:i},r,function(){n.css("height","auto")})})):(n.html(t.find(".WidgetContainerSpan").html()),o(n),$(n).waitForImages(function(){var i=n.outerHeight(),t;n.css("height","auto");t=n.outerHeight();n.css("height",i+"px");n.find(".autoResize").autoResize();n.animate({height:t},r,function(){CommonManager.GeneralRoundAsync();n.css("height","auto");verticalAlign();u();$(n).offset().top+$(n).height()>$(window).height()+$(window).scrollTop()&&scrollBodyToElementBottom(n)})}));e();a();w();typeof afterReplaceContent!="undefined"&&afterReplaceContent!=null&&afterReplaceContent();ft(n);k();l(n)}function ft(n){if(n.find("div.infographicsbtn").length>0){var t=n.parents("div").hasClass("PollPageFlag"),i=t?"Infographics_Poll":"Infographics_Stream";GoogleAnalyticsManager.GaEvent(i,"Impression")}}function u(){$(".cropInMiddle").not(".cropped").each(function(){var n=$(this);n.waitForImages(function(){var n=$(this),t=n.parent();n.width()>t.width()&&(n.is(".right")?n.css({position:"relative",right:(n.width()-t.width())/2+"px"}):n.css({position:"relative",left:(n.width()-t.width())/2+"px"}),n.addClass("cropped"))})})}function a(){setTimeout(function(){$(".AnswerImg").each(function(){var n=$(this).height(),t=$(this).closest(".vote").height();$(this).css("top",Math.abs((t-n)/2)+"px")})},300)}function f(n,t){if(t=$(t).closest(".WidgetContainerSpan"),n!=null){$("<div class='tmpContainer' style='display:none'>").append(n).appendTo($(t));var i=t.find(".tmpContainer");$(i).waitForImages(function(){ut(t,i)})}}function et(){$(".pollAnswerCB").uniform({checkboxClass:"checker"});$(".pollAnswerCBSingle").uniform({checkboxClass:"checkerSingle"});$(".opinionSharingChck").uniform({checkboxClass:"opionionWidgetChecker"});$(".poll_vote .pollAnswerCB").click(v);$(".poll_vote .pollAnswerCBSingle").click(v);$(".poll_vote .checker").click(function(n){h(this);stopBubble(n)})}function v(){var n=$(this).attr("checked");n=="checked"?$(this).removeAttr("checked"):$(this).attr("checked","checked");$.uniform.update()}function o(n){$(n).find(".pollAnswerCB").uniform({checkboxClass:"checker"}).unbind("click").click(y);$(n).find(".pollAnswerCBSingle").uniform({checkboxClass:"checkerSingle"}).unbind("click").click(y);$(n).find(".opinionSharingChck").uniform({checkboxClass:"opionionWidgetChecker"});$(n).find(".checker").unbind("click").click(function(n){h(this);stopBubble(n)})}function y(){var n=$(this).attr("checked");n=="checked"?$(this).removeAttr("checked"):$(this).attr("checked","checked");$.uniform.update()}function s(n,t,i,r,u){var e=$(n).closest(".WidgetContainerSpan"),s=e.find("#widgetIdHidden").val(),o=e.find(".i_vote");o.length>0?(o.css("background-color","transparent"),$.browser.msie?(o.html("<div class='ajaxHolder'>"),CommonManager.PerformAjaxCall(t,{pollId:s,i_AllowColse:i,widgetView:WidgetsManager.CurrentWidgetView},function(n){f(n,e)})):(o.html("<div class='ajaxHolder'>"),CommonManager.PerformAjaxCall(t,{pollId:s,i_AllowColse:i,widgetView:WidgetsManager.CurrentWidgetView},function(n){f(n,e)}))):CommonManager.PerformAjaxCall(t,{pollId:s,i_AllowColse:i,widgetView:WidgetsManager.CurrentWidgetView},function(n){f(n,e)});typeof u!="undefined"&&u&&u()}function h(n){ot($(n))}function p(n,t,i){var f,r,u;if(n=$(n),!n.hasClass("AnswerImg")&&!n.hasClass("pollResAnswerImg")&&!(n.closest(".overlay").length>0))return f=t?n.parents(".resultsVoteContainer:first").find(".overlay:first").clone():n.parents(".vote:first").find(".overlay:first").clone(),r=$(".overlayWrpTemp"),r.find(".overlay").remove(),r.append(f),$("> .overlay",r).show(),u=r.data("overlay"),u?u.load():r.overlay({mask:{color:"#0A0A0A",loadSpeed:200,opacity:.3},closeOnClick:!1,load:!0,oneInstance:!1,onLoad:function(){},onBeforeClose:function(){$(".overlay object").each(function(){var n=$(this);n.is(":visible")&&n.replaceWith(n)})},onClose:function(){$("> .overlay",r).html("")}}),stopBubble(i)}function ot(n){var i=n.closest(".poll_vote"),r=n.closest(".vote"),u=r.hasClass("mutex"),t=r.find("input"),f=i.find("#mutexLock").val()=="1";f?($(i).find("input").each(function(){$(this).attr("id")!=$(t).attr("id")&&$(this).removeAttr("checked")}),$(t).attr("checked")=="checked"?$(t).removeAttr("checked"):$(t).attr("checked","checked")):(u&&$(i).find("input").removeAttr("checked"),$(t).attr("checked")=="checked"?$(t).removeAttr("checked"):$(t).attr("checked","checked"));i.find("#mutexLock").val(u?"1":"0");$.uniform.update()}function w(){setTimeout(function(){$("#ResultsView .vote").each(function(){var n=$(this).find("#answerWidth").val();try{$(this).find(".answerVotingGraph").animate({width:n+"%"},1500,null)}catch(t){$(this).find(".answerVotingGraph").css("width",n+"%")}})},900);setTimeout(function(){},1300)}function st(n,t,i,u,f,e){var h,v;if(!r){r=!0;var c=[],o=$(n).closest(".WidgetContainerSpan"),y=o.find("#widgetIdHidden").val(),a=o.find("#widgetPointsAwardHidden").length>0?parseInt(o.find("#widgetPointsAwardHidden").val()):0,l=o.find("input[type='checkbox']");if(l.length>0){for(h=0;h<l.length;h++)l[h].checked&&c.push($(l[h]).attr("id"));if(c.length==0)return i&&CommonManager.ShowGeneralMsg(_WidgetScripts_mustselectatleastoneanswer),r=!1,!1}else c.push($(n).attr("id"));v={pollId:y,answers:c};CommonManager.PerformAjaxCallSync(e?e:__addVoteUrl,v,function(i){var e,h;WidgetsManager.LasVotedWidgetContentId=o.find("#widgetIdHidden").val();i.Result!=""?(e=$(n).closest(".openPollWidget").find("#pollVoteError"),e.find(".voteErrorText").html(i.Result),e.css({right:___isRtL?e.outerWidth()/-2+$(n).outerWidth()/2:"auto",left:___isRtL?"auto":e.outerWidth()/-2+$(n).outerWidth()/2,top:-1*e.outerHeight()-5}),e.show(),typeof u!="undefined"&&u&&u()):(s(n,f,t,u),typeof CommentStreamManager!="undefined"&&CommentStreamManager?CommentStreamManager.RefreshCommentStream():typeof u!="undefined"&&u&&u(),a>0&&(h=$("#userBalance"),h.text(parseInt(h.text())+a)));r=!1})}}function b(n,t){var i=$(t).closest(".WidgetContainerSpan"),r=i.find("#widgetIdHidden").val();CommonManager.PerformAjaxCallExternal(n,{pollId:r,i_AllowColse:!1},function(n){i.fadeOut("slow",function(){i.empty().replaceWith(n);var t=$(n).find(".WidgetContainerSpan");$("div.infographics_line").remove()})})}function ht(n){if(WidgetsManager.SavedWizardObject&&WidgetsManager.SavedWizardObject.Save(function(n){WidgetsManager.LatestCreatedContentId=n},!1),WidgetsManager.SavedVote)return WidgetsManager.Vote(WidgetsManager.SavedVote,!0,!1,n),document.location.href;if(WidgetsManager.SavedOpinion)return topicWidgetsManager.addOpinion(WidgetsManager.SavedOpinion,n),document.location.href;if(WidgetsManager.SavedComment)return topicWidgetsManager.addComment(WidgetsManager.SavedComment,n),document.location.href;if(WidgetsManager.SavedWallPost)return CommonManager.PerformAjaxCall(__SaveMessageToUserWallUrl,WidgetsManager.SavedWallPost,null),document.location.href;n!=undefined&&n!=null&&n()}function k(){var n=$("table.pollResultsWidgetAnswerText.hasTooltip");n.off("mouseover",d).on("mouseover",d);n.off("mouseout",g).on("mouseout",g)}function d(){$(this).closest(".resultsVoteContainer").find(".resultsTooltip").show()}function g(){$(this).closest(".resultsVoteContainer").find(".resultsTooltip").hide()}var nt=n,tt=t,c,r;it();this.InitModeratorPanel=function(){e()};this.CloseWidget=function(n){CommonManager.PerformAjaxCall(tt,{i_ContentId:n},function(){location.reload(!0)})};this.FinishedGettingWidget=function(n,t){return f(n,t)};this.HoverOverFollowerIcon=function(n){var t=$("#customTooltip");t.find(".customTooltipMain").html(_NG_socialRuler_ContentHasBeenAddedToYourFavorites);var r=t.outerHeight(),i=$(n).offset(),u=$(n).parents().hasClass("infographics_line")?85:82;t.css({top:i.top-r,left:i.left-u});$(n).hasClass("on")&&t.fadeIn(500)};this.HoverOutOfFollowerIcon=function(n){if($(n).hasClass("on")){var t=$("#customTooltip");setTimeout(function(){t.fadeOut(500)},1e3)}};this.ToggleFollower=function(n,t,i){var e;CommonManager.PerformAjaxCall(nt,{i_ContentId:t},null);e=$(n);$(n).toggleClass("on");var u=i?$("#customTooltipWhite"):$("#customTooltip"),r=$("#favorites .UserInfoNumWrapperL"),f=r?parseInt(r.html()):0;$(n).hasClass("on")?($(n).attr("title",""),$(".PollPageFlag .SocialRulerAddFavorite").attr("title",""),u.find(".customTooltipMain").html(_NG_socialRuler_ContentHasBeenAddedToYourFavorites),r&&r.html(++f)):($(n).attr("title",_NG_SocialRuler_AddtoFavorite),$(".PollPageFlag .SocialRulerAddFavorite").attr("title",_NG_SocialRuler_AddtoFavorite),u.find(".customTooltipMain").html(_NG_socialRuler_ContentHasBeenRemovedFromYourFavorites),r&&r.html(--f))};this.LoadUpDownVotes=function(n){l(n)};this.CropInMiddle=function(){u()};this.InitUniformFromContainer=function(n){o(n)};this.ChangeWidgetStateMutex=function(n,t,i){s(n,t,i,null,null)};this.ChangeWidgetState=function(n,t,i){return s(n,t,i)};this.PollAnsweredClicked=function(n){h(n)};this.AnswerImgClicked=function(n,t,i){return p(n,t,i)};this.Vote=function(n,t,i,r,u,f){return st(n,t,i,r,u,f)};r=!1;this.getReduceForAnswersGraph=function(){var n=0;return $("#userContent").length!=0?n=9.7:$("#wizardPanelContainer").length!=0?n=9.6:$(".mycontentpage").length!=0?n=12.9:$(".PollPageFlag").length!=0&&(n=9.6),n};this.LasVotedWidgetContentId=null;this.ExternalVote=function(n,t,i){for(var u=[],e=$(n).closest(".WidgetContainerSpan"),s=e.find("#widgetIdHidden").val(),f=e.find("input[type='checkbox']"),o,r=0;r<f.length;r++)f[r].checked&&u.push($(f[r]).attr("id"));if(u.length==0)return CommonManager.ShowGeneralMsg(_WidgetScripts_mustselectatleastoneanswer),!1;o={pollId:s,answers:u};CommonManager.PerformAjaxCallExternalNonGeneric(o,function(){b(i,n)})};this.ClosePollAfterVote=function(n,t){return b(n,t)};this.DoActionsAfterSignInOrRegistration=function(n){return ht(n)};this.LatestCreatedContentId=null;this.SavedVote=null;this.SavedOpinion=null;this.SavedComment=null;this.SavedWizardObject=null;this.SavedWallPost=null;this.IgnoreWidget=function(n,t){CommonManager.PerformAjaxCall(__IgnoreWidgetUrl,{i_ContentId:n},t)};this.CurrentWidgetView=null;this.eWidgetRenderingView={Dashboard:0,WidgetSpecific:1,UserProfile:2,UserContent:3,SearchResults:4}}function TopicWidgetManager(n,t,i,r,u,f,e){function a(n,t,i,r){var e=$(n).find("#widgetIdHidden").val(),f=$(n).closest(".WidgetContainerSpan").find(".p_commentPlaceHolder"),s={i_StartIdx:t,i_howManyToTake:i,i_TopicId:e},u=$("<span id='newOpinionElementWrapper' />");CommonManager.PerformAjaxCall(w,s,function(t){t!=""&&(u.html(t),r?f.append(u):f.prepend(u));WidgetsManager.InitUniformFromContainer("#newOpinionElementWrapper");$("#newOpinionElementWrapper").replaceWith(u.html());var i=$(n).find(".p_comment").length;i<parseInt($(n).find("#howManyOpinions").val())?$(".see_more_Opinions").show():$(".see_more_Opinions").hide();$(".see_more_Opinions").removeAttr("href");$(".expandOpinion").removeAttr("href");WidgetsManager.InitModeratorPanel()});o=!1}function l(n){var i=$(n).find("#opinionIdHidden").val(),t=$(n).find(".CommentsPlace"),r={i_OpinionId:i},u=parseInt($(n).find("#numOfCommentsSpan .number").html());u>0&&CommonManager.PerformAjaxCall(b,r,function(n){t.fadeOut("slow",function(){t.html(n);$(".see_more_Opinions").removeAttr("href");$(".expandOpinion").removeAttr("href");t.fadeIn("slow");WidgetsManager.InitModeratorPanel()})});s=!1}function d(n){var t;switch(n){case"AlreadySubmittedOpinion":t=_NG_TopicWidgetManager_AlreadySubmittedOpinion;break;default:t=n}return t}function v(n){var t;if(n==undefined)return _NG_TopicWidgetManager_OpinionLimitError;switch(n){case"ContentLimitReachedOpinion":t=_NG_WizardManager_Sorry_You_Cannot_Create_More_Than_In;t=t.replace("{0}",__CONTENT_LIMIT_NUMBER_OF_OPINIONS);t=t.replace("{1}",_NG_TopicWidget_Opinionscount);t=t.replace("{2}",__CONTENT_LIMIT_TIME_INTERVAL);break;case"ContentLimitReachedComment":t=_NG_WizardManager_Sorry_You_Cannot_Create_More_Than_In;t=t.replace("{0}",__CONTENT_LIMIT_NUMBER_OF_COMMENTS);t=t.replace("{1}",_NG_OpinionWidget_comments);t=t.replace("{2}",__CONTENT_LIMIT_TIME_INTERVAL);break;case"UserSuspended":document.location.href=BaseUrl;break;case"18":t=_NG_TopicWidgetManager_OpinionLimitError;break;case"19":t=_NG_TopicWidgetManager_OpinionLimitError;break;case"InvalidImage":t=_NG_Dashboard_InvalidImageError;break;default:console.log();t=n}return t}function y(){var n=/people/i.test(window.location.pathname);CommonManager.showSOIuserEmailVerficationPopup(n?_NG_Dashboard_InOrderOCreateContentOnTheComm:"")}var g=f,p=e,h=u,c=r,w=n,b=t,k=i,o,s;this.init=function(){$(".newOpinionTxt").unbind();$(".newOpinionTxt").bind("focus",function(){$(this).val()==c&&$(".newOpinionTxt").val("")}).bind("blur",function(){$(this).val()||$(".newOpinionTxt").val(c)});$(".newCommentTxt").focus(function(){var n=$(this);n.val()==h&&$(this).val("")}).blur(function(){$(this).val()==""&&$(this).val(h)})};this.init();this.changeTopicStateMutex=function(n,t,i,r){___IsProduction==!0&&$(".WidgetContainerSpan .g_close").click();WidgetsManager.ChangeWidgetState(n,t,i,r)};this.changeTopicState=function(n,t,i,r){WidgetsManager.ChangeWidgetState(n,t,i,r)};this.SecondReplyClicked=function(n){var t=$(n).closest(".WidgetContainerSpan"),i=$(t).find(".opinionplace:first");t.find(".secondReplyButton").hide();t.find(".secondReplyButton span").removeClass("generalRoundNoIE7");$(t).find(".opinionplace:first").show();t.find(".newOpinionTxt").autoResize();$(".voteBtn",i).addClass("generalRoundNoIE7")};o=!1;this.addOpinion=function(n,t){var i,r;if(!o){if(o=!0,!isUserEmailVerified){y();o=!1;return}if(i=$(n).closest(".WidgetContainerSpan"),r=$(i).find(".newOpinionTxt").val(),r==c||$.trim(r)=="")return CommonManager.ShowGeneralMsg(_NG_TopicWidgetManager_PleaseEnterYourOpinion),o=!1,!1;var u=$(i).find("#fbShareChck").is(":checked"),e=$(i).find("#twitterShareChck").is(":checked"),s=$(i).find("#widgetIdHidden").val(),h=new OpinionWizardObject(u,e,s,r);if(r==c)return o=!1,!1;u&&GoogleAnalyticsManager.GaEvent("PostOpinionFbSharing","Post");e&&GoogleAnalyticsManager.GaEvent("PostOpinionTwitterSharing","Post");CommonManager.CancelOneTimeShareFbTwitter();h.Save(f,function(n){var r,e,s,u,f,h;n.res==""||n.res=="last"?(r=n.facebookShareUrl,n=n.res,n==""&&(i.find(".secondReplyButton").show(),i.find(".secondReplyButton span").addClass("generalRoundNoIE7")),$(i).find(".newOpinionTxt").css("height","30px"),e=parseInt($(i).find("#howManyOpinions").val()),$(i).find("#howManyOpinions").val(e+1),s=$(i).find(".p_commentPlaceHolder").children(".p_comment").length+1,u=$(i).find("#howManyToDisplay").val(),s+1>u&&$($(i).find(".p_commentPlaceHolder").children(".p_comment")[u-1]).remove(),a(i,null,1),f=$(i).find(".opinionplace:first"),$(".voteBtn",f).removeClass("generalRoundNoIE7"),f.hide(),WidgetsManager.LasVotedWidgetContentId=i.find("#widgetIdHidden").val(),r!=null&&r!=""&&CommonManager.fbPopUpShare(r)):(o=!1,h=v(n.errorResult),CommonManager.ShowGeneralMsg(h));$(i).find(".newOpinionTxt").val(c);typeof t!="undefined"&&t&&t()})}};this.moreOpinionsFromTopicClicked=function(n){var t=$(n).closest(".WidgetContainerSpan"),i=$(t).find("#howManyToDisplay").val(),r=$(t).find(".p_comment").last().find("#opinionIdHidden").val();a(t,r,i,!0)};this.seeMoreCommentsClicked=function(n){var t=$(n).closest(".p_comment"),i=$(t).find("#howManyToDisplay").val();i+=i;$(t).find("#howManyToDisplay").val(i);l(t)};s=!1;this.addComment=function(n,t){var e;if(!s){if(s=!0,!isUserEmailVerified){y();s=!1;return}var i=$(n).closest(".p_comment"),u=$(i).find("#fbShareChck").is(":checked"),f=$(i).find("#twitterShareChck").is(":checked"),r=$(i).find(".newCommentTxt").val(),o=$(i).find("#opinionIdHidden").val();if(r==h||$.trim(r)=="")return s=!1,!1;u&&GoogleAnalyticsManager.GaEvent("PostCommentFbSharing","Post");f&&GoogleAnalyticsManager.GaEvent("PostCommentTwitterSharing","Post");e=new commentWizardObject(u,f,o,r);CommonManager.CancelOneTimeShareFbTwitter();e.Save(p,function(r){var f,u,e;r.res==""?(f=parseInt($(i).find("#numOfCommentsSpan .number").html()),$(i).find("#numOfCommentsSpan .number").html(f+1),l(i),$(n).closest(".p_comment").find(".opinionplace").hide("slow"),u=$(i).find(".newCommentTxt").data("AutoResizer"),u&&u.check(),WidgetsManager.LasVotedWidgetContentId=i.find("#opinionIdHidden").val()):(s=!1,e=v(r.errorResult),CommonManager.ShowGeneralMsg(e));$(i).find(".newCommentTxt").val(h);$(i).find(".newCommentTxt").css("height","30px");typeof t!="undefined"&&t&&t()})}};this.showComments=function(n){var t=$(n).closest(".p_comment"),i=$(t).find(".CommentsPlace"),r=$.trim(i.html());r!=""?(i.html(""),$(n).find("#numOfCommentsSpan").show()):l(t)};this.hideComments=function(n){var t=$(n).closest(".p_comment");$(t).find(".CommentsPlace").html("")};this.showAddComment=function(n){var t=$(n).closest(".p_comment");$(t).find(".opinionplace").show("slow",function(){setTimeout(function(){$(this).find(".autoResize").autoResize();WidgetsManager.InitUniformFromContainer($(t))},500)})};this.hideAddComment=function(n){var t=$(n).closest(".p_comment");t.find(".autoResize").css("height","auto");t.find(".newCommentTxt ").val(h);$(t).find(".opinionplace").hide("slow");$(t).find(".CommentsPlace").html("")};this.VoteUsefull=function(n,t,i){var r={i_OpinionId:t,i_Usefull:i};CommonManager.PerformAjaxCall(k,r,function(t){var i,r;t==""?($(n).hasClass("up")?(i=$(n).closest(".likesbuttons").find(".likesCount"),i.html(parseInt(i.html())+1),$(n).removeClass("up").addClass("upVoted")):(r=$(n).closest(".likesbuttons").find(".disLikesCount"),r.html(parseInt(r.html())+1),$(n).removeClass("down").addClass("downVoted")),$("a[name="+$(n).attr("name")+"]").attr("onclick","").unbind("click").addClass("disableClick")):CommonManager.ShowGeneralMsg(d(t))})}}function WizardObject(n,t,i,r,u,f,e){if(n==null||t==null)throw"object parent initialized badly";this.FacebookShare=n;this.TwitterShare=t;this.MainCategory=i;this.Title=r;this.TitleMediaType=u;this.TitleMediaLocation=f;this.AccessLevel=e;this.Save=function(){throw"Not Implemented";};this.SavingMessage=function(){throw"Not implemented";}}function commentWizardObject(n,t,i,r){this.ParentOpinionId=i;this.OpinionText=r;this.inheritFrom=WizardObject;this.inheritFrom(n,t,-1,null,null,null);this.Save=function(n,t){var i=JSON.stringify(this);CommonManager.PerformAjaxCall(n,{opinionWizardJson:i},t)}}function OpinionWizardObject(n,t,i,r){this.ParentTopicId=i;this.OpinionText=r;this.inheritFrom=WizardObject;this.inheritFrom(n,t,-1,null,null,null);this.Title=this.OpinionText;this.Save=function(n,t){var i=JSON.stringify(this);if(this.OpinionText.length>___MaxOpinionSize)return CommonManager.ShowGeneralMsg(_NG_OpinionWizard_OpinionTextShouldBeCharsLongMax.replace("{0}",___MaxOpinionSize)),!1;CommonManager.PerformAjaxCall(n,{opinionWizardJson:i},t)}}function PollAnswer(n,t,i,r,u){this.MediaType=t;this.ContentLocation=i;this.AnswerText=r;this.Id=n;this.IsNsp=u}function BattleWizardObject(n,t,i,r,u,f,e){this.inheritFrom=PollWizardObject;this.inheritFrom(n,t,i,r,u,f,e);this.Save=function(n,t,u){if(r.length>=___MaxPollTitleSize)return CommonManager.ShowGeneralMsg(_topicWizardManager_Msg+" "+___MaxPollTitleSize),!1;if(this.Answers.length<2||this.Answers[0].ContentLocation==""||this.Answers[1].ContentLocation=="")return CommonManager.ShowGeneralMsg(_NG_BattleWIdget_BattlesMustContainTwoImagesOrVideos),!1;if(this.Answers[0].ContentLocation==this.Answers[1].ContentLocation)return CommonManager.ShowGeneralMsg(_NG_BattleWizard_PleaseSelectDifferentContentForEachAnswer),!1;if(i==null)return CommonManager.ShowGeneralMsg(_WizardManager_MustSelectaCategory),!1;var f=JSON.stringify(this);return t?CommonManager.PerformAjaxCall(__saveBattleUrl,{battleWizardJson:f},n,u):CommonManager.PerformAjaxCallSync(__saveBattleUrl,{battleWizardJson:f},n,u),!0};this.SavingMessage=function(){return _NG_Wizard_CreatingCreatingBattle}}function ThumbsWizardObject(n,t,i,r,u,f,e){this.inheritFrom=PollWizardObject;this.inheritFrom(n,t,i,r,u,f,e);this.Save=function(n,t,u){if(r.length>=___MaxPollTitleSize)return CommonManager.ShowGeneralMsg(_topicWizardManager_Msg+" "+___MaxPollTitleSize),!1;if(f===null||f==="")return CommonManager.ShowGeneralMsg(_NG_Wizard_PleaseAttachImage),!1;if(i==null)return CommonManager.ShowGeneralMsg(_WizardManager_MustSelectaCategory),!1;var e=JSON.stringify(this);return t?CommonManager.PerformAjaxCall(__saveThumbsUrl,{thumbsWizardJson:e},n,u):CommonManager.PerformAjaxCallSync(__saveThumbsUrl,{thumbsWizardJson:e},n,u),!0};this.SavingMessage=function(){return _NG_Wizard_CreatingThumbs}}function PollWizardObject(n,t,i,r,u,f,e){this.Answers=[];this.IsSponsored=!1;this.HowManyMonths=3;this.IsRandomized=!1;this.PollChoiceType=ePollType.Single;this.inheritFrom=WizardObject;this.inheritFrom(n,t,i,r,u,f,e);this.Save=function(n,t,u){var s=JSON.stringify(this),f,o,e,h;if(r.length>=___MaxPollTitleSize)return CommonManager.ShowGeneralMsg(_topicWizardManager_Msg+" "+___MaxPollTitleSize),!1;if(this.Answers.length<___MinAnswersForPoll||this.Answers.length>___MaxAnswersForPoll&&!___CurrUserIsPanelist)return CommonManager.ShowGeneralMsg(_NG_Wizard_APollMustHaveBetweenAndValidAnswers.replace("{0}",___MinAnswersForPoll).replace("{1}",___MaxAnswersForPoll)),!1;for(f=0;f<this.Answers.length;f++){if(o=this.Answers[f],o.AnswerText.length>___MaxPollAnswerSize)return CommonManager.ShowGeneralMsg(_NG_PollWizard_AnswerLengthShouldBeCharsMax.replace("{0}",___MaxPollAnswerSize)),!1;for(e=0;e<this.Answers.length;e++)if(h=this.Answers[e],h.AnswerText==o.AnswerText&&f!=e)return CommonManager.ShowGeneralMsg(_NG_PollWizard_AnswersAndAreIdentical.replace("{0}",parseInt(f)+1).replace("{1}",parseInt(e)+1)),!1}return i==null?(CommonManager.ShowGeneralMsg(_WizardManager_MustSelectaCategory),!1):(t?CommonManager.PerformAjaxCall(__savePollUrl,{pollWizardJson:s},n,u):CommonManager.PerformAjaxCallSync(__savePollUrl,{pollWizardJson:s},n,u),!0)};this.SavingMessage=function(){return _NG_Wizard_CreatingPoll}}function TopicWizardObject(n,t,i,r,u,f,e){this.Body="";this.TestProductID=null;this.HowManyMonths=3;this.inheritFrom=WizardObject;this.inheritFrom(n,t,i,r,u,f,e);this.Save=function(n,t,u){var f=JSON.stringify(this);return r.length>=___MaxTopicTitleSize?(CommonManager.ShowGeneralMsg(_topicWizardManager_Msg+" "+___MaxTopicTitleSize),!1):this.Body.length>=___MaxTopicBodySize?(CommonManager.ShowGeneralMsg(_NG_TopicWizard_ThisTopicsBodyShouldBeCharMax.replace("{0}",___MaxTopicBodySize)),!1):i==null?(CommonManager.ShowGeneralMsg(_WizardManager_MustSelectaCategory),!1):(t?CommonManager.PerformAjaxCall(__saveTopicUrl,{topicWizardJson:f},n,u):CommonManager.PerformAjaxCallSync(__saveTopicUrl,{topicWizardJson:f},n,u),!0)};this.SavingMessage=function(){return _NG_Wizard_CreatingTopic}}var relatedContentSearchQuery,currentContentId,relatedContentSearchViewModel,RelatedContentSearchViewModel,ZeroClipboard,ContentAccessLevel,FinalizeRegistrationPopup;$(document).ready(function(){function i(t){$("#followContentHolder").fadeOut("slow",function(){$("#followContentHolder").html(t);$("#followContentHolder").fadeIn("slow");n=!0})}function t(){CommonManager.GetFollowersForContent($(".btn-follow-content").attr("contentId"),i)}FacebookTwitterInfographicsGA();initTopicWidget();$(".opinionplace textarea").live("focus",function(){$(".PollPageFlag .opinionplace").addClass("blueInputHolder")});$(".opinionplace textarea").live("blur",function(){$(".PollPageFlag .opinionplace").removeClass("blueInputHolder")});WidgetsManager.LoadUpDownVotes($(".WidgetContainerSpan"));var n=!0;$(".btn-follow-content").live("click",function(){if(!n)return!1;n=!1;var i=$(this).attr("targetItemId"),r=$(this).attr("widgetType");return $(this).hasClass("follow-content")?(CommonManager.Follow(i,r,t),$(this).removeClass("follow-content").addClass("unfollow-content")):(CommonManager.UnFollow(i,r,t),$(this).removeClass("unfollow-content").addClass("follow-content")),!1});$("#regStripSignIn").on("click",function(){CommonManager.ShowSignInModal()})});RelatedContentSearchViewModel=function(){function r(){var r={cultureId:TOLUNA_SESSION_CULTURE,query:relatedContentSearchQuery,offset:0,limit:i,isFullDataQuery:!1};CommonManager.PerformAjaxCall(t,r,function(t){var i=t.items,r;for(r in i)i[r].username!=null&&currentContentId!=i[r].contentId.Value&&n.RelatedContentResults.push({Title:u(i[r].title),Link:"/"+i[r].link,WidgetType:i[r].widgetType,Category:i[r].category,ContentIconClass:"contentIcon"+i[r].widgetType,Username:f(i[r].username),UserProfileUrl:"/people/"+i[r].username,UserPic:i[r].userpic,IsClosed:i[r].isClosed})})}function u(n){return n.length>40?n.substr(0,40)+"...":n}function f(n){return n==null?"":n.length>18?n.substr(0,18):n}var t="/search/content",i=2,n=this;n.RelatedContentResults=ko.observableArray([]);n.WidgetIconClass=function(n){switch(n){case eWidgetType.Poll:return"icon_poll_grey";case eWidgetType.Battle:return"icon_battle_grey";case eWidgetType.Thumbs:return"icon_thumb_grey";case eWidgetType.Topic:return"icon_topic_grey";default:return"icon_poll_grey"}};r()};$(document).ready(function(){relatedContentSearchViewModel=new RelatedContentSearchViewModel;ko.applyBindings(relatedContentSearchViewModel,$("#relatedContentContainer")[0])});ko.bindingHandlers.textWithHTMLEntities={update:function(n,t){var i=t(),r=$("<textarea/>").html(ko.unwrap(i)).text();$(n).text(r)}},function(n){n.fn.zclip=function(t){if(typeof t!="object"||t.length){if(typeof t=="string")return this.each(function(){var r=n(this),u,i;t=t.toLowerCase();u=r.data("zclipId");i=n("#"+u+".zclip");t=="remove"?(i.remove(),r.removeClass("active hover")):t=="hide"?(i.hide(),r.removeClass("active hover")):t=="show"&&i.show()})}else{var i=n.extend({path:"ZeroClipboard.swf",copy:null,beforeCopy:null,afterCopy:null,clickAfter:!0,setHandCursor:!0,setCSSEffects:!0},t);return this.each(function(){var t=n(this),r;t.is(":visible")&&(typeof i.copy=="string"||n.isFunction(i.copy))&&(ZeroClipboard.setMoviePath(i.path),r=new ZeroClipboard.Client,n.isFunction(i.copy)&&t.bind("zClip_copy",i.copy),n.isFunction(i.beforeCopy)&&t.bind("zClip_beforeCopy",i.beforeCopy),n.isFunction(i.afterCopy)&&t.bind("zClip_afterCopy",i.afterCopy),r.setHandCursor(i.setHandCursor),r.setCSSEffects(i.setCSSEffects),r.addEventListener("mouseOver",function(){t.trigger("mouseenter")}),r.addEventListener("mouseOut",function(){t.trigger("mouseleave")}),r.addEventListener("mouseDown",function(){t.trigger("mousedown");n.isFunction(i.copy)?r.setText(t.triggerHandler("zClip_copy")):r.setText(i.copy);n.isFunction(i.beforeCopy)&&t.trigger("zClip_beforeCopy")}),r.addEventListener("complete",function(r,u){n.isFunction(i.afterCopy)?t.trigger("zClip_afterCopy"):(u.length>500&&(u=u.substr(0,500)+"...\n\n("+(u.length-500)+" characters not shown)"),t.removeClass("hover"),alert("Copied text to clipboard:\n\n "+u));i.clickAfter&&t.trigger("click")}),r.glue(t[0],t.parent()[0]),n(window).bind("load resize",function(){r.reposition()}))})}}}(jQuery);ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,$:function(n){return typeof n=="string"&&(n=document.getElementById(n)),n.addClass||(n.hide=function(){this.style.display="none"},n.show=function(){this.style.display=""},n.addClass=function(n){this.removeClass(n);this.className+=" "+n},n.removeClass=function(n){for(var i=this.className.split(/\s+/),r=-1,t=0;t<i.length;t++)i[t]==n&&(r=t,t=i.length);return r>-1&&(i.splice(r,1),this.className=i.join(" ")),this},n.hasClass=function(n){return!!this.className.match(new RegExp("\\s*"+n+"\\s*"))}),n},setMoviePath:function(n){this.moviePath=n},dispatch:function(n,t,i){var r=this.clients[n];r&&r.receiveEvent(t,i)},register:function(n,t){this.clients[n]=t},getDOMObjectPosition:function(n,t){var i={left:0,top:0,width:n.width?n.width:n.offsetWidth,height:n.height?n.height:n.offsetHeight};return n&&n!=t&&(i.left+=n.offsetLeft,i.top+=n.offsetTop),i},Client:function(n){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);n&&this.glue(n)}};ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",handCursorEnabled:!0,cssEffects:!0,handlers:null,glue:function(n,t,i){var f,u,r;if(this.domElement=ZeroClipboard.$(n),f=99,this.domElement.style.zIndex&&(f=parseInt(this.domElement.style.zIndex,10)+1),typeof t=="string"?t=ZeroClipboard.$(t):typeof t=="undefined"&&(t=document.getElementsByTagName("body")[0]),u=ZeroClipboard.getDOMObjectPosition(this.domElement,t),this.div=document.createElement("div"),this.div.className="zclip",this.div.id="zclip-"+this.movieId,$(this.domElement).data("zclipId","zclip-"+this.movieId),r=this.div.style,r.position="absolute",r.left=""+u.left+"px",r.top=""+u.top+"px",r.width=""+u.width+"px",r.height=""+u.height+"px",r.zIndex=f,typeof i=="object")for(addedStyle in i)r[addedStyle]=i[addedStyle];t.appendChild(this.div);this.div.innerHTML=this.getHTML(u.width,u.height)},getHTML:function(n,t){var i="",r="id="+this.id+"&width="+n+"&height="+t,u;return navigator.userAgent.match(/MSIE/)?(u=location.href.match(/^https/i)?"https://":"http://",i+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+u+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+n+'" height="'+t+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+r+'"/><param name="wmode" value="transparent"/><\/object>'):i+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+n+'" height="'+t+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+r+'" wmode="transparent" />',i},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide();this.div.innerHTML="";var n=document.getElementsByTagName("body")[0];try{n.removeChild(this.div)}catch(t){}this.domElement=null;this.div=null}},reposition:function(n){if(n&&(this.domElement=ZeroClipboard.$(n),this.domElement||this.hide()),this.domElement&&this.div){var t=ZeroClipboard.getDOMObjectPosition(this.domElement),i=this.div.style;i.left=""+t.left+"px";i.top=""+t.top+"px"}},setText:function(n){this.clipText=n;this.ready&&this.movie.setText(n)},addEventListener:function(n,t){n=n.toString().toLowerCase().replace(/^on/,"");this.handlers[n]||(this.handlers[n]=[]);this.handlers[n].push(t)},setHandCursor:function(n){this.handCursorEnabled=n;this.ready&&this.movie.setHandCursor(n)},setCSSEffects:function(n){this.cssEffects=!!n},receiveEvent:function(n,t){var r,u,f,i;n=n.toString().toLowerCase().replace(/^on/,"");switch(n){case"load":if(this.movie=document.getElementById(this.movieId),!this.movie){r=this;setTimeout(function(){r.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){r=this;setTimeout(function(){r.receiveEvent("load",null)},100);this.ready=!0;return}this.ready=!0;try{this.movie.setText(this.clipText)}catch(e){}try{this.movie.setHandCursor(this.handCursorEnabled)}catch(e){}break;case"mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case"mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case"mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case"mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[n])for(u=0,f=this.handlers[n].length;u<f;u++)i=this.handlers[n][u],typeof i=="function"?i(this,t):typeof i=="object"&&i.length==2?i[0][i[1]](this,t):typeof i=="string"&&window[i](this,t)}};var EmbedManager=function(){function a(){var i,n;if(selectedSize=$("#WidgetEmbedPopup input[type=radio]:checked").val(),i=$("#customSizeTextbox").val(),selectedSize==="Custom"?i>0&&(n=i):n=selectedSize,o.length>0&&(r=!0),!$(this).hasClass("disabled")){if(n=$("#WidgetEmbedPopup input[type=radio]:checked").val(),n=="Custom"){if(currCustomSize=$("#customSizeTextbox").val(),currCustomSize.length==0){r=!1;return}if(currCustomSize=parseInt(currCustomSize),currCustomSize>f){r=!1;$("#customSizeTextbox").val(f);e();b();return}if(currCustomSize<t){r=!1;$("#customSizeTextbox").val(t);e();s();return}}$("#WidgetEmbedPopup").addClass("onPreview");e()}}function u(n){y=!0;$("#embedPopupsContainer #buttonsHolder .btn").addClass("disabled");(typeof n=="undefined"||n===null)&&(n=!0);$("#codeTextArea").val("");n&&$(".textareaWithoutScrollContainer #loadingBoxes").show();$("#widgetPreviewPart .widgetPreviewBottom").html("");$("#widgetPreviewPart .widgetPreviewBottom").append(w(!0))}function e(){var r,n,i,t,u;$("#WidgetEmbedPopup").hasClass("onPreview")&&($("#tolunaPlaceHolder iframe").css("height",l()),$("#tolunaPlaceHolder a").hide(),r=get_scroll_of_page().y,n=$("#widgetPreviewPart"),$("#widgetPreviewWidthText",n).html(h()),$("#widgetPreviewHeightText",n).html(l()),i=($(window).height()-$("#widgetPreviewPart").height())/2,t=i,i>0?t+=r:t=20+r,n.css("top",t+"px"),n.css("width",parseInt(h())+40),u=($(window).width()-$("#widgetPreviewPart").width())/2,$("#widgetPreviewPart").css("left",u+"px").show(),$("#widgetEmbedPart").hide(),i<0&&$.browser.msie&&setTimeout(function(){$(window).scrollTop(t-20)},1e3))}function v(){$("#widgetEmbedPart").show();$("#widgetPreviewPart").css("top","").hide();$("#WidgetEmbedPopup").removeClass("onPreview")}function k(){var r=$.browser,e=null,h;r.chrome=/chrome/.test(navigator.userAgent.toLowerCase());(r.chrome||r.webkit)&&(e=$("#codeTextArea"),$(e).removeAttr("readonly"),$(e).css({overflow:"hidden",border:"0px solid green",width:"180px","padding-right":"0px"}));$("#WidgetEmbedPopup input[type=radio]").uniform({radioClass:"checkerWidgetEmbed"});$("#WidgetEmbedPopup input[type=radio]").on("change",function(n){var f=!0,r;$(this).hasClass("disabled")?(i=!0,s(),$("#WidgetEmbedPopup input[type=radio]")[0].checked=!0,$.uniform.update()):$("#widgetEmbedPopupErrorMsg").hide();r=$("#WidgetEmbedPopup input[type=radio]:checked").val();r<t&&(i=!0,s(),n.preventDefault());r=="Custom"?(f=!1,$("#customSizeTextbox")[0].disabled=!1):($("#customSizeTextbox")[0].disabled=!0,$("#customSizeTextbox").val(""));u(f)});$("#previewBtn").live("click",a);$("#closePreviewBtn").live("click",v);$(".facebookImg",n).live("click",function(){$(".facebook",n).length>0?$(".facebook",n).click():$(".s_follow_icons .facebook").click()});$(".twitterImg",n).live("click",function(){$(".twitter",n).length>0?$(".twitter",n).click():$(".s_follow_icons .twitter").click()});h=1e3;$("#customSizeTextbox").on("keyup",function(){var n=$("#customSizeTextbox").val();isNaN(n)?(n=n.substring(0,n.length-1),$("#customSizeTextbox").val(n)):(o.push("wait"),setTimeout(function(){if(o.pop(),!(o.length>0)){var r=parseInt(n);if(r>f){$("#customSizeTextbox").val(f);u();i=!0;b();return}if(r<t){$("#customSizeTextbox").val(t);u();i=!0;s();return}$("#widgetEmbedPopupErrorMsg").hide();u()}},h))});$("#pollShortUrlLink, #codeTextArea").live("click",function(){$(this).select()})}function h(){var n=$("#WidgetEmbedPopup input[type=radio]:checked").val();return n=="Custom"?$("#customSizeTextbox").val():n}function p(){return n.find("object").length>0}function l(){return c}function w(t){var r=$(".base64ContentID",n).val(),i=g.replace("[c_Id]",r);return i=typeof t!="undefined"&&t?i.replace("[p]","1"):i.replace("[p]","0"),i=i.replace("[w]",h()),i.replace("[h]",l())}function nt(){$("#codeTextArea").val(w())}function b(){$("#widgetEmbedPopupErrorMsg").html(_NG_EmbedPopup_MaximumWidthCannotBeMoreThanPixels.replace("{0}",f));$("#widgetEmbedPopupErrorMsg").show()}function s(){var i=parseInt(n.find(".WidgetContentTypeHidden").val());switch(i){case ___WidgetTypes.Poll:$("#widgetEmbedPopupErrorMsg").html(_NG_EmbedPopup_MinimumWidthCannotBeLessThanPx.replace("{0}",t));break;case ___WidgetTypes.Thumbs:$("#widgetEmbedPopupErrorMsg").html(_NG_EmbedPopup_MinimumWidthCannotBeLessThanPx.replace("{0}",t));break;case ___WidgetTypes.Battle:p()?$("#widgetEmbedPopupErrorMsg").html(_NG_EmbedPopup_ForVideoBattleMinimumWidthCannotBeLessThanPx.replace("{0}",t)):$("#widgetEmbedPopupErrorMsg").html(_NG_EmbedPopup_MinimumWidthCannotBeLessThanPx.replace("{0}",t))}$("#widgetEmbedPopupErrorMsg").show()}var i=!1,rt=this,y=!0,r=!1,o=[],c;k();var n=null,d="<a href='"+___baseUrl+"registerTol?tolreg=1&rsid=50001999&rcid=32446&rgid=' target='_blank' title='Toluna' id='tolunaEmbedLogo'><\/a>",g="<div id='tolunaPlaceHolder'>"+d+"<\/div><script type='text/javascript' src='"+___baseUrl+"Js/JsEmbed?width=[w]&height=[h]&contentId=[c_Id]&preview=[p]' ><\/script>";c=0;var t,tt=250,it=450,f=800;return{ShowEmbedPopup:function(t){n=t;var i=$(".base64ContentID",n).val(),r=___baseUrl+"embed/"+i+"?w=500&amp;preview=1",u=$("<div><\/div>"),f={modalTitle:_NG_SharePopUp_SharePoll.replace("{0}",_NG_WizardPopup_Poll),buttonText:_NG_EmbedPopup_Copy,errorMessage:_NG_Dashboard_PleaseInsertSizeBetweenAnd};u.load(r,function(n){function r(){window.reactApp.services.dispose(t);$("#WidgetEmbedPopup").hide()}var t=document.getElementById("WidgetEmbedPopup");$("#WidgetEmbedPopup").show();window.reactApp.uiModels.modal(t,n,i,r,___baseUrl,f)},function(n){console.log("Error on getting poll HTML : ",n)})},updateHeight:function(n){c=n;e();nt();y=!1;$("#embedPopupsContainer #buttonsHolder .btn").removeClass("disabled");i==!0?i=!1:$("#widgetEmbedPopupErrorMsg").hide();$(".textareaWithoutScrollContainer #loadingBoxes").hide();r==!0&&(r=!1,a())}}}(),WidgetListStates={Recent:0,Popular:1,Friends:2,All:3},m_EmbedManager=null;window.getHeight=function(n){m_EmbedManager.updateHeight(n)},function(n,t){var i=n.jQuery||n.Cowboy||(n.Cowboy={}),r;i.throttle=r=function(n,r,u,f){function s(){function i(){o=+new Date;u.apply(h,c)}function l(){e=t}var h=this,s=+new Date-o,c=arguments;f&&!e&&i();e&&clearTimeout(e);f===t&&s>n?i():r!==!0&&(e=setTimeout(f?l:i,f===t?n-s:n))}var e,o=0;return typeof r!="boolean"&&(f=u,u=r,r=t),i.guid&&(s.guid=u.guid=u.guid||i.guid++),s};i.debounce=function(n,i,u){return u===t?r(n,i,!1):r(n,u,i!==!1)}}(this),function(n){var t="waitForImages";n.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage"]};n.expr[":"].uncached=function(t){if(!n(t).is('img[src!=""]'))return!1;var i=document.createElement("img");return i.src=t.src,!i.complete};n.fn.waitForImages=function(i,r,u){if(n.isPlainObject(arguments[0])&&(r=i.each,u=i.waitForAll,i=i.finished),i=i||n.noop,r=r||n.noop,u=!!u,!n.isFunction(i)||!n.isFunction(r))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var e=n(this),f=[],h,c,o,s;u?(h=n.waitForImages.hasImageProperties||[],c=/url\((['"]?)(.*?)\1\)/g,e.find("*").each(function(){var t=n(this);t.is("img:uncached")&&f.push({src:t.attr("src"),element:t[0]});n.each(h,function(n,i){var r=t.css(i),u;if(!r)return!0;while(u=c.exec(r))f.push({src:u[2],element:t[0]})})})):e.find("img:uncached").each(function(){f.push({src:this.src,element:this})});o=f.length;s=0;o==0&&i.call(e[0]);n.each(f,function(u,f){var h=new Image;n(h).bind("load."+t+" error."+t,function(n){return s++,r.call(f.element,s,o,n.type=="load"),s==o?(i.call(e[0]),!1):void 0});h.src=f.src})})}}(jQuery);ContentAccessLevel={Public:0,Private:1,Followers:2,External:3};var eMediaType={All:-1,Image:1,Text:0,Video:2},ePollType={Multiple:2,Single:1},eFeatured={QuickVotes:1,NotFeatured:0};FinalizeRegistrationPopup=function(n){n(function(){n("#finalizeRegistrationJustLooking").on("click",function(){n("#finalizeRegistrationPopup span.close").click()})})}(jQuery)