/*v7181: 2012-09-06T10:43:42*/ var $j={get_root_namespace:function(){return"$j"},namespace:function(){var B=arguments,F=this,D=0,C,E,A;for(;D-1){return }B.push(this.getWidgetClass());if(this.options.lazyLoadMustacheAssets===false){this._loadTemplate()}else{this._loadAssets(this._loadTemplate)}};this.refresh=function(){var E=this;if(!this._isInitialized){$j.log("widget not initialized"+E.getWidgetClass());return }C(document).ready(function(){try{E._onTemplatesReady(function(){var G=E.templates();if(G){E._render(G);E._isRendered=true}else{$j.log("templates not available for "+E.getWidgetClass())}})}catch(F){$j.log(F);$j.log(E._pluginName)}})};this._render=function(E){};this._onTemplatesReady=function(E){if(this.templates()){E()}else{$j.bind("$j.MustacheMixin.templatesReady."+D.templateClass,E)}};this._loadAssets=function(F){var E=this;$j.session.hostReady(function(){if(!A){A=true;if(typeof C.fn.mustache=="undefined"){$j.loader({js:[$j.session.host.getPeacockRoot()+"jquery/mustache.js"],context:this,success:function(){$j.log("{{mustache}} lazy loaded")}})}}if(D.loadCss){$j.loader({css:[this.getWidgetAssetURL("css")],context:this,success:function(){if(typeof F==="function"){if($j.session.host.isDev()){$j.log(E.getWidgetClass()+" assets loaded")}F.call(E)}},complete:function(){}})}else{F.call(E)}},this)};this.templates=function(F){try{if(F!==undefined){if(D.templateClass!=this.getWidgetClass()){$j.log("ugly: trying to set templates when this class uses an alternate template class")}$j.mtmpl[this.getWidgetClass()]=F}return $j.mtmpl[D.templateClass]}catch(E){$j.log("template error in: "+this.getWidgetClass());return""}};this.getTemplate=function(E){var F=this.templates();if(typeof F[E]=="undefined"){$j.log(E+" not found in "+D.templateClass);return""}return F[E]};this._loadTemplate=function(){if(this.templates()){return }if(D.templateClass!=this.getWidgetClass()){return }var F=this._getTemplatesFromNode(this.$root);if(F){this.templates(F);$j.trigger("$j.MustacheMixin.templatesReady."+this.getWidgetClass())}else{var E=this;$j.session.hostReady(function(){var G=E.getWidgetAssetURL("html");G=G.replace("cdn.lib.newsvine.com","lib.newsvine.com");$j.jsonpload(G,E,function(H){if(H.status!=="success"){$j.log.warn("Could not load a template for this template widget. resp=",H.status);return }$node=C("
").append(H.data);var I=E._getTemplatesFromNode($node);if(I){E.templates(I);$j.trigger("$j.MustacheMixin.templatesReady."+E.getWidgetClass())}},{cache:($j.session.host.isDev()===false)})},this)}};this._getTemplatesFromNode=function(F){var I=false;try{var E=F.find('script[class^="template_"]');if(E.size()>0){var I={};for(var H=0;H×').click(G,function(H){H.preventDefault();D.close.call(H.data,H)}).appendTo(F)}if(D.title!==""){A("<"+D.title_tag+"/>").addClass("c-modal-title").html(D.title).appendTo(F)}},footer:function(F,G){if(typeof D.save==="function"){A('");B.click(this,function(D){D.data.close()})};this.close=function(){if(this.isOpen){this.options.onClose.call(this)}};this.close_all=function(){A(".j_widget_lightbox .target_overlay").parent().parent().lightbox("close")}});A.fn.lightbox=function(){return $j.PluginWrapper.handler($j.widget.Lightbox,this,arguments)}})(jQuery);(function(A){$j.widget.tester=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.tester";this.options={assets:{css:false},nodes:{tester:{html:"testy testerson"}}}});A.fn.tester=function(){return $j.PluginWrapper.handler($j.widget.tester,this,arguments)}})(jQuery);(function(A){$j.widget.Zinger=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger";this.options={logo:'',title:"",message:"",nodes:{header:{nodes:{logo:{},title:{},message:{}}},section:{},footer:{}}};this.default_lightbox_options={width:450,height:350};this.lightbox=function(C){var B=A.extend(true,this.default_lightbox_options,C);this._super(A.fn.zinger,C,B)};this.button=function(C){var B=A.extend(true,this.default_lightbox_options,C);this.lightbox_button(A.fn.zinger,C,B,C)};this.render_section=function(B){this.fb=new $j.widget.Zinger.Facebook(B.$root);this.fb.init();this.nv=new $j.widget.Zinger.Newsvine(B.$root);this.nv.init();this.nv.onView(this.nv.VIEW_ENTER_PASSWORD,this.on_newsvine_view_change,this);this.nv.onView(this.nv.VIEW_ENTER_DISPLAYNAME,this.on_newsvine_view_change,this);this.nv.onView(this.nv.VIEW_ENTER_EMAIL,this.reset_view,this)};this.on_twitter_view_change=function(){if(this.fb){this.fb.$root.hide()}if(this.nv){this.nv.$root.hide()}};this.on_newsvine_view_change=function(){if(this.fb){this.fb.$root.hide()}if(this.tw){this.tw.$root.hide()}};this.reset_view=function(){if(this.fb){this.fb.$root.show()}if(this.tw){this.tw.$root.show()}if(this.nv){this.nv.$root.show()}};this.render_logo=function(B){B.$root.html(this.options.logo)};this.render_title=function(B){B.$root.html(this.options.title)};this.render_message=function(B){B.$root.show();B.$root.html(this.options.message)}});A.fn.zinger=function(){return $j.PluginWrapper.handler($j.widget.Zinger,this,arguments)}})(jQuery);(function(A){$j.widget("j_login_check",function(){this.options={"title-msg":"To join the discussion, please sign in.",plugin:null};this._widgetInit=function(C){var B=this;$j.session.ready(function(){if($j.session.user.isLoggedIn()){var D=B.$root[B.options.plugin];if(typeof D==="function"){return D.call(B.$root,B.options)}else{$j.log(B.options.plugin+" is not a valid plugin")}}else{var E=B.$root.zinger("lightbox",{title:B.options["title-msg"]});B.$root.click(function(){setTimeout(function(){E.lightbox("show")},100)})}})};this.refresh=function(){}},{autoload:true})})(jQuery);(function(A){$j.widget.Zinger.Disconnect=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger.Disconnect";this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/zinger/")};this.options={assets:{css:true,template:true},networks:[{enabled:false,network:"facebook",username:false,connect:{callback:function(){}},disconnect:{label:"Disconnect from Facebook",callback:function(){}}},{enabled:false,network:"twitter",username:false,connect:{callback:function(){}},disconnect:{label:"Disconnect from Twitter",callback:function(){}}}]};this.network_template=null;this.init=function(B){this.init_options(B);this.init_root_node(this.options);this.load(this.options.assets,function(C){if(C!==false){this.before_render_template(C);C=this.render_template(C);this.after_render_template(C)}})};this.render_template=function(B){var C={options:this.options};var B=A.tmpl(B,C).appendTo(this.$root);return B};this.before_render_template=function(B){this.network_template=B.find(".j-networks").template();B.find(".j-networks").empty()};this.after_render_template=function(B){$root=B.parent();$networks=$root.find(".j-networks");for(var C=0;C'+this.options.messages.button_label+"").appendTo(this.$controls);if(this.options.enable_sharing_checkbox===true){this.render_sharing_checkbox(this.$controls)}this.$button.click(this,function(D){D.preventDefault();D.data.handle_facebook_button_click()})},this)};this.render_sharing_checkbox=function(B){if($j.session.user.access.isFBS()===true){if($j.session.host.sharingVariable!==null){B.zinger_sharing()}}};this.handle_facebook_button_click=function(){if(this.options.force_sharing){$j.session.user.setSharing(true,true)}var C=this;var B=this.getPerms();FB.login(function(D){$j.log("getLoginStatus",D,D.status);$j.ext.FacebookClient.updateResponse(D);if(D.status==="connected"){$j.log("connected to FB");$j.fb.hasPerms(B,function(){this.newsvine_login_using_facebook(D);this.connected_callback(D)},function(){$j.log("cancelled request for permissions")},C)}else{$j.log("NOT connected to FB");FB.Event.subscribe("auth.login",function(G){try{var E="http://www.newsvine.com/_action/admin/debug?subj=fb-auth-login&msg=yes&url="+location.href.urlencode();$j.jsonp(E)}catch(F){}$j.ext.FacebookClient.updateResponse(G);$j.fb.hasPerms(B,function(){this.newsvine_login_using_facebook(G);this.connected_callback(G)},function(){$j.log("cancelled request for permissions")},C)})}},{scope:B})};this.connected_callback=function(B){if(A.isFunction(this.options.connected_callback)){var C=this.options.scope||this;this.options.connected_callback.call(C,B)}};this.newsvine_login_using_facebook=function(B){var C=$j.session.host.getRegDomainRoot()+"_nv/api/accounts/auth/facebookLogin?";C+="multiDomainLogin=true";C+="&token="+B.authResponse.accessToken;C+="&redirect="+"/_nv/api/accounts/showUserData?multiDomainLogin=true".urlencode();$j.jsonp(C,function(D){if(D.statusCode==="success"){if($j.cookie("sharing_optout")==="true"){$j.session.user.setSharing(false)}$j.session.user.login(D.data)}},{cache:false})}});A.fn.zinger_facebook=function(){return $j.PluginWrapper.handler($j.widget.Zinger.Facebook,this,arguments)}})(jQuery);(function(A){$j.widget.Zinger.Login=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger.Login";this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/zinger/")};this.options={edition:false,logged_in_mode:"menu",logged_out_mode:"menu",assets:{css:true,template:true},target:{avatar_size:15,bind_event:"click",label:"Account"},menu:{avatar_size:60,column:"My Column",settings:"Account Settings",logout:"Log out"},zinger:{title:"Log in or register below"},effects:{target_open:{effect:"slideDown",duration:400},target_close:{effect:"slideUp",duration:400}}};this.$target=null;this.$menu=null;this.$login=null;this.init=function(B){this.init_options(B);this.init_root_node(this.options);this.load(this.options.assets,function(C){if(C!==false){this.before_render_template(C);C=this.render_template(C);this.after_render_template(C)}})};this.render_template=function(B){var C={options:this.options,user:$j.session.user};var B=A.tmpl(B,C).appendTo(this.$root);return B};this.before_render_template=function(B){};this.after_render_template=function(B){this.$target=this.$root.find(".j-target");this.$menu=this.$root.find(".j-menu");this.$login=this.$root.find(".j-login-prompt");this.$target.data("node",false);this.target_bind();this.render_menu();this.$login.find(".j-zinger-login").zinger(this.options.zinger);if($j.session.user.isLoggedIn()===false&&this.options.logged_out_mode==="inline"){this.$target.hide();this.$login.show()}else{if($j.session.user.isLoggedIn()===true&&this.options.logged_in_mode==="inline"){this.$target.hide();this.$menu.show()}}$j.session.user.onLogin(this,function(D){this.render_menu();if(this.options.logged_out_mode==="inline"){this.$login.hide();this.$target.show()}else{this.$login.find(".j_widget_zinger").hide();this.$login.find(".j-onlogin").removeClass("c-hide");var C=this;setTimeout(function(){C.toggle("slideUp")},2000)}if(this.options.logged_in_mode==="inline"){this.$menu.show();this.$target.hide()}})};this.render_menu=function(){this.$menu.find(".j-user-displayName").html($j.session.user.displayName);this.add_avatar(this.$target.find("img.j-avatar"),this.options.target.avatar_size);this.add_avatar(this.$menu.find("img.j-avatar"),this.options.menu.avatar_size);var B=this.sync_facebook();if(B===false){this.render_fb_sharing()}this.menu_links()};this.target_bind=function(){this.$target.bind(this.options.target.bind_event,{scope:this},function(B){B.data.scope.target_handle()})};this.target_handle=function(){this.toggle()};this.toggle=function(D){if(typeof D==="undefined"){D=this.$target.data("node")?"hide":"show"}var B=this.$target.data("node");if(B===false){B=$j.session.user.isLoggedIn()?this.$menu:this.$login}if(D==="show"){var C=this.options.effects.target_open;this.$target.data("node",B);this.before_show();this.$target.addClass("c-focus")}else{var C=this.options.effects.target_close;this.$target.data("node",false);this.$target.removeClass("c-focus");this.before_hide()}B[C.effect](C.duration)};this.before_show=function(){this.clickaway_bind()};this.before_hide=function(){this.clickaway_unbind()};this.clickaway_bind=function(){A(document.body).bind(this.buildEventKey("click"),{scope:this},function(B){B.data.scope.clickaway_handle(B.target)})};this.clickaway_unbind=function(){A(document.body).unbind(this.buildEventKey("click"))};this.clickaway_handle=function(B){if(A(B).closest("#"+this.getWidgetNodeId()).size()===0){this.toggle("hide")}};this.render_fb_sharing=function(){if($j.session.user.access.isFBS()===true){if($j.session.host.sharingVariable!==null){var B=this.$menu.find(".j-fb-share");B.zinger_sharing()}}};this.sync_facebook=function(){var B=this.$menu.find(".j-syncfb");if($j.session.user.hasFacebookAff()===false){B.removeClass("c-hide");B.find(".j-zinger-fb").zinger_facebook({messages:{button_label:"Connect with Facebook"},connected_callback:function(){B.find(".j-connect").hide();B.find(".j-zinger-fb").hide();B.find(".j-connected").removeClass("c-hide");B.find(".j-connected").delay(3000).slideUp("slow")}});return true}else{B.find(".j-connect").hide();B.find(".j-zinger-fb").hide();B.find(".j-connected").removeClass("c-hide");return false}};this.menu_links=function(){var B=this.options.menu;var C=this.$menu;if(B.column){C.find("a.j-user-column").attr("href",$j.session.user.getURL())}else{C.find("a.j-user-column").parent().remove()}if(B.settings){C.find("a.j-user-settings").attr("href",$j.session.host.getAccountSettingsPath())}else{C.find("a.j-user-column").parent().remove()}if(B.logout){C.find("a.j-user-logout").attr("href",$j.session.host.getLogoutUrl())}else{C.find("a.j-user-column").parent().remove()}};this.add_avatar=function(C,B){if(C&&B){var D=B;C.attr("src",$j.session.user.getAvatar(D));C.attr("width",B).attr("height",B).attr("alt","Your Avatar")}}});A.fn.zinger_login=function(){return $j.PluginWrapper.handler($j.widget.Zinger.Login,this,arguments)}})(jQuery);(function(A){$j.widget.Zinger.MultiConnect=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger.MultiConnect";this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/zinger/")};this.options={assets:{css:true,template:true},title:"Hold on! You're almost there…",subtitle:"You chose additional sharing options:",message:"

You must first connect your account(s) to share your thoughts further:

",footer:'

You can always change Your Account Settings later.

',networks:[{enabled:false,network:"facebook",user_connected:false,message:"",connected:{message:"",callback:function(){}},not_connected:{message:"",callback:function(){}}},{enabled:false,network:"twitter",user_connected:false,message:"",connected:{message:"",callback:function(){}},not_connected:{message:"",callback:function(){}}}]};this.default_lightbox_options={width:500,height:390};this.network_template=null;this.lightbox=function(C){var B=A.extend(true,this.default_lightbox_options,C);this._super(A.fn.zinger_multiconnect,C,B)};this.init=function(B){this.init_options(B);this.init_root_node(this.options);this.load(this.options.assets,function(C){if(C!==false){this.before_render_template(C);C=this.render_template(C);this.after_render_template(C)}})};this.render_template=function(B){var C={options:this.options};var B=A.tmpl(B,C).appendTo(this.$root);return B};this.before_render_template=function(B){this.network_template=B.find(".j-networks").template();B.find(".j-networks").empty()};this.after_render_template=function(B){$root=B.parent();$root.find(".j-acct-link").attr("href",$j.session.host.getAccountSettingsPath());$root.find(".j-close").click(function(){A("
").lightbox("close_all")});$networks=this.$root.find(".j-networks");for(var C=0;CGreat!

Now we just need to know what name you\'d like to have on the site (e.g. John Smith, antelope123, Tim from Seattle):

',password:'

Excellent!

It looks like you already have an account registered with .

Please type in your password below:

',reset_pass:"

Enter the e-mail address you registered with and we will send you an e-mail to reset your password.

",reset_done:"

An e-mail has been sent to your Inbox. Please follow the instructions in the email to reset your password.

"},nodes:{header:{},controls:{nodes:{enter_email:{nodeType:"form"},enter_password:{nodeType:"form"},enter_displayname:{nodeType:"form"},enter_resetpass:{nodeType:"form"}}},status:{},footer:{nodes:{reset_password:{html:'Forgot your password?'},register_new:{html:'Register a new account.'},contact_us:{html:'Contact us to report a problem.'},start_over:{html:'Or, start over.'}}}}};this.after_render=function(B){this.view(this.VIEW_ENTER_EMAIL)};this.render_header=function(B){this.$header=B.$root;this.$header.showView=function(C){$header=this.show();if(C){$header.html(C)}}};this.render_footer=function(B){this.$footer=B.$root;A("div.reset_password a").click(this,function(D){try{D.data.view(D.data.VIEW_RESET_PASS)}catch(C){$j.session.reportError(C)}return false});A("div.start_over a").click(this,function(D){try{D.data.view(D.data.VIEW_ENTER_EMAIL)}catch(C){$j.session.reportError(C)}return false});A("div.register_new a").click(this,function(D){try{D.data.view(D.data.VIEW_ENTER_EMAIL)}catch(C){$j.session.reportError(C)}return false});this.$footer.showView=function(C){var C=A.extend({reset_password:true,register_new:false,contact_us:false,start_over:true},C);$footer=this.show();if(C.reset_password){$footer.children("div.reset_password").show()}else{$footer.children("div.reset_password").hide()}if(C.start_over){$footer.children("div.start_over").show()}else{$footer.children("div.start_over").hide()}if(C.register_new){$footer.children("div.register_new").show()}else{$footer.children("div.register_new").hide()}if(C.contact_us){$footer.children("div.contact_us").show()}else{$footer.children("div.contact_us").hide()}}};this.render_status=function(B){this.$status=B.$root};this.clear_status=function(){this.update_status("","");this.$status.hide()};this.update_status=function(B,C){this.$status.html(B);this.$status.attr("class","status "+C);this.$status.show()};this.render_enter_email=function(B){this.$enter_email_form=B.$root;this.$enter_email_form.append('');this.$enter_email_form.append('');this.$enter_email_form.submit(this,function(D){try{D.data.handle_enter_email()}catch(C){$j.session.reportError(C)}return false});this.$enter_email_form.showView=function(){$form=this.show();$form.children("input.email").focus()}};this.handle_enter_email=function(){var B=this.get_user_email_input();if($j.util.validate_domain(B,2)===true){this.check_domain_taken(B,this,function(C){this.handle_domain_taken(C)});return }else{if($j.util.validate_email(B)===false){this.update_status("Please enter a valid e-mail address.","error");return }}this.check_email_taken(B,this,function(C){this.handle_email_taken(C)})};this.get_user_display_input=function(){var B=A("input.displayName",this.$enter_displayname_form).val().trim();return B};this.get_user_email_input=function(){var B=A("input.email",this.$enter_email_form).val().trim();return B};this.render_enter_resetpass=function(B){this.$enter_reset_form=B.$root;this.$enter_reset_form.append('');this.$enter_reset_form.append('');this.$enter_reset_form.submit(this,function(D){try{D.data.handle_enter_resetpass()}catch(C){$j.session.reportError(C)}return false});this.$enter_reset_form.showView=function(C){$form=this.show();$form.children("input.email").focus();if($j.util.validate_email(C)){$form.children("input.email").val(C)}}};this.handle_enter_resetpass=function(){var C=A("input.email",this.$enter_reset_form).val();if($j.util.validate_email(C)===false){this.update_status("Please enter a valid e-mail address.","error");return }var B=$j.session.host.getResetPassUrl(C,$j.session.host.getUserDataUrl());$j.jsonp(B,this,function(D){this.view(this.VIEW_RESET_DONE)},{cache:false})};this.render_enter_password=function(B){this.$enter_password_form=B.$root;this.$enter_password_form.append('');this.$enter_password_form.append('');this.$enter_password_form.submit(this,function(D){try{D.data.handle_enter_password()}catch(C){$j.session.reportError(C)}return false});this.$enter_password_form.showView=function(){$form=this.show();var C=$form.children("input.password");C.val("").focus()}};this.handle_enter_password=function(){var B=this.get_user_email_input();var C=A("input.password",this.$enter_password_form).val();if($j.util.validate_password(C)===false){this.update_status("Please enter a valid e-mail address and password.","error");return }this.send_email_login(B,C,this,function(D){this.handle_email_login(D.statusCode,D.data)})};this.render_enter_displayname=function(B){this.$enter_displayname_form=B.$root;this.$enter_displayname_form.append('');this.$enter_displayname_form.append('');this.$enter_displayname_form.submit(this,function(D){try{D.data.handle_enter_displayname()}catch(C){$j.session.reportError(C)}return false});this.$enter_displayname_form.find("input.displayName").keyup(this,function(C){C.data.handle_displayname_input()});this.$enter_displayname_form.showView=function(){$form=this.show();$form.children("input.displayName").focus()}};this.handle_displayname_input=function(){var B=this.get_user_display_input();if($j.util.validate_display(B)===true&&this.check_displayname_value!==B){this.check_displayname_value=B;this.check_display_taken(B,this,function(C){if(C.statusCode===1){this.update_status("Name is available!","success")}else{if(C.statusCode===-4){this.update_status("Name is not available.","error")}else{this.clear_status()}}})}};this.handle_enter_displayname=function(){var C=this.get_user_email_input();var B=this.get_user_display_input();if($j.util.validate_display(B)===false){this.update_status("Please enter a valid display name. Display names must be at least 4 characters but not longer than 60.","error");return }this.check_display_taken(B,this,function(D){this.handle_display_taken(D)})};this.check_email_taken=function(C,D,E){var B=$j.session.host.getAPIPath(true)+"user/emailTaken?";B+="email="+C.urlencode();$j.jsonp(B,D,E,{cache:false})};this.check_domain_taken=function(C,D,E){var B=$j.session.host.getAPIPath(true)+"user/domainTaken?";B+="domain="+C.urlencode();$j.jsonp(B,D,E,{cache:false})};this.handle_domain_taken=function(B){if(B.isTaken===true){this.view(this.VIEW_ENTER_PASSWORD) }else{this.update_status("Please enter a valid e-mail address.","error");return }};this.handle_email_taken=function(B){if(B.emailTaken===true){this.view(this.VIEW_ENTER_PASSWORD)}else{this.view(this.VIEW_ENTER_DISPLAYNAME)}};this.send_email_login=function(C,E,D,F){var B=$j.session.host.getAPIPath(true,true)+"accounts/login?";B+="responseType=json";B+="&affiliate="+$j.session.host.getRegAffiliate();B+="&email="+C.urlencode();B+="&password="+E.urlencode();$j.jsonp(B,D,F,{cache:false})};this.handle_email_login=function(E,F){if(E==="success"){this.$root.hide();$j.session.user.login(F)}else{var D=F.errors?"":"Login was unsuccessful. Please try again.";for(var C in F.errors){var B=F.errors[C];if(B){D+="
"+B+"
"}}this.update_status(D,"error")}};this.check_display_taken=function(B,D,E){var C=$j.session.host.getNewsvineRoot()+"_action/section/checkName?";C+="displayName="+B.urlencode();$j.jsonp(C,D,E,{cache:false})};this.handle_display_taken=function(D){if(D.statusCode===1){var C=this.get_user_email_input();var B=this.get_user_display_input();this.send_quick_reg(C,B,this,function(E){this.handle_quick_reg(E.statusCode,E.data)})}else{if(D.statusCode===-4){this.update_status("Sorry, that name is not available.","error");return }else{this.update_status("Please enter a valid name.","error");return }}};this.send_quick_reg=function(D,C,E,G){var B=false;var F=$j.uri($j.session.host.getAPIPath(B,true)+"accounts/register");F.setParam("forceIgnoreSSL",true);F.setParam("responseType","redirect");F.setParam("affiliate",$j.session.host.getRegAffiliate());F.setParam("redirect",$j.session.host.getUserDataUrl().replace("https://","http://"));F.setParam("email",D);F.setParam("displayName",C);$j.jsonp(F.assemble(),E,G,{cache:false})};this.handle_quick_reg=function(E,F){if(E==="success"){this.$root.hide();$j.session.user.login(F)}else{var D=F.errors?"":"Registration was unsuccessful. Please try again.";for(var C in F.errors){var B=F.errors[C];if(B){D+="
"+B+"
"}}this.update_status(D,"error");this.$footer.showView({reset_password:false,register_new:false,contact_us:true,start_over:true})}};this.onView=function(B,D,C){this.bind("view_"+B,function(){D.call(C)})};this.view=function(C){this.clear_status();A("form",this.$root).hide();this.trigger("view_"+C);if(C===this.VIEW_ENTER_EMAIL){this.$header.showView(this.options.messages.email);this.$enter_email_form.showView();this.$footer.hide()}else{if(C===this.VIEW_ENTER_PASSWORD){this.$header.showView(this.options.messages.password);this.$enter_password_form.showView();this.$footer.showView();var B=this.get_user_email_input();if(B){A("span.email",this.$header).text(B)}}else{if(C===this.VIEW_ENTER_DISPLAYNAME){this.$header.showView(this.options.messages.displayName);this.$enter_displayname_form.showView();this.$footer.showView({reset_password:false})}else{if(C===this.VIEW_RESET_PASS){this.$header.showView(this.options.messages.reset_pass);this.$enter_reset_form.showView(this.get_user_email_input());this.$footer.showView({reset_password:false,register_new:true,start_over:true})}else{if(C===this.VIEW_RESET_DONE){this.$header.showView(this.options.messages.reset_done);this.$enter_reset_form.hide();this.$footer.showView({reset_password:false,register_new:true,start_over:true})}}}}}}});A.fn.zinger_newsvine=function(){return $j.PluginWrapper.handler($j.widget.Zinger.Newsvine,this,arguments)}})(jQuery);(function(A){$j.widget.Zinger.Sharing=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger.Sharing";this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/zinger/")};this.options={assets:{css:true,template:true},affiliateLabel:null};this.$checkbox=null;this.init=function(B){if($j.session.host.sharingVariable===null){return }this.init_options(B);this.init_root_node(this.options);this.load(this.options.assets,function(C){if(C!==false){this.before_render_template(C);C=this.render_template(C);this.after_render_template(C)}})};this.render_template=function(B){var C={options:this.options,user:$j.session.user};var B=A.tmpl(B,C).appendTo(this.$root);return B};this.before_render_template=function(B){if(!this.options.affiliateLabel){this.options.affiliateLabel=$j.session.host.domainRootLabel}};this.after_render_template=function(C){var B=$j.session.user;this.$checkbox=this.$root.find("input");if(typeof this.$checkbox.prop==="function"){this.$checkbox.prop("checked",B.isSharing())}else{this.$checkbox.attr("checked",B.isSharing())}this.$checkbox.click(this,function(F){if(typeof A(this).prop==="function"){B.setSharing(A(this).prop("checked"))}else{B.setSharing(A(this).attr("checked"))}});B.onSharingSet(this,function(F){$j.log("updating share state; ",this,F,F.isSharing());if(typeof this.$checkbox.prop==="function"){this.$checkbox.prop("checked",F.isSharing())}else{this.$checkbox.attr("checked",F.isSharing())}});var E=$j.session.host.domainRootLabel;if(E==="TODAY"){var D="http://today.msnbc.msn.com/id/46329902"}else{if(E==="msnbc.com"||E==="nbcnews.com"){var D="http://www.msnbc.msn.com/id/46385532"}}this.$root.find(".j-what").attr("href",D)}});A.fn.zinger_sharing=function(){return $j.PluginWrapper.handler($j.widget.Zinger.Sharing,this,arguments)}})(jQuery);(function(A){$j.widget.Zinger.Twitter=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger.Twitter";this.$header=null;this.$footer=null;this.$status=null;this.$button=null;this.VIEW_CONNECT=1;this.VIEW_ENTER_EMAIL=2;this.VIEW_RESET_PASS=3;this.VIEW_RESET_DONE=4;this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/zinger/")};this.options={scope:null,connected_callback:null,img_url:"http://i.newsvine.com/_vine/images/__/sign-in-with-twitter-l.png",messages:{email:'

Great!

Now we just need your e-mail address to complete the connect:

',reset_pass:"

Enter the e-mail address you registered with and we will send you an e-mail to reset your password.

",reset_done:"

An e-mail has been sent to your Inbox. Please follow the instructions in the email to reset your password.

"},nodes:{header:{},controls:{nodes:{enter_email:{nodeType:"form"},connect:{nodeType:"form"},enter_resetpass:{nodeType:"form"}}},status:{},footer:{nodes:{reset_password:{html:'Forgot your password?'},start_over:{html:'Or, start over.'}}}}};this.after_render=function(B){this.view(this.VIEW_CONNECT)};this.render_connect=function(B){this.$connect_form=B.$root;$j.tw(function(C){this.$button=A('Sign in with twitter').appendTo(this.$connect_form);this.$button.css("cursor","pointer");this.$button.click(this,function(D){D.data.handle_twitter_button_click()})},this);this.$connect_form.showView=function(){$form=this.show()}};this.handle_twitter_button_click=function(){$j.tw(function(C){$j.log("T.isConnected=",C.isConnected(),C.currentUser);if(C.isConnected()){$j.log("LOGGED INTO TWITTER!");this.newsvine_login_using_twitter(C)}else{$j.log("LOGGED OUT OF TWITTER!");C.signIn();C.unbind("authComplete");var B=this;C.bind("authComplete",function(F,D,E){$j.log("T.authComplete......... T.isConnected=",C.isConnected());B.newsvine_login_using_twitter(C)})}},this)};this.connected_callback=function(B){if(A.isFunction(this.options.connected_callback)){var C=this.options.scope||this;this.options.connected_callback.call(C,B)}};this.newsvine_login_using_twitter=function(C){var D=$j.uri($j.session.host.getAPIPath(true,true)+"accounts/auth/twitterLogin");D.setParam("domainRoot",$j.session.host.getDomainRoot());D.setParam("redirect","/_nv/api/accounts/showUserData?multiDomainLogin=true");var B=this.get_user_email_input();if(B!==""){D.setParam("email",B)}$j.log("T.currentUser=",C.currentUser,D.assemble());$j.jsonp(D.assemble(),this,function(E){if(E.statusCode==="success"){$j.session.user.login(E.data);this.connected_callback(C)}else{if(E.data&&E.data.errors&&E.data.errors.R14){this.view(this.VIEW_ENTER_EMAIL)}else{alert('Error code "CPE-720". Unable to register using Twitter credentials. Please try again or contact us at http://www.newsvine.com/_nv/cms/info/contact to report the issue.')}}},{cache:false})};this.render_header=function(B){this.$header=B.$root;this.$header.showView=function(C){$header=this.show();if(C){$header.html(C)}}};this.render_footer=function(B){this.$footer=B.$root;A("div.reset_password a").click(this,function(D){try{D.data.view(D.data.VIEW_RESET_PASS)}catch(C){$j.session.reportError(C)}return false});A("div.start_over a").click(this,function(D){try{D.data.view(D.data.VIEW_CONNECT)}catch(C){$j.session.reportError(C)}return false});this.$footer.showView=function(C){var C=A.extend({reset_password:true,start_over:true},C);$footer=this.show();if(C.reset_password){$footer.children("div.reset_password").show()}else{$footer.children("div.reset_password").hide()}if(C.start_over){$footer.children("div.start_over").show()}else{$footer.children("div.start_over").hide()}}};this.render_status=function(B){this.$status=B.$root};this.clear_status=function(){this.update_status("","")};this.update_status=function(B,C){this.$status.html(B);this.$status.attr("class","status "+C)};this.render_enter_email=function(B){this.$enter_email_form=B.$root;this.$enter_email_form.append('');this.$enter_email_form.append('');this.$enter_email_form.submit(this,function(D){try{D.data.handle_enter_email()}catch(C){$j.session.reportError(C)}return false});this.$enter_email_form.showView=function(){$form=this.show();$form.children("input.email").focus()}};this.handle_enter_email=function(){var B=this.get_user_email_input();if($j.util.validate_email(B)===false){this.update_status("Please enter a valid e-mail address.","error");return }this.check_email_taken(B,this,function(C){this.handle_email_taken(C)})};this.get_user_email_input=function(){var B=A("input.email",this.$enter_email_form).val().trim();return B};this.check_email_taken=function(C,D,E){var B=$j.session.host.getAPIPath(true)+"user/emailTaken?";B+="email="+C.urlencode();$j.jsonp(B,D,E,{cache:false})};this.handle_email_taken=function(B){if(B.emailTaken===true){this.update_status("This e-mail address is already registered. Use the forgot password link below or use a different e-mail.","error");this.$footer.showView({reset_password:true,start_over:true})}else{$j.tw(function(C){this.newsvine_login_using_twitter(C)},this)}};this.render_enter_resetpass=function(B){this.$enter_reset_form=B.$root;this.$enter_reset_form.append('');this.$enter_reset_form.append('');this.$enter_reset_form.submit(this,function(D){try{D.data.handle_enter_resetpass()}catch(C){$j.session.reportError(C)}return false});this.$enter_reset_form.showView=function(C){$form=this.show();$form.children("input.email").focus();if($j.util.validate_email(C)){$form.children("input.email").val(C)}}};this.handle_enter_resetpass=function(){var D=A("input.email",this.$enter_reset_form).val();if($j.util.validate_email(D)===false){this.update_status("Please enter a valid e-mail address.","error");return }var B=true;var C=$j.session.host.getResetPassUrl(D,$j.session.host.getUserDataUrl(B));$j.jsonp(C,this,function(E){this.view(this.VIEW_RESET_DONE)},{cache:false})};this.onView=function(B,D,C){this.bind("view_"+B,function(){D.call(C)})};this.view=function(B){this.clear_status();A("form",this.$root).hide();this.trigger("view_"+B);if(B===this.VIEW_CONNECT){this.$header.hide();this.$connect_form.showView();this.$footer.hide()}else{if(B===this.VIEW_ENTER_EMAIL){this.$header.showView(this.options.messages.email);this.$enter_email_form.showView();this.$footer.showView({reset_password:false,start_over:true})}else{if(B===this.VIEW_RESET_PASS){this.$header.showView(this.options.messages.reset_pass);this.$enter_reset_form.showView(this.get_user_email_input());this.$footer.showView({reset_password:false,register_new:true,start_over:true})}else{if(B===this.VIEW_RESET_DONE){this.$header.showView(this.options.messages.reset_done);this.$enter_reset_form.hide();this.$footer.showView({reset_password:false,register_new:true,start_over:true})}}}}}});A.fn.zinger_twitter=function(){return $j.PluginWrapper.handler($j.widget.Zinger.Twitter,this,arguments)}})(jQuery);(function(A){$j.namespace("$j.widget.fb");$j.widget.fb.Activity=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.fb.Activity";this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/fb/")};if(A.browser.msie&&A.browser.version==="7.0"){var B=196}else{var B=185}this.options={assets:{css:true,template:true},title:"What my friends are reading & watching",not_sharing_likebox:{width:458,height:B},yes_sharing_likebox:{width:237,height:260},activity_feed:{width:450,height:280,toggle:false},fb_recommendations:{width:300,height:300},plugins:{like_button:false,recommend_button:false,recommendations:false,activity:false,sharing_like_box:false,not_sharing_like_box:false}};this.templates={};this.init=function(C){$j.session.ready(function(){this.set_plugin_options(C);this.init_options(C);A.extend(this.options,{domainRoot:$j.session.host.domainRoot,appId:$j.session.host.getFacebookConfig().appId,appHome:$j.session.host.getFacebookConfig().appHome});this.options.appHome=$j.session.host.getFacebookConfig().appHome;this.init_root_node(this.options);this.load(this.options.assets,function(D){if(D!==false){this.before_render_template(D);D=this.render_template(this.templates.root);this.after_render_template(D)}})},this)};this.set_plugin_options=function(C){if(C.edition==="cover"){this.options.plugins.like_button=true;this.options.plugins.recommendations=true;this.options.plugins.activity=true}else{if(C.edition==="story"){this.options.plugins.activity=true;this.options.plugins.sharing_like_box=true;this.options.plugins.not_sharing_like_box=true}else{if(C.edition==="video"){this.options.plugins.activity=true;this.options.plugins.recommend_button=true}}}};this.render_template=function(D,C,E){if(D!==false){C=C||this.$root;E=E||{};E.options=this.options;E.user=$j.session.user;var D=A.tmpl(D,E).appendTo(C)}return D};this.before_render_template=function(C){$nodes=C.children("code.template");for(var D=0;D<$nodes.length;D++){$node=A($nodes[D]).removeClass("template");var F=$node.attr("class");var E=$node.template();this.templates[F]=E}};this.after_render_template=function(D){$j.session.windowReady(function(){this.configureWidget($j.session.user);this.render_onload_plugins(this.$root);this.$root.find(".sharing_bar").fb_sharing(this.options).show()},this);var C=$j.session.user;C.onSharingSet(this,function(E){this.configureWidget(E)});C.onLogin(this,function(E){this.configureWidget(E)});if(this.options.activity_feed.toggle===true){this.$root.find(".j-title").click(this,function(E){E.preventDefault();E.data.handle_title_click()})}};this.render_onload_plugins=function(C){if(this.options.plugins.like_button===true){this.render_template(this.templates.like_button,C.find(".j-plugin-like-button"));C.find(".j-plugin-like-button").show()}this.parse(C)};this.parse=function(C){$j.fb(function(D){FB.XFBML.parse(C.get(0))})};this.render_recommend_button=function(C,D){var E=this.render_template(this.templates.recommend_button,C);if(typeof D==="string"){E.attr("data-href",D)}};this.recommend=function(D){var C=A.extend({empty:true,url:location.href,$node:this.$root.find(".recommend_button")},D||{});if(C.empty===true){C.$node.empty()}this.render_recommend_button(C.$node,C.url);this.parse(C.$node)};this.configureWidget=function(C){if(C.isFacebookSharing()===true){$j.fb(function(D){if(D.status==="connected"){this.showSharing()}else{this.hideSharing()}},this)}else{this.hideSharing()}};this.showSharing=function(){var C=this.options.plugins;if(C.activity===true){C.activity=false;this.render_template(this.templates.activity,this.$root.find(".j-plugin-activity"));this.$root.find(".j-plugin-activity").show()}if(C.sharing_like_box===true){C.sharing_like_box=false;this.render_template(this.templates.sharing_like_box,this.$root.find(".j-plugin-sharing-like-box"));this.$root.find(".j-plugin-sharing-like-box").show()}this.parse(this.$root.find(".fb_connected"));this.$root.removeClass("notSharing");this.$root.find(".fb_notConnected").hide();this.$root.find(".fb_connected").show()};this.hideSharing=function(){var C=this.options.plugins;if(C.recommend_button===true){C.recommend_button=false;this.render_recommend_button(this.$root.find(".j-plugin-recommend-button"));this.$root.find(".j-plugin-recommend-button").show()}if(C.recommendations===true){C.recommendations=false;this.render_template(this.templates.recommendations,this.$root.find(".j-plugin-recommendations"));this.$root.find(".j-plugin-recommendations").show()}if(C.not_sharing_like_box===true){C.not_sharing_like_box=false;this.render_template(this.templates.not_sharing_like_box,this.$root.find(".j-plugin-not-sharing-like-box"));this.$root.find(".j-plugin-not-sharing-like-box").show();this.$root.find(".hide_like").show()}this.parse(this.$root.find(".fb_notConnected"));this.$root.addClass("notSharing");this.$root.find(".fb_connected").hide();this.$root.find(".fb_notConnected").show()};this.handle_title_click=function(){this.toggle_activity()};this.toggle_activity=function(){this.$root.find(".fb-activity").toggle()}});A.fn.fb_activity=function(){return $j.PluginWrapper.handler($j.widget.fb.Activity,this,arguments)}})(jQuery);(function(B){function A(){var C="msnbc";if(window.location.host.search("today")!=-1){C="todayshow"}return C}$j.widget("j_fb_prompt",function(){this.registerMixin($j.MustacheMixin);this.registerMixin($j.ModalMixin);var C=null;this._render=function(E){if(!C){var D=A();if(D==="todayshow"){var F="Hey, you got something to share?"}else{var F="Enjoy NBC News, TODAY and MSNBC on Facebook"}C=this.modal(this.$root,{clickaway:false,title:F,body:function(K,J){if(D=="todayshow"){K.append(this.render_template(E.today_prompt));B(".c-modal-title").addClass("c-today");B(".c-modal-footer").addClass("c-today")}else{K.append(this.render_template(E.msnbc_prompt));B(".c-modal-title").addClass("c-msnbc");B(".c-modal-footer").addClass("c-msnbc")}I();function I(){var N=new Array();N.siteName=A();N.deviceType="desktop";N.typeName=L();N.eventType="pageevent";N.eventName="launch";N.featureName="og_prompt";N.elem="og_prompt";try{EventTracker().track(N)}catch(M){}}function H(){var N=new Array();N.siteName=A();N.deviceType="desktop";N.typeName=L();N.eventType="pageevent";N.eventName="accept";N.featureName="og_prompt";N.elem="og_prompt";try{EventTracker().track(N)}catch(M){}}function L(){var M="StoryBlog";if(window.location.host=="today.msnbc.msn.com"||window.location.host=="msnbc.msn.com"){M="storyv2"}return M}var G={scope:this,force_sharing:true,enable_sharing_checkbox:false,messages:{button_label:"Allow"},connected_callback:function(M){if($j.session.user.isLoggedIn()===true){$j.session.user.setSharing(true)}else{$j.session.user.onLogin(this,function(N){$j.session.user.setSharing(true)})}H();J.hide()}};K.find(".j-prompt").zinger_facebook(G)},footer:function(G,H){B('Continue on to story').appendTo(G).click(function(I){I.preventDefault();H.hide()});if(D=="todayshow"){B(".c-modal-footer").addClass("c-today")}else{B(".c-modal-footer").addClass("c-msnbc")}}})}else{C.show()}}})})(jQuery);$j.session.ready(function(C){var F=D();var E=A();if(E===true&&F===true&&C.isSharing()===true&&C.isFacebookSharing()===false){if(B()){$(document).ready(function(){$('
').appendTo("body").j_fb_prompt()})}}function D(){var G=false;if($j.uri(document.referrer).host==="www.facebook.com"||$j.uri(document.referrer).host==="facebook.com"){G=true}return G}function B(){var H=false;if($j.cookie("og_visits")){var G=Number($j.cookie("og_visits"));if(G==1){H=true;G++}else{if(G>=5){G=1}else{G++}}document.cookie="og_visits="+G}else{$j.cookie("og_visits","1",{expires:30,path:"/",domain:$j.session.host.cookieDomain});H=true}if($(".j_prompt_prompt").length>0){H=false}return H}function A(){var G=true;if(window.location.href=="http://www.msnbc.msn.com/"||window.location.href=="http://www.msnbc.msn.com"||window.location.href=="http://today.msnbc.msn.com/"||window.location.href=="http://today.msnbc.msn.com"){G=false}if(window.location.host=="video.today.msnbc.msn.com"||window.location.host=="video.msnbc.msn.com"){G=false}if(window.location.href.search("26184891")!=-1||window.location.href.search("21134540")!=-1){G=false}return G}});(function(A){$j.namespace("$j.widget.fb");$j.widget.fb.Sharing=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.fb.Sharing";this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/fb/")};this.options={assets:{css:true,template:true},login:{edition:"networknav"},url:null,type:null,onAllow:function(B){},share_prompt_message:"Share what you're reading & see what your friends are viewing",sharing_message:"You're sharing this story on Facebook",confirm_message:"This story has been removed from your Facebook profile.",undo_label:"Undo",stop_label:"Stop all sharing"};this.templates={};this.init=function(B){this.init_options(B);this.init_root_node(this.options);this.load(this.options.assets,function(C){if(C!==false){this.before_render_template(C);C=this.render_template(this.templates.root);this.after_render_template(C)}})};this.render_template=function(C,B,D){if(C!==false){B=B||this.$root;D=D||{};D.options=this.options;D.user=$j.session.user;var C=A.tmpl(C,D).appendTo(B)}return C};this.before_render_template=function(B){$nodes=B.children("code.template");for(var C=0;C<$nodes.length;C++){$node=A($nodes[C]).removeClass("template");var E=$node.attr("class");var D=$node.template();this.templates[E]=D}};this.after_render_template=function(D){this.$prompt=this.$root.find(".j-share-prompt").removeClass("j-share-prompt").removeClass("c-hide").hide();this.$account=this.$root.find(".j-account").removeClass(".j-account").removeClass("c-hide").hide();var C={force_sharing:true,enable_sharing_checkbox:false,messages:{button_label:"Allow"},scope:this,connected_callback:function(G){if($j.session.user.isLoggedIn()===true){this.handle_allow_callback()}else{$j.session.user.onLogin(this,function(H){this.handle_allow_callback()})}}};this.$prompt.find(".j-fb-connect").zinger_facebook(C);var B=A.extend({target:{avatar_size:30,label:""}},this.options,{edition:this.options.login.edition});this.$root.find(".j-zinger-login").zinger_login(B);this.$account.find(".j-undo").click(this,function(G){G.preventDefault();G.data.handle_undo_click()});this.$account.find(".j-stopall").click(this,function(G){G.preventDefault();G.data.handle_stopall_click()});this.toggle();$j.session.user.onLogin(this,function(G){this.toggle()});$j.session.user.onSharingSet(this,function(G){this.toggle()});var F=$j.session.host.domainRootLabel;if(F==="TODAY"){var E="http://today.msnbc.msn.com/id/46329902"}else{if(F==="msnbc.com"){var E="http://www.msnbc.msn.com/id/46385532"}}this.$root.find(".j-what").attr("href",E)};this.toggle=function(B){B=B||false;if($j.session.user.isFacebookSharing()===false||B===true){this.$account.hide();this.$prompt.show()}else{$j.fb(function(C){if(C.status==="connected"){this.$prompt.hide();this.$account.show()}else{this.$account.hide();this.$prompt.show()}},this)}};this.handle_undo_click=function(){this.$account.find(".j-sharing-message").hide();this.$account.find(".j-undo").hide();this.$account.find(".j-confirm-message").show();this.unshare_item()};this.handle_stopall_click=function(){$j.session.user.setSharing(false);this.unshare_item();this.toggle()};this.handle_allow_callback=function(){if(typeof this.options.onAllow==="function"){this.options.onAllow.call(this,$j.session.user)}else{if(typeof this.options.url!=="string"){this.options.url=location.href}if(typeof this.options.type!=="string"){this.options.type="article"}$j.session.user.share({type:this.options.type,url:this.options.url,connected:{callback:function(B){$j.log("you shared!",this.options.url,B)}}})}};this.unshare_item=function(){$j.session.user.unshare({})}});A.fn.fb_sharing=function(){return $j.PluginWrapper.handler($j.widget.fb.Sharing,this,arguments)}})(jQuery);(function(A){$j.widget("j_content_abusereport",function(){this.registerMixin($j.MustacheMixin);this.options={contentId:null,node:null};this._render=function(){if(!this.options.node){this.options.node=this.$root}this.append_template(this.getTemplate("base_table"),{},this.options.node);if($j.session.user.access.isEmployee()){this.getAbuseReports()}};this.getAbuseReports=function(){var B=this;var C=$j.uri($j.session.host.webRoot+"/_nv/api/content/abuseReport?contentId="+this.options.contentId);$j.jsonp(C.assemble(),this,function(D){A.each(D.response,function(E,F){F.location=window.location.origin+window.location.pathname});B.append_template(B.getTemplate("reports"),{data:(D.response).reverse()},B.options.node.find("table"))});this.$root.show()}})})(jQuery);(function(A){$j.widget("j_content_poll",function(){this.registerMixin($j.MustacheMixin);MAX_BAR_HEIGHT=100;this.options={pollId:null,hasVoted:false,userVote:null,closed:false,align:null,isBlock:null,isLongPoll:null,editor:null};this._render=function(){if(this._isRendered===false){if(this.options.align==="block"){this.options.isBlock=true}this.get_poll_data()}else{return }};this.buildOptionMap=function(F){var E=new Array();var B=F.split(",");for(var D=0;D0){B.options.hasVoted=true;B.options.userVote=E.hasVoted}B.build_poll_data(E)},{cache:false})}};this.build_poll_data=function(D){var B=this;if(B.$root.find(".j-header").length===0){D.data.closed=B.options.closed;D.data.align=B.options.align;var C=B.append_template(B.getTemplate("header"),{data:D.data},B.$root)}if(B.options.hasVoted===false&&B.options.closed===false){B.render_poll(D)}else{B.$root.find(".j-poll-results");if(B.$root.find(".j-poll-results").length>0){B.$root.find(".j-poll-results").remove()}B.render_results(D)}};this.get_poll_data=function(){var B=this;var C=$j.uri($j.session.host.getAPIPath(false,false,true)+"poll/getPoll?pollId="+this.options.pollId);$j.jsonp(C.assemble(),this,function(F){var E=new Date();var D=(E.getTime())/1000;if(D>F.data.closeDate){B.options.closed=true}if(F.data.answers.length>6){B.options.isLongPoll=true}if(B.options.hasVoted===false){B.get_voter_status(F)}else{B.build_poll_data(F)}},{cache:false})};this.render_poll=function(E){var B=this;var D=this.append_template(this.getTemplate("poll"),{data:E.data},this.$root.find(".j-header"));if(B.options.isBlock){B.render_results(E)}else{var C=this.$root.find(".j-results");A(C).show();A(C).bind("click",function(){if(B.$root.find(".j-poll-results").length>0){D.hide();B.$root.find(".j-poll-results").show()}else{B.render_results(E)}})}this.$root.find("form").submit(function(){value=B.$root.find("form input:checked").val();if(value){B.submit_vote(value)}return false})};this.submit_vote=function(D){var B=this;if(this.options.hasVoted===false){var C=$j.uri($j.session.host.getAPIPath(false,false,false)+"poll/vote.php?pollId="+this.options.pollId+"&pollAnswer="+D);$j.jsonp(C.assemble(),this,function(E){if(E.status==="success"){B.options.hasVoted=true;B.options.userVote=D;if(B.options.isBlock===true){B.$root.find(".j-poll-choices").hide()}B.get_poll_data()}})}};this.render_results=function(E){var B=this;var D=this.create_results(E);if(this.options.isLongPoll&&this.options.isBlock){var C=this.append_template(this.getTemplate("long_results"),{data:D},this.$root.find(".j-header"))}else{if(this.options.isBlock){var C=this.append_template(this.getTemplate("full_results"),{data:D},this.$root.find(".j-header"))}else{this.$root.find(".j-poll-choices").hide();var C=this.append_template(this.getTemplate("results"),{data:D},this.$root.find(".j-header"));if(this.options.hasVoted===true){this.$root.find(".j-vote").hide()}else{this.$root.find(".j-vote").bind("click",function(){C.hide();if(B.$root.find(".j-poll-choices").length>0){B.$root.find(".j-poll-choices").show()}else{B.render_poll(E)}})}}}};this.create_results=function(G){var H=this.$root.find(".j-header").width();var B=this;var E=0;var C=0;A.each(G.data.answers,function(I,J){E=E+parseInt(J.votes)});var D=new Array();A.each(G.data.answers,function(I,K){var J=Math.round((K.votes/E)*100);if(J>C){C=J}});A.each(G.data.answers,function(I,P){var N=null;if(P.optionId===parseInt(B.options.userVote)){N=true}var K=new Array();K.title=P.title;var M=0;if(E===0){K.percent=0;K.yesHeight=MAX_BAR_HEIGHT}else{M=P.votes/E;K.percent=Math.round(M*100);var L=M/C*100;var J=Math.round(L*MAX_BAR_HEIGHT);if(J===0){J=5}var O=MAX_BAR_HEIGHT-J;K.yesHeight=J;K.noHeight=O}K.isUsersVote=N;K.numVotes=P.votes;K.index=I;D.push(K)});var F={};F.answerCount=G.data.answers.length;F.colWidth=Math.floor((H-G.data.answers.length)/G.data.answers.length);F.totalVotes=E;F.answerData=D;return F}},{autoload:true})})(jQuery);