/*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<B.length;D++){A=B[D];if(A.indexOf(".")){E=A.split(".");for(C=(E[0]==this.get_root_namespace())?1:0;C<E.length;C++){F[E[C]]=F[E[C]]||{};F=F[E[C]]}}else{F[A]=F[A]||{}}}return F}};(function(){var A=false,B=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(G){var F=this.prototype;A=true;var E=new this();A=false;for(var D in G){E[D]=typeof G[D]=="function"&&typeof F[D]=="function"&&B.test(G[D])?(function(H,I){return function(){var K=this._super;this._super=F[H];var J=I.apply(this,arguments);this._super=K;return J}})(D,G[D]):G[D]}function C(){if(!A&&this._construct){this._construct.apply(this,arguments)}}C.prototype=E;C.constructor=C;C.extend=arguments.callee;return C}})();(function(B){var A=false;$j.JengaWidget=function(D,C){this.$root=null;this.options={};this._className=null;this._instanceId=null;this._mxInits=[];this._isInitialized=false;this._isRendered=false;this._construct=function(F,E){this._instanceId=$j.util.uid();this._className=E;this._createRootNode(F)};this.isRendered=function(){return this._isRendered};this.init=function(E){this._setOptions(E);this._initRootNode();this._globalInit();for(var F=0;F<this._mxInits.length;F++){(this._mxInits[F]).call(this)}this._widgetInit();this._isInitialized=true;this.refresh()};this._globalInit=function(){if(!A){this._loadGlobalCSS()}A=true};this._widgetInit=function(){};this.registerMixin=function(E,G){var H=this.init;delete this.init;E.call(this);if(this.init){var F=this.init;this._mxInits.push(function(){F.call(this,G)});delete this.init}else{}this.init=H};this.refresh=function(){var E=this;B(document).ready(function(){E._render.call(E);E._isRendered=true})};this._render=function(){};this.empty=function(){this.$root.empty()};this.getInstanceId=function(){return this._instanceId};this.getWidgetId=function(){return this.getWidgetClass()+"_"+this.getInstanceId()};this.getWidgetClass=function(){return this._className};this.updateOptions=function(E){this._setOptions(E)};this._setOptions=function(E){if(E){this.options=B.extend(true,{},this.options,E)}};this._createRootNode=function(E){this.$root=B(E)};this._initRootNode=function(){this.$root.attr("id",this.getWidgetId());this.$root.addClass(this._getWidgetPackage());this.$root.addClass(this.getWidgetClass())};this._getWidgetPackage=function(){return"j_widget"};this._loadGlobalCSS=function(){$j.session.ready(function(){var E=$j.session.host.getPeacockRoot()+"jenga/widget/global.css?v="+$j.session.host.peacockRevision;$j.loader({css:[E]})})};this.getWidgetAssetURL=function(I){var F=$j.session.host.getPeacockRoot();var H=this.getWidgetClass().replace(/\_/g,"/").replace("j/","jenga/widget/");var G=I?"."+I:"";var E="?v="+$j.session.host.peacockRevision;if($j.session.host.isDev()){E+="&rand="+Math.random()}return F+H+G+E};this.buildEventKey=function(F,E){var G=F+"."+this.getWidgetClass();if(E===true){G+="."+this.getInstanceId()}return G};this._construct(D,C)}})(jQuery);(function(A){$j.widget=function(C,B,D){$j.plugin(C,function(E){if(A.isFunction(B)){$j.JengaWidget.call(this,E,C);B.call(this)}else{A.error("Jenga WidgetPlugin does not have a valid method to call")}},D)}})(jQuery);(function(A){$j.ToggleMixin=function(){this.getMixinClass=function(){return"ToggleMixin"};this._rootIsHidden=true;this.isHidden=function(){return this._rootIsHidden};this.checkInit=function(B){if(this._isInitialized===false){this.init(B)}};this.publicFunction=function(B,C){this[B]=function(D){this.checkInit(D);C.apply(this,arguments);return this}};this.publicFunction("toggle",function(B){if(this.isHidden()===true){this.show(B)}else{this.hide(B)}});this.publicFunction("show",function(B){this._rootIsHidden=false;this.$root.show()});this.publicFunction("hide",function(B){this._rootIsHidden=true;this.$root.hide()})}})(jQuery);(function(C){var B=[];var A=false;$j.namespace("$j.mtmpl");$j.MustacheMixin=function(){var D=null;this.init=function(E){var F={loadCss:true,templateClass:this.getWidgetClass()};D=C.extend({},F,E);if(C.inArray(this.getWidgetClass(),B)>-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("<div>").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<E.size();H++){$tmpl=C(E[H]);var G=$tmpl.attr("class").replace("template_","");I[G]=$tmpl.html().trim()}}return I}catch(J){$j.log.warn("Could not load a template for "+_self.getWidgetClass()+". error=",J);return I}};this.render_template=function(G,H,E){H=H||{};H.options=C.extend(true,{},this.options,H.options);var F=C(C.mustache(G,H));if(E&&E.size()>0){E.html(F)}return F};this.append_template=function(F,G,E){var H=this.render_template(F,G);E.append(H);return H};this.render_template_partials=function(G,H,F){H=H||{};H.options=C.extend(true,{},this.options,H.options);var E=C(C.mustache(G,H,F));return E}}})(jQuery);(function(A){$j.ModalMixin=function(){this.modal=function(B,D){var C=this;var D=A.extend(true,{show:true,title:"&nbsp;",title_tag:"h1",cancel_label:"Cancel",save_label:"Save changes",scope:this,close:function(F){this.hide()},cancel:function(F){this.hide()},save:function(F){this.hide()},body:function(G,F){},header:function(F,G){if(typeof D.close==="function"){A('<a href="#" class="c-modal-close">&times;</a>').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('<button class="c-button b-save"/>').text(D.save_label).click(G,function(H){H.preventDefault();D.save.call(H.data,H)}).appendTo(F)}if(typeof D.cancel==="function"){A('<button class="c-button b-cancel"/>').text(D.cancel_label).click(G,function(H){H.preventDefault();D.cancel.call(H.data,H)}).appendTo(F)}}},D);var E=new function(){this.$modal=B;this.options=D;this.hide=function(){this.$modal.j_modal("hide",this.options)};this.show=function(){this.$modal.j_modal("show",this.options)};this.toggle=function(){this.$modal.j_modal("toggle",this.options)};if(typeof D.header==="function"&&(D.title!==""||D.close!==false)){$header=A('<div class="c-modal-header" />').appendTo(this.$modal);D.header.call(D.scope,$header,this)}if(typeof D.body==="function"){$body=A('<div class="c-modal-body" />').appendTo(this.$modal);D.body.call(D.scope,$body,this)}if(typeof D.footer==="function"&&(D.cancel!==false||D.save!==false)){$footer=A('<div class="c-modal-footer" />').appendTo(this.$modal);D.footer.call(D.scope,$footer,this)}if(this.options.show===true){this.$modal.j_modal("show",this.options)}else{this.$modal.hide()}this.reset=function(F){E.hide();B.empty();C._isRendered=false;C._render();C._isRendered=true;if(F===true){E.hide()}}};return E}}})(jQuery);(function(A){$j.namespace("$j.widget");$j.widget.AbstractWidget=Class.extend(new function(){this.instanceId=null;this.options={};this._construct=function(B){this.instanceId=$j.util.uid();this.$root=A('<div class="j_widget '+this.getClassName()+'"/>').appendTo(A(B));this.$root.attr("id",this.getWidgetNodeId())};this.destroy=function(){A(window).unbind(this.buildEventKey(""));this.$root.removeData(this.buildDataKey());this.$root.removeData(this.getClassName());this.$root.remove()};this.init=function(B){B=B||{};this.init_options(B);this.init_root_node(this.options);this.init_render()};this.init_options=function(B){if(B){this.options=A.extend(true,{},this.options,B)}};this.init_root_node=function(C){var B=C;$j.session.ready(function(){if(B.edition){this.$root.addClass("j_edition_"+B.edition)}var D=B.affiliate?"j_affiliate_"+B.affiliate:this.getWidgetAffiliate();this.$root.addClass(D)},this)};this.init_render=function(){assets=this.options.assets||{css:true};this.load(assets,function(){this.render(this.$root,this.options.nodes)})};this.getWidgetNodeId=function(){return this.getClassName()+"_"+this.getInstanceId()};this.getInstanceId=function(){return this.instanceId};this.getClassName=function(B){B=B||"_";return this.getPluginClass().toLowerCase().replace("$j","j").replace(/\./g,B)};this.getWidgetName=function(){return this.getClassName().substr(this.getClassName().lastIndexOf("_")+1)};this.getWidgetAffiliate=function(){var B=$j.session.host.getDomainRoot();if(B==="newsvine.com"){return"j_affiliate_newsvine"}else{if(B==="today.com"||B==="today.msnbc.msn.com"){return"j_affiliate_today"}else{if(B==="msnbc.msn.com"){return"j_affiliate_msnbc"}}}};this.adjustParent=function(C){if(C.closest("."+this.getClassName()).size()===0){var B=this.$root.get(0).className;C=A('<div class="'+B+'" />').appendTo(C)}return C};this.moveRoot=function(B){if(B==="parent"){}else{if(B==="append"){}else{if(B==="first_child"){if(this.$root.parent().children().size()>1){this.$root.parent().children(":first").before(this.$root)}}}}};this.getData=function(){var B=this.$root.data(this.buildDataKey());return B?B:{}};this.setData=function(B){this.$root.data(this.buildDataKey(),B)};this.get=function(C,B){var D=this.getData();if(typeof D[C]==="undefined"){return B}else{return D[C]}};this.set=function(B,D){var C=this.getData();C[B]=D;this.setData(C)};this.buildDataKey=function(){return this.getClassName()+"_data"};this.buildEventKey=function(B){return B+"."+this.getClassName()+"."+this.getInstanceId()};this.bind=function(C,D){var B=this;this.$root.bind(this.buildEventKey(C),function(){D.apply(B,arguments)})};this.trigger=function(B,C){this.$root.trigger(this.buildEventKey(B),C)};this.render=function(C,B){C=C||this.$root;B=B||this.options.nodes;this.before_render(C,B);this.build_nodes(C,B);this.render_nodes(B);this.after_render(C,B)};this.reload=function(C,B){C=C||this.$root;B=B||this.options.nodes;C.empty();this.render(C,B)};this.before_render=function(C,B){};this.after_render=function(C,B){};this.build_nodes=function(D,C){for(var B in C){this.build_node(D,B,C[B])}};this.build_node=function(E,B,D){if(!D){return }var C=D.nodeType||"div";D.$root=A("<"+C+"/>").appendTo(E);D.$root.addClass(B)};this.render_nodes=function(C){for(var B in C){this.render_node(B,C[B])}};this.render_node=function(B,C){this.custom_render("before",B,C);if(C.nodes){this.build_nodes(C.$root,C.nodes);this.render_nodes(C.nodes)}C.$root.html(C.html);this.custom_render("",B,C);this.load_plugins(C.$root,C.plugins);this.custom_render("after",B,C)};this.custom_render=function(C,B,E){var C=C?"_"+C:"";var D=this["render_"+B+C];if(D&&typeof D==="function"){D.call(this,E)}};this.load_plugins=function(C,B){if(B&&B.length>0){for(var D=0;D<B.length;D++){this.load_plugin(C,B[D])}}};this.load_plugin=function(B,C){if(!C.plugin){return }if(typeof C.plugin==="string"){C.plugin=A.fn[C.plugin]}C.method=C.method||"init";C.options=C.options||{};C.plugin.call(B,C.method,C.options)};this.getTemplatePath=function(B){var E="http:"+this.getAssetPath().replace("cdn.lib.newsvine.com","lib.newsvine.com");var D=E+B;if($j.session.uri.protocol==="https"){var C=$j.session.host.getNewsvineRoot(true)+"_api/util/jsonpload?v="+$j.session.host.peacockRevision+"&u="+D}else{var C=$j.session.host.getCDNRoot()+"/_api/util/jsonpload?v="+$j.session.host.peacockRevision+"&u="+D}return C};this.getAssetPath=function(){var B=$j.session.host.getPeacockRoot();var C=B+"jenga/widget/"+this.getWidgetName()+"/";return C.replace("http:","")};this.load=function(C,E){if(A.isFunction(C)){E=C;C={}}var C=A.extend(true,{css:false,js:false,template:false},C);var D=C;var B=E;$j.session.ready(function(){this._init_load(D,B)},this)};this.get_global_css=function(){return this.getAssetPath()+"../global.css?v="+$j.session.host.peacockRevision};this._init_load=function(B,D){if(B.css===true){B.css=[this.getAssetPath()+this.getWidgetName()+".css?v="+$j.session.host.peacockRevision,this.get_global_css()]}if(B.template===true){if(B.js===false){B.js=["//ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"]}if(B.mustache){B.js.push($j.session.host.getPeacockRoot()+"jquery/mustache.js")}var C=D;D=function(){$j.jsonp(this.getTemplatePath(this.getWidgetName()+".html"),this,function(F){if(F.status==="success"){var E=A(F.data)}else{var E=false}if(A.isFunction(C)===true){C.call(this,E)}})}}if(B.css||B.js){B.context=this;B.success=function(){D.call(this)};B.js=B.js===false?[]:B.js;B.css=B.css===false?[]:B.css;$j.loader(B)}else{if(A.isFunction(D)===true){D.call(this)}}};this.lightbox=function(B,D,C){var C=A.extend(true,{plugins:[{plugin:B,options:D}]},C);this.$root.parent().lightbox(C);this.destroy()};this.lightbox_button=function(B,E,C,D){var C=A.extend(true,{plugins:[{plugin:B,options:E}]},C);var D=A.extend(true,{label:"Log in"},D);$button=A("<button/>").appendTo(this.$root.parent());$button.text(D.label);$button.click(this,function(F){A(F.target).lightbox("show")});$button.lightbox(C);this.destroy()}});$j.widget.AbstractWidget.prototype.getPluginClass=function(){if(this.className){return this.className}else{throw ("Class Name not defined")}}})(jQuery);(function(C){var B=[];var A=function(D){return"__"+D+"__self__"};$j.plugin=function(F,D,E){var G={autoload:false};if(typeof F!=="string"){C.error("Jenga pluginName must be defined")}if(typeof D!=="function"){C.error("Jenga pluginFunction must be defined")}if(typeof E==="object"){G=C.extend({},G,E)}B.push(F);C.fn[F]=function(){var I=arguments.length>=0?arguments[0]:null;if(!I||typeof I==="object"){I="init";var H=arguments;H[0]=H.length>0?H[0]:{}}else{var H=Array.prototype.slice.call(arguments,1)}return this.each(function(M,N){var P=C(N).pluginObj(F);if(typeof P!=="object"){P=new D(N,H[0]);P._pluginName=F;C(N).data(A(F),P)}if(I==="init"){var J=C(this);var O=J.data();var K=H[0];for(var L in O){if(L.startsWith("__")===false){K[L]=O[L]}}H[0]=K}if(typeof P[I]==="function"){P[I].apply(P,H)}else{if(I==="init"){}else{C.error("JengaPlugin does not have a valid method to call ["+I+"]")}}})};if(G.autoload===true){$j.plugin.autoload("."+F,F)}};$j.plugin.autoload=function(D,E){C(document).ready(function(){if(typeof C.fn[E]==="function"){C(D).each(function(F,G){C(G)[E]({})})}})};C.fn.pluginObj=function(D){return C(this).data(A(D))};C.fn.loadPlugins=function(){var D=function(F,G){if(C(G).attr("class")){var E=C(G).attr("class").split(" ");if(E.length>0){for(var I=0;I<E.length;I++){var H=E[I];if(C.inArray(H,B)>-1&&typeof C(G).pluginObj(H)!=="object"){$j.plugin.autoload(C(G),H)}}}}};C(this).contents().andSelf().each(D);return this}})(jQuery);(function(E){$j.namespace("$j.loader");var B=[];var D="http://i.newsvine.com";$j.loader=function(G,F){if(typeof G=="object"){F=G;G="init"}new A()[G](F)};$j.loader.defaults={js:[],css:[],img:[],name:null,cdn:false,timeout:20000,success:function(){},error:function(){},complete:function(){},each:function(){},context:this};var C=document.getElementsByTagName("head")[0];function A(){var O=this,Q,K=[],M=[],L,F,H,G=[];this.init=function(R){if(!R){return }Q=E.extend({},$j.loader.defaults,R);H={js:Q.js,css:Q.css,img:Q.img};E.each(H,function(S,T){if(typeof T=="string"){T=T.split(",")}G=G.concat(T)});if(!G.length){J("error");return }if(Q.timeout){L=setTimeout(function(){var S=K.concat(M);E.each(G,function(U,T){E.inArray(T,S)==-1&&M.push(T)});J("error")},Q.timeout)}E.each(H,function(T,U){var S=Q.cdn&&!vine.session.devMachine;if(E.isArray(U)){E.each(U,function(W,V){if(S&&V.substring(0,4)!="http"){V=vine.util.appendParamToURL(D+V,"r",vine.session.revision)}N(T,V)})}else{if(typeof U=="string"){if(S&&U.substring(0,4)!="http"){U=vine.util.appendParamToURL(D+U,"r",vine.session.revision)}N(T,U)}}})};this.js=function(V,W,S){var U=E('script[src*="'+V+'"]');if(U.length){U.attr("pending")?U.bind("scriptload",W):W();return }var T=document.createElement("script");T.setAttribute("type","text/javascript");T.setAttribute("src",V);T.setAttribute("id",S);T.setAttribute("pending",1);T.onerror=P;E(T).bind("scriptload",function(){E(this).removeAttr("pending");W();setTimeout(function(){E(T).unbind("scriptload")},10)});var R=false;T.onload=T.onreadystatechange=function(){if(!R&&(!this.readyState||/loaded|complete/.test(this.readyState))){R=true;T.onload=T.onreadystatechange=null;E(T).trigger("scriptload")}};C.appendChild(T)};this.css=function(S,W,T){if(E('link[href*="'+S+'"]').length){W();return }if(typeof S!=="string"){return }if(S.indexOf("//")===0){S=location.protocol+S}var U=E('<link rel="stylesheet" type="text/css" media="all" href="'+S+'" id="'+T+'"></link>')[0];if(E.browser.msie){U.onreadystatechange=function(){/loaded|complete/.test(U.readyState)&&W()}}else{if(E.browser.opera){U.onload=W}else{if(S.indexOf("//")===0){S="http:"+S}var R=location.hostname.replace("www.",""),V=/http:/.test(S)?/^(\w+:)?\/\/([^\/?#]+)/.exec(S)[2]:R;S.indexOf("https://")===0||(R!=V&&E.browser.mozilla)?W():(function(){try{U.sheet.cssRules}catch(X){F=setTimeout(arguments.callee,20);return }W()})()}}C.appendChild(U)};this.img=function(S,T){var R=document.createElement("img");R.onload=T;R.onerror=P;R.src=S;B.push(R)};this.disable=function(R){E("#lazy-loaded-"+R,C).attr("disabled","disabled")};this.enable=function(R){E("#lazy-loaded-"+R,C).removeAttr("disabled")};this.destroy=function(R){E("#lazy-loaded-"+R,C).remove()};function N(S,R){O[S](R,function(T){T=="error"?M.push(R):K.push(R)&&Q.each(R);I()},"lazy-loaded-"+(Q.name?Q.name:new Date().getTime()))}function J(R){Q.complete.call(Q.context,R,K,M);Q[R].call(Q.context,(R=="error"?M:K));clearTimeout(L);clearTimeout(F)}function I(){if(K.length==G.length){J("success")}else{if(K.length+M.length==G.length){J("error")}}}function P(){M.push(this.src);I()}}})(jQuery);(function(A){$j.namespace("$j.PluginWrapper");$j.PluginWrapper.handler=function(E,B,C){var F=C.length>=0?C[0]:null;if(!F||typeof F==="object"){F="init"}else{C=Array.prototype.slice.call(C,1)}var D=E.prototype.getPluginClass();if(F==="getObject"){return A(B.get(0)).data(D)}else{if(F==="getSelf"){return A(B.get(0)).parent().data(D)}}return B.each(function(){var G=A(this).data(D);if(!G){var G=new E(this);A(this).data(D,G)}else{if(G&&F==="init"){return }}if(A.isFunction(G[F])){G[F].apply(G,C)}else{A.error("Method "+F+" is not a function defined by this Plugin.")}})}})(jQuery);(function(A){$j.cookie=function(E,F,C){if(arguments.length>1&&String(F)!=="[object Object]"){C=A.extend({},C);if(F===null||F===undefined){C.expires=-1}if(typeof C.expires==="number"){var H=C.expires,D=C.expires=new Date();D.setDate(D.getDate()+H)}F=String(F);return(document.cookie=[encodeURIComponent(E),"=",C.raw?F:encodeURIComponent(F),C.expires?"; expires="+C.expires.toUTCString():"",C.path?"; path="+C.path:"",C.domain?"; domain="+C.domain:"",C.secure?"; secure":""].join(""))}C=F||{};var B,G=C.raw?function(I){return I}:decodeURIComponent;return(B=new RegExp("(?:^|; )"+encodeURIComponent(E)+"=([^;]*)").exec(document.cookie))?G(B[1]):null};if(typeof A.cookie==="undefined"){A.cookie=$j.cookie}})(jQuery);(function(B){$j.date=function(D,C){if(typeof D==="object"){C=D}var C=B.extend({},C);return new function(){this.options=C;this.date=new Date();if(D){this.date.setTime(D)}this.format=function(E){return A(E,this.date.getTime())}}};$j.date.returnMonth=function(D){var C=["January","February","March","April","May","June","July","August","September","October","November","December"];return C[D-1]};$j.date.format=function(D,C){return $j.date(C).format(D)};$j.date.localLongFormat=function(E){var D=(new Date(E));var F=D.toLocaleTimeString().split(":");var C=F[0]%12;if(C=="0"){C="12"}return D.toLocaleDateString()+" "+C+":"+F[1]+(Math.floor(F[0]/12)?" pm":" am")};function A(K,I){var H=this,J,G,D=/\\?([a-z])/gi,C,E=function(M,L){if((M=M+"").length<L){return new Array((++L)-M.length).join("0")+M}return M},F=["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur","January","February","March","April","May","June","July","August","September","October","November","December"];C=function(L,M){return G[L]?G[L]():M};G={d:function(){return E(G.j(),2)},D:function(){return G.l().slice(0,3)},j:function(){return J.getDate()},l:function(){return F[G.w()]+"day"},N:function(){return G.w()||7},S:function(){var L=G.j();return L>4&&L<21?"th":{1:"st",2:"nd",3:"rd"}[L%10]||"th"},w:function(){return J.getDay()},z:function(){var M=new Date(G.Y(),G.n()-1,G.j()),L=new Date(G.Y(),0,1);return Math.round((M-L)/86400000)+1},W:function(){var M=new Date(G.Y(),G.n()-1,G.j()-G.N()+3),L=new Date(M.getFullYear(),0,4);return E(1+Math.round((M-L)/86400000/7),2)},F:function(){return F[6+G.n()]},m:function(){return E(G.n(),2)},M:function(){return G.F().slice(0,3)},n:function(){return J.getMonth()+1},t:function(){return(new Date(G.Y(),G.n(),0)).getDate()},L:function(){return new Date(G.Y(),1,29).getMonth()===1|0},o:function(){var N=G.n(),L=G.W(),M=G.Y();return M+(N===12&&L<9?-1:N===1&&L>9)},Y:function(){return J.getFullYear()},y:function(){return(G.Y()+"").slice(-2)},a:function(){return J.getHours()>11?"pm":"am"},A:function(){return G.a().toUpperCase()},B:function(){var M=J.getUTCHours()*3600,L=J.getUTCMinutes()*60,N=J.getUTCSeconds();return E(Math.floor((M+L+N+3600)/86.4)%1000,3)},g:function(){return G.G()%12||12},G:function(){return J.getHours()},h:function(){return E(G.g(),2)},H:function(){return E(G.G(),2)},i:function(){return E(J.getMinutes(),2)},s:function(){return E(J.getSeconds(),2)},u:function(){return E(J.getMilliseconds()*1000,6)},e:function(){throw"Not supported (see source code of date() for timezone on how to add support)"},I:function(){var M=new Date(G.Y(),0),O=Date.UTC(G.Y(),0),L=new Date(G.Y(),6),N=Date.UTC(G.Y(),6);return 0+((M-O)!==(L-N))},O:function(){var M=J.getTimezoneOffset(),L=Math.abs(M);return(M>0?"-":"+")+E(Math.floor(L/60)*100+L%60,4)},P:function(){var L=G.O();return(L.substr(0,3)+":"+L.substr(3,2))},T:function(){return"UTC"},Z:function(){return -J.getTimezoneOffset()*60},c:function(){return"Y-m-d\\Th:i:sP".replace(D,C)},r:function(){return"D, d M Y H:i:s O".replace(D,C)},U:function(){return J.getTime()/1000|0}};this.date=function(M,L){if(M==undefined){return }H=this;J=((typeof L==="undefined")?new Date():(L instanceof Date)?new Date(L):new Date(L*1000));return M.replace(D,C)};return this.date(K,I)}})(jQuery);(function(A){$j.namespace("$j.util");String.prototype.trim=function(){return(this.replace(/^\s*|\s*$/g,""))};String.prototype.startsWith=function(B){return(this.substr(0,B.length)==B)};String.prototype.endsWith=function(B){return(this.substr(this.length-B.length)==B)};String.prototype.urlencode=function(){return encodeURIComponent(this)};String.prototype.urldecode=function(){return decodeURIComponent(this)};String.prototype.striptags=function(){return this.replace(/<\/?[^>]+>/gi,"")};String.prototype.truncate=function(B,D){if(!B){B=300}if(this.length>B){var E=this.substring(0,B);if(E){var F=E.split(" ");var C=F.splice(0,F.length-2).join(" ");return C+(D!==undefined?D:"...")}}return this};$j.util.uid=function(){var B=A(document.body).data("jenga_util_uid");if(typeof B==="undefined"){B=0}A(document.body).data("jenga_util_uid",++B);return B};$j.util.validate_email=function(B){if(B&&B.trim()&&B.match(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/)){return true}else{return false}};$j.util.validate_domain=function(B,C){var D=60;var C=typeof C==="undefined"?4:C;if(typeof B!=="string"){return false}B=B.trim();if(B.length>=C&&B.length<=D&&!B.match(/[^a-z0-9\-]/)){return true}else{return false}};$j.util.validate_display=function(C){var D=60;var B=4;if(typeof C!=="string"){return false}C=C.trim();if(C.length>=B&&C.length<=D){return true}else{return false}};$j.util.validate_password=function(B){if(B&&B.trim()&&B.trim().length>3){return true}else{return false}};$j.util.formData=function(B){var C={jsoncallback:1};jQuery.map(A(B).serializeArray(),function(E,D){C[E.name]=E.value});return C}})(jQuery);(function(A){$j.namespace("$j.log");$j.log=function(){$j.log.console("info",arguments)};$j.log.console=function(E,B){if(typeof console==="undefined"){return }else{if(A.isFunction(console[E])===true){console[E].apply(console,B)}else{if(typeof console[E]!=="undefined"){var D=[];for(var C=0;C<B.length;C++){D[C]=B[C]}console[E](D)}}}};$j.log.warn=function(){$j.log.console("warn",arguments)};$j.log.error=function(){$j.log.console("error",arguments)};$j.log.assert=function(){$j.log.console("assert",arguments)};$j.log.dir=function(){$j.log.console("dir",arguments)}})(jQuery);(function(A){$j.uri=function(B){return new function(){this.uri=null;this.anchor=null;this.anchorParams=new Array();this.domain=null;this.host=null;this.nodes=new Array();this.params=new Array();this.password=null;this.path=null;this.port=null;this.protocol=null;this.queryString=null;this.subDomain=this.username=null;if(B){this.uri=B;var E=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?([\w=&]*)/;var C=E.exec(B);this.protocol=C[2];this.username=C[4];this.password=C[5];this.host=C[6];this.port=C[7];this.path=C[8];this.queryString=C[9];this.anchor=C[10];this.nodes=this.host.split(".");if(this.nodes.length<=2){this.domain=this.host;this.subDomain=""}else{this.domain=this.nodes.slice(-2).join(".");if(this.nodes.length==3){this.subDomain=this.nodes[0]}else{this.subDomain=this.nodes.slice(0,this.nodes.length-3)}}if(this.queryString){var G=this.queryString.split("&");for(var D=0;D<G.length;D++){var F=G[D].split("=");if(F.length==1){this.params[F[0]]=null}else{this.params[F[0]]=F[1]}}}if(this.anchor){var G=this.anchor.split("&");for(var D=0;D<G.length;D++){var F=G[D].split("=");if(F.length==1){this.anchorParams[F[0]]=null}else{this.anchorParams[F[0]]=F[1]}}}}this.isset=function(H){if(typeof (this.params[H])==="undefined"){return false}else{return true}};this.getParam=function(I,H){if(this.params[I]&&typeof this.params[I]!=="function"){return this.params[I]}else{return H?H:null}};this.setParam=function(H,I){H=typeof H==="string"?H.urlencode():H;I=typeof I==="string"?I.urlencode():I;this.params[H]=I;return this};this.clearParam=function(H){if(this.isset(H)){delete this.params[H]}return this};this.issetAnchor=function(H){if(typeof (this.anchorParams[H])==="undefined"){return false}else{return true}};this.getAnchor=function(I,H){if(typeof this.anchorParams[I]==="string"){return this.anchorParams[I]}else{return H?H:null}};this.setAnchor=function(I,J,H){I=typeof I==="string"?I.urlencode():I;J=typeof J==="string"?J.urlencode():J;this.anchorParams[I]=J;if(!H){this.assemble();location.href=this.assemble()}return this};this.clearAnchors=function(){this.anchor="";this.anchorParams=new Array();return this};this.make=function(J){var I=$j.uri(this.uri);if(typeof J==="object"){for(var H in J){I[H]=J[H]}}return I};this.assemble=function(){var L=this.protocol+"://"+(this.username?this.username+(this.password?":"+this.password:"")+"@":"")+this.host+(this.port?":"+this.port:"")+this.path;var H="";var K=false;for(var J in this.params){if(J=="in_array"||J=="indexOf"){continue}H+=(K?"&":"?")+J;H+=this.getParam(J)?"="+this.getParam(J):"";K=true}if(K){L+=H}var I="";var K=false;for(var J in this.anchorParams){if(J=="in_array"||J=="indexOf"){continue}I+=(K?"&":"#")+J;I+=this.getAnchor(J)?"="+this.getAnchor(J):"";K=true}if(K){L+=I}return L}}}})(jQuery);(function(F){$j.bind=function(e,g,f){e=e.replace(/\./g,"_").replace("$j","jenga");F(window).bind(e,function(i,h){g.call(f,h,i)})};$j.trigger=function(e,f){e=e.replace(/\./g,"_").replace("$j","jenga");F(window).trigger(e,f)};$j.unbind=function(e){e=e.replace(/\./g,"_").replace("$j","jenga");F(window).unbind(e)};$j.jsonp=function(f,g,h,e){if(typeof g==="function"){e=h;h=g;g=null}if(typeof e!=="object"){e={}}if(typeof e.cache==="undefined"){e.cache=true}if(e.cache===true){e.jsonpCallback=jenga_callbacks.registerCallback(g,f,h)}e.url=e.url?e.url:f;e.dataType="jsonp";e.crossDomain=true;e.success=e.success?e.success:function(){if(h){h.apply(g,arguments)}};e.callbackParameter="callback";P(e)};$j.jsonpload=function(f,g,h,e){if($j.session.uri.protocol==="https"){var f=$j.session.host.getNewsvineRoot(true)+"_api/util/jsonpload?u="+f}else{var f=$j.session.host.getCDNRoot()+"/_api/util/jsonpload?u="+f}$j.jsonp(f,g,h,e)};function D(){}function V(e){C=[e]}function N(i,f,g,h){try{h=i&&i.apply(f.context||f,g)}catch(e){console.info("error in jsonp callback:");console.info(e);h=!1}return h}function M(e){return/\?/.test(e)?"&":"?"}var O="async",T="charset",R="",d="error",U="insertBefore",S="_jqjsp",a="on",G=a+"click",J=a+d,Q=a+"load",Y=a+"readystatechange",A="readyState",c="removeChild",I="<script>",Z="success",b="timeout",E=window,H=F("head")[0]||document.documentElement,B=H.firstChild,X={},L=0,C,K={callback:S,url:location.href},W=E.opera;function P(h){h=F.extend({},K,h);var f=h.complete,u=h.dataFilter,w=h.callbackParameter,m=h.callback,v=h.cache,e=h.pageCache,g=h.charset,i=h.url,y=h.data,o=h.timeout,l,s=0,q=D,n,k,x,j,r;h.abort=function(){!(s++)&&q()};if(N(h.beforeSend,h,[h])===!1||s){return h}i=i||R;y=y?((typeof y)=="string"?y:F.param(y,h.traditional)):R;i+=y?(M(i)+y):R;w&&(i+=M(i)+encodeURIComponent(w)+"=?");!v&&!e&&(i+=M(i)+"_"+(new Date()).getTime()+"=");i=i.replace(/=\?(&|$)/,"="+m+"$1");function t(z){if(!(s++)){q();e&&(X[i]={s:[z]});u&&(z=u.apply(h,[z]));N(h.success,h,[z,Z]);N(f,h,[h,Z])}}function p(z){if(!(s++)){q();e&&z!=b&&(X[i]=z);N(h.error,h,[h,z]);N(f,h,[h,z])}}if(e&&(l=X[i])){l.s?t(l.s[0]):p(l)}else{E[m]=V;x=F(I)[0];x.id=S+L++;if(g){x[T]=g}W&&W.version()<11.6?((j=F(I)[0]).text="document.getElementById('"+x.id+"')."+J+"()"):(x[O]=O);if(Y in x){x.htmlFor=x.id;x.event=G}x[Q]=x[J]=x[Y]=function(z){if(!x[A]||!/i/.test(x[A])){try{x[G]&&x[G]()}catch(AA){}z=C;C=0;z?t(z[0]):p(d)}};x.src=i;q=function(z){r&&clearTimeout(r);x[Y]=x[Q]=x[J]=null;H[c](x);j&&H[c](j)};H[U](x,B);j&&H[U](j,B);r=o>0&&setTimeout(function(){p(b)},o)}return h}})(jQuery);var jenga_callbacks={registerCallback:function(B,A,D){var C="id"+A.replace("https://","").replace("http://","").replace(/[^a-zA-Z0-9]+/g,"");jenga_callbacks[C]=function(){D.apply(B,arguments)};return"jenga_callbacks."+C}};(function(A){$j.namespace("$j.ext");$j.ext.FacebookClient=new function(){this.config=null;this.isReady=false;this.isInitializing=false;this.resp=null;this.init=function(B){if(this.isInitializing){return }else{this.isInitializing=true}$j.session.ready(function(){this.config=$j.session.host.getFacebookConfig();if(!this.config.appId){return }if(typeof FB!=="undefined"){$j.ext.FacebookClient.check_FB()}else{$j.loader({js:"//connect.facebook.net/en_US/all.js",success:function(){A(document).ready(function(){document.getElementsByTagName("html")[0].setAttribute("xmlns:fb","http://www.facebook.com/2008/fbml");if(A("div#fb-root").size()===0){A(document.body).append('<div id="fb-root"/>')}$j.ext.FacebookClient.check_FB()})}})}},this)};this.check_FB=function(){if(typeof FB!=="undefined"){$j.ext.FacebookClient.init_FB()}else{setTimeout($j.ext.FacebookClient.check_FB,10)}};this.init_FB=function(){var C="/_fb/channel.html";var B=$j.session.uri.host;if(B==="www.msnbc.msn.com"){C="/id/46419312"}else{if(B==="today.msnbc.msn.com"){C="/id/46419312"}else{if(B==="video.msnbc.msn.com"){C="/channel.html"}else{if(B==="video.today.msnbc.msn.com"){C="/channel.html"}}}}var D=$j.session.uri.make({path:C}).assemble();FB.init({appId:this.config.appId,channelUrl:D,status:true,xfbml:true});FB.getLoginStatus(function(E){$j.ext.FacebookClient.updateResponse(E);$j.ext.FacebookClient.isReady=true;$j.trigger("$j.ext.fb.isReady",$j.ext.FacebookClient.resp)})};this.updateResponse=function(B){$j.ext.FacebookClient.resp=B};this.getPerms=function(){var B=$j.ext.FacebookClient.config.perms;if($j.session.user.isSharing()){B=this.addPublishActions(B)}return B};this.addPublishActions=function(B){if(typeof B==="string"&&B.indexOf("publish_actions")===-1){B+=", publish_actions"}return B};this.addPublishStream=function(B){if(typeof B==="string"&&B.indexOf("publish_stream")===-1){B+=", publish_stream"}return B};this.buildResponsePerms=function(E){var C="";if(typeof E==="object"&&E.data&&E.data.length>0){var D=E.data[0];for(var B in D){if(D[B]==1){C+=B+","}}}return C};this.checkPerms=function(B,F){if(typeof B!=="string"||typeof F!=="string"){return false}var G=B.split(",");var C=F.split(",");$j.log("request_Perms===",B,G);$j.log("responsePerms===",F,C);for(var E=0;E<G.length;E++){for(var D=0;D<C.length;D++){$j.log(G[E].trim().length,G[E].trim(),C[D].trim(),G[E].trim().length===0||G[E].trim()===C[D].trim());if(G[E].trim().length===0||G[E].trim()===C[D].trim()){break}else{if(D===C.length-1){return false}}}}return true}};$j.fb=function(C,B){if($j.ext.FacebookClient.isReady){if(C){C.call(B,$j.ext.FacebookClient.resp)}}else{if(C){$j.bind("$j.ext.fb.isReady",C,B)}$j.ext.FacebookClient.init()}};$j.fb.unshare=function(B,D){var C={connected:{scope:null,callback:function(E){}},not_connected:{scope:null,callback:function(E){}}};A.extend(C,D);$j.fb(function(E){if(E.status==="connected"){FB.api(B,"delete",function(F){C.connected.callback.call(C.connected.scope,F)})}else{C.not_connected.callback.call(C.not_connected.scope,E)}})};$j.fb.share=function(C){var B={connected:{scope:null,callback:function(E){}},not_connected:{scope:null,callback:function(E){}},data:null,path:null,type:null,action:null,url:null};A.extend(B,C);if(B.path===null&&B.type==="video"){B.path="/me/video.watches";B.data={video:B.url};B.action="watches"}else{if(B.path===null&&B.type==="article"){B.path="/me/news.reads";B.data={article:B.url};B.action="reads"}else{if(B.path===null){return false}}}$j.fb(function(E){if(E.status==="connected"){FB.api(B.path,"post",B.data,function(F){B.connected.callback.call(B.connected.scope,F);if(F&&!F.error){FB.api("/me",function(G){D(B.type,B.action,G.id,A.cookie("vid"),B.data.access_token,B.url)})}})}else{B.not_connected.callback.call(B.not_connected.scope,E)}});function D(K,H,P,F,I,J){var M="https://newscircle.msnbc.msn.com/fb/";var N="msnbc";var L=A('meta[property="og:url"]').attr("content");if(window.location.host.indexOf("today")!=-1){N="today"}var O=A.param({FbId:P,NvId:F,Token:I,url:L,app:N});var E=M+H+"/"+K+"?"+O;var G=new Image();G.src=E}};$j.fb.hasPerms=function(B,C,E,D){$j.fb(function(F){$j.log("checking hasPerms; resp.status===",F.status);if(F.status==="connected"){FB.api("/me/permissions",function(H){var G=$j.ext.FacebookClient.buildResponsePerms(H);if($j.ext.FacebookClient.checkPerms(B,G)){if(typeof C==="function"){C.call(D,F)}}else{if(typeof E==="function"){E.call(D,F)}}})}else{if(typeof E==="function"){E.call(D,F)}}})}})(jQuery);(function(A){$j.namespace("$j.ext");twttr=false;$j.ext.TWITTER_CONFIG={"newsvine.com":{appId:"L7EvKunhgfP2ld36anC1g"},"today.com":{},"msn.com":{appId:"SqwqQUUf54JHcI3QPvUVtg"}};$j.ext.TwitterConfig=function(E){if(!E){for(var D in $j.ext.TWITTER_CONFIG){host=$j.session.uri.host;if(D===host.substr(host.length-D.length)){if(!E||D.length>E.length){E=D}}}}var B=$j.ext.TWITTER_CONFIG[E];if(!B){return }for(var C in B){this[C]=B[C]}};$j.ext.TwitterClient=new function(){this.config=null;this.isReady=false;this.isInitializing=false;this.T=null;this.init=function(B){if(this.isInitializing){return }else{this.isInitializing=true}this.config=new $j.ext.TwitterConfig(B);if(!this.config.appId){return }$j.loader({js:"//platform.twitter.com/anywhere.js?v=1&id="+this.config.appId,success:function(){$j.ext.TwitterClient.check_TW()}})};this.check_TW=function(){if(twttr){$j.ext.TwitterClient.init_TW()}else{setTimeout($j.ext.TwitterClient.check_TW,10)}};this.init_TW=function(){var B=$j.session.uri.make({path:"/_tw/channel.html"}).assemble();twttr.anywhere.config({callbackURL:B});twttr.anywhere(function(C){$j.ext.TwitterClient.T=C;$j.ext.TwitterClient.isReady=true;$j.trigger("$j.ext.tw.isReady",$j.ext.TwitterClient.T)})}};$j.tw=function(C,B){if($j.ext.TwitterClient.isReady){if(C){C.call(B,$j.ext.TwitterClient.T)}}else{if(C){$j.bind("$j.ext.tw.isReady",C,B)}$j.ext.TwitterClient.init()}}})(jQuery);(function(A){$j.namespace("$j.session");$j.session.HostConfig=function(){this.isDevMachine=false;this.webRoot=null;this.logoutUrl=null;this.resetPassUrl=null;this.useHTTPS=null;this.mediaDomain=null;this.peacockPath=null;this.peacockRevision=null;this.domainName=null;this.displayName=null;this.domainRoot=null;this.regDomain=null;this.jsonServer=null;this.amazonImageServer=null;this.routingNode=null;this.domainRootLabel=null;this.sharingVariable=null;this.tokens=null;this.maxNations=0;this.ignoreStates="irx";this.groupType=null;this.init=function(){};this.initFromKeyValues=function(C){for(var B in C){this[B]=C[B]}if(typeof this.webRoot==="string"){this.webRoot=this.webRoot.replace("www.polls.newsvine.com","www.newsvine.com").replace("www.cdn.newsvine.com","www.newsvine.com")}this.init()};this.isDev=function(){return this.isDevMachine};this.getFacebookConfig=function(){return this.facebookConfig};this.getJsonServer=function(B){if(B){return this.jsonServer}return this.jsonServer.replace("polls.","")};this.getPublishServer=function(B){return this.webRoot+"/_tps/_publish/"+B};this.getRoutingNode=function(B){B=typeof B==="undefined"?"":B;if(this.isDev()||typeof HOSTCONFIG_SERVER!=="undefined"){return $j.session.uri.nodes[1]+B}else{return""}};this.getPeacockRoot=function(){return this.peacockPath};this.getMediaRoot=function(){return"http://"+this.mediaDomain};this.getCDNRoot=function(){if(this.isDev()){return this.webRoot}else{return this.getMediaRoot()}};this.getDomainRoot=function(){return this.domainRoot};this.getRegAffiliate=function(){switch(this.domainName){case"business":case"politics":case"msnbc":case"health":case"travel":case"world-news":case"technology-science":return"msnbc.msn.com";break;default:return this.getDomainRoot()}};this.getRegDomainRoot=function(){return"http://"+this.regDomain+"/"};this.getNewsvineRoot=function(B){var C=this.webRoot+"/";if(B===true&&this.useHTTPS){C=C.replace("http://","https://")}return C};this.getAPIPath=function(C,B,E){if(C===true){var D=this.getNewsvineRoot(C)}else{if(E===true){var D=this.getCDNRoot()+"/"}else{var D=this.getRegDomainRoot()}}if(B===true){D+="_nv/api/"}else{D+="_api/"}return D};this.getSizedAvatarURL=function(C,B){if(C.indexOf("/group.gif")>0){return C}return C.replace(/\/\d+x\d+/,"/"+B+"x"+B).replace(/width=\d+/,"width="+B)};this.avatarResize=function(C){var B=C.attr("width");if(B){C.attr("src",this.getSizedAvatarURL(C.attr("src"),B))}};this.getAccountSettingsPath=function(){return this.getRegDomainRoot()+"_nv/accounts/global/information?multiDomainLogin=true&affiliate="+this.getRegAffiliate()};this.getLogoutUrl=function(C){if(typeof C==="undefined"){C=location.href}if(C!==false){var B=$j.uri(this.logoutUrl);B.setParam("redirect",C);return B.assemble()}else{return this.logoutUrl}};this.getResetPassUrl=function(B,E){var C=$j.uri(this.resetPassUrl);C.setParam("email",B);C.setParam("affiliate",this.getRegAffiliate());if(E){var D=$j.uri(E);D.protocol=C.protocol;C.setParam("rdRedirect",D.assemble())}return C.assemble()};this.getUserDataUrl=function(B,D){var B=typeof B==="undefined"?false:B;var D=typeof D==="undefined"?true:D;var C=this.getAPIPath(B,false)+"user/getUserData";C+="?domainName="+this.domainName;C+="&contentId="+this.getContentId();C+="&contentType="+A('meta[name="contentType"]').attr("content");if(D!==false&&B===false){C+="&multiDomainLogin=true"}return C};this.getContentId=function(){return A('meta[name="contentId"]').attr("content")}}})(jQuery);(function(A){$j.namespace("$j.session");$j.session.Poke=function(){this.$img=false;this.pokeURL=false;this.init=function(C){this.pokeURL=C||"http://log.newsvine.com/poke.gif";if(location.protocol==="https:"){this.pokeURL=this.pokeURL.replace("http://","https://")}var B=this;A(document).ready(function(){B.$img=A("img#poke");if(!B.$img.get(0)){B.$img=A('<img id="poke" alt="Tracking Image" width="0" height="0" style="display:none;"/>').appendTo(A(document.body))}$j.trigger("$j.session.Poke.isReady")})};this.doPoke=function(D,G,E){var C=this.pokeURL+"?get="+D+"&x="+G;var F=E&&encodeURIComponent(decodeURIComponent(A.param(E)));if(F!=null){C+="&d="+F}C+="&jenga&rand="+Math.floor(Math.random()*1000000000);if(this.$img===false){var B=this;$j.bind("$j.session.Poke.isReady",function(){B.doPoke.call(B,D,G,E)})}else{this.$img.attr("src",C)}$j.trigger("jenga_poke",[[D,G,E]])}}})(jQuery);(function(A){$j.namespace("$j.session");$j.session.UserAccess=function(){this.data={};this.perms={};this.group_perms={};this.init=function(D,C,B){this.data=D;this.perms=C;this.group_perms=B};this.isEmployee=function(){return this.data.isEmployee};this.isAdmin=function(){return this.data.isAdmin};this.isFBS=function(){return true};this.SCOPE_CONTENT="content";this.SCOPE_GROUP="groups";this.GROUP_PUBLIC_DISCUSSION="_public_";this.canChangeMemberState=function(D,C,B){if(!D){$j.log("canChangeMemberState: access denied, no group provided.");return false}groupType=D.groupTypeId%100;assignerState=$j.session.user.getGroupAss(D.domainName);if(this.data.isAdmin){assignerState="s"}if(!assignerState){assignerState="x"}if(this.group_perms&&this.group_perms[groupType]&&this.group_perms[groupType][assignerState]&&this.group_perms[groupType][assignerState][B?B:""]){if((targets=this.group_perms[groupType][assignerState][B?B:""])!=null){return targets.indexOf(C)!=-1}}return false};this.getPermission=function(D,C,B){if(!this.perms){return false}if(C&&!B){return false}if(this.perms[C]&&this.perms[C][B]&&(this.perms[C][B][D]!==undefined)){return this.perms[C][B][D]}return this._getDefaultPerm(D)};this._getDefaultPerm=function(B){if(!this.perms){return false}if(this.perms.defaults&&this.perms.defaults[B]==1){return true}return false}}})(jQuery);(function(A){$j.namespace("$j.session");$j.session.User=function(){this.loginState=-1;this.email=null;this.domainName=null;this.displayName=null;this.url=null;this.avatar=null;this.affiliations=null;this.access=null;this.permissions=null;this.msnbc_sharing_optout=false;this.today_sharing_optout=false;this.sailor=true;this.lastSeen=null;this.memberSince=null;this.numArticles=0;this.numComments=0;this.numSeeds=0;this.vinacity="000000";this.groups=[];this.ignoreList=[];this.geo={zip:null,city:null,country:null};this._last_fb_postId=null;this.$event_node=false;var F=0;var E=1;var D=2;var B="Newsvine";var C="facebook:";this.init=function(){};this.initFromKeyValues=function(G){this.email=G.email||null;this.domainName=G.domainName||null;this.displayName=G.displayName||null;this.avatar=G.avatar||null;this.loginState=G.loginState?G.loginState*1:0;this.validated=G.isValidated?G.isValidated*1:0;this.url=G.url||null;this.affiliations=G.affiliation||"";this.lastPub=G.lastPub||1;this.msnbc_sharing_optout=G.msnbc_sharing_optout===true?true:false;this.today_sharing_optout=G.today_sharing_optout===true?true:false;this.sailor=G.sailor;this.geo.zip=G.zip||null;this.geo.city=G.city||null;this.geo.country=G.country||null;if(G.assumedUser){A("body").addClass("c-assumed")}this.access=new $j.session.UserAccess();if(G.access){this.access.init(G.access,(G.permissions?G.permissions:null),(G.group_permissions?G.group_permissions:null))}this.lastSeen=$j.date.format("M, Y",G.lastSeen);this.memberSince=$j.date.format("M, Y",G.memberSince);if(this.loginState){this.numArticles=G.numArticles;this.numComments=G.numComments;this.numSeeds=G.numSeeds;this.vinacity=G.vinacity;this.groups=G.groups;this.ignoreList=G.ignoreList}this.init()};this.login=function(H){var G=this.isLoggedIn();this.initFromKeyValues(H);if(G===false&&this.isLoggedIn()===true){this.trigger("login")}else{if($j.session.host.isDev()===true||$j.session.host.getRoutingNode()==="app1"){this.trigger("login")}}};this.onLogin=function(G,H){if(typeof G==="function"){H=G;G=null}this.bind("login",function(){H.call(G,this)},this)};this.onSharingSet=function(G,H){if(typeof G==="function"){H=G;G=null}this.bind("sharing_set",function(){H.call(G,this)},this)};this.getEventNode=function(){if(this.$event_node===false){try{this.$event_node=A('<div class="jenga_session_User_event_node" style="display:none;"/>').appendTo(A(document.body))}catch(G){this.$event_node=A(window)}}return this.$event_node};this.bind=function(G,I,H){this.getEventNode().bind(G,function(){I.apply(H,arguments)})};this.trigger=function(G,H){this.getEventNode().trigger(G,H)};this.isPassiveLogin=function(){if(this.loginState===D){return true}else{return false}};this.isActiveLogin=function(){if(this.loginState===E){return true}else{return false}};this.isValidated=function(){return this.isLoggedIn()&&this.validated};this.isLoggedIn=function(){if(this.loginState>F){return true}else{return false}};this.getAffiliations=function(){if(typeof this.affiliations==="string"){return this.affiliations.split(",")}else{return[]}};this.getAffiliation=function(I){var H=this.getAffiliations();for(var G in H){if(H[G]===I||(typeof H[G]==="string"&&H[G].startsWith(I))){return H[G]}}return false};this.hasAffiliation=function(G){return this.getAffiliation(G)===false?false:true};this.hasFacebookAff=function(){return this.hasAffiliation(C)};this.isSharing=function(){var G=$j.session.host.sharingVariable;if(G===null){return false}if(this.isLoggedIn()===false){return $j.cookie("sharing_optout")==="true"?false:true}if(typeof this[G]==="undefined"){return false}else{return !(this[G])}};this.isFacebookSharing=function(){if(this.isSharing()&&this.hasFacebookAff()){return true}else{return false}};this.setSharing=function(J,G){if(typeof G==="undefined"){G=false}var L=$j.session.host.sharingVariable;if(L===null){return false}if(typeof this[L]==="undefined"||typeof $j.session.host.tokens[L]==="undefined"){return false}if(J===false){$j.cookie("sharing_optout",true,{expires:3650,path:"/",domain:$j.session.host.cookieDomain})}else{$j.cookie("sharing_optout",false,{expires:-1,path:"/",domain:$j.session.host.cookieDomain})}if(this.isLoggedIn()){this[L]=!J;var K=$j.session.host.tokens[L];var H=J===true?"0":"1";var I=$j.uri($j.session.host.getAPIPath(false,true)+"users/SetToken");I.setParam("set",H);I.setParam("tokenId",K);$j.jsonp(I.assemble(),this,function(M){},{cache:false})}if(G===false){this.trigger("sharing_set")}};this.share=function(G){var H=G.connected;A.extend(G,{connected:{scope:this,callback:function(K){if(K&&K.id&&isNaN(K.id*1)===false){this.set_last_postId(K.id)}else{if(K&&K.error&&K.error.type==="OAuthException"){var J=typeof K.error.message==="string"?K.error.message:"";if(J.startsWith("(#3501)")){var I=J.split(" ");if(I.length>0&&isNaN(I[I.length-1]*1)===false){this.set_last_postId(I[I.length-1])}}}}H.callback.call(H.scope,K)}}});if(this.isFacebookSharing()){$j.fb.share(G)}};this.set_last_postId=function(G){this._last_fb_postId=G};this.unshare=function(G){if(isNaN(this._last_fb_postId*1)===false){$j.fb.unshare(this._last_fb_postId,G)}};this.stripProfanityNode=function(G){if(this.sailor){return G}A("*",G).andSelf().each(function(){if(this.nodeType==1&&A(this).text()){var H=A(this).html();var I=$j.session.user.stripProfanity(H);if(H!=I){A(this).html(I)}}})};this.stripProfanity=function(I){if(this.sailor){return I}var G="@!$%#";newtext=I.replace(/fuck|shit|asshole|cunt|cocksucker|nigger/gi,G);var H="@!$%#";newtext=newtext.replace(/matsu@\!\$%#a/ig,"matsushita");newtext=newtext.replace(/@\!\$%#rit/ig,"Shitrit");newtext=newtext.replace(/sma@\!\$%#s/gi,"smashits");newtext=newtext.replace(/al@\!\$%#eru/gi,"alshiteru");newtext=newtext.replace(/jin@\!\$%#an/gi,"jinshitan");newtext=newtext.replace(/yo@\!\$%#ake/gi,"yoshitake");newtext=newtext.replace(/s@\!\$%#/gi,"snigger");return newtext};this.getDefaultAvatar=function(){var H=$j.session.host.getCDNRoot();H+="/_vine/images/av/30x30/";var G=$j.session.host.getDomainRoot();if(G==="newsvine.com"){H+="vine.jpg"}else{if(G==="today.com"||G==="today.msnbc.msn.com"){H+="today.jpg"}else{H+="msnbc.jpg"}}return H};this.getAvatar=function(G){return this.avatar?$j.session.host.getSizedAvatarURL(this.avatar,G):this.getDefaultAvatar()};this.getGroups=function(I,H){var G=[];if(I){for(var J=0;J<this.groups.length;J++){if($j.group_actions.isInGroup(this.groups[J].ass)){G.push(this.groups[J])}}}else{G=this.groups}if(H===true){return G.slice(0,$j.session.host.maxNations)}else{return G}};this.getGroup=function(G){if(!this.isLoggedIn()){return null}for(var H=0;H<this.groups.length;H++){if(this.groups[H]&&(this.groups[H].domainName==G)){return this.groups[H]}}return null};this.getGroupAss=function(G){var H=$j.session.user.getGroup(G);return(H?H.ass:null)};this.getURL=function(){if(this.url){return this.url}else{var G="http://"+this.domainName+"."+$j.session.host.getRoutingNode(".")+"newsvine.com";return G}};this.buildLink=function(){var G=A('<a href="'+this.getURL()+'">'+this.displayName+"</a>");return G};this.getNationAvails=function(){if(this.isLoggedIn()){var G=$j.session.host.maxNations;for(var H=0;H<this.groups.length;H++){if(this.groups[H]&&($j.session.host.ignoreStates.indexOf(this.groups[H].ass)===-1)){G--}}}return G};this.getGeoLocation=function(H,I){if(typeof H==="function"){I=H;H=null}var G=this;if(this.geo.city===null){$j.session.UserLoader.getUserData(function(J){G.geo.city=J.city;G.geo.country=J.country;G.geo.zip=J.zip;I.call(H,G.geo)})}else{I.call(H,this.geo)}}};$j.session.UserLoader={isRegisteredUser:function(){if(A.cookie("vid")==null){return false}else{if(A.cookie("vid").charAt(0)!=="v"){return false}else{return true}}},getUserData:function(D,E){if(typeof D==="function"){E=D;D={}}var C=D.url||$j.session.host.getUserDataUrl(true,false);var B=this;$j.jsonp(C,function(F){E.call(this,F.data)},{cache:false})},init:function(B,C,D){if(typeof C==="function"){D=C;C={}}if($j.session.UserLoader.isRegisteredUser()===true){$j.session.UserLoader.getUserData(C,function(E){B.initFromKeyValues(E);
D()})}else{if(C.default_user){B.initFromKeyValues(C.default_user);D()}}}}})(jQuery);(function(A){$j.namespace("$j.session");A.extend($j.session,{uri:false,host:false,user:false,poke:false,reportError:false,domReady:true,isReady:false,isWindowReady:false,ready:function(D,C){if($j.session.isReady===true){try{D.call(C,$j.session.user)}catch(B){$j.log(B)}}else{$j.bind("$j.session.isReady",function(){try{D.call(C,$j.session.user)}catch(E){$j.log(E)}})}},windowReady:function(C,B){if($j.session.isWindowReady===true){C.call(B)}else{A(window).load(function(){C.call(B)})}},hostReady:function(C,B){if($j.session.host===false){$j.bind("$j.session.hostIsReady",function(){C.call(B,$j.session.host)})}else{C.call(B,$j.session.host)}},checkReady:function(){if($j.session.isReady===true){return true}else{if($j.session.host===false){return false}else{if($j.session.user===false){return false}else{if($j.session.domReady===false){return false}else{$j.session.isReady=true;$j.trigger("$j.session.isReady");return true}}}}},init_host:function(D,E){if(typeof HOSTCONFIG_SERVER!=="undefined"){var B=HOSTCONFIG_SERVER}else{if($j.session.uri.protocol==="https"){var B="https://www.newsvine.com/"}else{var B="http://www.polls.newsvine.com/"}}var C=B+"_api/hostConfig?remoteHost="+D;$j.jsonp(C,function(G){var F=new $j.session.HostConfig();F.initFromKeyValues(G);$j.session.host=F;if(typeof E==="function"){E.call(this)}$j.trigger("$j.session.hostIsReady");$j.session.checkReady()})},init_poke:function(){var B=new $j.session.Poke();B.init();$j.session.poke=function(){B.doPoke.apply(B,arguments)};$j.session.reportError=function(C){if($j.session.host&&$j.session.host.isDev()){$j.log("$j.session.reportError=",C)}};window.onerror=function(E,D,C){E=D+":"+C+":"+E;if(E.indexOf("xpopup")>-1){return }$j.session.reportError(E)}},init_user:function(){var B=new $j.session.User();$j.session.UserLoader.init(B,{default_user:{loginState:0}},function(){$j.session.user=B;$j.session.checkReady()})},refresh_user:function(C){var B=new $j.session.User();$j.session.UserLoader.init(B,{default_user:{loginState:0}},function(){$j.session.user=B;if(C){C()}})},check_jquery_version:function(){var B=A().jquery;if(B&&B.length>=3){vernum=B.substr(0,3)*1;if(vernum<1.5){$j.log("ALERT... jenga requires at least jQuery 1.5.1 or newer. Best used with 1.6.3")}else{if(vernum<1.6){$j.log("WARNING... jenga may work with 1.5.x but has only been tested with 1.6.3")}}}},init:function(){$j.log("jQuery v",A().jquery,"; jenga v",3.05);$j.session.check_jquery_version();A(window).load(function(){$j.session.isWindowReady=true});$j.session.uri=$j.uri(location.href);$j.session.init_host($j.session.uri.host,function(){$j.session.init_user()});$j.session.init_poke();A(document).ready(function(){$j.session.domReady=true;$j.session.checkReady()})}});A(window).load(function(){if($j.session.isReady===false){$j.session.isWindowReady=true;$j.session.init()}});$j.session.ready(function(B){$j.log("$j.session.isReady",$j.session);if(B.isLoggedIn()){$j.log("Hello, "+B.displayName,B)}else{$j.log("User is not logged in",B)}})})(jQuery);(function(A){$j.plugin("j_modal",function(B,C){var D={esckey:true,overlay:true,clickaway:true};this.$root=A(B);this.$overlay=false;this.options=A.extend(true,{},D,C);this.$root.addClass("j_modal");this.init=function(){this.toggle()};this.toggle=function(){if(this.$root.css("display")==="none"||this.$overlay===false){this.show()}else{this.hide()}};this.show=function(){if(this.options.esckey===true){this._keyup_bind()}if(this.options.overlay===true){this._overlay_show()}this.$root.css("display",this.$root.css("display"));this.$root.show();A("body").css("overflow","hidden")};this.hide=function(){if(this.options.esckey===true){this._keyup_unbind()}if(this.options.overlay===true){this._overlay_hide()}this.$root.hide();A("body").css("overflow","auto")};this._keyup_bind=function(){A(document).bind("keyup.j_modal",this,function(E){E.data._keyup_handle(E.keyCode)})};this._keyup_unbind=function(){A(document).unbind("keyup.j_modal")};this._keyup_handle=function(E){var F=27;if(E===F){this.hide()}};this._overlay_show=function(){this.$overlay=A('<div class="j_modal_overlay" />').appendTo(document.body);if(this.options.clickaway===true){this.$overlay.click(this,function(E){E.data.hide()})}};this._overlay_hide=function(){if(this.$overlay){this.$overlay.unbind("click");this.$overlay.remove();this.$overlay=null}}});$j.plugin("j_modal_target",function(B,C){var D=A(B);D.bind("click",function(E){E.preventDefault();A(D.attr("href")).j_modal()})},{autoload:true})})(jQuery);(function(A){$j.widget.Lightbox=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Lightbox";this.isOpen=false;this.$target=null;this.$target_overlay=null;this.$lightbox_overlay=null;this.$lightbox=null;this.options={style:"lightbox",event:"click",width:"auto",height:"auto",onClose:function(){this.hide()},nodes:{header:{close_button:true},section:{},footer:{}}};this.init=function(B){this.init_options(B);this.init_root_node(this.options);assets=this.options.assets||{css:true};this.load(assets,function(){this.$target=this.$root.parent();this.moveRoot("first_child");this.$target_overlay=this.init_target_overlay(this.$root,this.$target);this.$lightbox_overlay=this.init_lightbox_overlay(A(document.body));this.$lightbox=this.init_lightbox(A(document.body),this.options);this.target_overlay_bind({event:this.options.event});this.render(this.$lightbox,this.options.nodes)})};this.init_target_overlay=function(C,B){C=this.adjustParent(C);var D=A('<div class="target_overlay"/>').appendTo(C);C.css("position","relative");D.css("position","absolute");D.css("width",B.width());D.css("height",B.height());return D};this.init_lightbox_overlay=function(C){C=this.adjustParent(C);var B=A('<div class="lightbox_overlay"/>').appendTo(C);B.hide();B.hide();return B};this.init_lightbox=function(D,B){D=this.adjustParent(D);var C=A('<div class="lightbox"/>').appendTo(D);C.hide();if(B.style&&B.style!="lightbox"){D.parent().addClass(B.style)}if(this.auto_size_lightbox()===false){C.css("width",B.width);C.css("height",B.height)}return C};this.auto_size_lightbox=function(){if(typeof this.options.width==="number"&&typeof this.options.height==="number"){return false}else{return true}};this.center_lightbox=function(){var C=Math.floor((A(window).width()-this.$lightbox.outerWidth())/2);var B=Math.floor((A(window).height()-this.$lightbox.outerHeight())/2);this.$lightbox.css("left",C);this.$lightbox.css("top",B)};this.target_overlay_bind=function(){this.$target_overlay.bind(this.buildEventKey(this.options.event),{scope:this},function(B){B.data.scope.target_overlay_handle();return false})};this.target_overlay_unbind=function(){this.$target_overlay.unbind(this.buildEventKey(this.options.event))};this.target_overlay_handle=function(){this.show()};this.keyup_bind=function(){A(document).bind(this.buildEventKey("keyup"),{scope:this},function(B){B.data.scope.keyup_handle(B.keyCode)})};this.keyup_unbind=function(){A(document).unbind(this.buildEventKey("keyup"))};this.keyup_handle=function(B){var C=27;switch(B){case C:this.hide();break;default:break}};this.clickaway_bind=function(){this.$lightbox_overlay.click({scope:this},function(B){B.data.scope.clickaway_handle(B.target)})};this.clickaway_unbind=function(){this.$lightbox_overlay.unbind("click")};this.clickaway_handle=function(B){if(this.$lightbox_overlay.attr("class").trim()===B.className.trim()){this.hide()}};this.show=function(){this.isOpen=true;this.center_lightbox();this.$lightbox_overlay.fadeTo(350,0.7);this.$lightbox.fadeTo(350,1);this.keyup_bind();this.clickaway_bind()};this.hide=function(){this.isOpen=false;if(this.$lightbox_overlay){this.$lightbox_overlay.fadeOut(350);this.$lightbox.fadeOut(350);this.keyup_unbind();this.clickaway_unbind()}};this.render_header_before=function(B){if(B.close_button){this.render_close_button(B.$root)}};this.render_section=function(B){this.load_plugins(B.$root,this.options.plugins)};this.render_footer_after=function(B){if(B.close_button){this.render_close_button(B.$root)}};this.render_close_button=function(C){var B=A('<div class="close_button"/>').appendTo(C);B.append("<button>close</button>");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:'<img src="//www.cdn.newsvine.com/_vine/images/__/icon_peacock.png" width="20" height="14" alt="" />',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.networks.length;C++){if(this.options.networks[C].enabled===true){this.render_network($networks,this.network_template,this.options.networks[C])}}};this.render_network=function(E,B,C){var D={network:C};C.$root=A.tmpl(B,D).appendTo(E);if(C.username){this.network_is_connected(C.$root)}C.$root.find(".j-connect")["zinger_"+C.network]({scope:this,connected_callback:function(F){this.network_is_connected(C.$root);if(A.isFunction(C.connect.callback)===true){C.connect.callback.call(this)}}});C.$root.find(".j-disconnect").click(this,function(G){try{G.data.handle_disconnect_click(C)}catch(F){}return false})};this.network_is_connected=function(B){B.addClass("c-connected")};this.handle_disconnect_click=function(B){this.send_disconnect(B,function(){B.$root.removeClass("c-connected")})};this.send_disconnect=function(D,E){var B=$j.session.uri.protocol==="https";var C=$j.uri($j.session.host.getAPIPath(B,true)+"accounts/auth/"+D.network+"Login");C.setParam("delete",1);$j.jsonp(C.assemble(),this,function(F){E.call(this);if(A.isFunction(D.disconnect.callback)===true){D.disconnect.callback.call(this)}},{cache:false})}});A.fn.zinger_disconnect=function(){return $j.PluginWrapper.handler($j.widget.Zinger.Disconnect,this,arguments)}})(jQuery);(function(A){$j.fb();$j.widget.Zinger.Facebook=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger.Facebook";this.$button=null;this.$controls=null;this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/zinger/")};this.options={perms:null,scope:null,connected_callback:null,force_sharing:false,enable_sharing_checkbox:true,messages:{button_label:"Connect with Facebook"},assets:{css:true},nodes:{controls:{}}};this.getPerms=function(){if(this.options.perms===null){$j.log("getting perms from FBClient=",$j.ext.FacebookClient.getPerms());return $j.ext.FacebookClient.getPerms()}else{$j.log("using defined perms=",this.options.perms);return this.options.perms}};this.render_controls=function(B){this.$controls=B.$root;$j.fb(function(C){this.$button=A('<a class="zinger_fb_button zinger_fb_button_medium"><span class="zinger_fb_button_text">'+this.options.messages.button_label+"</span></a>").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&hellip;",subtitle:"You chose additional sharing options:",message:"<p>You must first connect your account(s) to share your thoughts further:</p>",footer:'<p>You can always change <a class="j-acct-link">Your Account Settings</a> later.</p>',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("<div/>").lightbox("close_all")});$networks=this.$root.find(".j-networks");for(var C=0;C<this.options.networks.length;C++){if(this.options.networks[C].enabled===true){this.render_network($networks,this.network_template,this.options.networks[C])}}};this.render_network=function(F,C,D){var E={network:D};var B=A.tmpl(C,E).appendTo(F);if(D.user_connected===true){this.network_is_connected(B)}B.find(".j-connect")["zinger_"+D.network]({scope:this,connected_callback:function(G){$j.log("OK TO POST MY COMMENT",this);$j.log("............... this is not done.................",this);this.network_is_connected(B);if(A.isFunction(D.connected.callback)===true){D.connected.callback.call(this)}}})};this.network_is_connected=function(B){B.addClass("c-done")}});A.fn.zinger_multiconnect=function(){return $j.PluginWrapper.handler($j.widget.Zinger.MultiConnect,this,arguments)}})(jQuery);(function(A){$j.widget.Zinger.Newsvine=$j.widget.AbstractWidget.extend(new function(){this.className="$j.widget.Zinger.Newsvine";this.$header=null;this.$footer=null;this.$status=null;this.$enter_email_form=null;this.$enter_password_form=null;this.$enter_displayname_form=null;this.$enter_reset_form=null;this.VIEW_ENTER_EMAIL=1;this.VIEW_ENTER_PASSWORD=2;this.VIEW_ENTER_DISPLAYNAME=3;this.VIEW_RESET_PASS=4;this.VIEW_RESET_DONE=5;this.check_displayname_value="";this.getAssetPath=function(){return this._super().replace("/"+this.getWidgetName()+"/","/zinger/")};this.options={messages:{email:"&hellip;or just your e-mail address:",displayName:'<h2 class="success">Great!</h2> <p> Now we just need to know what name you\'d like to have on the site (e.g. John Smith, antelope123, Tim from Seattle):</p>',password:'<h2 class="success">Excellent!</h2> <p>It looks like you already have an account registered with <span class="email">that email address</span>.</p><p> Please type in your password below:</p>',reset_pass:"<p>Enter the e-mail address you registered with and we will send you an e-mail to reset your password. </p>",reset_done:"<p>An e-mail has been sent to your Inbox. Please follow the instructions in the email to reset your password.</p>"},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:'<a href="#">Forgot your password</a>?'},register_new:{html:'<a href="#">Register a new account</a>.'},contact_us:{html:'<a href="http://www.newsvine.com/_nv/cms/info/contact?subj=loginproblem">Contact us</a> to report a problem.'},start_over:{html:'Or, <a href="#">start over</a>.'}}}}};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('<input type="text" class="email" name="email" placeholder="you@email.com" />');this.$enter_email_form.append('<input type="submit" name="submit" value="Submit" />');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('<input type="email" class="email" name="email" placeholder="you@email.com" />');this.$enter_reset_form.append('<input type="submit" name="submit" value="Send Email" />');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('<input type="password" class="password" name="password" placeholder="Password" />');this.$enter_password_form.append('<input type="submit" name="submit" value="Submit" />');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('<input type="text" class="displayName" name="displayName" placeholder="Your Public Name" />');this.$enter_displayname_form.append('<input type="submit" name="submit" value="Submit" />');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+="<div>"+B+"</div>"}}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+="<div>"+B+"</div>"}}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:'<h2 class="success">Great!</h2> <p>Now we just need your e-mail address to complete the connect:</p>',reset_pass:"<p>Enter the e-mail address you registered with and we will send you an e-mail to reset your password. </p>",reset_done:"<p>An e-mail has been sent to your Inbox. Please follow the instructions in the email to reset your password.</p>"},nodes:{header:{},controls:{nodes:{enter_email:{nodeType:"form"},connect:{nodeType:"form"},enter_resetpass:{nodeType:"form"}}},status:{},footer:{nodes:{reset_password:{html:'<a href="#">Forgot your password</a>?'},start_over:{html:'Or, <a href="#">start over</a>.'}}}}};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('<img src="'+this.options.img_url+'" alt="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('<input type="text" class="email" name="email" placeholder="you@email.com" />');this.$enter_email_form.append('<input type="submit" name="submit" value="Submit" />');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('<input type="email" class="email" name="email" placeholder="you@email.com" />');this.$enter_reset_form.append('<input type="submit" name="submit" value="Send Email" />');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('<a href="#continue">Continue on to story</a>').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(){$('<div class="j-fb-sharing-prompt" />').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;D<B.length;D++){var C=B[D].split(":");E[C[0]]={votedOptionId:C[0],userCommented:C[1]}}return E};this.getVotedOptionFromMap=function(B,D){for(var C=0;C<D.data.answers.length;C++){if(B[D.data.answers[C].optionId]!=null){return B[D.data.answers[C].optionId]}}return null};this.get_voter_status=function(E){var B=this;var G=$j.cookie("voter");if(G){var D=B.buildOptionMap(G);var C=B.getVotedOptionFromMap(D,E);if(C!==null){B.options.hasVoted=true;B.options.userVote=parseInt(C.votedOptionId);B.build_poll_data(E)}}if(B.options.hasVoted===false){var F=$j.uri($j.session.host.getAPIPath(false,false,false)+"poll/hasVoted?pollId="+B.options.pollId);$j.jsonp(F.assemble(),this,function(H){if(H.hasVoted>0){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);