BF_js_version="1.0.0";BF_XSS={request:function(b){var d=BF_server+b.script;d+="?version="+BF_js_version;for(name in b.params){d+="&";var c=b.params[name];d+=escape(name)+"="+escape(c)}var a=document.createElement("script");a.src=d;document.getElementsByTagName("body")[0].appendChild(a)},swift_injection:function(b){var a=document.createElement("script");a.src=b;document.getElementsByTagName("head")[0].appendChild(a)},badge:function(args){if(BF_XSS.__open_badge){BF_XSS.__open_badge.style.display="none"}if(args.close==true){BF_XSS.__close_badge=true;return}if(BF_XSS.__close_badge){BF_XSS.__close_badge=false;return false}var target=args.target;var json_data=unescape(target.getAttribute("rel:bf_data"));this.obj=eval("("+json_data+")");var div_id=this.obj.buzz_id+"_"+this.obj.badge_type;if(!document.getElementById(div_id)){var div=document.createElement("div");div.id=div_id;div.className="badge-tip badge-"+this.obj.badge_type;args.target.appendChild(div);var spinner=document.createElement("div");spinner.className="spinner";spinner.innerText=" ";div.appendChild(spinner)}if(BF_XSS.__open_badge&&BF_XSS.__open_badge.id==div_id){BF_XSS.__open_badge=null;return true}BF_XSS.__open_badge=document.getElementById(div_id);BF_XSS.__open_badge.style.display="block";BF_XSS.request({script:"_badge",params:{element_id:div_id,json:json_data}});return false},stats_response:function(g,f){if(typeof f=="undefined"){f=BF_XSS.buzz_id}var h=document.getElementById(f+"_top_linking_sites");if(h){for(var e=0;e<g.domains.length;e++){if(g.domains[e]){var b=document.createElement("li");var c=document.createElement("a");c.setAttribute("href","http://"+g.domains[e]["domain"]);c.appendChild(document.createTextNode(g.domains[e]["domain"]));b.appendChild(c);h.appendChild(b)}}}h=document.getElementById(f+"_total_views");if(g.impressions&&g.impressions.length>0){var d=g.impressions[0]["total"]+"";d=d.replace(/(\d)(\d{3,3})?(\d{3,3})?(\d{3,3})?(\d{3,3})?(\d{3,3})?(\d{3,3})$/,"$1,$2,$3,$4,$5,$6,$7");d=d.replace(/,{2,}/,",");if(h){h.appendChild(document.createTextNode(d))}}if(g.pie){BF_XSS.update_chart(g.pie,f+"_chart")}},update_chart:function(d,f){var f=document.getElementById(f);var c=f.getAttribute("width");if(!c){c=50}var a=f.getAttribute("height");if(!a){a=40}var b=document.createElement("img");var e="http://chart.apis.google.com/chart?chs="+c+"x"+a+"&chd=t:"+d+","+(100-d)+"&cht=p3&chco=0077ee,ee3322&chf=bg,s,0d0d0d";b.src=e;f.appendChild(b);f.className="chart"}};var BuzzLoader=function(){var b=false;var a={p1:[],p2:[],p3:[],p4:[],p5:[],p6:[],p7:[],p8:[],p9:[],p10:[],user:[]};var c=function(){var d;for(d=1;d<=10;d++){a["p"+d].each(function(g){try{g()}catch(f){}})}b=true;a.user.each(function(e){e()})};return{waitForDOM:function(){if(Prototype.Browser.IE){if(!$("buzz-body")){setTimeout("BuzzLoader.waitForDOM();",100)}else{c()}}else{document.observe("dom:loaded",c)}},callLoaded:function(d){if(b){d()}else{a.user.push(d)}},register:function(e,d){if(d>10||d<1){return 0}a["p"+d].push(e);return 1},register_injection:function(d,e){return BuzzLoader.register(function(){setTimeout(function(){BF_XSS.swift_injection(d)},1)},e)}}}();BuzzLoader.waitForDOM();BFW_COOKIE="bf2-b";BFW_INFO_COOKIE="bf2-b_info";DEFAULT_USER="default_user";var BF_User=function(){this.isLoggedIn=function(){if(BFW_Util.getCookie(BFW_COOKIE)){return true}else{return false}};this.getSessionKey=function(){return BFW_Util.getCookie(BFW_COOKIE)};this.logout=function(a){BFW_Util.deleteCookie(BFW_COOKIE);BFW_Util.deleteCookie(BFW_INFO_COOKIE);BFW_Util.deleteCookie(DEFAULT_USER);if(!a){window.location.reload()}};this.getUserInfo=function(){var a=BFW_Util.getCookie(BFW_INFO_COOKIE);var c=BFW_Util.getParameters({str:a,escape:true});var b=BFW_Util.getCookie(DEFAULT_USER);if(c&&b){c.default_user=BFW_Util.getParameters({str:b,escape:true})}return c||{}};this.load_user_settings=function(){if(this.isLoggedIn()&&(!this.getUserInfo().username||this.getUserInfo().username!=this.getUsernameFromSession())){try{var c=new BF_Login({action:"userdata"});c.init({action:"userdata"});c.cookieLogin()}catch(b){console.error(b)}}else{if(this.isLoggedIn()&&bf_username==this.getUserInfo().username&&!document.location.href.match(/\/submissions\//)){var a=document.createElement("script");a.src=bf_sr+"/js/public/contribute/user_settings.js?"+BF_STATIC.version;document.getElementsByTagName("body")[0].appendChild(a);var a=document.createElement("script");a.src=bf_sr+"/js/public/contribute/user_post.js?"+BF_STATIC.version;document.getElementsByTagName("body")[0].appendChild(a)}}};this.getUsernameFromSession=function(){var a=BFW_Util.getCookie(BFW_COOKIE);b="";if(a){var b=a.substring(64,a.length)}return b}};var BFW_Util={getCookie:function(a){var b=document.cookie.match(new RegExp("(^|;)\\s*"+encodeURIComponent(a)+"=([^;\\s]*)"));return(b?decodeURIComponent(b[2]):null)},deleteCookie:function(c,e){var f=new Date();f.setTime(f.getTime()-1000000000);var b="; expires="+f.toGMTString();var a=decodeURIComponent(c)+"="+b+"; path=/";if(e){a+="; domain=."+e}else{a+="; domain=.buzzfeed.com"}document.cookie=a},setCookie:function(c){var f=1000*60*60*24*365;if(c.seconds||c.seconds==0){f=c.seconds*1000}var e=new Date();e.setTime(e.getTime()+f);var b="";if(f>0){b="; expires="+e.toGMTString()}var a=encodeURIComponent(c.name)+"="+encodeURIComponent(c.value)+b+"; path=/";if(c.host){a+="; domain=."+c.host}else{a+="; domain=.buzzfeed.com"}document.cookie=a},setInfoCookie:function(a){var b=a.value;b.isa=(b.p_admin)?"true":"false";if(b.f_index){b.f_index="true"}if(b.user_switching&&BFW_Util.getCookie(DEFAULT_USER)==null){b.user_switching="true";BFW_Util.setCookie({name:DEFAULT_USER,value:$H({display_name:encodeURIComponent(b.display_name),userid:b.userid,id:b.userid,username:encodeURIComponent(b.username),session_key:b.session_key,p_alias:b.p_alias,p_admin:b.p_admin,image:encodeURIComponent(b.image)}).toQueryString()})}BFW_Util.setCookie({name:BFW_INFO_COOKIE,value:$H(b).toQueryString()})},updateInfoCookie:function(c){var a=(new BF_User()).getUserInfo();for(var b in a){if(typeof c[b]!="undefined"){a[b]=c[b]}}BFW_Util.setCookie({name:BFW_INFO_COOKIE,value:$H(a).toQueryString()})},getParameters:function(a){var b={};var d=null;if(a&&a.str){d=a.str}if(!d){d=window.location.toString();if(d.indexOf("?")>-1){d=(d.split("?"))[1]}else{d=null}}if(!d||d==null){return}d=d.replace(/&amp;/g,"&");var c=d.split("&");c.each(function(f){f=f.split("=");if(a&&a.escape){f[1]=unescape(f[1])}if(b[f[0]]){if(typeof(b[f[0]])=="string"){var e=new Array();e[0]=b[f[0]];e[1]=f[1];b[f[0]]=e}else{b[f[0]].push(f[1])}}else{b[f[0]]=f[1]}});return b}};function Tracker(){this.entries=[];this.registered=new Array();this.url=encodeURIComponent(window.location.toString());this.referrer=encodeURIComponent(document.referrer.toString());this.network_cookie=BFW_Util.getCookie("BUZZ_WIDGET");if(this.network_cookie&&window.location.href.match(this.network_cookie)){this.url+=encodeURIComponent("?w=1");BFW_Util.deleteCookie("BUZZ_WIDGET")}this.defaults={c:"",u:"",type:"",user:"",buzz:"",query:"",url:this.url,referrer:this.referrer};this.cloud=Cloud.servers[Math.floor(Math.random()*Cloud.servers.length)];this.source="http://"+this.cloud+"/small.gif?type="}Tracker.gClick=function(a){if(typeof _gaq!="undefined"&&_gaq!=null){_gaq.push(["_trackPageview",a,"clicked"])}};Tracker.prototype={setDefaults:function(a){for(key in a){this.defaults[key]=a[key]}},add:function(a,b){entry={};for(key in this.defaults){entry[key]=this.defaults[key]}valid=true;for(key in a){entry[key]=a[key]}if(b){unique_cookie=BFW_Util.getCookie("BF-U");if(unique_cookie){unique_cookie=unique_cookie.split(",");if(unique_cookie.indexOf(b)!=-1){valid=false}else{unique_cookie.unshift(b)}if(unique_cookie.length>100){unique_cookie=unique_cookie.slice(0,99)}BFW_Util.setCookie({name:"BF-U",value:unique_cookie.join()})}else{BFW_Util.setCookie({name:"BF-U",value:b})}}if(valid){this.entries.push(entry)}},run:function(c){if(this.entries.length){var b=this.entries.find(function(d){return d.type==100});if(b&&b.query&&!b.query.match(/buzzfeed.com/)){this.entries.unshift({buzz:b.user,user:b.user,c:b.u,u:b.u,type:this.types.VXN_CLICK_IN,types:[this.types.VXN_CLICK_IN],domain:"",query:"",url:""});this.entries.unshift({buzz:"buzz",user:"buzz",c:"7BA7",u:"7BA7",type:this.types.VXN_CLICK_OUT,types:[this.types.VXN_CLICK_OUT],domain:"",query:"",url:""})}else{this.entries=this.entries.without(b);if(!this.entries.length){return false}}if(document.location.href.match(/debug/)){console.log("Tracking "+this.entries.length+" entry positions");this.entries.each(function(f){var d={};["buzz","query","type","user"].each(function(e){if(f[e]){d[e]=f[e]+"";d[e]=d[e].split(",").first()}});if(d.type==30||d.type==35&&d.query){console.log([d.user,d.buzz,tracker.positions[d.query]])}else{if(f.type==""){console.log([d.user,d.buzz,"Primary page impression"])}else{if(f.type=="12"){console.log([d.user,d.buzz,"Unique page impression"])}else{console.log([d.user,d.buzz,f.type])}}}})}if(this.entries.length==1&&this.entries[0].type==""&&this.entries[0].referrer!=""&&!this.entries[0].referrer.match(/buzzfeed\.com/)){this.entries[0].referrer=window.location.href}list=this.entries.shift();if(list.type!=""){list.referrer=""}different={};last=Object.clone(list);multiple=false;while(this.entries.length){multiple=true;entry=this.entries.shift();if(entry.type!=""){entry.referrer=""}for(key in list){list[key]+=","+entry[key];if(!different[key]&&last[key]!=entry[key]){different[key]=1}}}if(multiple){for(key in list){if(!different[key]&&key!="type"){list[key]=list[key].replace(/,.*$/,"")}}}var a=new Image;a.src=this.source+list.type+"&user="+list.user+"&buzz="+list.buzz+"&url="+list.url+"&query="+list.query+"&referrer="+list.referrer+"&c="+list.c+"&u="+list.u+"&z="+(new Date).getTime()}},track:function(){if(!this.tracker.registered[this.index].data_obj){this.tracker.registered[this.index].data_obj=JSON.parse(this.tracker.registered[this.index].data)}if(!this.tracker.registered[this.index].events[this.event].data_obj){this.tracker.registered[this.index].events[this.event].data_obj=JSON.parse(this.tracker.registered[this.index].events[this.event].data)}$H(this.tracker.registered[this.index].events[this.event].data_obj).each(function(pair){if(pair.key=="callback"){try{eval(pair.value+"("+this.tracker.registered[this.index].data+");")}catch(e){}return true}if(!Object.isArray(pair.value)){pair.value=[pair.value]}pair.value.each(function(query){data=Object.clone(this.tracker.registered[this.index].data_obj);data.type=this.tracker.types[pair.key];data.query=query;this.tracker.add(data)}.bind(this))}.bind(this));if(this.run){this.tracker.run()}},trackSiteClick:function(e){el=e.element();if(e.srcElement){el=e.srcElement}else{if(e.currentTarget){el=e.currentTarget}}if(el.tagName&&el.tagName.toLowerCase()=="img"&&el.parentNode&&el.parentNode.tagName.toLowerCase()=="a"){el=el.parentNode}track_data=eval("("+el.getAttribute("track")+")");if(!track_data){return true}var external_click=false;if(!el.href.match(/buzzfeed.com/)){external_click=true;track_data.referrer=encodeURIComponent(el.href);Tracker.gClick("/_ga/link/"+el.href.replace(/http(s)?:\/\//,""))}ctracker=new Tracker();for(i=0;i<track_data.types.length;i++){track_data.type=track_data.types[i];if(typeof track_data.queries!="undefined"&&track_data.queries[i]){track_data.query=track_data.queries[i]}else{if(external_click){track_data.query=encodeURIComponent(el.href)}else{track_data.query=""}}ctracker.add(track_data)}ctracker.run()},attach:function(){if(arguments&&arguments.length>0){base_el=$(arguments[0])}else{base_el=document}var a=function(c){var d=c.getAttribute("track");var b={data:d,events:{}};this.registered.push(b);this.events.each(function(f){b.events[f]={};var e=c.readAttribute("track_"+f);if(e){b.events[f].data=e;if(f=="load"){this.track.bind({tracker:this,event:f,index:(this.registered.length-1)})()}else{Event.observe(c,f,this.track.bind({tracker:this,event:f,index:(this.registered.length-1),run:true}))}}},this);$A(c.getElementsByTagName("A")).each(function(e){e.setAttribute("track",d);Event.observe(e,"mousedown",Tracker.prototype.trackSiteClick)});c.removeClassName("track")}.bind(this);universal_dom.assign_handler({bucket:"track",handler:a});this.run()},registered:[],events:["load","mousedown","mouseover","submit"],positions:["","Header","Homepage Flow","B-Page Viral Alert","Index Sidebar","B-Page Sidebar","C-Page Sidebar","Non-ad Flow","Non-ad Header","Non-ad Sidebar Partner","Non-ad Sidebar Raw","Non-ad Sidebar Badge","Non-ad Permalink Flow","Non-ad Clickable Sidebar","Non-ad Related Buzz","Non-ad Viral Related Unit","Viral Related Unit","Bottom-Of-Page Promo","Multi Homepage Flow","Valley of The Nerds","AOL Related Promo","Targeted-B","Targeted-C","Targeted-A"],types:{REFERRER_DIRECT:0,REFERRER_INTERNAL:1,REFERRER_LINK:2,REFERRER_SEARCH:3,REFERRER_NETWORK:4,SHARE_EMAIL:5,SHARE_FACEBOOK:6,SHARE_STUMBLE:7,SHARE_DELICIOUS:8,SHARE_DIGG:9,SHARE_REDDIT:10,SHARE_MIXX:11,SHARE_TWITTER:15,SHARE_FARK:16,SHARE_MYSPACE:17,SHARE_REBUZZ:18,SHARE_RESERVED4:19,SHARE_RESERVED5:20,UNIQUE_VISIT:12,WIDGET_IMPRESSION:13,WIDGET_CLICK:14,BUZZBOX_IMPRESSION:21,BUZZBOX_CLICK:22,VXN_CLICK_OUT:23,VXN_CLICK_IN:24,BUZZBOX_RES4:25,BUZZBOX_RES5:26,BUZZBOX_RES6:27,BUZZBOX_RES7:28,BUZZBOX_RES8:29,PROMO_IMPRESSION:30,PROMO_AD_IMP:31,BOOST_IMPRESSION:32,PROMO_IMP_RES3:33,PROMO_IMP_RES4:34,PROMO_CLICK:35,PROMO_AD_CLICK:36,BOOST_CLICK:37,PROMO_CLICK_RES3:38,PROMO_CLICK_RES4:39,SITE_CLICK:100}};POLLER_CALLBACK_LOOKUP=new Object();function poller_call_back(b,a){var c=POLLER_CALLBACK_LOOKUP[b];var d=c.callback;if(!c||!c.callback){console.error("no poller callback function defined with key: %s",b);return}else{c.poller.stop_polling();c.callback(a)}}function set_poller_trigger(){var e=5000;var c=new Date();c.setTime(c.getTime()+e);var b="";b="; expires="+c.toGMTString();var a="BUZZ_POLLER_COOKIE=true"+b+"; domain=.buzzfeed.com; path=/static/js/poller";document.cookie=a}cookie_poller=function(){this.active=false;this.count=0;this.start=function(a){this.active=true;this.count=0;cookie_poller_active=true;if(!a||!a.callback_string||!a.poll_url||!a.pollid){this.usage();return}this.callback_string=a.callback_string;this.callback_arguments=a.arguments;this.poll_url=a.poll_url;this.pollid=a.pollid;this.poll()};this.add_poller_callback=function(a,c,b){POLLER_CALLBACK_LOOKUP[a]={callback:c,poller:this}};this.poll=function(f){this.count++;if((this.count*500)>(1000*10*60)){this.active=false}if(this.active==true){var e=this.poll_url;e+="?version="+(new Date()).getTime();e+="&callback="+escape(this.callback_string);e+="&pollid="+this.pollid;if(this.callback_arguments){var d=escape(Object.toJSON(this.callback_arguments));e+="&args="+d}var c=document.createElement("script");c.src=e;var a=document.getElementsByTagName("body")[0];if(a){a.appendChild(c)}var b=function(){this.poll()}.bind(this);setTimeout(b,500)}};this.stop_polling=function(){this.active=false;this.count=0};this.usage=function(){var a="usage: cookie_poller.poll( {callback_string: 'afunction', poll_url: 'http://example/js/poll.js, pollid: 'a_unique_id', [ arguemnts: {} ] } )";console.error(a);console.error("cookie_poller.poll() needs a callback_string, a XSS poller url, a unique id and an optional arguments hash")}};var ABTestList=new Array();var ABTest=function(){this.testid=null;this.element=null;this.selected_test=null;this.test_units=[];this.num_clicks;this.init=function(a){this.testid=a.testid;this.element=a.element;this.test_units=a.test_units;this.selected_test=this.test_units[Math.floor(Math.random()*this.test_units.length)];this.num_clicks=0;this.register_events(this.selected_test);ABTestList.push(this)};this.clicked=function(a){Tracker.gClick("/_ga/click/abtest/"+this.testid+"/"+a)};this.register_events=function(){var a=$(this.element);if(a){a.addClassName(this.selected_test.className);Event.observe(a,"mousedown",function(d){var c=Event.element(d);if(c.tagName=="IMG"){c=c.parentNode}if(c.tagName=="A"||c.tagName=="INPUT"||c.tagName=="BUTTON"){if(this.num_clicks!="5+"&&this.num_clicks<4){this.num_clicks+=1}else{this.num_clicks="5+"}var b=c.getAttribute("rel:abtrack_id");if(b==null){b=c.tagName}this.clicked(this.selected_test.analytics_url+"/click/"+b+"/"+this.num_clicks)}}.bind(this))}};this.register_impression=function(){Tracker.gClick("/_ga/click/abtest/"+this.testid+"/"+this.selected_test.analytics_url+"/impression")}};var TT_Filters={round:function(a){return Math.round(a)},floor:function(a){return Math.floor(a)},ceil:function(a){return Math.ceil(a)},add_commas:function(a){a+="";a=a.replace(/(\d)(\d{3,3})?(\d{3,3})?(\d{3,3})?(\d{3,3})?(\d{3,3})?(\d{3,3})$/,"$1,$2,$3,$4,$5,$6,$7");a=a.replace(/,{2,}/,",");return a},upper:function(a){return a.toUpperCase()},lower:function(a){return a.toLowerCase()},ucfirst:function(a){return a.toString().substring(0,1).toUpperCase()+a.substring(1,a.length)},lcfirst:function(a){return a.toString().substring(0,1).toLowerCase()+a.substring(1,a.length)},titleCase:function(d){if(!d||d==""){return""}var b=d;var c=b.split(" ");var a=new Array("and","the","to","for","is","in","a","at","an","from","by","if","of");for(i=0;i<c.length;i++){if(i==0){c[i]=(c[i].substring(0,1)).toUpperCase()+c[i].substring(1)}else{if(a.indexOf(c[i])<0){c[i]=(c[i].substring(0,1)).toUpperCase()+c[i].substring(1)}}}retval=c.join(" ");return retval},quoteCase:function(b){if(!b||b==""){return""}var a=b.toLowerCase();a=a.replace(/^("*)/,"");a=a.replace(/("*)$/,"");return'"'+this.ucfirst(a)+'"'},trim:function(a){return a.toString().replace(/^\s+/,"").replace(/\s+$/,"")},collapse:function(a){return a.toString().replace(/^\s+/,"").replace(/\s+$/,"").replace(/\s+/g," ")},html:function(a){if(a){return a.toString().replace(/&/g,"&amp;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;")}},link:function(a){if(a){return a.toString().replace(/&/g,"&amp;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;").replace(/"/g,"").replace(/\s/g,"%20")}},js:function(a){if(a){return a.toString().replace(/'/g,"").replace(/\n|\r/g,"")}},html_entity:function(a){return"HTML_ENTITY: not implemented.  see http://www.w3.org/TR/REC-html40/sgml/entities.html"},html_para:function(a){return a.toString().replace(/\n+/g,"<p>")},html_break:function(a){return a.toString().replace(/\n+/g,"<br><br>")},html_line_break:function(a){return a.toString().replace(/\n/g,"<br>")},uri:function(a){return escape(a)},unescape_uri:function(a){a=a.replace(/\+/g," ");return unescape(a)},indent:function(e,d){if(!d){d="    "}var a=e.split(/\n/);var b="";for(var c=0;c<a.length;c++){a[c]=a[c].toString().replace(/^/g,d)}return a.join("\n")},truncate:function(b,a){if(b){if(!a){a=32}if(b.length<=a){return b}return b.toString().substring(0,a-3)+"..."}},repeat:function(d,c){if(!c){c=1}var a=d;for(var b=c-1;b>0;b--){a+=d}return a},remove:function(c,a){if(!a){return c}var b=new RegExp(a,"g");return c.toString().replace(b,"")},replace:function(d,a,b){if(d){if(!a){return d}if(!b){b=""}var c=new RegExp(a,"g");d=d.toString().replace(c,b)}return d},strftime:function(e,a){var b=new Date();var d=e;if(e<10000000000){d=e+"000"}b.setTime(d);for(var c in TT_strftime_funks){if(c.length==1){a=a.replace("%"+c,TT_strftime_funks[c](b))}}return a},alert:function(a){alert(a);return""},clean_entities:function(a){if(a){return TT_cleanEntities(a)}},html_noentities:function(a){if(a){return a.toString().replace(/\</g,"&lt;").replace(/\>/g,"&gt;").replace(/"/g,"&quot;")}},html_entities:function(a){return TT_cleanEntities(a).toString().replace(/\</g,"&lt;").replace(/\>/g,"&gt;")}};TT_strftime_funks={zeropad:function(a){return a>9?a:"0"+a},a:function(a){return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][a.getDay()]},A:function(a){return["Sunday","Monday","Tuedsay","Wednesday","Thursday","Friday","Saturday"][a.getDay()]},b:function(a){return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][a.getMonth()]},B:function(a){return["January","February","March","April","May","June","July","August","September","October","November","December"][a.getMonth()]},c:function(a){return a.toString()},d:function(a){return this.zeropad(a.getDate())},H:function(a){return this.zeropad(a.getHours())},I:function(a){return(a.getHours()==12||a.getHours()==0)?12:this.zeropad((a.getHours()+12)%12)},i:function(a){return(a.getHours()==12||a.getHours()==0)?12:(a.getHours()+12)%12},m:function(a){return this.zeropad(a.getMonth()+1)},M:function(a){return this.zeropad(a.getMinutes())},p:function(a){return this.H(a)<12?"am":"pm"},S:function(a){return this.zeropad(a.getSeconds())},w:function(a){return a.getDay()},y:function(a){return this.zeropad(this.Y(a)%100)},Y:function(a){return a.getFullYear()},"%":function(a){return"%"}};function TT_cleanEntities(d){var c={160:"nbsp",161:"iexcl",164:"curren",162:"cent",163:"pound",165:"yen",166:"brvbar",167:"sect",168:"uml",169:"copy",170:"ordf",171:"laquo",172:"not",173:"shy",174:"reg",8482:"trade",175:"macr",176:"deg",177:"plusmn",178:"sup2",179:"sup3",180:"acute",181:"micro",182:"para",183:"middot",184:"cedil",185:"sup1",186:"ordm",187:"raquo",188:"frac14",189:"frac12",190:"frac34",191:"iquest",215:"times",247:"divide",192:"Agrave",193:"Aacute",194:"Acirc",195:"Atilde",196:"Auml",197:"Aring",198:"AElig",199:"Ccedil",200:"Egrave",201:"Eacute",202:"Ecirc",203:"Euml",204:"Igrave",205:"Iacute",206:"Icirc",207:"Iuml",208:"ETH",209:"Ntilde",210:"Ograve",211:"Oacute",212:"Ocirc",213:"Otilde",214:"Ouml",216:"Oslash",217:"Ugrave",218:"Uacute",219:"Ucirc",220:"Uuml",221:"Yacute",222:"THORN",223:"szlig",224:"agrave",225:"aacute",226:"acirc",227:"atilde",228:"auml",229:"aring",230:"aelig",231:"ccedil",232:"egrave",233:"eacute",234:"ecirc",235:"euml",236:"igrave",237:"iacute",238:"icirc",239:"iuml",240:"eth",241:"ntilde",242:"ograve",243:"oacute",244:"ocirc",245:"otilde",246:"ouml",248:"oslash",249:"ugrave",250:"uacute",251:"ucirc",252:"uuml",253:"yacute",254:"thorn",255:"yuml",338:"OElig",339:"oelig",352:"Scaron",353:"scaron",376:"Yuml",710:"circ",732:"tilde",8194:"ensp",8195:"emsp",8201:"thinsp",8204:"zwnj",8205:"zwj",8206:"lrm",8207:"rlm",8211:"ndash",8212:"mdash",8216:"lsquo",8217:"rsquo",8218:"sbquo",8220:"ldquo",8221:"rdquo",8222:"bdquo",8224:"dagger",8225:"Dagger",8230:"hellip",8240:"permil",8249:"lsaquo",8250:"rsaquo",8364:"euro"};var b=d.split("");var e="";for(i=0;i<b.length;i++){var a=b[i].charCodeAt(0);if(c[a]){e+="&"+c[a]+";"}else{if(a>127){e+="&#"+a+";"}else{e+=b[i]}}}return e}var BF_Effect={ScrollIntoView:function(b,g){if(g===undefined){var g=0.5}var f=document.viewport.getHeight();var d=$(b).getHeight();var e=document.viewport.getScrollOffsets().top+$(b).viewportOffset().top;var c=Math.ceil(e/g/100);if($(b).viewportOffset().top>0){e-=f;if(f>=d){e+=d}else{e+=f-30}}else{c*=-1}var a=function(k,j){var h=document.viewport.getScrollOffsets().top;if((j<0&&h>k)||(j>0&&h<k)){window.scrollTo(0,Math.round(h+j));setTimeout(function(){a(k,j)},1)}};setTimeout(function(){a(e,c)},1)},FadeOut:function(b,a){if(!a){$(b).setOpacity(1).show();a=100-2;setTimeout(function(){BF_Effect.FadeOut(b,a)},5)}else{a=a-2;if(a>0){$(b).setOpacity(a/100);setTimeout(function(){BF_Effect.FadeOut(b,a)},5)}else{$(b).hide()}}},FadeIn:function(b,a){try{if(!a){$(b).setOpacity(0.01);$(b).show();a=1;setTimeout(function(){BF_Effect.FadeIn(b,a)},5)}else{a=a+2;if(a<100){$(b).setOpacity(a/100);setTimeout(function(){BF_Effect.FadeIn(b,a)},5)}else{$(b).setOpacity(1)}}}catch(c){console.error(c)}}};Object.extend(Element.Methods,{showOnScreen:function(a,b){a.show();BF_Effect.ScrollIntoView(a,b)}});Element.addMethods();var BF_UI={closeDialog:function(d,b){if(!b){b={}}var c=$(d);c.hide();if(typeof user_post!="undefined"&&user_post.show_video_preview){$("video-form-preview").show()}var a=$(d).getElementsByTagName("IFRAME")[0];if(a){a=(a.contentWindow)?a.contentWindow:(a.contentDocument.document)?a.contentDocument.document:a.contentDocument}if(b.loadDefaultDiv){if(a){if(a.document.getElementById(b.loadDefaultDiv)){a.document.getElementById(b.loadDefaultDiv).style.display="block"}}}$$("embed, object, select, .has-embed").each(function(e){e.style.visibility="visible"});if(a&&typeof a.minimizeEventHandler=="function"){a.minimizeEventHandler()}if(b.onComplete){b.onComplete()}},create_or_show_dialog:function(c){if(!$(c.id)){if(!c.width){c.width=800}if(!c.height){c.height=465}if(!c.scrolling){c.scrolling="no"}if(!c.title){c.title="Dialog"}if(!c.url.match(/^https?:\/\//)){c.url=c.url}var b=new Template(' 				<div class="bf_overlay_mask"></div> 				<div class="bf_dialog"> 					<div class="bf_dialog_header"><span class="title">#{title}</span> <a href="#" onclick="BF_UI.closeDialog(\'#{id}\',{loadDefaultDiv:\'#{url}\'});return false;" class="close">&times;</a></div> 					<div class="bf_dialog_content"> 						<iframe id="#{id}_iframe" src="#{url}" name="#{id}_iframe" frameborder="0" scrolling="#{scrolling}" allowTransparency="true" width="#{width}" height="#{height}"></iframe> 					</div> 				</div> 			');var a=b.evaluate(c);var d=document.createElement("div");d.id=c.id;d.style.display="none";d.className="bf_canvas";d.innerHTML=a;document.getElementsByTagName("BODY")[0].appendChild(d)}BF_UI.showDialog(c.id,c.title)},showDialog:function(g){try{if(typeof user_post!="undefined"&&$("video-form-preview")&&$("video-form-preview").visible()){$("video-form-preview").hide();user_post.show_video_preview=true}else{if(typeof user_post!="undefined"){user_post.show_video_preview=false}}}catch(c){user_post.show_video_preview=false}var b=$(g);var f="Crop Image";if(arguments.length>1){f=arguments[1]}b.show();$$("embed, object, select, .has-embed").each(function(e){e.style.visibility="hidden"});var d=b.select(".title");if(d&&d.length>0){d.first().update(f)}var a=b.select(".bf_dialog").first();if(a){a.style.top=Math.floor(Math.max(document.viewport.getScrollOffsets().top,document.viewport.getScrollOffsets().top+(document.viewport.getHeight()/2)-($(a).getHeight()/2)))+"px"}},renderEntities:function(b){var d="BF_RENDER_ENTITIES_DIV_73625";var a=$(d);if(!a){var c=document.getElementsByTagName("body")[0];a=document.createElement("DIV");a.setAttribute("id",d);a.id=d;a.style.display="none";c.appendChild(a)}a.innerHTML=b;b=a.innerHTML;b=b.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&");return b}};function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null}function eraseCookie(a){createCookie(a,"",-1)}BF_Request=function(){this._redirect=function(url){document.location.href=url};this.request=function(url,args){var success=args.onSuccess;var resp=function(resp){var json=resp.getResponseHeader("X-json");var obj=null;if(json){obj=eval("("+resp.responseText+")")}var ajax_redir=resp.getHeader("X-ajaxlocation");if(ajax_redir){if(!ajax_redir.match(/https?:\/\//)){ajax_redir=BF_STATIC.web_root+ajax_redir}this._redirect(ajax_redir)}else{success(resp,obj)}}.bind(this);args.onSuccess=resp;if(!args.on401){args.on401=function(){var user=new BF_User();user.logout({noreload:true});document.location.href=BF_STATIC.web_root+"/signin?badauth=true"}}if(!args.onFailure){args.onFailure=function(resp){alert("Sorry, but we are unable to process your request at this time.")}}if(args.bf_auth&&!(args.parameters&&args.parameters.session_key)){args.parameters.session_key=BFW_Util.getCookie(BFW_COOKIE)}if(args.while_processing){if(args.while_processing.show){args.while_processing.show=$(args.while_processing.show)}if(args.while_processing.hide){args.while_processing.hide=$(args.while_processing.hide)}if(args.while_processing.show){args.while_processing.show.show();args.while_processing.show.removeClassName("hidden")}if(args.while_processing.hide){args.while_processing.hide.hide();args.while_processing.hide.addClassName("hidden")}var _onSuccess=args.onSuccess;args.onSuccess=function(a,b){if(args.while_processing.show){args.while_processing.show.hide();args.while_processing.show.addClassName("hidden")}if(args.while_processing.hide){args.while_processing.hide.show();args.while_processing.hide.removeClassName("hidden")}_onSuccess(a,b)};var _onFailure=args.onFailure;args.onFailure=function(a,b){if(args.while_processing.show){args.while_processing.show.hide();args.while_processing.show.addClassName("hidden")}if(args.while_processing.hide){args.while_processing.hide.show();args.while_processing.hide.removeClassName("hidden")}_onFailure(a,b)};var _on401=args.on401;args.on401=function(a,b){if(args.while_processing.show){args.while_processing.show.hide();args.while_processing.show.addClassName("hidden")}if(args.while_processing.hide){args.while_processing.hide.show();args.while_processing.hide.removeClassName("hidden")}_on401(a,b)}}new Ajax.Request(url,args)}};BF_DID_REGISTER=false;BF_Register=function(){this.highlight_field=new Array();this.ajax=new BF_Request();this.ERR_MISSING_PARAMS="Please complete all fields.";this.ERR_BAD_USERNAME="Your username may only contain letters and numbers.";this.ERR_USERNAME_LENGTH="Your username must be between 3 and 30 characters in length.";this.ERR_PW_LENGTH="Your password must be at least 6 characters in length.";this.ERR_MUST_AGGEE="You must agree to the Terms of Service in order to register.";this.ERR_PW_MUST_MATCH="Your passwords do not match.";this.ERR_DUP_USERNAME="Sorry, that username  is not available. Please try another.";this.ERR_DUP_EMAIL="There is already an account with that email address.";this.BANNED_FB_UID="You cannot register with that Facebook user.";this.ERR_BAD_EMAIL="You have entered an invalid email address.";this.ERR="Sorry, we are unable to process your request at this time.";this.ERR_ALREADY_REGISTERED="You have already registered for an account";this.highlight_field[this.ERR_BAD_USERNAME]="register-username";this.highlight_field[this.ERR_USERNAME_LENGTH]="register-username";this.highlight_field[this.ERR_PW_LENGTH]="register-pw1";this.highlight_field[this.ERR_PW_MUST_MATCH]="register-pw2";this.highlight_field[this.ERR_MUST_AGGEE]="register-agree";this.highlight_field[this.ERR_DUP_USERNAME]="register-username";this.highlight_field[this.ERR_DUP_EMAIL]="bfe";this.highlight_field[this.ERR_BAD_EMAIL]="bfe";this.SUCCESS1="Thanks for registering. We&rsquo;ve created your account and saved your post, but before we post it we need you to validate your email address. We&rsquo;ve sent you a confirmation email with instructions. If you don&rsquo;t receive the mail in a few minutes, please check your spam folder.<br /><br />Your post will appear automatically once you validate.";this.SUCCESS1_VALIDATED="Thanks for registering. We&rsquo;ve validated your email address with Facebook, created your account and saved your post. ";this.SUCCESS2="Thanks for registering. We&rsquo;ve created your account, but before you can vote we need you to validate your email address. We&rsquo;ve sent you a confirmation email with instructions. If you don&rsquo;t receive the mail in a few minutes, please check your spam folder.";this.SUCCESS2_VALIDATED="Thanks for registering. We&rsquo;ve validated your email address with Facebook and created your account. You now can vote.";this.SUCCESS3="<h3>Please Validate Your Email</h3><p>Thanks for registering. We&rsquo;ve created your account, but before you can log in we need you to validate your email address. We&rsquo;ve sent you a confirmation email with instructions. If you don&rsquo;t receive the mail in a few minutes, please check your spam folder.</p>";this.SUCCESS3_VALIDATED="<h3>Your Email Has Been Validated</h3><p>Thanks for registering. We&rsquo;ve created your account and validated your email address with Facebook. Some of your profile data has been prepopulated with information from your Facebook profile. You can log in now.</p>";this.SUCCESS4="Thanks for registering. We&rsquo;ve created your account, but before you can post we need you to validate your email address. We&rsquo;ve sent you a confirmation email with instructions. If you don&rsquo;t receive the mail in a few minutes, please check your spam folder.<br/><br/>Once you validate <a id='register_this_page_url' href=''>click here</a> to make a post.";this.SUCCESS4_VALIDATED="Thanks for registering. We&rsquo;ve created your account and validated your email address with Facebook.";this.fb_link_handler=function(){var handler=function(event){event.stop();$("facebook-login").hide();$("facebook-registration-form").hide();bf_login.switch_to_link_accounts()}.bind(this);if($("fb-link-submit")){$("fb-link-submit").observe("click",handler)}if($("fb-link-submit2")){$("fb-link-submit2").observe("click",handler)}};this.fb_register_handler=function(reset_form,args){if(BF_Register.registered_fb_handler){return}BF_Register.registered_fb_handler=true;this.fb_link_handler();if(typeof reset_form=="undefined"){reset_form=true}if(args){this.args=args}var handler=function(event){event.stop();this.facebook_register()}.bind(this);if($("facebook-registration-form")){$("facebook-registration-form").stopObserving("submit",handler)}if($("facebook-registration-form")){$("facebook-registration-form").observe("submit",handler)}if($("fb-register-submig")){$("fb-register-submit").disabled=false}if(reset_form&&$("facebook-registration-form")){$("facebook-registration-form").reset()}};this.alias_register_handler=function(reset_form,args){if(BF_Register.alias_registered_handler){return}BF_Register.alias_registered_handler=true;if(typeof reset_form=="undefined"){reset_form=true}if(args){this.args=args}var handler=function(event){event.stop();this.alias_register()}.bind(this);BF_UserSwitcher.count_aliases(function(obj){if($("alias-sites-left")&&obj.success){var user_info=new BF_User().getUserInfo();var remaining=parseInt(user_info.max_aliases)-parseInt(obj.count);$("alias-sites-left").update(remaining);if(remaining==1){$("alias-sites-left-plural").hide()}if(obj.unlimited==1){$("alias-count-message").hide()}else{$("alias-count-message").show()}if(remaining<=0&&user_info.max_aliases!=0){$("alias-registration-fieldset").hide();$("alias-registration-hit-limit").show()}}});if($("alias-registration-form")){$("alias-registration-form").stopObserving("submit",handler)}if($("alias-registration-form")){$("alias-registration-form").observe("submit",handler)}if($("alias-registration-form")){$("alias-register-submit").disabled=false}if(reset_form&&$("alias-registration-form")){$("alias-registration-form").reset()}};this.register_handler=function(reset_form,args){if(BF_Register.registered_handler){return}BF_Register.registered_handler=true;if(typeof reset_form=="undefined"){reset_form=true}if(args){this.args=args}var handler=function(event){event.stop();this.register()}.bind(this);if($("regsitration-form")){$("regsitration-form").stopObserving("submit",handler)}if($("regsitration-form")){$("regsitration-form").observe("submit",handler)}if($("register-submit")){$("register-submit").disbaled=false}if(reset_form&&$("regsitration-form")){$("regsitration-form").reset()}};this.facebook_register=function(){var name=$F("fb-register-name").strip();var email="get_from_facebook@buzzfeed.com";try{email=facebook.user_data.email}catch(e){}var username=$F("fb-register-username").strip();var pw1=$F("fb-register-pw1").strip();var agreed=true;var emailme=0;var import_fb_profile=$("import_fb_profile_checkbox").checked?"true":"false";if(import_fb_profile=="false"){name=username}var facebook_uid=$("fb-facebook-uid")?$("fb-facebook-uid").value:"";this.username=username;this.password=pw1;if($("fb-email-me").checked){emailme=1}var rr=function(resp){this.response(resp)}.bindAsEventListener(this);var er=function(resp){this.err(resp)}.bindAsEventListener(this);var params={name:name,username:username,pw:pw1,email:email,contribute:1,allow_email_updates:emailme,facebook_uid:facebook_uid,import_fb_profile:import_fb_profile,registered_from_url:window.location.href,reg_user_agent:navigator.userAgent};new Ajax.Request("/buzzfeed/_contribute_register",{method:"post",parameters:params,onSuccess:rr,onFailure:er})};this.alias_register=function(){var username=$("alias-register-username").value.strip();if(!username.match(/^[a-zA-Z0-9]+$/)){this._alias_register({success:0,message:"Site URL must consist of only alphanumeric characters"});return}var display_name=$("alias-register-display_name").value;if($("alias-registering-status")){$("alias-registering-status").show()}if(!username||!display_name){this._alias_register({success:0,message:"missing username"})}else{BF_UserSwitcher.create_alias({username:username,display_name:display_name},this._alias_register)}};this._alias_register=function(obj){if(obj.success==0||obj.status!=200){$("alias-message").show();if(obj.message.match(/missing username/i)){$("alias-message").update("please fill out all fields")}else{if(obj.message.match(/logged in/i)){$("alias-message").update("please log in and try again")}else{if(obj.message.match(/privileges/i)){$("alias-message").update("you don't have permission to create an alias")}else{if(obj.message.match(/limit/i)){$("alias-message").update("Sorry, but you are over your alias limit")}else{if(obj.message.match(/username/i)){$("alias-message").update("this site URL already is taken, please select another")}else{$("alias-message").update(obj.message)}}}}}}else{if($("alias-registration-fieldset")){$("alias-registration-fieldset").hide()}if($("alias-registration-creating-site")){$("alias-registration-creating-site").show()}BF_UserSwitcher.switchTo(obj.userid,function(){})}if($("alias-registering-status")){$("alias-registering-status").hide()}};this.register=function(){$("registering-status").show();if($("register-submit")){$("register-submit").disabled=true}if(typeof this.args=="undefined"){this.args={action:"vote"}}var name=$F("register-name").strip();var email=$F("bfe").strip();var username=$F("register-username").strip();var pw1=$F("register-pw1").strip();var pw2=$F("register-pw2").strip();var agreed=false;var emailme="";var facebook_location="";var facebook_uid="";var facebook_url="";var facebook_session_key="";var import_fb_profile=false;if(BF_STATIC.facebook_enabled){facebook_uid=$("facebook-uid")?$("facebook-uid").value:"";facebook_session_key=$("facebook-session_key")?$("facebook-session_key").value:"";import_fb_profile=$("import_fb_profile_checkbox").checked}if($("register-agree").checked){agreed=true}if($("email-me").checked){emailme=1}if(!name||!email||!username||!pw1||!pw2){if($("register-submit")){$("register-submit").disabled=false}this.update_registration_message(this.ERR_MISSING_PARAMS);$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()}else{if(!username.match(/^[a-zA-Z0-9]+$/)){if($("register-submit")){$("register-submit").disabled=false}this.update_registration_message(this.ERR_BAD_USERNAME);$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()}else{if(username.length<3||username.length>30){if($("register-submit")){$("register-submit").disabled=false}this.update_registration_message(this.ERR_USERNAME_LENGTH);$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()}else{if(pw1!=pw2){this.update_registration_message(this.ERR_PW_MUST_MATCH);if($("register-submit")){$("register-submit").disabled=false}$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()}else{if(!agreed){this.update_registration_message(this.ERR_MUST_AGGEE);if($("register-submit")){$("register-submit").disabled=false}$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()}else{if(typeof pw1=="undefined"||pw1.length<6){this.update_registration_message(this.ERR_PW_LENGTH);if($("register-submit")){$("register-submit").disabled=false}$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()}else{if(typeof email=="undefined"||!email.match(/^([^@]+)@([^\.]+)\.([a-zA-Z])+/)){if($("register-submit")){$("register-submit").disabled=false}this.update_registration_message(this.ERR_BAD_EMAIL);$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()}else{this.username=username;this.password=pw1;var rr=function(resp){this.response(resp)}.bindAsEventListener(this);var er=function(resp){this.err(resp)}.bindAsEventListener(this);$("register-submit").disbaled=true;var params={name:name,username:username,pw:pw1,email:email,contribute:1,allow_email_updates:emailme,facebook_uid:facebook_uid,location:facebook_location,link:facebook_url,facebook_session_key:facebook_session_key,import_fb_profile:import_fb_profile,registered_from_url:window.location.href,reg_user_agent:navigator.userAgent};new Ajax.Request("/buzzfeed/_contribute_register",{method:"post",parameters:params,onSuccess:rr,onFailure:er})}}}}}}}};this.update_registration_message=function(msg){if(Prototype.Browser.IE){$("registration-message").innerText=msg;$("facebook-registration-message").innerText=msg}else{$("registration-message").update(msg);$("facebook-registration-message").update(msg)}if(this.__error_field){this.__error_field.style.border="1px solid gray";this.__error_field=null}if(this.highlight_field[msg]&&$(this.highlight_field[msg])){$(this.highlight_field[msg]).style.border="1px solid red";this.__error_field=$(this.highlight_field[msg])}};this.response=function(resp){var username=this.username;var password=this.password;$("registering-status").hide();try{$("register-submit").disbaled=false;obj=eval("("+resp.responseText+")");if(!obj||!obj.status){this.err()}else{if(obj.status=="success"){__reg_ok=true;BF_DID_REGISTER=true;$("regsitration-form").reset();if(this.args&&this.args.action=="vote"&&vote_manager.contribution_id){if($("contribute-success")){$("contribute-success").hide()}var reg_success_div=$("registered-success").remove();$("registration-div").hide();var div=document.createElement("div");div.appendChild(reg_success_div);$($("registration-div").parentNode).appendChild(div);$("registered-success").show();$("registered-success").style.marginTop="10px";var show_message=this.SUCCESS2;if(obj.user_validated){show_message=this.SUCCESS2_VALIDATED;if($("please-validate-your-email")){$("please-validate-your-email").update("We Have Validated Your Email")}}$("reg-success-message").update(show_message)}else{if(this.args&&this.args.action=="signin"){if($("contribute-success")){$("contribute-success").hide()}if($("registered-success")){$("registered-success").show()}if($("registration-div")){$("registration-div").hide()}if($("reg-success-message")){var show_message=this.SUCCESS3;if(obj.user_validated){show_message=this.SUCCESS3_VALIDATED}$("reg-success-message").update(show_message);$("reg-success-message").show();if(obj.user_validated){var params={username:username,password:password,contribute:1};new Ajax.Request("/buzzfeed/_www_login",{method:"post",parameters:params,onSuccess:function(r){bf_login.loggedIn(r);if(window.location.href.indexOf("/signin")!=-1){window.location.href="/"+username}},onFailure:bf_login.err})}}}else{if(this.args&&this.args.action=="badge_vote"){if(badge_vote_manager&&badge_vote_manager.onRegister){badge_vote_manager.onRegister()}else{if($("registered-vote-success")){$("registered-vote-success").show()}if($("registration-div")){$("registration-div").hide()}}}else{if(this.args&&this.args.action=="contest_entry"){if(typeof contest_manager!="undefined"&&contest_manager.onLogin){contest_manager.onLogin()}}else{if(this.args&&this.args.action=="micosite_submission"){if(typeof picks_controller!="undefined"&&picks_controller.onLogin){picks_controller.onLogin()}}else{if(this.args&&this.args.action=="prediction"&&typeof predictions!="undefined"){predictions.onRegister()}else{if($("contribute-success")){$("contribute-success").hide()}if($("registered-success")){$("registered-success").show()}if($("registration-div")){$("registration-div").hide()}if(bf_contribute&&bf_contribute.type=="image"){var show_message=this.SUCCESS4;if(obj.user_validated){show_message=this.SUCCESS4_VALIDATED}if($("reg-success-message")){$("reg-success-message").update(show_message)}}else{var show_message=this.SUCCESS1;if(obj.user_validated){show_message=this.SUCCESS1_VALIDATED;if($("please-validate-your-email")){$("please-validate-your-email").update("We Have Validated Your Email")}var params={username:username,password:password,contribute:1};new Ajax.Request("/buzzfeed/_www_login",{method:"post",parameters:params,onSuccess:function(r){bf_login.loggedIn(r,this.args);if(window.location.href.indexOf("/signin")!=-1){window.location.href="/"+username}},onFailure:bf_login.err})}if($("reg-success-message")){$("reg-success-message").update(show_message)}}bf_contribute.submit({session_key:obj.session_key})}}}}}}if($("register_this_page_url")){var rurl=document.location.href;rurl=rurl.replace(/#.*/,"");$("register_this_page_url").href=rurl}}else{if(obj.message=="bad beta key"){if($("register-submit")){$("register-submit").disabled=false}this.update_registration_message(this.ERR_BETA_KEY);$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show()}else{if(obj.message=="duplicate username"){if($("register-submit")){$("register-submit").disabled=false}this.update_registration_message(this.ERR_DUP_USERNAME);$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show()}else{if(obj.message=="duplicate email"){if($("register-submit")){$("register-submit").disabled=false}if(facebook.is_logged_in()){this.update_registration_message(this.BANNED_FB_UID)}else{this.update_registration_message(this.ERR_DUP_EMAIL)}$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").addClassName("error");$("registration-message").show()}else{this.err()}}}}}}catch(e){this.err()}};this.err=function(resp){$("register-submit").disabled=false;$("facebook-registration-message").update(this.ERR);$("facebook-registration-message").addClassName("error");$("facebook-registration-message").show();$("registration-message").update(this.ERR);$("registration-message").addClassName("error");$("registration-message").show();$("registering-status").hide()};this.redirect_to=function(url){window.location.href=BF_STATIC.web_root+"/"+url};this.form_values=function(obj){if(typeof obj.pw=="undefined"){obj.pw=$("register-password").value}if(typeof obj.username=="undefined"){obj.name=obj.username=$("register-uri-text").value}if(typeof obj.email=="undefined"){obj.email=$("register-email").value}return obj};this.new_register=function(obj){var errors=false;if(typeof obj.pw2=="undefined"){obj.pw2=obj.pw}if(typeof obj.name=="undefined"){obj.name=obj.username}var required={username:"Please enter a URL",email:"Please enter a valid e-mail address",pw:"Please enter a password"};var error_msg_box=$("registration-error-message");var error=function(msg){errors=true;if(error_msg_box){error_msg_box.update(msg);error_msg_box.show()}};obj=this.form_values(obj);var strip=new Array("name","email","username","pw");strip.each(function(el){if(typeof obj[el]!="undefined"){obj[el]=obj[el].strip()}});for(var each in required){if(typeof obj[each]=="undefined"||obj[each]==""){error(required[each]);break}}if(obj.username=="url"){obj.username=""}if(obj.pw=="password"){obj.pw=""}if(obj.email=="your@email.com"){obj.email=""}if(!errors&&!obj.email.match(/^([^@]+)@([^\.]+)\.([a-zA-Z])+/)){error("Please enter a valid email address")}if(!errors&&(obj.username.length<3||obj.username.length>30)){error("Please enter a URL between 3 and 30 characters")}if(!errors&&obj.pw.length<6){error("Your password must have at least 6 characters")}if(!errors){bf_register.ajax.request("/buzzfeed/_contribute_register",{method:"post",parameters:obj,while_processing:{show:"registration-spinner",hide:"new-registration-form"},onSuccess:function(r){var json=eval("("+r.responseText+")");bf_register._new_register(obj,json)}})}};this._new_register=function(obj,json){if(json.status=="failed"){bf_register._error(json)}else{bf_register._success(obj,json)}};this._error=function(json){var messages={"duplicate email":facebook.is_logged_in()?bf_register.BANNED_FB_UID:bf_register.ERR_DUP_EMAIL,"duplicate username":bf_register.ERR_DUP_USERNAME};var old_msg=$("registration-success-message");old_msg.hide();var msg=$("registration-error-message");if(msg){msg.update(messages[json.message]||json.message);msg.show()}};this._success=function(obj,json){var old_msg=$("registration-error-message");old_msg.hide();if(json.user_validated){var params={username:obj.username,password:obj.pw,contribute:1};bf_register.ajax.request("/buzzfeed/_www_login",{method:"post",parameters:params,while_processing:{show:"logging-in",hide:"new-registration-form"},onSuccess:function(r){bf_login.loggedIn(r);bf_register.redirect_to("settings?firstTime=true")}})}else{var form=$("new-registration-form");var msg=$("registration-success-message");if(form){form.hide()}if(msg){msg.show()}}};this.register_alias=function(obj){var errors=false;var error_msg_box=$("registration-error-message");var error=function(msg){errors=true;if(error_msg_box){error_msg_box.update(msg);error_msg_box.show()}};if(obj.username.length<3||obj.username.length>30){error("Please enter a URL between 3 and 30 characters")}if(!errors){BF_UserSwitcher.create_alias({username:obj.username,display_name:typeof obj.name=="undefined"?obj.username:obj.name},bf_register._register_alias)}};this._register_alias=function(obj){if(obj.success==0||obj.status!=200){bf_register._error({message:obj.message||"Unable to create an alias at this time"})}else{BF_UserSwitcher.switchTo(obj.userid,function(){bf_register.redirect_to("settings?firstTime=true")})}}};BF_Login=function(){this.AUTH_RETURN_PAGE_COOKE="auth_return_page_cookie";this.LOGIN_ERR="Please enter a username and a password";this.AUTH_ERR="Please enter a valid username and a password";this.ERR="Sorry, we&rsquo;re unable to process your request at this time.";this.PASSWORD_ERR="Please enter your email address";this.PASSWORD_SUCCESS="We&rsquo;ve sent you an email with a reset password link.";this.PASSWORD_SERVER_ERROR="There was a problem contacting the server and we were unable to reset your password. Please try again later.";this.NEED_VALIDATION_ERROR="Your account needs to be validated. Please check your email for a validation link.";this.init=function(args){this.already_sent=false;bf_login.ajax=new BF_Request();bf_register=new BF_Register();var user=new BF_User();var logged_in_elements=$$(".logged-in");var logged_out_elements=$$(".not-logged-in");if(user.isLoggedIn()){logged_in_elements.each(function(el){el.show()});logged_out_elements.each(function(el){el.hide()})}else{logged_in_elements.each(function(el){el.hide()});logged_out_elements.each(function(el){el.show()})}if(BF_STATIC.facebook_enabled){$$(".hide-unless-facebook-enabled").each(function(el){el.show()})}var si_user=new BF_User();if(document.location.pathname.toString().match(/\/(signin|signin\/)$/)&&si_user.isLoggedIn()&&document.location.search.indexOf("microsite")==-1){var si_user_info=si_user.getUserInfo();var userpage=BF_STATIC.web_root+"/"+si_user_info.username;document.location.href=userpage;return}if(!si_user.isLoggedIn()&&document.location.search.indexOf("microsite")!=-1){window.location.href=document.location.pathname}if(args){this.args=args}var forgot_password_form=$("forgot-password-form");if(forgot_password_form){if(!bf_login.initialized){forgot_password_form.observe("submit",function(event){event.stop();bf_login.reset_password()}.bind(this))}}var login_form=$("login-form");if(login_form){if(!bf_login.initialized){bf_login.initialized=true;login_form.observe("submit",function(event){event.stop();bf_login.login()}.bind(this))}}var link_accounts_form=$("link-accounts-form");if(link_accounts_form){link_accounts_form.observe("submit",function(e){e.stop();bf_login.link_accounts()}.bind(this))}var forgot_password_link=$("forgot-password-link");if(forgot_password_link){forgot_password_link.observe("click",function(event){event.stop();$("login-form").hide();$("forgot-password-form").show()}.bind(this))}var registration_form=$("regsitration-form");if(registration_form&&$("switch_to_register")){$("switch_to_register").observe("click",function(e){e.stop();$("login-form").hide();$("regsitration-form").showOnScreen()})}else{if($("switch_to_register")){$("switch_to_register").observe("click",function(e){e.stop();window.location.href=BF_STATIC.web_root+"/signup"})}}var switch_to_login=$("switch_to_login");if(switch_to_login){switch_to_login.observe("click",function(event){event.stop();bf_login.switch_registration_to_login()}.bind(this))}var forgot_password_cancel=$("forgot-password-cancel");if(forgot_password_cancel){forgot_password_cancel.observe("click",function(event){event.stop();bf_login.cancel_reset_password()}.bind(this))}if(document.location.search.indexOf("badauth=true")>-1){$("bad-cookie-message").show()}if(BF_STATIC&&BF_STATIC.facebook_enabled==true){if($("facebook-login")){$("login-form").addClassName("facebook-enabled");$("facebook-login").show()}}if(document.location.pathname.toString().match(/\/(signin|signin\/)$/)){facebook.auto_register_enabled=false;facebook.link_accounts_enabled=true}};this.switch_login_to_alias_registration=function(){$("login-form").hide();$("regsitration-form").hide();$("alias-registration-form").show();$("user_signin_message").hide();$("create_site_message").show()};this.switch_login_to_registration=function(){facebook.auto_register_enabled=false;facebook.observe("user_logged_in",function(){var email="get_from_facebook@buzzfeed.com";try{email=facebook.user_data.email}catch(e){}var initial_registration_fieldset=$("initial-registration-fieldset");var facebook_connected_div=$("facebook-connected-div");var facebook_button_div=$("facebook-registration-fieldset");if(facebook_button_div){facebook_button_div.hide()}if(initial_registration_fieldset){initial_registration_fieldset.hide()}if(facebook_connected_div){facebook_connected_div.show()}var temp_pw="";var character='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_!@#$%^&*(){}[]:";<>,./?|';for(var i=0;i<10;i++){temp_pw+=character[Math.round(Math.random()*character.length-1)]}event_handler.HANDLERS.map_into({target:{value:temp_pw}},{target:"submit-button",field:"register.pw2"});event_handler.HANDLERS.map_into({target:{value:temp_pw}},{target:"submit-button",field:"register.pw"});event_handler.HANDLERS.map_into({target:{value:facebook.session.uid}},{target:"submit-button",field:"register.facebook_uid"});event_handler.HANDLERS.map_into({target:{value:email}},{target:"submit-button",field:"register.email"});event_handler.HANDLERS.map_into({target:{value:facebook.session.session_key}},{target:"submit-button",field:"register.facebook_session_key"})});if($("login-form")){$("login-form").hide()}if($("regsitration-form")){$("regsitration-form").show()}if($("alias-registration-form")){$("alias-registration-form").hide()}if($("new-registration-form")){$("new-registration-form").show()}BF_UserSwitcher.count_aliases(function(obj){if($("alias-sites-left")&&obj.success){var user_info=new BF_User().getUserInfo();var remaining=parseInt(user_info.max_aliases)-parseInt(obj.count);$("alias-sites-left").update(remaining);if(remaining==1){$("alias-sites-left-plural").hide()}if(obj.unlimited==1){$("alias-count-message").hide()}else{$("alias-count-message").show()}if(remaining<=0&&user_info.max_aliases!=0){$("alias-registration-fieldset").hide();$("alias-registration-hit-limit").show()}}})};this.switch_to_link_accounts=function(){if($("login-form")){$("login-form").hide()}if($("regsitration-form")){$("regsitration-form").hide()}if($("link-accounts-form")){$("link-accounts-form").show()}if($("alias-registration-form")){$("alias-registration-form").hide()}};this.switch_registration_to_login=function(){if($("link-accounts-form")){$("link-accounts-form").hide()}$("login-form").show();$("regsitration-form").hide();$("alias-registration-form").hide()};this.cancel_reset_password=function(){$("login-form").show();$("forgot-password-form").hide();$("alias-registration-form").hide()};this.reset_password=function(){if(this.already_sent){return}this.already_sent=true;$("forgot-password-cancel").hide();var reset_password_status=$("resetting-password-status");if(reset_password_status){reset_password_status.show()}$("forgot-password-message").hide();var email=$F("login-email");if(!email){this.setError(this.PASSWORD_ERR,"forgot-password");if(reset_password_status){reset_password_status.hide()}$("forgot-password-cancel").show()}else{$("forgot-password-submit").disabled=true;var lr=function(resp){this.passwordSent(resp)}.bindAsEventListener(this);var er=function(resp){$("forgot-password-cancel").show();this.err(resp,"forgot-password")}.bindAsEventListener(this);var params={email:email};bf_login.ajax.request("/buzzfeed/_forgot_password",{method:"get",parameters:params,onSuccess:lr,onFailure:er})}};this.link_accounts=function(){try{if($("link-accounts-status")){$("link-accounts-status").show()}$("link-accounts-message").hide();var username=$F("link-accounts-username");var password=$F("link-accounts-password");if(!username||!password){if($("link-accounts-status")){$("link-accounts-status").hide()}this.setError(this.LOGIN_ERR,"link-accounts")}else{$("link-accounts-submit").disabled=true;var lr=function(resp){this.loggedIn(resp,{link_accounts:1})}.bindAsEventListener(this);var er=function(resp){$("link-accounts-status").hide();$("link-accounts-submit").enable();$("link-accounts-message").update(this.LOGIN_ERR)}.bindAsEventListener(this);var params={username:username,password:password,contribute:1};bf_login.ajax.request("/buzzfeed/_www_login",{method:"post",parameters:params,onSuccess:lr,onFailure:er})}}catch(e){console.error(e)}};this.login=function(){try{$("bad-cookie-message").hide();if($("logging-in-status")){$("logging-in-status").show()}$("login-message").hide();var username=$F("login-username");var password=$F("login-password");if(!username||!password){if($("logging-in-status")){$("logging-in-status").hide()}this.setError(this.LOGIN_ERR)}else{$("login-submit").disabled=true;var lr=function(resp){this.loggedIn(resp)}.bindAsEventListener(this);var er=function(resp){this.err(resp)}.bindAsEventListener(this);var params={username:username,password:password,contribute:1};bf_login.ajax.request("/buzzfeed/_www_login",{method:"post",parameters:params,onSuccess:lr,onFailure:er})}}catch(e){console.error(e)}};this.cookieLogin=function(){var lr=function(resp){this.loggedIn(resp)}.bindAsEventListener(this);var er=function(resp){this.err(resp)}.bindAsEventListener(this);var params={session_key:BFW_Util.getCookie(BFW_COOKIE)};new Ajax.Request("/buzzfeed/_www_login",{method:"post",parameters:params,onSuccess:lr,onFailure:er})};this.passwordSent=function(resp){$("forgot-password-cancel").show();var reset_password_status=$("resetting-password-status");try{obj=eval("("+resp.responseText+")");if(obj.updated){this.setError(this.PASSWORD_SUCCESS,"login");$("login-message").className="message success";if(reset_password_status){reset_password_status.hide()}$("login-form").show();$("forgot-password-form").hide()}else{if("User needs validation"==obj.error){this.setError(this.NEED_VALIDATION_ERROR,"forgot-password");if(reset_password_status){reset_password_status.hide()}}else{this.setError(obj.error,"forgot-password");this.already_sent=false;if(reset_password_status){reset_password_status.hide()}}}}catch(e){console.dir({e:e});if(reset_password_status){reset_password_status.hide()}}};this.loggedInCallbacks=[];this.loggedIn=function(resp,args){if(!args){args={}}if(document.location.search.indexOf("contribution=false")!=-1&&!this.args){this.args={action:"badge_vote"}}try{if($("login-submit")){$("login-submit").disabled=false}if($("link-accounts-submit")){$("link-accounts-submit").disabled=false}obj=eval("("+resp.responseText+")");if(obj.login){BFW_Util.setCookie({name:BFW_COOKIE,value:obj.session_key});try{BFW_Util.setInfoCookie({value:obj})}catch(e){console.error(e)}facebook.link_accounts();if(typeof prepopulated_quickpost_manager!="undefined"&&prepopulated_quickpost_manager.onLogin){prepopulated_quickpost_manager.onLogin()}if(typeof contest_manager!="undefined"&&contest_manager.onLogin){contest_manager.onLogin()}if(typeof picks_controller!="undefined"&&picks_controller!=null&&picks_controller.onLogin){picks_controller.onLogin()}if(typeof badge_vote_manager!="undefined"&&badge_vote_manager.onLogin){badge_vote_manager.onLogin();badge_vote_manager.onLogin=null}if(this.args&&this.args.current_page=="home"&&!obj.test_mode&&window.location.href.indexOf("testmode=on")==-1){var url=BFW_Util.getCookie(this.AUTH_RETURN_PAGE_COOKE);if(url){BFW_Util.deleteCookie(this.AUTH_RETURN_PAGE_COOKE);document.location=url}else{window.location.href=BF_STATIC.web_root+"/"+escape(obj.username)}}else{if(this.args&&this.args.action=="vote"&&vote_manager.contribution_id){vote_manager._vote(null,vote_manager.contribution_id);if($("registration-div")){$("login-message").show();$("login-message").className="message success";$("login-message").update("Login Successful");if($("logging-in-status")){$("logging-in-status").hide()}$("login-fieldset").hide();setTimeout(function(){fadeOut("registration-div",100)},2000)}}else{if(this.args&&this.args.action=="userdata"){var user_nav=new BF_UserNav();user_nav.init()}else{if(this.args&&this.args.action=="bookmarklet"){bf_bm.showForm()}else{if(this.args&&this.args.action=="badge_vote"){$("registration-div").hide();if($("contribute-preview")){$("contribute-preview").hide()}}else{if($("registration-div")){$("registration-div").hide()}if($("contribute-preview")){$("contribute-preview").hide()}if($("contribute-submit-fieldset")){$("contribute-submit-fieldset").show()}if(typeof bf_contribute!="undefined"){bf_contribute.submit()}}}}}}if($("usernav-signin")){$("usernav-signin").hide()}if($("usernav-signup")){$("usernav-signup").hide()}var user_nav=new BF_UserNav();user_nav.init();if(this.loggedInCallbacks){this.loggedInCallbacks.each(function(fn){fn()})}}else{if(args.link_accounts){this.setError(this.AUTH_ERR,"link-accounts")}else{this.setError(this.AUTH_ERR)}if($("logging-in-status")){$("logging-in-status").hide()}if($("link-accounts-status")){$("link-accounts-status").hide()}}}catch(e){console.dir({e:e})}};this.err=function(resp,target){this.setError(this.ERR,target);if($("logging-in-status")){$("logging-in-status").hide()}if($("resetting-password-status")){$("resetting-password-status").hide()}};this.setError=function(err,target){if(!target){target="login"}try{$(target+"-message").update(err)}catch(e){$(target+"-message").innerText=err}$(target+"-message").className="message error";$(target+"-message").show();$(target+"-submit").disabled=false}};bf_login=new BF_Login();BuzzLoader.register(bf_login.init,1);var fadeOut=function(b,a){$(b).setOpacity(a/100);if(a>0){setTimeout("fadeOut('"+b+"',"+(a-2)+")",5)}else{$(b).hide()}};var BF_UserSwitcher={controller:"/buzzfeed/_switch",template:'<li><a href="" onclick="return false" class="switch-to-user" rel:id="#{id}"><img src="#{root}#{image}"/>#{display_name}</a></li>',show_warning:function(){var b=new BF_User();if(b.isLoggedIn()){var a=b.getUserInfo();if(!window.location.pathname.match("/dashboard$")&&typeof a.default_user!="undefined"&&a.default_user.username!=a.username){$$(".switched-display_name").each(function(c){c.update(a.display_name)});$$(".switch-warning").each(function(c){c.show()})}else{$$(".switch-warning").each(function(c){c.hide()})}}},disable_private_fields:function(){var b=new BF_User();if(b.isLoggedIn()){var a=b.getUserInfo();if(typeof a.default_user!="undefined"&&a.default_user.username!=a.username){var c=["user-settings-button"];c.each(function(d){if($(d)){$(d).style.display="none"}})}}},switch_list_ui:function(a){a.stop();if($("switch-list-spinner")){$("switch-list-spinner").show()}BF_UserSwitcher.getSwitchList(BF_UserSwitcher._switch_list_ui)},_switch_list_ui:function(e){var d=new Template(BF_UserSwitcher.template);var b='<a class="close_switch_list_ui" href="#" onclick="BF_UserSwitcher.hide_switch_list_ui();return false;"><img src="'+BF_STATIC.static_root+'/images/public/video-lightbox/closebox.png" alt="Close"/></a><ul>';var a=(new BF_User()).getUserInfo();var c=(typeof a.default_user.image=="undefined"||a.default_user_image==null)?"":a.default_user.image;if(c==null||c==""){c="/static/images/public/defaults/user.jpg"}e.unshift({image:unescape(c),display_name:unescape(a.default_user.display_name),userid:unescape(a.default_user.userid)});e.each(function(f){if(typeof f.image=="undefined"||f.image==""||f.image==null){f.image="/static/images/public/defaults/user.jpg"}b+=d.evaluate({image:f.image,display_name:f.display_name,id:f.userid,root:BF_STATIC.image_root})});if(a.p_alias=="true"||(typeof a.default_user!="undefined"&&a.default_user.p_alias=="true")){b+='<li><a href="'+BF_STATIC.web_root+'/signup"><img src="'+BF_STATIC.static_root+'/images/public/icons/new-microsite.png" alt="" width="25" height="25" /><i>Create Another BuzzFeed</i></a></li>'}$("usernav-switch-list").update(b+"</ul>");$("usernav-switch-list").show();if($("switch-list-spinner")){$("switch-list-spinner").hide()}$$(".switch-to-user").each(function(f){f.observe("click",function(g){g.stop();var h=g.target.getAttribute("rel:id");BF_UserSwitcher.switchTo(h,function(){window.location.reload()})})})},hide_switch_list_ui:function(){$("usernav-switch-list").hide()},switchTo:function(e,d){var b=new BF_User();if(b.isLoggedIn()){var a=b.getUserInfo();if(typeof a.default_user!="undefined"){if(a.userid==e){$("usernav-switch-list").hide();if($("switch-list-spinner")){$("switch-list-spinner").hide()}}else{$("usernav-switch-list").hide();if($("switch-list-spinner")){$("switch-list-spinner").show()}var c=new BF_Request();c.request(BF_UserSwitcher.controller,{method:"post",parameters:{action:"switch",default_username:a.default_user.username,default_session_key:a.default_user.session_key,switch_id:e},onSuccess:function(f){BF_UserSwitcher._switchTo(f,d)}})}}}},_switchTo:function(a,b){bf_login.loggedIn(a);facebook.logout(b)},getSwitchList:function(d){var b=new BF_User();if(b.isLoggedIn()){var a=b.getUserInfo();if(typeof a.default_user!="undefined"){var c=new BF_Request();c.request(BF_UserSwitcher.controller,{method:"post",parameters:{action:"switch_list",default_username:a.default_user.username,default_session_key:a.default_user.session_key},onSuccess:function(e){BF_UserSwitcher._getSwitchList(e.responseText,d)}})}}},_getSwitchList:function(responseText,callback){var obj=eval("("+responseText+")");if(obj.success=="1"){callback(obj.switch_list)}},create_alias:function(c,e){if(typeof c.username=="undefined"||typeof c.display_name=="undefined"){BF_UserSwitcher._create_alias({status:500,responseText:Object.toJSON({success:0,message:"Oops! You need to tell us your desired URL"})},e);return}var b=new BF_User();if(b.isLoggedIn()){var a=b.getUserInfo();if(typeof a.default_user!="undefined"){var d=new BF_Request();d.request(BF_UserSwitcher.controller,{method:"post",parameters:{action:"add_alias",username:c.username,display_name:c.display_name,default_username:a.default_user.username,default_session_key:a.default_user.session_key},onSuccess:function(f){BF_UserSwitcher._create_alias(f,e)},onFailure:function(f){BF_UserSwitcher._create_alias(f,e)}})}else{BF_UserSwitcher._create_alias({status:500,responseText:Object.toJSON({success:0,message:"Insufficient privileges"})},e)}}else{BF_UserSwitcher._create_alias({status:500,responseText:Object.toJSON({success:0,message:"User not logged in"})},e)}},_create_alias:function(r,callback){var obj=eval("("+r.responseText+")");obj.status=r.status;callback(obj)},count_aliases:function(d){var b=new BF_User();if(b.isLoggedIn()){var a=b.getUserInfo();if(typeof a.default_user!="undefined"){var c=new BF_Request();c.request(BF_UserSwitcher.controller,{method:"post",parameters:{action:"count_aliases",default_username:a.default_user.username,default_session_key:a.default_user.session_key},onComplete:function(e){BF_UserSwitcher._count_aliases(e,d)}})}}},_count_aliases:function(r,callback){var obj=eval("("+r.responseText+")");obj.status=r.status;callback(obj)}};BF_UserNav=function(){this.init=function(){this.update_session();if(typeof report_manager=="undefined"){var f=document.createElement("script");f.src=BF_STATIC.static_root+"/js/public/report/report.js";document.getElementsByTagName("body")[0].appendChild(f)}if($("usernav-ul")){var c=new BF_User();if(c.isLoggedIn()){var b=c.getUserInfo();if(!b||!b.username||b.username!=c.getUsernameFromSession()){var a=new BF_Login();a.init({action:"userdata"});a.cookieLogin()}else{try{picks_controller=null;if(typeof(BF_PicksController)!="undefined"){picks_controller=new BF_PicksController();picks_controller.init()}var d=b.display_name?b.display_name:b.username;$("usernav-displayname").update(d);$("usernav-displayname").show()}catch(h){console.error(h)}if(b.image&&b.image!=null&&b.image!="null"){try{$("usernav-image").childElements()[0].src=BF_STATIC.image_root+b.image}catch(h){console.error(h)}}$("usernav-image").show();$("usernav-profile").show();$("usernav-profile-link").href=BF_STATIC.web_root+"/"+b.username;if($("usernav-profile-link2")){$("usernav-profile-link2").href=BF_STATIC.web_root+"/"+b.username}$("usernav-signout").observe("click",function(k){k.stop();facebook.logout(user_nav.signout)}.bindAsEventListener(this));$("usernav-signout").show();$("usernav-new-feed").show();$("usernav-settings").show();if($("guide_promo")){$("guide_promo").show()}if(typeof b.default_user!="undefined"){$("usernav-switch").show();$("usernav-switch-link").observe("click",function(k){BF_UserSwitcher.switch_list_ui(k)});BF_UserSwitcher.show_warning();BF_UserSwitcher.disable_private_fields();var j=new RegExp("/"+c.getUserInfo().username+"#?$");if($("site-blank-slate")&&window.location.href.match(j)){$("site-blank-slate").show()}}else{$("usernav-switch").hide()}if(b.p_dashboard=="true"){if($("usernav-dashboard")){$("usernav-dashboard").removeClassName("hidden")}}else{if($("usernav-dashboard")){$("usernav-dashboard").addClassName("hidden")}}}}else{$("usernav-signin").show();$("usernav-signup").show();$("usernav-settings").hide();if($("signup_promo")){$("signup_promo").show()}}$("usernav-ul").show()}if($("signup_promo-profile_page")&&c.isLoggedIn()){var c=new BF_User();var b=c.getUserInfo();if(!b||!b.username||b.username!=c.getUsernameFromSession()){var a=new BF_Login();a.init({action:"userdata"});a.cookieLogin()}else{var g=$("signup_promo-profile_page");g.href="/"+b.username}}};this.update_session=function(){var c=new BF_User();if(c.isLoggedIn()){var b=c.getUserInfo();var a=b.login_cookie_version||0;var d=BF_STATIC.login_cookie_version||a;if(a!=d){if(!BFW_Util.getCookie("session_reload_count")){BFW_Util.setCookie({name:"session_reload_count",value:1,seconds:60});new Ajax.Request("/buzzfeed/_user_session_update",{method:"get",parameters:{action:"update"},onSuccess:bf_login.loggedIn,onFailure:bf_login.err})}}}};this.signout=function(a){if(typeof a=="undefined"){a={}}$("usernav-menu").hide();$("usernav-profile").update('<div style="padding: 5px;"><span id="usernav-loggingout"></span></div>');user_nav.logging_out_cnt=0;user_nav.logging_out();var b=function(){BFW_Util.deleteCookie(BFW_COOKIE);BFW_Util.deleteCookie(BFW_INFO_COOKIE);BFW_Util.deleteCookie(DEFAULT_USER);if(!a.no_reload&&!window.location.href.match(/\/settings/)){window.location.reload()}else{if(window.location.href.match(/\/settings/)){window.location.href=BF_STATIC.web_root+"/signin"}}};setTimeout(b,500)};this.logging_out=function(){if(user_nav.logging_out_cnt<5){user_nav.logging_out_cnt++}else{user_nav.logging_out_cnt=0}var a="";for(i=0;i<user_nav.logging_out_cnt;i++){a+="&nbsp; ."}$("usernav-loggingout").innerHTML="Logging out"+a;setTimeout(function(){user_nav.logging_out()},300)}};var user_nav=new BF_UserNav();BuzzLoader.register(function(){user_nav.init()},1);var BF_RealTimeWeb=function(){this.TIMEOUT_INTERVAL=900;this.LOOK_FOR_MORE_CONTENT_WHEN_NO_CONTENT_FOUND=1000*60;this.COOKIE="bf_realtime";this.controller=BF_STATIC.web_root+"/_realtime.js";this.alerts_template=new Template('<li id="item-#{id}" class="#{icon}">#{template}</li></div>');this.max_reload_count=0;this.init=function(args){if(typeof(templates)=="undefined"){return}this.timeout_interval=this.TIMEOUT_INTERVAL;this.target=$("realtime_web");this.load_realtime_data({first_time:true});this.fixup_templates();this.timeout_ps=undefined;this._pause=false;this.since_last_display=0};this.pause=function(args){realtime_web._pause=!realtime_web._pause;if(typeof args["true"]!="undefined"&&typeof args["false"]!="undefined"){$(args.target).innerHTML=args[new String(realtime_web._pause)]}};this.fixup_templates=function(){for(var each in templates){if(!isNaN(templates[each].length)){for(var i=0;i<templates[each].length;i++){var obj=templates[each][i];if(obj.description_match!==undefined){obj.regex=new RegExp(obj.description_match);obj.use_me=function(item){return item.description.match(this.regex)!=null}}else{obj.use_me=function(item){return true}}}}}};this.load_realtime_data=function(args){if(!args){args={}}var onSuccess=function(r){realtime_web.prepare_data(r);realtime_web.load_new_item()};if(args.first_time){onSuccess=function(r){realtime_web.prepare_data(r);realtime_web.prepopulate_old_items();realtime_web.load_new_item()}}if(realtime_web.max_reload_count<3){realtime_web.ajax(realtime_web.controller,{parameters:{cb:(new Date()).getTime()},onSuccess:onSuccess,onFailure:function(r){if(realtime_web.load_data_ps){window.clearTimeout(realtime_web.load_data_ps)}realtime_web.load_data_ps=window.setTimeout(realtime_web.load_realtime_data,realtime_web.LOOK_FOR_MORE_CONTENT_WHEN_NO_CONTENT_FOUND)}});realtime_web.max_reload_count++;window.setTimeout(function(){realtime_web.max_reload_count=0},1000*60)}};this.prepare_data=function(r){var data=eval("("+r.responseText+")");realtime_web.offset=0;realtime_web.content=data;var has_content=false;for(var each in realtime_web.content.content){var has_content=true;realtime_web.content.content[each].image=BF_STATIC.image_root+realtime_web.content.content[each].image}if(!has_content){if(realtime_web.load_data_ps){window.clearTimeout(realtime_web.load_data_ps)}realtime_web.load_data_ps=window.setTimeout(realtime_web.load_realtime_data,realtime_web.LOOK_FOR_MORE_CONTENT_WHEN_NO_CONTENT_FOUND)}var realtime_cookie=BFW_Util.getCookie(realtime_web.COOKIE);if(realtime_cookie){var pieces=realtime_cookie.split(":");if(pieces[0]==data.earliest){realtime_web.offset=parseInt(pieces[1])}}if(realtime_web.offset==0){realtime_web.offset=Math.floor((new Date()).getTime()/1000)-data.earliest}var expire_seconds=21*60;var old_cookie=BFW_Util.getCookie(realtime_web.COOKIE);if(old_cookie){var id=old_cookie.split(":")[0];if(id==parseInt(data.earliest)){data.ignore_me=true}}if(typeof data.earliest!="undefined"){BFW_Util.setCookie({name:realtime_web.COOKIE,value:data.earliest+":"+realtime_web.offset,seconds:expire_seconds})}};this.a_href_regex=new RegExp("<a ","g");this.prepopulate_old_items=function(c){if(!c){c=0}var old_items=[];var ordered_items=[];for(var each in realtime_web.content.content){realtime_web.content.content[each].id=parseInt(each);ordered_items.push(realtime_web.content.content[each])}var idx=Math.floor((new Date()).getTime()/1000)-realtime_web.offset;ordered_items=ordered_items.sort(function(a,b){return a.id-b.id});while(ordered_items[0].id<idx){old_items.push(ordered_items.shift())}while(old_items.length<7&&ordered_items.length>7){old_items.push(ordered_items.shift())}old_items.reverse();old_items=old_items.slice(0,6);old_items.each(function(item){var template_obj=templates[new String(item.action)];if(typeof template_obj!="undefined"){delete realtime_web.content.content[item.id];var use_obj=template_obj;if(typeof use_obj!="string"){for(var i=0;i<template_obj.length;i++){if(template_obj[i].use_me(item)){use_obj=template_obj[i]}}}item.icon=use_obj.icon;var template=new Template(use_obj.template);item.template=template.evaluate(item);var html=realtime_web.alerts_template.evaluate(item);html=html.replace(realtime_web.a_href_regex,"<a onmousedown=\"Tracker.gClick('/click/realtime_web')\" ");realtime_web.target.innerHTML=html+realtime_web.target.innerHTML}});realtime_web.content.ignore_me=false};this.nothing_found=function(){if(realtime_web.since_last_display++>3){realtime_web.offset--;realtime_web.timeout_interval=100}};this.load_new_item=function(){if(realtime_web.content.ignore_me){if(realtime_web.load_data_ps){window.clearTimeout(realtime_web.load_data_ps)}realtime_web.load_data_ps=window.setTimeout(realtime_web.load_realtime_data,realtime_web.LOOK_FOR_MORE_CONTENT_WHEN_NO_CONTENT_FOUND);return}var idx=Math.floor((new Date()).getTime()/1000)-realtime_web.offset;if(idx>realtime_web.content.latest){realtime_web.load_realtime_data()}else{var item=realtime_web.content.content[new String(idx)];if(typeof item=="undefined"||realtime_web._pause){if(typeof item=="undefined"){realtime_web.nothing_found()}clearTimeout(realtime_web.timeout_ps);realtime_web.timeout_ps=setTimeout(realtime_web.load_new_item,realtime_web.timeout_interval);return}realtime_web.since_last_display=0;realtime_web.timeout_interval=realtime_web.TIMEOUT_INTERVAL;delete realtime_web.content.content[new String(idx)];var template_obj=templates[new String(item.action)];if(typeof template_obj!="undefined"){var use_obj=template_obj;if(typeof use_obj!="string"){for(var i=0;i<template_obj.length;i++){if(template_obj[i].use_me(item)){use_obj=template_obj[i]}}}item.icon=use_obj.icon;var template=new Template(use_obj.template);item.template=template.evaluate(item);var html=realtime_web.alerts_template.evaluate(item);html=html.replace(realtime_web.a_href_regex,"<a onmousedown=\"Tracker.gClick('/click/realtime_web')\" ");var old_top=realtime_web.target.firstChild;if(old_top){var span=document.createElement("span");span.innerHTML=html;realtime_web.target.insertBefore(span,old_top)}else{realtime_web.target.innerHTML=html+realtime_web.target.innerHTML}realtime_web.fadeIn($("item-"+item.id),0)}clearTimeout(realtime_web.timeout_ps);realtime_web.timeout_ps=setTimeout(realtime_web.load_new_item,realtime_web.TIMEOUT_INTERVAL)}};this.fadeIn=function(el,opacity){if(!el){return}el.setOpacity(opacity/100);if(opacity<100){setTimeout(function(){realtime_web.fadeIn(el,opacity+10)},10)}};this.ajax=function(url,args){var r=new BF_Request();r.request(url,args)}};var realtime_web=new BF_RealTimeWeb();var parameters=BFW_Util.getParameters()||{};var mock_only=(parameters.mock_only?parameters.mock_only:0)==1;BuzzLoader.register(function(){realtime_web.init({test_mode:mock_only})},1);var BF_Predictions=function(){this.PREDICTIONS_CONTROLLER="/buzzfeed/_predictions";this.TEMPLATES={will_go_viral_prediction:new Template('<div class="predict-message-inner predict-message-yes"><div class="predict-agree"><h3>Thanks for Voting! <a href="http://www.buzzfeed.com/top/predictors">Leaderboard &rsaquo;</a></h3></div>#{share_buttons} <p class="psst"><strong>Psst!</strong> Want to make better predictions? Click through to a post and find the &ldquo;View More Stats&hellip;&rdquo; button to see how much viral traffic it&rsquo;s getting.</p> <a href="#" onclick="this.parentNode.parentNode.className=\'hidden\'; return false" class="close">&times;</a></div>'),wont_go_viral_prediction:new Template('<div class="predict-message-inner predict-message-no"><div style="predict-disagree"><h3>Thanks! #{agree}% Agree This Will Go Won\'t Viral</h3> <p>Guessing &ldquo;NO&rdquo; won\'t get you on the <a href="http://www.buzzfeed.com/top/predictors">leaderboard</a>, but it will help us fine-tune our algorithms and determine what kinds of stuff to show on the front page.</p></div> <a href="#" onclick="this.parentNode.parentNode.className=\'hidden\';return false" class="close">&times;</a></div>'),server_error:new Template('<div class="predict-message-inner predict-message-error">#{message}</div>'),share_template:new Template('			<div class="social-message-share section" style="float:left;width:100%;"> 				<h5 style="margin-bottom:10px;">Tip the odds in your favor by sharing:</h5> 				<div style="float:left;width:60px;margin-right:15px"> 					<a name="fb_share" type="box_count" share_url="http://www.buzzfeed.com/#{buzz_uri}" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fwww.buzzfeed.com%2F#{buzz_uri}&src=sp"></a> 				</div> 				<div style="float:left;width:50px;margin-right:15px"> 					<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?text=#{buzz_name}&url=http%3A//www.buzzfeed.com/#{buzz_uri}&count=vertical&related=buzzfeed" style="width:60px; height:70px;"></iframe> 				</div> 				<div style="float:left;width:69px;margin-right:15px"> 					<iframe scrolling="no" height="70" frameborder="0" width="69" src="http://www.reddit.com/static/button/button2.html?t=3&amp;width=69&amp;url=http%3A%2F%2Fwww.buzzfeed.com%2F#{buzz_uri}"></iframe> 				</div> 				<div style="float:left;width:52px;margin-right:15px"> 					<a class="DiggThisButton DiggMedium" href="http://digg.com/submit?url=http%3A//www.buzzfeed.com/#{buzz_uri}&amp;title=#{buzz_name}"></a> 				</div> 				<div style="float:left;width:50px;"> 					<a href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.buzzfeed.com/#{buzz_uri}"> <img src="#{image_root}/static/images/public/social/stumble_big.png" height="70" width="50" alt=""></a> 				</div>			</div>		')};this.REMAINING_VOTES_TEXT=["That was your last vote for today, try again tomorrow!","You have one vote left today, make it count!","You have two votes left today, use them wisely!","Now vote as much as you want!"];this.CUSTOM_TEXT=[{min:0,max:19,msg:"Wow, you must be much smarter than everyone else!"},{min:20,max:44,msg:"Way to go against the crowd!"},{min:45,max:58,msg:"No consensus here!"},{min:59,max:80,msg:"It seems you&rsquo;re playing it safe."},{min:81,max:94,msg:"It&rsquo;s hard to argue with the herd."},{min:95,max:100,msg:"There must be something you all know."},];this.ajax=function(url,args){args.while_processing={show:"predictions_spinner_"+args.parameters.buzz_id};var r=new BF_Request();r.request(url,args)};this.init=function(){if($("login-submit")){$("login-submit").setAttribute("value","Sign In")}bf_login.init();this.reg=new BF_Register();this.reg.args={action:"prediction"};this.reg.register_handler()};this.make=function(args){var user=new BF_User();if(!user.isLoggedIn()){var target=$("predictions_ui_"+args.buzz_id);if(target){target=$($(target).parentNode).parentNode}predictions.login(target)}else{var note=$("notice-predictions");if(note){note.addClassName("hidden")}predictions.ajax(predictions.PREDICTIONS_CONTROLLER,{parameters:{action:"make",buzz_id:args.buzz_id,prediction_id:args.prediction_id},onSuccess:predictions._make,onFailure:function(){predictions._make_fail({responseText:"{buzz_id:"+args.buzz_id+',message:"Sorry, we couldn\'t save your vote at this time. Please try again later."}'})}})}};this.get_custom_text=function(data){var msg="";predictions.CUSTOM_TEXT.each(function(record){if(typeof record!="undefined"&&typeof record.min!="undefined"&&data.agree>=record.min&&data.agree<=record.max){msg=record.msg}});return msg};this._make=function(r){var obj=eval("("+r.responseText+")");if(r.status!=200||obj.success==0){predictions._make_fail(r)}else{var predictions_ui=$("predictions_ui_"+obj.buzz_id);predictions_ui.addClassName("hidden");var share_buttons=$("predictions_agree_"+obj.buzz_id);var data=predictions_ui.getAttribute("rel:data");data=data.evalJSON();var html="";if(obj.prediction_id==1){var votes_message=predictions.REMAINING_VOTES_TEXT[3];html=predictions.TEMPLATES.share_template.evaluate({buzz_uri:data.uri,buzz_name:data.title,image_root:BF_STATIC.image_root,votes_left:obj.votes_left,votes_text:votes_message});html=predictions.TEMPLATES.will_go_viral_prediction.evaluate({custom_text:predictions.get_custom_text(obj),share_buttons:html,agree:obj.agree,votes_left:obj.votes_left,votes_text:votes_message})}else{html=predictions.TEMPLATES.wont_go_viral_prediction.evaluate({custom_text:predictions.get_custom_text(obj),share_buttons:html,agree:obj.agree})}share_buttons.innerHTML=html;share_buttons.removeClassName("hidden");(function(){var s=document.createElement("SCRIPT"),s1=document.getElementsByTagName("SCRIPT")[0];s.type="text/javascript";s.async=true;s.src="http://widgets.digg.com/buttons.js";s1.parentNode.insertBefore(s,s1)})()}};this._make_fail=function(r){var obj=eval("("+r.responseText+")");var share_buttons=$("predictions_agree_"+obj.buzz_id);share_buttons.innerHTML=predictions.TEMPLATES.server_error.evaluate({message:obj.message});share_buttons.removeClassName("hidden");var predictions_ui=$("predictions_ui_"+obj.buzz_id);predictions_ui.addClassName("hidden")};this.login=function(target){var registration_div=$("registration-div");if(target){registration_div.parentNode.removeChild(registration_div);target.appendChild(registration_div)}registration_div.show()};this.onRegister=function(){$("registration-success").innerHTML=predictions.reg.SUCCESS3;$("registration-success").removeClassName("hidden");$("regsitration-form").hide()}};var predictions=new BF_Predictions();BuzzLoader.register(function(){predictions.init()},2);var ABTestList=new Array();var ABTest=function(){this.testid=null;this.element=null;this.selected_test=null;this.test_units=[];this.num_clicks;this.init=function(a){this.testid=a.testid;this.element=a.element;this.test_units=a.test_units;this.selected_test=this.test_units[Math.floor(Math.random()*this.test_units.length)];this.num_clicks=0;this.register_events(this.selected_test);ABTestList.push(this)};this.clicked=function(a){Tracker.gClick("/_ga/click/abtest/"+this.testid+"/"+a)};this.register_events=function(){var a=$(this.element);if(a){a.addClassName(this.selected_test.className);Event.observe(a,"mousedown",function(d){var c=Event.element(d);if(c.tagName=="IMG"){c=c.parentNode}if(c.tagName=="A"||c.tagName=="INPUT"||c.tagName=="BUTTON"){if(this.num_clicks!="5+"&&this.num_clicks<4){this.num_clicks+=1}else{this.num_clicks="5+"}var b=c.getAttribute("rel:abtrack_id");if(b==null){b=c.tagName}this.clicked(this.selected_test.analytics_url+"/click/"+b+"/"+this.num_clicks)}}.bind(this))}};this.register_impression=function(){Tracker.gClick("/_ga/click/abtest/"+this.testid+"/"+this.selected_test.analytics_url+"/impression")}};var bf_event_handler=function(){this.CLASS=".behavior";this.ACTION_ATTRIBUTE="rel:actions";this.DATA_ATTRIBUTE="rel:data";this.HANDLERS={call:function(e,data){var fn=eval(data.fn);fn(data.data?data.data:data)},vote:function(e,data){badge_vote_manager.flow_vote(e,data)},share_email:function(e,data){BF_ShareEmail.locate_form_and_share_email(data.buzz_id+"-email-form",data.buzz_id)},register:function(e,data){var user=new BF_User();if(user.isLoggedIn()){bf_register.register_alias(data)}else{bf_register.new_register(data)}},map_into:function(e,data){var target=e.target;var update_el=$(data.target);var value=target.value;if(data.value){value=data.value(target)}if(update_el){var json=eval("("+update_el.getAttribute("rel:data")+")");var field=data.field.split(".");var obj=json;var end_field=field.pop();while(field.length){var f=field.shift();if(typeof obj[f]!="undefined"){obj=obj[f]}else{obj[f]={}}}if(data.append){obj[end_field]=(typeof obj[end_field]=="undefined"?"":obj[end_field]+data.append)+value}else{obj[end_field]=value}update_el.setAttribute("rel:data",Object.toJSON(json));if(data.hide&&$(data.hide)){$(data.hide).hide()}}},clear_default_field:function(e,data){var target=e.target;var remove_class=(typeof data!="undefined"&&typeof data.remove_class!="undefined")?data.remove_class:"initial-field-state";var set_value=(typeof data!="undefined"&&typeof data.set_value!="undefined")?data.set_value:"";var default_value=target.getAttribute("defaultValue")||"";if(default_value.length==0){target.setAttribute("defaultValue",target.value)}if(target.className.match(new RegExp(remove_class))){target.removeClassName(remove_class);target.value=set_value;if(typeof data!="undefined"&&data.set_type){try{target.setAttribute("type",data.set_type)}catch(e){var new_field=target.cloneNode(true);new_field.setAttribute("type",data.set_type);target.parentNode.replaceChild(new_field,target)}}}},restore_default_field:function(ev){var el=ev.target;if(el.value.length>0){return}el.type="text";el.value=el.getAttribute("defaultValue");el.addClassName("initial-field-state")},filter_chars:function(e,data){if(e.keyCode==37||e.keyCode==39){return}var regex=data.disallow;var target=e.target;var newValue=target.value.replace(regex,"");if(target.value!=newValue){target.value=newValue}},upload_image:function(e,data){$("user-image-edit-iframe").src="/static/images/public/backgrounds/bluestripe.png";$("user-image-edit-iframe").src=data.iframe_src;this.upload_image_type=data.upload_image_type;BF_UI.showDialog("user-image-edit");event_handler.get_image_settings=function(){return data}},show:function(e,data){if($(data.id)){$(data.id).removeClassName("hidden")}},hide:function(e,data){if($(data.id)){$(data.id).addClassName("hidden")}}};this.init_called=0;this.generic_handler=function(e){event_handler._event_handler(e)};this.init=function(){if(++event_handler.init_called>1){console.error("event_handler.init should not be called explicitly; use universal_dom.update(element) instead: "+console.trace())}else{universal_dom.assign_handler({bucket:"event_handler",handler:event_handler._assign_handlers})}};this._assign_handlers=function(el){var ACTION=0;var HANDLER=1;var actions=el.getAttribute(event_handler.ACTION_ATTRIBUTE);if(actions){var action_list=actions.split(" ");action_list.each(function(action){var pieces=action.split(":");el.stopObserving(pieces[ACTION],event_handler.generic_handler);el.observe(pieces[ACTION],event_handler.generic_handler)})}};this._event_handler=function(e){e.stop();var ACTION=0;var HANDLER=1;var event_type=e.type;var target=e.target;var actions=target.getAttribute(event_handler.ACTION_ATTRIBUTE);var action_list=actions.split(" ");action_list.each(function(action){var pieces=action.split(":");if(pieces[ACTION]==event_type){target.handler=pieces[HANDLER]}});if(typeof target.handler!="undefined"){var data={};var json=target.getAttribute(event_handler.DATA_ATTRIBUTE);if(json){data=eval("("+json+")")}data=typeof data[target.handler]!="undefined"?data[target.handler]:data;if(typeof event_handler.HANDLERS[target.handler]!="undefined"){var fn=event_handler.HANDLERS[target.handler];if(fn){fn(e,data)}}else{var fn=eval(target.handler);data.event=e;fn(data)}}}};var event_handler=new bf_event_handler();BuzzLoader.register(event_handler.init,1);var BF_GTrack=function(){this.init=function(){universal_dom.assign_handler({bucket:"gtrack",handler:function(a,b){if(a.hasAttribute("rel:elements")){gtrack.choose_element(a)}else{if(a.hasAttribute("rel:classes")){gtrack.choose_class(a)}else{gtrack.click(a)}}}})};this.choose_element=function(e){var d=e.getAttribute("rel:elements").split(" ");var f=e.getAttribute("rel:unit");var b=d[Math.floor(Math.random()*d.length)];var c=e.select("."+b)[0];c.removeClassName("hidden");Tracker.gClick("/_ga/click/abtest/"+f+"/"+b+"/impression");var a=e.select("a","input");a.each(function(g){var h=g.getAttribute("rel:gtrack_id");Event.observe(g,"click",function(){Tracker.gClick("/_ga/click/abtest/"+f+"/"+b+"/click/"+h)})})};this.choose_class=function(d){var c=d.getAttribute("rel:classes").split(" ");var e=d.getAttribute("rel:unit");var b=c[Math.floor(Math.random()*c.length)];d.addClassName(b);Tracker.gClick("/_ga/click/abtest/"+e+"/"+b+"/impression");var a=d.select("a","input");a.each(function(f){var g=f.getAttribute("rel:gtrack_id");Event.observe(f,"click",function(){Tracker.gClick("/_ga/click/abtest/"+e+"/"+b+"/click/"+g)})})};this.click=function(b){var c=b.getAttribute("rel:unit");Tracker.gClick("/_ga/click/gtrack/"+c+"/impression");var a=b.select("a","input");a.each(function(d){var e=d.getAttribute("rel:gtrack_id");Event.observe(d,"click",function(){Tracker.gClick("/_ga/click/gtrack/"+c+"/click/"+e)})})}};var gtrack=new BF_GTrack();BuzzLoader.register(gtrack.init,1);var BFTestRunner=function(){this.__mock_objects={};this.called={};this.init=function(){test_runner.force_testmode_on_ajax();this.load_files([{type:"text/css",url:"http://yui.yahooapis.com/2.7.0/build/logger/assets/logger.css"},{type:"text/css",url:"http://yui.yahooapis.com/2.7.0/build/yuitest/assets/testlogger.css"},{type:"text/javascript",url:"http://yui.yahooapis.com/2.7.0/build/yahoo-dom-event/yahoo-dom-event.js"},{type:"text/javascript",url:"http://yui.yahooapis.com/2.7.0/build/logger/logger-min.js"},{type:"text/javascript",url:"http://yui.yahooapis.com/2.7.0/build/yuitest/yuitest-min.js"},{type:"text/javascript",url:"http://yui.yahooapis.com/2.7.0/build/yahoo/yahoo-min.js"},{type:"text/javascript",url:"http://yui.yahooapis.com/2.7.0/build/json/json-min.js"}]);this.observe("page_load:done",function(){test_runner.load_tests()});document.observe("dom:loaded",function(e){test_runner.fire_event("page_load",{})})};this.on_page=function(page){if(window.location.href.indexOf(page)!=-1){return true}else{var params=window.location.search;if(page.indexOf("?")!=-1){params=params.replace(/\?/,"&")}window.location.href=BF_STATIC.web_root+page+params}return false};this.append_to_function=function(old_fn,appendage){this.__mock_objects["special-"+old_fn]=eval(old_fn);this.mock(old_fn,function(){eval("var supr="+test_runner.__mock_objects[old_fn]);supr(eval(old_fn+".arguments"));appendage(eval(old_fn+".arguments"))})};this.force_testmode_on_ajax=function(params){if(typeof test_runner._request=="undefined"){this._request=Ajax.Request;this._request_events=Ajax.Request.Events;this.mock("Ajax.Request",function(path,params){params.parameters.testmode="on";Ajax.Request.Events=test_runner._request_events;new test_runner._request(path,params)},"special")}};this.remove_special=function(method){if(typeof this.__mock_objects[method]!="undefined"){eval(method+"="+this.__mock_objects["special-"+method])}};this.mock=function(method,fn,prefix){if(prefix){prefix+="-"}else{prefix=""}this.__mock_objects[prefix+method]=eval(method);var object_path=method.split(".");var first_word=eval(object_path[0]);if(typeof first_word=="undefined"||typeof first_word=="object"){this._mock_object(object_path,[]);object_path=method.split(".");var fn_name=object_path.pop();var obj=eval(object_path.join("."));obj[fn_name]=fn}else{if(typeof first_word=="function"&&object_path[1]){var obj=function(){};var old=first_word;for(var each in old.prototype){obj.prototype[each]=old.prototype[each]}obj.prototype[object_path[1]]=fn}}return obj};this.unmock=function(method){if(typeof test_runner.__mock_objects[method]!="undefined"){eval(method+"="+test_runner.__mock_objects[method])}};this.unmock_all=function(){for(var method in test_runner.__mock_objects){if(method.match(/^special-/)){continue}test_runner.unmock(method)}};this._mock_object=function(object_to_build,object_built){object_built.push(object_to_build.shift());var test;try{test=eval(object_built.join("."))}catch(e){var str=object_built.join(".")+" = new Object();";eval(str)}if(test=="undefined"){var str=object_built.join(".")+" = new Object();";eval(str)}if(object_to_build.length>0){this._mock_object(object_to_build,object_built)}};this._init_testmode=function(code){if(typeof test_runner=="undefined"){window.setTimeout(function(){test_runner._init_testmode(code)},200);return}test_runner.run=function(suite){code.suite=suite};code.reload_count=0;code.ajax=function(url,params){try{var response=code.suite.get_response(url,params.parameters);if(params.while_processing.show){$(params.while_processing.show).addClassName("hidden")}params.onSuccess({status:200,responseText:Object.toJSON(response)})}catch(e){if(code.reload_count++<15){window.setTimeout(function(){code.ajax(url,params)},200)}}}};this.generate_event_handler_tests=function(suite,tests){var test_case=new YAHOO.tool.TestCase({name:"Auto-generated event handler tests"});for(var handler in tests){tests[handler].each(function(btn){if(typeof btn.el!="undefined"){btn.id=btn.id||btn.el.className||btn.el.tagName}else{btn.el=$(btn.id)}test_case["test_"+btn.id+"_is_hooked_up_to_"+handler+"_handler"]=function(handler,btn){if(typeof btn.setup!="undefined"){btn.setup()}var called={};if(typeof btn.preface!="undefined"){eval(btn.preface)}test_runner.mock(handler,function(){called[handler]=true;called.arguments=arguments});if(btn.el==null){btn.el=$(btn.id)}test_runner.Assert.isObject(btn.el,"Found "+btn.id+" element on the page");test_runner.UserAction.click(btn.el);test_runner.Assert.areSame(true,called[handler],"Called "+handler+" from "+btn.el.innerHTML+" element ("+btn.id+")");if(btn.args){btn.args.each(function(expected,idx){test_runner.Assert.isDeeply(expected,called.arguments[idx],"Got expected argument in position "+idx)})}}.curry(handler,btn)})}suite.add(test_case)};this.generate_dependency_tests=function(suite,dependencies){var test_case=new YAHOO.tool.TestCase({name:"Auto-generated dependency tests"});dependencies.each(function(dependency){if(typeof dependency=="string"){test_case["test_"+dependency+"_element_id_exists"]=function(dependency){test_runner.Assert.elementIDExists(dependency)}.curry(dependency)}else{if(typeof dependency=="object"){if(dependency.test=="is_defined"){test_case["test_"+dependency.id+"_is_defined"]=function(dependency){test_runner.Assert.isObject(eval(dependency.id),dependency.id+" is loaded")}.curry(dependency)}}}});suite.add(test_case)};this.profile=function(object_name,object){test_runner.call_profile={};YAHOO.tool.TestRunner.subscribe(YAHOO.tool.TestRunner.COMPLETE_EVENT,function(){console.dir({coverage:test_runner.call_profile})});for(var each in object){if(typeof object[each]!="function"){continue}var rnd_name=each+"_"+(new Date()).getTime();object[rnd_name]=object[each];test_runner.call_profile[each]=0;object[each]=Function(object[each].argumentNames(),'test_runner.call_profile["'+each+'"]+=1;'+object_name+"."+rnd_name+"("+(object[each].argumentNames()).join(",")+")")}};var temp=BFW_Util.getCookie("bf_trace_path");this.trace_path=(temp==null)?new Array():eval("("+unescape(temp)+")");this.trace=function(object_name){var object=eval(object_name);var temp={};for(var key in object){temp[key]=object[key]}for(var each in temp){if(typeof object[each]!="function"){continue}if(object[each].toString().match(/trace_wrapper/)){continue}var rnd_name=each+"_"+(new Date()).getTime();object[rnd_name]=object[each];object[each]=Function(object[each].argumentNames(),'				var trace_wrapper = true; var __trace_context="unknown";				try{__trace_context = arguments.callee.caller.toString();}catch(e){} 				var __trace_result;					var __trace_e; 				var __log = {args:arguments,calling:"'+object_name+"."+each+'",context:__trace_context}; 				test_runner.trace_path.push(__log); 				console.dir({"calling_'+object_name+"."+each+'":__log}); 				try {					__trace_e="";					__trace_result='+object_name+"."+rnd_name+"("+(object[each].argumentNames()).join(",")+');				} catch(e){__trace_e=e}; 				__log = {error:__trace_e,_args:arguments,result:__trace_result,called:"'+object_name+"."+each+'",context:__trace_context}; 				test_runner.trace_path.push(__log); 				console.dir({"called_'+object_name+"."+each+'":__log}); 				BFW_Util.setCookie({name:"bf_trace_path",value:escape(Object.toJSON(test_runner.trace_path))}); 				if ( __trace_e != "" ) throw(__trace_e); 				return __trace_result')}};this.dump_trace=function(){var dump=window.open("","");test_runner.trace_path.each(function(entry){var str="<li>";for(var each in entry){str+="<b>"+each+"</b>: "+entry[each]+" ("+typeof entry[each]+") <br />"}str+="</li>";dump.document.writeln(str)})};this.clear_trace=function(){BFW_Util.deleteCookie("bf_trace_path");test_runner.trace_path=new Array()};this.wait_until=function(fn_timer,fn_run,deadlock_suffix){if(fn_timer()){fn_run()}else{if(!deadlock_suffix){deadlock_suffix=(new Date()).getTime();Facebook["__deadlock_"+deadlock_suffix]=0}else{if(Facebook["__deadlock_"+deadlock_suffix]++>100){fn_run()}}window.setTimeout(function(){test_runner.wait_until(fn_timer,fn_run,deadlock_suffix)},200)}};this.add=function(obj){var tr=YAHOO.tool.TestRunner;tr.add(obj)};this.run=function(suite){this._run(true,suite)};this.local_run=function(suite){this._run(false,suite)};this._run=function(post_to_server,suite){var tr=YAHOO.tool.TestRunner;tr.subscribe(tr.TEST_PASS_EVENT,test_runner.unmock_all);tr.subscribe(tr.TEST_FAIL_EVENT,test_runner.unmock_all);if(post_to_server){tr.subscribe(tr.COMPLETE_EVENT,function(results){var oReporter=new YAHOO.tool.TestReporter(BF_STATIC.web_root+"/_fixtures",YAHOO.tool.TestFormat.JSON);oReporter.report(results.results)})}var logger=new YAHOO.tool.TestLogger();if(window.location.href.match(/test_method=/i)){var params=window.location.href.split("&");params.each(function(args){if(args.match(/test_method=/i)){var trash=args.split(/=/);var test_method=trash[1];suite.items.each(function(test){for(var each in test){if(each.match(/^test_/i)&&each!=test_method){delete test[each]}}})}})}if(suite){tr.add(suite)}tr.run()};this.log_in=function(session){var default_session={session_key:"1234567812345678123456781234567812345678123456781234567812345678marcos",display_name:"Test%20User",image:"",username:"marcos",facebook_uid:"",show_account_settings:"true",registration_path:"signin",is_facebook_user:"false",terminal_user:"false",last_active:123456789,isa:"false",user_id:1234567};var obj=session?session:{};for(var key in default_session){if(typeof obj[key]=="undefined"){obj[key]=default_session[key]}}BFW_Util.setCookie({name:BFW_COOKIE,value:obj.session_key});var info_cookie="display_name="+obj.display_name;info_cookie+="&image="+obj.image;info_cookie+="&username="+obj.username;info_cookie+="&facebook_uid="+obj.facebook_uid;info_cookie+="&show_account_settings="+obj.show_account_settings;info_cookie+="&registration_path="+obj.registration_path;info_cookie+="&is_facebook_user="+obj.is_facebook_user;info_cookie+="&terminal_user="+obj.terminal_user;info_cookie+="&isa="+obj.isa;BFW_Util.setCookie({name:BFW_INFO_COOKIE,value:info_cookie})};this.log_out=function(){BFW_Util.deleteCookie(BFW_COOKIE);BFW_Util.deleteCookie(BFW_INFO_COOKIE);BFW_Util.deleteCookie(DEFAULT_USER)};this.extendAssertions=function(){test_runner.Assert=YAHOO.util.Assert;test_runner.UserAction={};for(var each in YAHOO.util.UserAction){if(each=="click"){test_runner.UserAction[each]=function(obj){if(obj.click){obj.click()}else{YAHOO.util.UserAction.click(obj)}}}else{test_runner.UserAction[each]=YAHOO.util.UserAction[each]}}test_runner.Assert.isVisible=function(id,msg){var value=$(id).visible()&&!$(id).hasClassName("hidden");test_runner.Assert.areEqual(true,value,msg?msg:id+" is visible")};test_runner.Assert.isHidden=function(id,msg){var value=$(id).visible()&&!$(id).hasClassName("hidden");test_runner.Assert.areEqual(false,value,msg?msg:id+" is hidden")};test_runner.Assert.isLike=function(str,regex,msg){test_runner.Assert.isNotNull(str.match(regex),msg?msg:str+" matches regex")};test_runner.Assert.isNotLike=function(str,regex,msg){test_runner.Assert.isNull(str.match(regex),msg?msg:str+" matches regex")};test_runner.Assert.elementIDExists=function(id,msg){test_runner.Assert.isNotNull($(id),msg?msg:id+" is on the page")};test_runner.Assert.isDeeply=function(obj1,obj2,msg){if(typeof obj1=="object"){for(var each in obj1){test_runner.Assert.isDeeply(obj1[each],obj2[each],msg)}}else{test_runner.Assert.areSame(obj1,obj2,msg)}}};this.load_tests=function(){var params=test_runner.parse_params();var tests_to_run=params.test_suite?test_runner.__test_suites[params.test_suite]():[];if(params.tests){var tests=params.tests.split(",");for(var i=0;i<tests.length;i++){tests_to_run.push(test_runner.__tests[tests[i]])}}if(params.test){tests_to_run.push(test_runner.__tests[params.test])}test_runner._wait_for_yahoo(test_runner.extendAssertions);test_runner._wait_for_yahoo(function(){test_runner.load_files(tests_to_run)})};this._wait_for_yahoo=function(fn){if(typeof this.__wait_count=="undefined"){this.__wait_count=0}else{if(this.__wait_count++>1000){alert("Took too long to load Yahoo files");return}}if(typeof YAHOO=="undefined"||typeof YAHOO.util=="undefined"||typeof YAHOO.util.UserAction=="undefined"||typeof YAHOO.util.Assert=="undefined"){window.setTimeout(function(e){test_runner._wait_for_yahoo(fn)},200)}else{fn()}};this.cookie=function(key){var cookie_arr=document.cookie.split(";");var cookie={};for(var i=0;i<cookie_arr.length;i++){var key_val=cookie_arr[i].split("=");key_val[0]=key_val[0].replace(/ /g,"");cookie[key_val[0]]=key_val[1]}return unescape(cookie[key])};this.parse_params=function(str){var params={};if(!str){str=window.location.search.substring(1)}var key_values=str.split("&");for(var i=0;i<key_values.length;i++){var data=key_values[i].split("=");if(data.length==2){params[data[0]]=data[1]}else{params[data[0]]=true}}return params};this.$=function(id){if($(id)){return $(id)}return $(test_runner.DOM_SYNONYMS[id])};this.load_files=function(files){if(typeof files=="string"){files=[{type:"text/javascript",url:files}]}for(var i=0;i<files.length;i++){var file_data=files[i];if(typeof file_data=="string"){file_data={type:"text/javascript",url:file_data}}if(file_data.type=="text/javascript"){this.load_javascript(file_data)}else{if(file_data.type=="text/css"){this.load_css(file_data)}else{console.error("unrecognized file type to load: "+file_data.type)}}}};this.load_javascript=function(data){var tag=document.createElement("script");tag.setAttribute("type",data.type);tag.setAttribute("src",data.url);tag.setAttribute("defer","false");if(document.getElementsByTagName("HEAD")=="undefined"){this.observe("page_load",function(){document.getElementsByTagName("HEAD")[0].appendChild(tag)})}else{document.getElementsByTagName("HEAD")[0].appendChild(tag)}};this.load_css=function(data){var tag=document.createElement("link");tag.setAttribute("rel","stylesheet");tag.setAttribute("type",data.type);tag.setAttribute("href",data.url);if(document.getElementsByTagName("HEAD")=="undefined"){this.observe("page_load",function(e){document.getElementsByTagName("HEAD")[0].appendChild(tag)})}else{document.getElementsByTagName("HEAD")[0].appendChild(tag)}};this.observe=function(ev,fn){if(!this.__EVENTS[ev]){this.__EVENTS[ev]=[]}this.__EVENTS[ev].push(fn)};this.fire_event=function(ev,args){var fns=test_runner.__EVENTS[ev]?test_runner.__EVENTS[ev]:[];for(var i=0;i<fns.length;i++){fns[i](args)}if(ev.indexOf(":done")==-1){test_runner.fire_event(ev+":done",args)}};this.__EVENTS={};this.DOM_SYNONYMS={};this.__tests={buzz_stats:"/static/js/public/test/buzz_stats.js",demo:"/static/js/public/test/demo.js",login:"/static/js/public/test/login.js",register:"/static/js/public/test/register.js",profile:"/static/js/public/test/profile.js",prepopulated_quickpost:"/static/js/public/test/prepopulated_quickpost_test.js",save_buzz:"/static/js/public/test/save_buzz_test.js",facebook2:"/static/js/public/test/facebook2_test.js",badges:"/static/js/public/test/badge_test.js",session_tracking:"/static/js/public/test/session_test.js",micro_sites:"/static/js/public/test/microsite_test.js",handler_test:"/static/js/public/test/generic_handler.js",inline_media_social_actions:"/static/js/public/test/inline-media-social-actions.js",signup:"/static/js/public/test/new_signup_page.js",settings:"/static/js/public/test/new_settings.js",predictions:"/static/js/public/test/predictions_test.js",quickpost:"/static/js/public/test/quickpost_test.js",dashboard:"/static/js/public/test/dashboard_test.js","dashboard-stats":"/static/js/public/test/dashboard-stats-test.js",dashboard_ad:"/static/js/public/test/dashboard_ad_test.js",dashboard_widget:"/static/js/public/test/dashboard_widget_test.js",dashboard_user_stats:"/static/js/public/test/dashboard_user_stats_test.js",realtimeweb:"/static/js/public/test/realtimeweb_test.js",user_switching:"/static/js/public/test/user_switching_test.js",user_tracking:"/static/js/public/test/user_tracking.js",user_panel:"/static/js/public/test/user_panel_test.js",universal_dom_traversal:"/static/js/public/test/universal_dom_traversal_test.js",social:"/static/js/public/test/social_test.js",top_predictors:"/static/js/public/test/top_predictors.js"};this.__test_suites={all:function(){var suite=[];for(var each in test_runner.__tests){suite.push(test_runner.__tests[each])}return suite}}};test_runner=new BFTestRunner();if(test_runner.parse_params()["testmode"]=="on"){test_runner.init()}bf_badge_vote_manager=function(){this.VOTE_CONTROLLER="/buzzfeed/_badge_vote";this.VOTE_DEFINITIONS={badge:{onSuccess:function(r){badge_vote_manager.badgeResponse(r)},onSuccess_flow:function(r,data){badge_vote_manager.flow_badgeResponse(r,data)},parameters:{badge_id:function(t){if(t.className.match(/bf_dom/)){var json=eval("("+t.getAttribute("rel:data")+")");return json.vote.badge_id}else{return t.getAttribute("rel:badge_id")}}},success_template:'<a href="/#{username}">#{display_name}</a> thinks #{title} is <a class="badgeword">#{badge}</a>. <span class="ago">just now</span>'},love_or_hate:{onSuccess:function(r){badge_vote_manager.loveHateResponse(r)},onSuccess_flow:function(r,data){badge_vote_manager.flow_loveHateResponse(r,data)},parameters:{value:function(t){if(t.className.match(/bf_dom/)){var json=eval("("+t.getAttribute("rel:data")+")");return json.vote.value=="loves"?1:0}else{return t.getAttribute("rel:value")=="loves"?1:0}}},success_template:'<a href="/#{username}">#{display_name}</a> <span class="feed-#{loves}">&nbsp;</span> #{title}. <span class="ago">just now</span>'}};this.SHARE_TEMPLATE=new Template('    <div class="social-message-share section" style="float:left;width:100%;"> 			<h5 style="margin-bottom:10px;">Share this post and help it go viral:</h5>			<div style="float:left;width:60px;margin-right:15px"> 				<a name="fb_share" type="box_count" share_url="http://www.buzzfeed.com/#{buzz_uri}"></a> 			</div> 			<div style="float:left;width:50px;margin-right:15px"> 				<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?text=#{buzz_name}&url=http%3A//www.buzzfeed.com/#{buzz_uri}&count=vertical&related=buzzfeed" style="width:60px; height:70px;"></iframe> 			</div> 			<div id="div_subadge" style="float:left;width:52px;margin-right:15px"> 			  <iframe src="http://www.stumbleupon.com/badge/embed/5/?url=http%3A//www.buzzfeed.com/#{buzz_uri}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:65px; height: 18px;" allowTransparency="true"></iframe> 			</div> 			<div style="float:left;width:52px;margin-right:15px"> 			  <iframe src="http://digg.com/tools/diggthis.php?u=http%3A//www.buzzfeed.com/#{buzz_uri}&amp;t=#{buzz_name}" frameborder="0" height="80" scrolling="no" width="52"></iframe> 			</div> 			<div style="float:left;width:69px;margin-right:25px"> 			  <iframe scrolling="no" height="70" frameborder="0" width="69" src="http://www.reddit.com/static/button/button2.html?t=3&amp;width=69&amp;url=http%3A%2F%2Fwww.buzzfeed.com%2F#{buzz_uri}"></iframe> 			</div> 		</div> 	');this.SHARE_THE_LOVE_TEMPLATE=new Template('    <div class="social-message-share section">     	<div class="social-message-share-inner"> 	    	<div class="social-message-share-facebook-box"> 					<h5>Share this post and help it go viral:</h5> 					<div class="social-message-share-facebook"><fb:like rel:buzz_id="#{buzz_id}" href="http://www.buzzfeed.com/#{buzz_uri}" show_faces="true" width="280"></fb:like></div> 				</div> 				<div class="social-message-share-tweet-box"> 					<div id="tweet-box-#{buzz_id}"></div> 				</div> 				<div class="social-message-share-buttons"> 					<div> 						<a name="fb_share" type="box_count" share_url="http://www.buzzfeed.com/#{buzz_uri}"></a> 					</div> 					<div class="social-message-share-retweet social-message-share-button"> 						<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?text=#{buzz_name}&url=http%3A//www.buzzfeed.com/#{buzz_uri}&count=vertical&related=buzzfeed" style="width:60px; height:70px;"></iframe> 					</div> 					<div class="social-message-share-stumble social-message-share-button" id="div_subadge"> 					  <iframe src="http://www.stumbleupon.com/badge/embed/5/?url=http%3A//www.buzzfeed.com/#{buzz_uri}" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:65px; height: 80px;" allowTransparency="true"></iframe> 					</div> 					<div class="social-message-share-digg social-message-share-button" style="width:52px"> 					  <a class="DiggThisButton DiggMedium" href="http://digg.com/submit?url=http%3A//www.buzzfeed.com/#{buzz_uri}&amp;title=#{buzz_name}"></a> 					</div> 					<div class="social-message-share-reddit social-message-share-button"> 					  <iframe scrolling="no" height="70" frameborder="0" width="69" src="http://www.reddit.com/static/button/button2.html?t=3&amp;width=69&amp;url=http%3A%2F%2Fwww.buzzfeed.com%2F#{buzz_uri}"></iframe> 					</div> 				</div> 				<div class="clear"></div> 			</div> 		</div> 	');this.badgeResponse=function(r){var json=eval("("+r.responseText+")");if($("spinner-badge")){$("spinner-badge").hide()}if(badge_vote_manager._spinner){$(badge_vote_manager._spinner).hide();badge_vote_manager._spinner=null}if(json.success){BFW_Util.updateInfoCookie({last_active:json.last_active});var target=$(json.element_id);var parent=target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}Event.stopObserving(target,"click",badge_vote_manager.vote);target.removeAttribute("href");$(target.parentNode).addClassName("voted");if(json.already_voted){return badge_vote_manager._already_voted(json)}var user=new BF_User();var vote_category=target.getAttribute("rel:category");var vote_definition=badge_vote_manager.VOTE_DEFINITIONS[vote_category];var template=vote_definition.success_template;var data={username:user.getUserInfo().username,display_name:user.getUserInfo().display_name,title:unescape(parent.getAttribute("rel:buzz_title")),uri:parent.getAttribute("rel:buzz_uri"),badge:target.getAttribute("rel:badge_name")};badge_vote_manager._add_response(template,data,{parent_class:["feed-action","feed-badge"]});badge_vote_manager._hide_social_messages();if(target.getAttribute("rel:message")){$("badge-message").update(unescape(target.getAttribute("rel:message")))}$("social_message").show();$("number_of_contribs_header").show();this._update_reaction_count(target.getAttribute("rel:badge_id"))}else{}};this.loveHateResponse=function(r){var json=eval("("+r.responseText+")");if($("spinner-love_or_hate")){$("spinner-love_or_hate").hide()}if(badge_vote_manager._spinner){$(badge_vote_manager._spinner).hide();badge_vote_manager._spinner=null}if(json.success&&json.element_id){BFW_Util.updateInfoCookie({last_active:json.last_active});var target=$(json.element_id);if(target.parentNode.id.match(/(love|hate)_button-\d+/)){$(target.parentNode).show()}var parent=target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}Event.stopObserving(target,"click",badge_vote_manager.vote);target.removeAttribute("href");$(target.parentNode).addClassName("voted");if(json.already_voted){return badge_vote_manager._already_voted(json)}var user=new BF_User();var vote_category=target.getAttribute("rel:category");var vote_definition=badge_vote_manager.VOTE_DEFINITIONS[vote_category];var template=vote_definition.success_template;var data={display_name:user.getUserInfo().display_name,title:unescape(parent.getAttribute("rel:buzz_title")),uri:parent.getAttribute("rel:buzz_uri"),loves:target.getAttribute("rel:value")};var className=data.loves=="loves"?"feed-love":"feed-hate";badge_vote_manager._hide_social_messages();if(!badge_vote_manager.is_contribution(target)){badge_vote_manager._add_response(template,data,{parent_class:["feed-action",className]});$("social_message-"+data.loves).show();$("number_of_contribs_header").show();this._update_reaction_count(data.loves=="loves"?"love":"hate")}else{var contribution_message=$("social_message-"+parent.getAttribute("rel:buzz_id"));var vote_feedback=data.loves=="loves"?"Yeah!":"Awww";contribution_message.update(vote_feedback);contribution_message.show()}}else{}};this._already_voted=function(json){badge_vote_manager._hide_social_messages();var target=$(json.element_id);if(badge_vote_manager.is_contribution(target)){var parent=target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}var social_message=$("social_message-"+parent.getAttribute("rel:buzz_id"));if(social_message){social_message.update("Okay!");social_message.style.width="100%";social_message.show()}}else{$("social_message-already-voted").show()}};this._add_response=function(template_str,data,args){var items={};for(var each in data){items[each]=data[each].replace(/</g,"&lt;").replace(/>/g,"&gt;")}var template=new Template(template_str);var message=template.evaluate(items);var li=new Element("li",{"class":"feed-action"});$("contribution-list").insert({top:li});if(args&&args.parent_class){var classes=args.parent_class;for(var i=0;i<classes.length;i++){li.addClassName(classes[i])}}li.update(message)};this._exceeded_maximum_badge_votes=function(){var buttons=$$(".vote-badge");for(var i=0;i<buttons.length;i++){Event.stopObserving(buttons[i],"click",badge_vote_manager.vote);buttons[i].observe("click",badge_vote_manager._show_vote_exceeded)}badge_vote_manager._show_vote_exceeded()};this._show_vote_exceeded=function(e){if(typeof e!="undefined"){e.stop()}badge_vote_manager._hide_social_messages();$("social_message-badge-votecount-exceeded").show()};this._hide_social_messages=function(){if($("social_message-badge-votecount-exceeded")){$("social_message-badge-votecount-exceeded").hide()}if($("social_message-already-voted")){$("social_message-already-voted").hide()}if($("social_message")){$("social_message").hide()}if($("social_message-loves")){$("social_message-loves").hide()}if($("social_message-hates")){$("social_message-hates").hide()}};this.init=function(){bf_login.init();this.ajax=new BF_Request();if(typeof twttr=="undefined"){var script=document.createElement("script");script.src="http://platform.twitter.com/anywhere.js?id="+BF_STATIC.twitter_api_key+"&v=1";script.async=true;document.getElementsByTagName("BODY")[0].appendChild(script)}var user_info=(new BF_User()).getUserInfo();if(user_info&&typeof user_info.p_disable_reaction!="undefined"&&user_info.p_disable_reaction=="true"){$$("#lovehate_buttons, #badge_voting, .lovehate-buttons").each(function(el){el.style.visibility="hidden"})}else{for(var category in badge_vote_manager.VOTE_DEFINITIONS){var divs=$$(".vote-"+category);for(var i=0;i<divs.length;i++){var div=divs[i];if(div.className.match(/bf_dom/)){continue}div.setAttribute("rel:category",category);if(!div.id){div.id="vote-"+category+"-"+parseInt(Math.random()*10000000)}div.observe("click",badge_vote_manager.vote)}}}var target=$("filter-show_everything");var showSortButtons=$$("#contribution-list .contrib").length>0&&$$("#contribution-list .feed-action").length>0;if(target){target.observe("click",function(e){e.stop();badge_vote_manager._hide_content("feed-action",false);badge_vote_manager._hide_content("contrib",false);$(e.target.parentNode).addClassName("current");$($("filter-hide_contributions").parentNode).removeClassName("current");$($("filter-hide_all_votes").parentNode).removeClassName("current")})}target=$("filter-hide_all_votes");if(target){if(showSortButtons){target.show()}target.observe("click",function(e){e.stop();badge_vote_manager._hide_content("feed-action",true);badge_vote_manager._hide_content("contrib",false);$(e.target.parentNode).addClassName("current");$($("filter-hide_contributions").parentNode).removeClassName("current");$($("filter-show_everything").parentNode).removeClassName("current")})}target=$("filter-hide_contributions");if(target){if(showSortButtons){target.show()}target.observe("click",function(e){e.stop();badge_vote_manager._hide_content("feed-action",false);badge_vote_manager._hide_content("contrib",true);$(e.target.parentNode).addClassName("current");$($("filter-hide_all_votes").parentNode).removeClassName("current");$($("filter-show_everything").parentNode).removeClassName("current")})}target=$("number_of_contribs_header");if(target&&!showSortButtons){$("number_of_contribs_header").addClassName("no-menu")}target=$("fb-login-again");if(target){target.observe("click",function(e){e.stop();$("log-into-facebook-again").hide()})}target=$("fb-dont-login-again");if(target){target.observe("click",function(e){e.stop();$("log-into-facebook-again").hide();createCookie("fb-vote-prompt","false")})}var contribs=$$(".contrib");for(var i=0;i<contribs.length;i++){var buzz_id=contribs[i].getAttribute("rel:buzz_id");if(buzz_id){contribs[i].observe("mouseout",function(e){var parent=e.target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}var buzz_id=parent.getAttribute("rel:buzz_id");var id="tools-"+buzz_id;if($(id)){$(id).removeClassName("selected_tools")}});contribs[i].observe("mouseover",function(e){var parent=e.target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}var buzz_id=parent.getAttribute("rel:buzz_id");var id="tools-"+buzz_id;if($(id)){$(id).addClassName("selected_tools")}})}}if(document.location.href.match(/#share/)&&$("badge_voting")){var target=$("badge_voting").getElementsByTagName("A")[0];if(!target.id){target.id=(new Date()).getTime()}var vote_category=target.getAttribute("rel:category");badge_vote_manager.show_sharing_links({element_id:target.id,category:vote_category})}};this._hide_content=function(class_name,hide){var items=$$("#contribution-list ."+class_name);for(var i=0;i<items.length;i++){if(hide){items[i].hide()}else{items[i].show()}}};this.show_social_icons=function(){if(typeof ActiveHistory=="undefined"){return}ActiveHistory.observe("visited:digg",function(){if($("share_digg_button")){$("share_digg_button").show()}});ActiveHistory.observe("visited:twitter",function(){if($("share_twitter_button")){$("share_twitter_button").show()}});ActiveHistory.observe("visited:reddit",function(){if($("share_reddit_button")){$("share_reddit_button").show()}});ActiveHistory.observe("visited:stumbleupon",function(){if($("share_stumbleupon_button")){$("share_stumbleupon_button").show()}});ActiveHistory.observe("visited:delicious",function(){if($("share_delicious_button")){$("share_delicious_button").show()}});ActiveHistory.observe("visited:fark",function(){if($("share_fark_button")){$("share_fark_button").show()}})};this.flow_vote=function(e,data){var target=e.target;var user=new BF_User();var parent=target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}data.buzz_id=parent.getAttribute("rel:buzz_id");if(user.isLoggedIn()){if(data.category=="badge"){var user=new BF_User();var user_info=user.getUserInfo();if(typeof _badge_votes_so_far=="undefined"){_badge_votes_so_far={}}if(typeof _badge_votes_so_far[data.buzz_id]=="undefined"){_badge_votes_so_far[data.buzz_id]={}}if(typeof _badge_votes_so_far!="undefined"){if(typeof _badge_votes_so_far[""+data.buzz_id]=="undefined"){_badge_votes_so_far[""+data.buzz_id]={}}if(typeof _badge_votes_so_far[""+data.buzz_id][user_info.username]=="undefined"){_badge_votes_so_far[""+data.buzz_id][user_info.username]=1}else{_badge_votes_so_far[""+data.buzz_id][user_info.username]+=1}if(_badge_votes_so_far[""+data.buzz_id][user_info.username]>=4){return badge_vote_manager._flow_show_vote_exceeded(data.buzz_id)}}}badge_vote_manager._flow_vote(target,data)}else{badge_vote_manager.login(target);badge_vote_manager.onLogin=function(){badge_vote_manager._flow_vote(target,data)};badge_vote_manager.onRegister=function(){badge_vote_manager._flow_showRegistrationMessage(data.buzz_id)}}};this._flow_vote=function(target,data){badge_vote_manager._flow_hide_all_social_messages();var parent=target;if(!target.id){target.id="temp-"+(new Date()).getTime()}var vote_category=target.getAttribute("rel:category");badge_vote_manager.show_sharing_links({element_id:target.id,category:vote_category});while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}data.buzz_id=parent.getAttribute("rel:buzz_id");data.buzz_uri="/"+parent.getAttribute("rel:buzz_uri");data.buzz_title=unescape(parent.getAttribute("rel:buzz_title"));data.blurb=unescape(parent.getAttribute("rel:blurb"));data.image_src=unescape(parent.getAttribute("rel:image_src"));data.title_is_excerpt=parent.getAttribute("rel:title_is_excerpt");badge_vote_manager._spinner=$(data.buzz_id+"-spinner-"+data.category);badge_vote_manager._spinner.show();var vote_definition=this.VOTE_DEFINITIONS[data.category];if(!vote_definition){return}var params={action:"vote",element_id:target.id,category:data.category,uri:data.buzz_uri,buzz_id:data.buzz_id,from_page:window.location.href.split("/").pop()};for(var each in vote_definition.parameters){params[each]=vote_definition.parameters[each](target)}badge_vote_manager.ajax.request(this.VOTE_CONTROLLER,{method:"get",parameters:params,onSuccess:function(r){vote_definition.onSuccess_flow(r,data)}})};this.flow_badgeResponse=function(r,data){var json=eval("("+r.responseText+")");if($("spinner-badge")){$("spinner-badge").hide()}if(badge_vote_manager._spinner){$(badge_vote_manager._spinner).hide();badge_vote_manager._spinner=null}if(json.success){BFW_Util.updateInfoCookie({last_active:json.last_active});var user=new BF_User();var target=$(json.element_id);Event.stopObserving(target,"click",event_handler._event_handler);target.removeAttribute("href");$(target.parentNode).addClassName("voted");if(json.already_voted){badge_vote_manager._flow_already_voted(data.buzz_id);return}var vote_definition=badge_vote_manager.VOTE_DEFINITIONS[data.category];data.username=user.getUserInfo().username;data.display_name=user.getUserInfo().display_name;data.title=data.buzz_title;data.uri=data.buzz_uri;data.badge=data.badge_name;badge_vote_manager._flow_hide_all_social_messages();if(data.message){$(data.buzz_id+"-badge-message").update(unescape(data.message))}$(data.buzz_id+"-social_message").show()}else{}};this.flow_loveHateResponse=function(r,data){var json=eval("("+r.responseText+")");if(badge_vote_manager._spinner){$(badge_vote_manager._spinner).hide();badge_vote_manager._spinner=null}if(json.success){var user=new BF_User();BFW_Util.updateInfoCookie({last_active:json.last_active});var target=$(json.element_id);Event.stopObserving(target,"click",event_handler._event_handler);target.removeAttribute("href");$(target.parentNode).addClassName("voted");if(json.already_voted){badge_vote_manager._flow_already_voted(data.buzz_id);return}var vote_definition=badge_vote_manager.VOTE_DEFINITIONS[data.category];data.display_name=user.getUserInfo().display_name,data.title=data.buzz_title,data.uri=data.buzz_uri,data.loves=data.value;var className=data.loves=="loves"?"feed-love":"feed-hate";$(data.buzz_id+"-social_message-"+data.loves).show()}else{}};this._flow_already_voted=function(buzz_id){badge_vote_manager._flow_hide_all_social_messages();$(buzz_id+"-social_message-already-voted").show()};this._flow_hide_all_social_messages=function(){$$(".social-message").each(function(el){el.hide()})};this._flow_show_vote_exceeded=function(buzz_id){badge_vote_manager._flow_hide_all_social_messages();$(buzz_id+"-social_message-badge-votecount-exceeded").show()};this._flow_showRegistrationMessage=function(buzz_id){var targetParent=$(buzz_id+"-social-actions");if(targetParent){var div=document.createElement("div");div.className="section social-message validate";var h5=document.createElement("h5");var span=document.createElement("span");span.appendChild(document.createTextNode("Please Validate Your Email"));h5.appendChild(span);var p=document.createElement("p");p.appendChild(document.createTextNode("Thanks for registering. Before you can react or contribute we need to quickly validate your email address. We've sent you a confirmation email with instructions. If you don't receive the email in a few minutes, please check your spam folder."));div.appendChild(h5);div.appendChild(p);targetParent.appendChild(div)}if($("registration-div")){$("registration-div").hide()}};this.vote=function(e){e.stop();var user=new BF_User();var target=e.target;if(user.isLoggedIn()){var vote_category=target.getAttribute("rel:category");badge_vote_manager.show_sharing_links({element_id:target.id,category:vote_category});user_info=user.getUserInfo();var fb_vote_prompt=readCookie("fb-vote-prompt");badge_vote_manager._vote(target)}else{badge_vote_manager.login(target);badge_vote_manager.onLogin=function(){badge_vote_manager._vote(target)};badge_vote_manager.onRegister=function(){badge_vote_manager._showRegistrationMessage(target)}}};this._showRegistrationMessage=function(target){var parent=target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}var buzz_id=parent.getAttribute("rel:buzz_id");var targetParent=$("tools-div-"+buzz_id);if(!targetParent){targetParent=$("social-actions")}if(targetParent){var div=document.createElement("div");div.className="section social-message validate";var h5=document.createElement("h5");var span=document.createElement("span");span.appendChild(document.createTextNode("Please Validate Your Email"));h5.appendChild(span);var p=document.createElement("p");p.appendChild(document.createTextNode("Thanks for registering. Before you can react or contribute we need to quickly validate your email address. We've sent you a confirmation email with instructions. If you don't receive the email in a few minutes, please check your spam folder."));div.appendChild(h5);div.appendChild(p);targetParent.appendChild(div);if($("registration-div")){$("registration-div").hide()}}};this._vote=function(target){var vote_category=target.getAttribute("rel:category");if(!vote_category){return}var parent=target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}var buzz_id=parent.getAttribute("rel:buzz_id");if(vote_category=="badge"){if(typeof _badge_votes_so_far=="undefined"){_badge_votes_so_far={};_badge_votes_so_far[buzz_id]={}}var user=new BF_User();var user_info=user.getUserInfo();if(typeof _badge_votes_so_far!="undefined"){if(typeof _badge_votes_so_far[""+buzz_id][user_info.username]=="undefined"){_badge_votes_so_far[""+buzz_id][user_info.username]=1}else{_badge_votes_so_far[""+buzz_id][user_info.username]+=1}if(_badge_votes_so_far[""+buzz_id][user_info.username]>=4){return badge_vote_manager._exceeded_maximum_badge_votes()}}}if(badge_vote_manager.is_contribution(target)){$("love_button-"+parent.getAttribute("rel:buzz_id")).hide();$("hate_button-"+parent.getAttribute("rel:buzz_id")).hide();$("social_message-"+parent.getAttribute("rel:buzz_id")).hide();badge_vote_manager._spinner=$("spinner-"+parent.getAttribute("rel:buzz_id"));$(badge_vote_manager._spinner).style.width="100%";$(badge_vote_manager._spinner).show()}else{if($("spinner-"+vote_category)){$("spinner-"+vote_category).show()}}var vote_definition=this.VOTE_DEFINITIONS[vote_category];if(!vote_definition){return}var params={action:"vote",element_id:target.id,category:vote_category,uri:"/"+parent.getAttribute("rel:buzz_uri"),buzz_id:parent.getAttribute("rel:buzz_id")};for(var each in vote_definition.parameters){params[each]=vote_definition.parameters[each](target)}var ajax=new BF_Request();ajax.request(this.VOTE_CONTROLLER,{method:"get",parameters:params,onSuccess:vote_definition.onSuccess})};this.simple_love_vote=function(uri,buzz_id){var vote_definition=this.VOTE_DEFINITIONS.love_or_hate;var params={action:"vote",buzz_id:buzz_id,category:"love_or_hate",uri:uri,value:1};var ajax=new BF_Request();ajax.request(this.VOTE_CONTROLLER,{method:"get",parameters:params,onSuccess:vote_definition.onSuccess})};this.is_contribution=function(target){var parent=target;while(parent.parentNode&&!parent.getAttribute("rel:buzz_id")){parent=parent.parentNode}return parent.parentNode.className.match(/contribution-lovehate-buttons/)};this.login=function(target){var registration_div=$("registration-div");if(registration_div){registration_div.parentNode.removeChild(registration_div)}var login_form_target_str=target.getAttribute("rel:login_form_target");if(!login_form_target_str){var json=eval("("+target.getAttribute("rel:data")+")");if(json){login_form_target_str=json.vote.login_form_target}}if(!login_form_target_str){login_form_target_str="social-actions"}if($(login_form_target_str)){$(login_form_target_str).appendChild(registration_div)}var reg=new BF_Register();reg.register_handler(false,{action:"badge_vote"});reg.fb_register_handler(false,{action:"badge_vote"});$("login-submit").value="Sign In";$("register-submit").value="Register";if($("preview-again-from-registration")){$("preview-again-from-registration").hide()}if($("preview-again-from-login")){$("preview-again-from-login").hide()}bf_login.args={action:"badge_vote"};$("registration-div").showOnScreen()};this._update_reaction_count=function(id_prefix){var id=id_prefix+"-reaction-count";var count=$(id).innerHTML.replace(/\s+/g,"");var count=parseInt(count);if(!isNaN(count)){count++;$(id).update(count)}};this.show_sharing_links=function(info){if(!info.category){info.category=info.element_id.split("-").slice(0,-1).join("-")}if(info.category=="love-button"){info.category="love_or_hate"}var parent=$(info.element_id);while((info.buzz_id=parent.getAttribute("rel:buzz_id"))==null&&parent.parentNode){parent=parent.parentNode}if($("generated-sharing-links")&&$("generated-sharing-links").getAttribute("rel:buzz_id")==info.buzz_id){return}var blank=BF_STATIC.image_root+"/static/images/public/backgrounds/trans.gif";["default-sharing-links","generated-sharing-links"].each(function(id){var el=$(id);if(el){var iframes=el.getElementsByTagName("IFRAME");for(var i=0;i<iframes.length;i++){iframes[i].src=blank}el.parentNode.removeChild(el)}});var data={image_root:BF_STATIC.image_root};while((data.buzz_uri=parent.getAttribute("rel:buzz_uri"))==null&&parent.parentNode){parent=parent.parentNode}while((data.buzz_name=parent.getAttribute("rel:buzz_title"))==null&&parent.parentNode){parent=parent.parentNode}for(var each in data){if(each!="image_root"&&each!="buzz_name"){data[each]=escape(data[each])}}var parent_div=badge_vote_manager.find_parent("div",$(info.element_id));if(parent_div.parentNode.className.match(/contrib/)){parent_div=parent_div.parentNode}else{parent_div=parent_div.parentNode.parentNode}var div=document.createElement("div");div.id="generated-sharing-links";div.setAttribute("rel:buzz_id",info.buzz_id);data.buzz_id=info.element_id.split("-").pop();if($($(info.element_id).parentNode).parentNode.getAttribute("rel:buzz_id")){data.buzz_id=$($(info.element_id).parentNode).parentNode.getAttribute("rel:buzz_id")}var template=badge_vote_manager.SHARE_THE_LOVE_TEMPLATE;div.innerHTML=template.evaluate(data);(function(){var s=document.createElement("SCRIPT"),s1=document.getElementsByTagName("SCRIPT")[0];s.type="text/javascript";s.async=true;s.src="http://widgets.digg.com/buttons.js";s1.parentNode.insertBefore(s,s1)})();$(parent_div).appendChild(div);FB.XFBML.parse(div);var badge_prefix="";if($(info.element_id).getAttribute("rel:badge_name")){badge_prefix=$(info.element_id).getAttribute("rel:badge_name")+"! "}else{if($(info.element_id).getAttribute("rel:data")){var json=$(info.element_id).getAttribute("rel:data");var obj=eval("("+json+")");if(typeof obj.vote!="undefined"&&typeof obj.vote.badge_name!="undefined"){badge_prefix=obj.vote.badge_name+"! "}}}var setup_twitter=function(count,msg){if(typeof twttr!="undefined"){twttr.anywhere(function(T){T("#tweet-box-"+data.buzz_id).tweetBox({width:280,label:"Share on Twitter",defaultContent:msg})})}else{if(count<10){window.setTimeout(function(){setup_twitter(count++)},200)}else{}}};if(!Prototype.Browser.IE6){new Ajax.Request("/buzzfeed/_short_url",{method:"get",parameters:{buzz_id:data.buzz_id,url:"http://buzzfeed.com/"+data.buzz_uri,format:"json"},onComplete:function(r){var obj=eval("("+r.responseText+")");var msg=badge_prefix+unescape(unescape(data.buzz_name))+" "+obj.short_url||"http://buzzfeed.com/"+data.buzz_uri;setup_twitter(0,msg)}})}};this.find_parent=function(tag,el){if(el.tagName.toLowerCase()==tag.toLowerCase()){return el}else{if(el.parentNode!=null){return badge_vote_manager.find_parent(tag,el.parentNode)}else{return console.warn("no "+tag+" found in DOM")}}}};badge_vote_manager=new bf_badge_vote_manager();badge_vote_manager.show_social_icons();BuzzLoader.register(function(){badge_vote_manager.init()},2);var BF_MobilePromos=function(){this.agent=navigator.userAgent.toLowerCase();this.is_mobile=this.agent.match(/iphone|ipod|android|ipad/);this.is_iphone=this.agent.match(/iphone|ipod/);this.is_android=this.agent.match(/android/);this.is_ipad=this.agent.match(/ipad/);this.init=function(){if(mobile_promos.is_iphone){$("iphone_app_promo").show()}else{if(mobile_promos.is_android){}else{}}}};var mobile_promos=new BF_MobilePromos();BuzzLoader.register(function(){mobile_promos.init()},1);sailthru_horizon_track=function(e){getCookie=function(g){var j=g+"=";var f=document.cookie.split(";");for(var h=0;h<f.length;h++){var k=f[h];while(k.charAt(0)==" "){k=k.substring(1,k.length)}if(k.indexOf(j)==0){return k.substring(j.length,k.length)}}return null};var a=getCookie("sailthru_hid");if(!a||!e.domain){return}var c="http://"+e.domain+"/horizon/track?r="+Math.random();if(e.tag){e.tags=e.tag}if(e.tags){if(e.tags instanceof Array){c+="&tag="+encodeURIComponent(e.tags.join(","))}else{if(e.tags instanceof Object){for(var b in e.tags){c+="&tag["+encodeURIComponent(b)+"]="+encodeURIComponent(e.tags[b])}}else{c+="&tag="+encodeURIComponent(e.tags)}}}if(e.set){for(var b in e.set){c+="&set["+encodeURIComponent(b)+"]="+encodeURIComponent(e.set[b])}}var d=new Image();d.src=c};sailthru_submit_email=function(c){var b="/buzzfeed/_email/";var a=$("sailthru_email_form-"+c.id).getValue().strip();if(!a||a=="your email address"){$("sailthru_email_success-"+c.id).className="hidden";$("sailthru_email_failure-"+c.id).className="";$("sailthru_email_failure-"+c.id).innerHTML="Please enter an email address."}else{$("sailthru_email_spinner-"+c.id).className="spinner-text";new Ajax.Request(b,{method:"get",parameters:{email:a},onSuccess:function(d){if(d.responseText.match(/Email added/)){$("sailthru_email_failure-"+c.id).className="hidden";$("sailthru_email_success-"+c.id).className="";$("sailthru_email_success-"+c.id).innerHTML="You are signed up! You should receive your first email tomorrow morning."}else{$("sailthru_email_success-"+c.id).className="hidden";$("sailthru_email_failure-"+c.id).className="";$("sailthru_email_failure-"+c.id).innerHTML="Sorry! We weren't able to sign you up. Please try again."}$("sailthru_email_spinner-"+c.id).className="spinner-text hidden"},onFailure:function(d){$("sailthru_email_success-"+c.id).className="hidden";$("sailthru_email_failure-"+c.id).className="";$("sailthru_email_failure-"+c.id).innerHTML="Sorry! We weren't able to sign you up. Please try again."}})}};