var TimesPeople=TimesPeople||{};if(typeof Object.create!=="function"){Object.create=function(o){function F(){}F.prototype=o;return new F()}}(function(app){var debug=false;if(typeof console=="undefined"||!debug){app.console={log:function(){}}}else{app.console=console}app.Object={};app.Object.extend=function(destination,source){for(var property in source){destination[property]=source[property]}return destination};app.isIE=function(){return !+"\v1"};app.isIE6=function(){return app.isIE()&&!window.XMLHttpRequest};app.isReady=function(){return(document.body&&document.body.firstChild)?true:false};app.$=function $(element){if(typeof element=="string"){element=document.getElementById(element)}return element};app.truncate=function(string,length){length=length||30;return string.length>length?string.slice(0,length-3)+"...":String(string)};app.hasClassName=function(element,className){if(!(element=app.$(element))){return}var elementClassName=element.className;return(elementClassName.length>0&&(elementClassName==className||new RegExp("(^|\\s)"+className+"(\\s|$)").test(elementClassName)))};app.getElementsByClassName=(function(){var fn,el=document.createElement("div");if(el.getElementsByClassName){fn=function getElementsByClassName(className,element){element=element||document.body;return Array.prototype.slice.call(element.getElementsByClassName(className),0)}}else{fn=function getElementsByClassName(className,element){element=element||document.body;for(var results=[],childNodes=element.getElementsByTagName("*"),re=new RegExp("(?:\\s|^)"+className+"(?:\\s|$)"),length=childNodes.length,i=0;i<length;++i){element=childNodes[i];if(re.test(element.className)){results.push(element)}}return results}}return fn})();app.hasNativeShadow=(function(){var is_capable=false;var element=document.documentElement;var style=element.style;var shadow_properties=["BoxShadow","MozBoxShadow","WebkitBoxShadow"];for(var i=0,shadow_property;shadow_property=shadow_properties[i];i++){app.console.log(shadow_property,style[shadow_property]);is_capable=typeof style[shadow_property]=="string";if(is_capable){break}}if(app.isIE()){is_capable=true}return is_capable})()})(TimesPeople);(function(app){app.EventPublisher=function EventPublisher(){this.observers=[]};app.EventPublisher.prototype={register:function(observer){this.observers.push(observer)},unregister:function(observer){var current_observers=this.observers;var results=[];for(var i=0,current_observer;current_observer=current_observers[i];i++){if(observer!=current_observer){results.push(current_observer)}}this.observers=results},notifyObservers:function(event,data){for(var i=0,observers=this.observers;i<observers.length;i++){try{observers[i].update({event:event,data:data})}catch(e){app.console.log(e)}}}}})(TimesPeople);(function(app){var cache=[];app.Event={observe:function(element,eventName,fn){var handler;if(element.addEventListener){if(eventName==="mouseenter"||eventName==="mouseleave"){eventName=eventName==="mouseenter"?"mouseover":"mouseout";handler=function(event){var parent=event.relatedTarget;while(parent&&parent!==element){try{parent=parent.parentNode}catch(e){parent=element}}if(parent===element){return}fn.call(element,event)}}element.addEventListener(eventName,(handler||fn),false)}else{if(element.attachEvent){if(eventName.indexOf(":")>-1){eventName="dataavailable"}handler=function(){return fn.call(element,normalize(window.event))};element.attachEvent("on"+eventName,handler)}}cache.push(handler||fn);if(handler){fn.handler=handler}return element},fire:function(element,eventName,memo){element=app.$(element);if(element==document&&document.createEvent&&!element.dispatchEvent){element=document.documentElement}var event;if(document.createEvent){var event=document.createEvent("HTMLEvents");event.initEvent(eventName,true,true)}else{var event=document.createEventObject();event.eventType=(eventName.indexOf(":")>-1)?"ondataavailable":on+eventName}event.eventName=eventName;event.memo=memo||{};if(document.createEvent){element.dispatchEvent(event)}else{element.fireEvent(event.eventType,event)}return Event.extend(event)},stopObserving:function(element,eventName,fn){var handler;if(typeof fn.handler=="function"){handler=fn.handler}else{handler=fn}if(element.removeEventListener){switch(eventName){case"mouseenter":eventName="mouseover";break;case"mouseleave":eventName="mouseout";break}element.removeEventListener(eventName,handler,false)}else{if(element.detachEvent){element.detachEvent("on"+eventName,handler)}}},pointer:function(event){var docElement=document.documentElement,body=document.body||{scrollLeft:0,scrollTop:0};return{x:event.pageX||(event.clientX+(docElement.scrollLeft||body.scrollLeft)-(docElement.clientLeft||0)),y:event.pageY||(event.clientY+(docElement.scrollTop||body.scrollTop)-(docElement.clientTop||0))}}};function destroyCache(){for(var i=0,entry;entry=cache[i];i++){entry=null}}function normalize(event){event.stopPropagation=event.stopPropagation||function(){event.cancelBubble=true};event.preventDefault=event.preventDefault||function(){this.returnValue=false};event.target=event.target||event.srcElement;return event}if(window.attachEvent){window.attachEvent("onunload",destroyCache)}})(TimesPeople);(function(app){app.Cookie={get:function(name){return new RegExp(name+"=([^;]+)").test(unescape(document.cookie))?RegExp.$1:null},set:function(name,value,options){var newcookie=[escape(name)+"="+escape(value)];if(options){if(options.expires){newcookie.push("expires="+options.expires.toGMTString())}if(options.path){newcookie.push("path="+options.path)}if(options.domain){newcookie.push("domain="+options.domain)}if(options.secure){newcookie.push("secure")}}document.cookie=newcookie.join("; ")}}})(TimesPeople);(function(app){function run(){loadCSS();restoreState()}function restoreState(){app.state=app.Cookie.get("news_people_toolbar");if(app.state!="NO"){addMargin()}}function addMargin(){if(document.body){document.body.style.paddingTop="51px"}else{document.write("<style>html body {padding-top:51px;}</style>")}}function loadCSS(){var head=document.getElementsByTagName("head")[0];function createLink(uri){var link=document.createElement("link");link.href=uri;link.type="text/css";link.rel="stylesheet";head.appendChild(link);link=null}createLink(app.Config.css_host+app.Config.css_build_path+"/styles.css");(function(){if(document.body){var value=document.body.style.backgroundColor;if(!value&&document.defaultView){var css=document.defaultView.getComputedStyle(document.body,null);value=css?css.backgroundColor:null}else{if(!value&&document.body.currentStyle){value=document.body.currentStyle.backgroundColor}}if(value=="rgb(26, 26, 26)"||value.toLowerCase()=="#1a1a1a"){app.Config.is_dark=true;createLink(app.Config.css_host+app.Config.css_path+"/dark.css")}else{app.Config.is_dark=false}if(app.isIE6()){createLink(app.Config.css_host+app.Config.css_path+"/ie6.css")}}else{setTimeout(arguments.callee,10)}})()}run()})(TimesPeople);(function(app){var cache={};app.template=function(str,data){var fn=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+str.replace(/[\r\t\n]/g," ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');");return data?fn(data):fn}})(TimesPeople);if(!this.JSON){JSON=function(){function f(n){return n<10?"0"+n:n}Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()};var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==="string"){return c}return"\\u"+("0000"+(+(a.charCodeAt(0))).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(typeof value.length==="number"&&!(value.propertyIsEnumerable("length"))){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}return{stringify:function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})},parse:function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+(+(a.charCodeAt(0))).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}()}(function(){this.FX=function(el,attributes,duration,callback,ctx){this.el=DOM.get(el);this.attributes=attributes;this.duration=duration||0.7;this.callback=callback||function(){};this.ctx=ctx||window};this.FX.prototype={frame:{},endAttr:{},startAttr:{},start:function(){var fx=this;this.getAttributes();this.duration=this.duration*1000;this.time=new Date().getTime();this.animating=true;this.timer=setInterval(function(){var time=new Date().getTime();if(time<(fx.time+fx.duration)){fx.elapsed=time-fx.time;fx.setCurrentFrame()}else{fx.frame=fx.endAttr;fx.complete()}fx.setAttributes()},1)},stop:function(finish){if(this.animating){if(finish){this.frame=this.endAttr;this.setAttributes()}this.complete()}},ease:function(start,end){return start+((1-Math.cos((this.elapsed/this.duration)*Math.PI))/2)*(end-start)},complete:function(){clearInterval(this.timer);this.timer=null;this.animating=false;this.callback.call(this.ctx)},setCurrentFrame:function(){for(attr in this.startAttr){if(this.startAttr[attr] instanceof Array){this.frame[attr]=[];for(var i=0;i<this.startAttr[attr].length;i++){this.frame[attr][i]=this.ease(this.startAttr[attr][i],this.endAttr[attr][i])}}else{this.frame[attr]=this.ease(this.startAttr[attr],this.endAttr[attr])}}},getAttributes:function(){for(var attr in this.attributes){switch(attr){case"color":case"background-color":this.startAttr[attr]=parseColor(this.attributes[attr].from||DOM.getStyle(this.el,attr));this.endAttr[attr]=parseColor(this.attributes[attr].to);break;case"scrollTop":case"scrollLeft":var el=(this.el==document.body)?(document.documentElement||document.body):this.el;this.startAttr[attr]=this.attributes[attr].from||el[attr];this.endAttr[attr]=this.attributes[attr].to;break;default:this.startAttr[attr]=this.attributes[attr].from||(parseFloat(DOM.getStyle(this.el,attr))||0);this.endAttr[attr]=this.attributes[attr].to;break}}},setAttributes:function(){for(var attr in this.frame){switch(attr){case"opacity":DOM.setStyle(this.el,attr,this.frame[attr]);break;case"scrollLeft":case"scrollTop":var el=(this.el==document.body)?(document.documentElement||document.body):this.el;el[attr]=this.frame[attr];break;case"color":case"background-color":var rgb="rgb("+Math.floor(this.frame[attr][0])+","+Math.floor(this.frame[attr][1])+","+Math.floor(this.frame[attr][2])+")";DOM.setStyle(this.el,attr,rgb);break;default:DOM.setStyle(this.el,attr,this.frame[attr]+"px");break}}}};var DOM={get:function(id){return(typeof id=="string")?document.getElementById(id):id},getStyle:function(el,prop){prop=toCamelCase(prop);var view=document.defaultView;if(view&&view.getComputedStyle){return el.style[prop]||view.getComputedStyle(el,"")[prop]||null}else{if(prop=="opacity"){var opacity=el.filters("alpha").opacity;return isNaN(opacity)?1:(opacity?opacity/100:0)}return el.style[prop]||el.currentStyle[prop]||null}},setStyle:function(el,prop,value){if(prop=="opacity"){el.style.filter="alpha(opacity="+value*100+")";el.style.opacity=value}else{prop=toCamelCase(prop);el.style[prop]=value}}};var toCamelCase=(function(){var cache={};return function(str){if(!cache[str]){return cache[str]=str.replace(/-([a-z])/g,function($0,$1){return $1.toUpperCase()})}else{return cache[str]}}})();var parseColor=function(str){var rgb=str.match(/^#?(\w{2})(\w{2})(\w{2})$/);if(rgb&&rgb.length==4){return[parseInt(rgb[1],16),parseInt(rgb[2],16),parseInt(rgb[3],16)]}rgb=str.match(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/);if(rgb&&rgb.length==4){return[parseInt(rgb[1],10),parseInt(rgb[2],10),parseInt(rgb[3],10)]}rgb=str.match(/^#?(\w{1})(\w{1})(\w{1})$/);if(rgb&&rgb.length==4){return[parseInt(rgb[1]+rgb[1],16),parseInt(rgb[2]+rgb[2],16),parseInt(rgb[3]+rgb[3],16)]}}}).call(TimesPeople);(function(app){app.Request=(function(){var head=document.getElementsByTagName("head")[0];var scripts=document.getElementsByTagName("script");var bell_pathname=app.Config.bell_pathname;if(!bell_pathname){for(var i=0,script;script=scripts[i];i++){app.console.log(script.src);if(script.src&&(/\?bell=(.*)/).test(script.src)){bell_pathname=RegExp.$1;break}}}if(bell_pathname==window.location.pathname&&window!=window.top){throw"Aborting: toolbar loading in the tunnel iframe"}if(!bell_pathname){throw'Please supply a root relative path to the "bell" file. (filename.js?bell=/path/to/file)'}var publisher=new app.EventPublisher();function Request(url,options){options=app.Object.extend({method:"get",params:"",onComplete:function(){}},options||{});publisher.notifyObservers("http request initiated");iframeRequest(url,options)}function iframeRequest(url,options){var iframe=document.createElement("iframe");iframe.style.position="absolute";iframe.style.top="-1000px";head.appendChild(iframe);var onComplete=options.onComplete;app.Event.observe(iframe,"load",processResponse);app.console.log("document.domain",document.domain);iframe.src=app.Config.tunnel_uri+"?url="+encodeURIComponent(url)+"&method="+options.method+"&params="+encodeURIComponent(options.params)+"&bell="+window.location.protocol+"//"+window.location.host+bell_pathname;function processResponse(){try{if(iframe.contentWindow.location&&iframe.contentWindow.location.pathname==bell_pathname){app.Event.stopObserving(iframe,"load",processResponse);app.console.log("gained access to iframe: "+iframe.contentWindow.location.pathname);var responseText=iframe.contentWindow.name;if(responseText){var response=JSON.parse(responseText);if(response.status&&response.status==200&&typeof options.onSuccess==="function"){options.onSuccess(response)}if(typeof options.onComplete==="function"){options.onComplete(response)}app.Event.stopObserving(iframe,"load",processResponse);window.setTimeout(function(){head.removeChild(iframe)},500);publisher.notifyObservers("http request completed")}}}catch(e){app.console.log(e)}}}app.Object.extend(Request,{register:function(observer){publisher.register(observer)},unregister:function(observer){publisher.unregister(observer)}});return Request})();app.Ajax={};app.Ajax.Request=app.Request})(TimesPeople);(function(app){app.User=(function(){var user,member,regi,loaded;var publisher=new app.EventPublisher();function User(){if(this==window){throw"User can only be used as a constructor."}this.profile=this.profile||{};this.newsfeed=this.newsfeed||[];user=user||this;return user}User.getInstance=function(){return new User()};User.create=function(attributes){var user=new User();if(user.profile.uid){attributes.uid=user.profile.uid}new app.Request(app.Config.user_service_create_url,{method:"post",params:"profile="+encodeURIComponent(JSON.stringify(attributes)),onComplete:function(response){switch(response.status){case 200:processResponse(response);publisher.notifyObservers("user created",user);publisher.notifyObservers("user saved",user);publisher.notifyObservers("user logged in",user);break;case 412:case 500:var data=response.responseText&&JSON.parse(response.responseText);if(data){app.console.log(data.error_message);publisher.notifyObservers("user could not be created",data)}break}}});return user};User.prototype={attributes:{},register:function(observer){publisher.register(observer)},unregister:function(observer){publisher.unregister(observer)},load:function(){new app.Request(app.Config.user_service_get_url,{onComplete:processResponse})},update:update,save:function(){new app.Request(app.Config.user_service_update_url,{method:"post",params:"profile="+JSON.stringify(this.profile),onComplete:processResponse})},login:function(credentials){var instance=this;new app.Request(app.Config.user_service_login_url,{method:"post",params:"username="+credentials.username+"&password="+credentials.password+"&svid="+credentials.svid,onComplete:function(response){switch(response.status){case 200:processResponse(response);publisher.notifyObservers("user logged in",instance);break;case 403:processResponse(response);break;case 500:var data=response.responseText&&JSON.parse(response.responseText);if(data){app.console.log(data.error_message);publisher.notifyObservers("user login failed",data)}break}loaded=true}})},updateImage:function(){this.profile.picURL=imagePath(this.profile.uid);this.save();window.setTimeout(function(){publisher.notifyObservers("user image updated")},1000)},updateFullSizeImage:function(){this.profile.fullpicURL=imagePath(this.profile.uid,true);this.save();window.setTimeout(function(){publisher.notifyObservers("user full size image updated")},1000)},addToFeed:function(activity){this.newsfeed.unshift(activity);publisher.notifyObservers("feed updated",user)},isLoaded:function(){return loaded},isMember:function(){return member},isNYTMember:function(){return regi},isTimesPeopleMember:function(){return member},addFollowee:function(userId){new app.Request(app.Config.user_service_add_following_url,{method:"post",params:"ids="+encodeURIComponent("["+userId+"]"),onComplete:function(response){user.load()}})},removeFollowee:function(userId){app.console.log(JSON.stringify({ids:[userId]}));new app.Request(app.Config.user_service_remove_following_url,{method:"post",params:"ids="+encodeURIComponent("["+userId+"]"),onComplete:function(response){user.load()}})},getSearchPageURI:function(){if(!member){return}return app.Config.host+"/view/user/"+this.profile.uid+"/findpeople.html"},getFollowersPageURI:function(){if(!member){return""}return app.Config.host+"/view/user/"+this.profile.uid+"/interested_people.html"},invite:function(emails){var instance=this;var url=app.Config.service_base+"/user/invite";new app.Request(url,{method:"post",params:"emails="+encodeURIComponent('["'+emails.join('","')+'"]'),onSuccess:function(response){app.console.log("invitations sent",response);instance.load();publisher.notifyObservers("invitations sent",{})},onComplete:function(response){if(response.status==500){app.console.log("error sending invitations",response.responseText);var data=JSON.parse(response.responseText);instance.load();publisher.notifyObservers("error sending invitations",data)}}})}};function update(attributes){app.Object.extend(user,attributes);publisher.notifyObservers("attributes updated",user);app.console.log(user)}function processResponse(response){switch(response.status){case 200:member=true;var attributes=response.responseText?JSON.parse(response.responseText):response;if(attributes.profile||attributes.newsfeed){update(attributes)}break;case 401:member=false;publisher.notifyObservers("no user info",null);break;case 403:member=false;regi=true;publisher.notifyObservers("user not registered",null);break;case 500:publisher.notifyObservers("service error",null);break}loaded=true}function imagePath(id,fullsize){return app.Config.user_image_host+"/"+idToPartitionedPath(id)+"/"+(fullsize?"uncropped-":"cropped-")+id+".jpg?"+Math.random().toString()}function idToPartitionedPath(id){return id.toString().replace(/(\d{4}(?=\d))/g,"$1/")}return User})()})(TimesPeople);(function(app){app.Activity=(function(){var publisher=new app.EventPublisher();var activity;function Activity(){if(this==window){throw"User can only be used as a constructor"}activity=this;Activity.user=Activity.user||new app.User();if(!Activity.user.profile.uid){throw"The current user object is not valid or hasn't loaded yet"}if(typeof arguments[0]=="object"){initializeWithObject.call(this,arguments[0])}else{initializeWithArguments.apply(this,arguments)}save()}Activity.prototype={makeDisplayReady:function(){return makeDisplayReady(this)}};function initializeWithObject(options){if(this instanceof Activity==false){throw"this function needs to be called with 'apply' and be passed an instance of Activity"}options=app.Object.extend({userid:Activity.user.profile.uid,object_desc:app.Page&&app.Page.description||"",object_type:app.Page&&app.Page.type||"",object_url:getObjectUrl(),object_thumbnail_url:"",object_note:"",visible:1,source:window.location.host},options);app.Object.extend(this,options)}function initializeWithArguments(verb,object,object_desc,object_url,object_thumbnail_url,object_type,object_note){if(this instanceof Activity==false){throw"this function needs to be called with 'apply' and be passed an instance of Activity"}this.userid=Activity.user.profile.uid;this.verb=verb;this.object=object;this.object_desc=object_desc||app.Page&&app.Page.description||"";this.object_type=object_type||app.Page&&app.Page.type;this.object_url=object_url||getObjectUrl();this.object_thumbnail_url=object_thumbnail_url||"";this.object_note=object_note||"";this.visible=1;this.source=window.location.host}function save(){new app.Request(app.Config.activity_service_post_url,{method:"post",params:"activities="+encodeURIComponent("["+JSON.stringify(activity)+"]"),onComplete:processResponse})}function processResponse(response){switch(response.status){case 200:Activity.user.addToFeed(makeDisplayReady(activity));publisher.notifyObservers("action saved");break;case 401:case 403:break;case 500:publisher.notifyObservers("error saving action");app.console.log(response.responseText);break}}function makeDisplayReady(activity){var item=app.Object.extend({},activity);item.actorDisplayname="You";item.date_updated=new Date().toString();item.picURL=Activity.user.profile.picURL;return item}function getObjectUrl(){var preserve_search;switch(window.location.hostname){case"community.nytimes.com":case"query.nytimes.com":case"travel.nytimes.com":case"movies.nytimes.com":preserve_search=true;break;case"www.nytimes.com":default:preserve_search=false}var search=window.location.search&&preserve_search?window.location.search+"&src=tp":"?src=tp";return[window.location.protocol,"//",window.location.host,window.location.pathname,search,window.location.hash].join("")}app.Object.extend(Activity,{register:function(observer){publisher.register(observer)},unregister:function(observer){publisher.unregister(observer)},hide:function(id){new app.Request(app.Config.activity_service_hide_url,{method:"post",params:"activity_id="+id,onSuccess:function(response){publisher.notifyObservers("action hidden")}})}});return Activity})()})(TimesPeople);(function(app){var self,spinner;var template='    <div id="TP_container" class="TP_env">      <div id="TP_inner">        <div id="TP_left_panel" class="TP_toolbar_item"></div>        <div id="TP_feed" class="TP_toolbar_item">          <div id="TP_latest_item" class="TP_feed_content TP_toolbar_item_content" style=""></div>        </div>        <div style="display: none;" id="TP_spinner">          <object width="24" height="24" data="'+app.Config.image_host+app.Config.image_path+'spinner.swf" type="application/x-shockwave-flash">            <param value="'+app.Config.image_host+app.Config.image_path+'spinner.swf" name="movie"/>            <param value="Transparent" name="WMode"/>          </object>        </div>        <div id="TP_right_panel"  class="TP_toolbar_item">           <div id="TP_activity_on_page" class="TP_toolbar_item_content" style=""></div>        </div>        <div  id="TP_minimize_button" class="TP_toolbar_item"></div>      </div>    </div>    <div id="TP_container_shadow"<% if (!hasNativeShadow) { %> class="border-shadow"<% } %>></div>  ';app.ToolbarView=function ToolbarView(user,latestItemView,feedView,userView,toolsView,pageActivityView){this.user=user;this.latestItemView=latestItemView;this.feedView=feedView;this.userView=userView;this.toolsView=toolsView;this.pageActivityView=pageActivityView;this.panels=[];this.open_panel=null;this.user.register(this);self=self||this;return self};app.ToolbarView.prototype={draw:function(){if(this.drawn){return}this.container=document.createElement("div");this.container.id="TP_fixed_toolbar";this.container.innerHTML=app.template(template,app);this.drawn=true;document.body.insertBefore(this.container,document.body.firstChild);var self=this;var minimizeButton=app.$("TP_minimize_button");if(minimizeButton){app.Event.observe(minimizeButton,"click",function(){self.minimize()})}this.latest_item=app.$("TP_latest_item");this.latest_item.appendChild(this.latestItemView.element);spinner=app.$("TP_spinner");app.Request.register(this);app.Event.observe(document.body,"ToolbarPanelView:open",onOpenPanel);app.Event.observe(document.body,"ToolbarPanelView:close",onClosePanel)},minimize:function(){if(!this.minimized){for(var i=0,panel;panel=this.panels[i];i++){panel.close()}this.minimized=true;persistState("NO");new app.FX(this.container,{top:{to:-40}},0.5).start();new app.FX(document.body,{paddingTop:{to:13}},0.5).start();this.minimizedView.toggle()}},restore:function(){app.console.log("restore!");if(this.minimized){if(!this.drawn){this.draw()}this.minimized=false;persistState("YES");new app.FX(this.container,{top:{to:0}},0.5).start();new app.FX(document.body,{paddingTop:{to:51}},0.5).start();this.minimizedView.toggle();this.user.load()}},update:function(msg){switch(msg.event){case"attributes updated":drawMemberToolbar(this);break;case"user saved":drawMemberToolbar(this);break;case"followees updated":break;case"user not registered":drawGuestToolbar(this);break;case"no user info":drawGuestToolbar(this);break;case"user image updated":var user=msg.data;var imgs=app.getElementsByClassName("you");for(var i=0,img;img=imgs[i];i++){img.src=this.user.profile.picURL}break;case"feed updated":updateFeed(this);break;case"service error":app.console.log("service error");handleError(this);break;case"http request initiated":spinner.style.display="block";break;case"http request completed":spinner.style.display="none";break}}};function handleError(view){view.feedView.data=view.latestItemView.data=[{actorDisplayname:"",actorId:0,picURL:"http://graphics8.nytimes.com/images/apps/timespeople/none.png",verb:"",object:"TimesPeople is down for maintenance",object_desc:"",object_url:"http://timespeople.nytimes.com/home/about/",object_type:"",object_thumbnail_url:"",date_updated:new Date()}];updateFeed(view);window.setTimeout(function(){view.minimize();persistState("YES")},2000)}function updateFeed(view){view.latestItemView.draw(1)}function drawGetStartedToolbar(view){new app.Request(app.Config.default_feed_url,{onSuccess:function(response){view.feedView.data=view.latestItemView.data=generateDefaultFeed(response);view.user.update({profile:{followers_count:0,displayname:"Your Name",userpage:"",picURL:"http://graphics8.nytimes.com/images/apps/timespeople/none.png"},newsfeed:view.feedView.data,page_activity:[]});drawMemberToolbar(view);app.$("TP_minimize_button").style.display="none"}})}function drawGuestToolbar(view){if(view.minimized){return}if(app.Page&&app.Page.isGetStarted()){drawGetStartedToolbar(view);return}new app.Request(app.Config.default_feed_url,{onSuccess:function(response){var defaultFeed=generateDefaultFeed(response);view.feedDrawerView=new app.ToolbarPanelView(view.feedView,app.$("TP_feed"),"The latest activity in your network...","Latest activity in your network","/packages/html/timespeople/ad.html");view.panels=[view.feedDrawerView];view.feedView.data=view.latestItemView.data=defaultFeed;app.$("TP_left_panel").innerHTML='<h4>Welcome to TimesPeople</h4><a class="TP_toolbar_link" href="'+app.Config.get_started_uri+'">Get Started</a>';app.$("TP_right_panel").innerHTML='<div class="TP_toolbar_item_content"><div  id="TP_get_started_button" class="TP_leftcap TP_rightcap"><span>Recommend</span></div></div>';app.Event.observe(app.$("TP_get_started_button"),"click",onClickRecommendButtonWhenLoggedOut);updateFeed(view);view.container.style.position="absolute";view.container.style.top="0%"}})}function drawMemberToolbar(view){if(view.minimized){return}view.userView.setElement(app.$("TP_left_panel"));view.userView.draw();view.toolsView.setElement(app.$("TP_activity_on_page"));view.toolsView.draw();view.feedDrawerView=new app.ToolbarPanelView(view.feedView,app.$("TP_feed"),"The latest activity in your network...","Latest activity in your network","/packages/html/timespeople/ad.html");view.panels=[view.feedDrawerView];if(app.Page&&app.Page.isRecommendable()){view.toolsDrawerView=new app.ToolbarPanelView(view.pageActivityView,app.$("TP_right_panel"),"What your friends are saying","","/packages/html/timespeople/annotation_ad.html");view.toolsView.observe("clickAnnotate",function(){view.toolsDrawerView.open()});view.panels.push(view.toolsDrawerView)}view.feedView.data=view.latestItemView.data=view.user.newsfeed;view.pageActivityView.feedView.data=view.user.page_activity;view.toolsView.updatePageActivityCount(view.user.page_activity.length);updateFeed(view);view.container.style.position="";view.container.style.top="0%";view.container.style.top=""}function onClickRecommendButtonWhenLoggedOut(){window.location=app.Config.get_started_uri+"?url="+encodeURIComponent(window.location.href)}function persistState(state){var date=new Date();date.setTime(date.getTime()+31536000000);app.Cookie.set("news_people_toolbar",state,{domain:app.Config.cookie_domain,path:"/",expires:date})}function onOpenPanel(event){var panel=event.memo;if(self.open_panel){self.open_panel.close()}self.open_panel=panel}function onClosePanel(event){var panel=event.memo;self.open_panel=null}function generateDefaultFeed(response){if(response.status!=200){return[{actorDisplayname:"",actorId:0,picURL:"http://graphics8.nytimes.com/images/apps/timespeople/none.png",verb:"",object:"TimesPeople Lets You Share and Discover the Best of NYTimes.com",object_desc:"",object_note:"",object_url:"http://timespeople.nytimes.com/home/about/",object_type:"",object_thumbnail_url:"",date_updated:new Date()}]}var items=JSON.parse(response.responseText);var defaultFeed=[];for(var i=0,item;item=items[i];i++){defaultFeed.push({actorDisplayname:"TimesPeople",actorId:0,picURL:"http://graphics8.nytimes.com/images/apps/timespeople/none.png",verb:"recommended",object:item.title,object_desc:item.object_desc||"",object_note:"",object_url:item.url,object_type:"",object_thumbnail_url:"",date_updated:new Date()})}return defaultFeed}})(TimesPeople);(function(app){app.FeedView=(function(){var activityTemplate='      <tr>        <td class="TP_avatar_cell">          <a href="<%= userpage %>"><img class="TP_avatar" src="<%= picURL %>"></a>        </td>        <td class="TP_object_cell">          <span class="TP_story"><a class="TP_user" href="<%= userpage %>"><%= actorDisplayname %></a> <%= verb %><%= punctuation %> </span>          <span class="TP_object"><a origin="tp" href="<%= object_url %>" title="<%= object %>"><%= truncated_object %></a></span>          <% if (object_note) { %>            <img src="<%= TimesPeople.Config.image_host + TimesPeople.Config.image_path %>toolbar/1.5/annotation.gif">          <% } %>          <% if (display_annotations && object_note) { %>              <p class="TP_annotation">&ldquo;<%= object_note %>&rdquo;</p>          <% } %>        </td>        <td class="TP_timestamp_cell"><%= date %></td>      </tr>    ';function FeedView(element,data){this.element=element||document.createElement("div");this.data=data||{};this.display_annotations=true}FeedView.prototype={draw:function(length){this.element.innerHTML=buildFeed(length,this.data,this.display_annotations)},buildFeedItem:function(activity){return buildFeedItem(activity,this.display_annotations)},setDisplayAnnotations:function(value){this.display_annotations=Boolean(value)}};function buildFeed(length,activities,display_annotations){if(!activities||!activities.length){return""}length=length||activities.length;var html=[];html.push('<table class="TP_feed_content">');for(var i=0;i<length;i++){if(i==25){break}html.push(buildFeedItem(activities[i],display_annotations))}html.push("</table>");return html.join("")}function buildFeedItem(activity,display_annotations){activity=app.Object.extend({},activity);activity.actorDisplayname=activity.actorDisplayname||activity.user_displayname;activity.actorId=activity.actorId||activity.userid;var d=new Date(activity.date_updated);if(d=="Invalid Date"||isNaN(d)){var dateStr=activity.date_updated.replace(/-/g,"/");d=new Date(dateStr)}if(d.getDate()==new Date().getDate()){var mhours=d.getHours();var hours=mhours>12?mhours-12:mhours;if(hours==0){hours=12}var minutes=d.getMinutes();minutes=minutes<10?"0"+minutes:minutes;var period=mhours>=12?"pm":"am";activity.date=hours+":"+minutes+" "+period}else{activity.date=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][d.getMonth()]+" "+d.getDate()}if(activity.verb=="commented"){activity.verb="commented on"}activity.object_type=activity.object_type.toLowerCase();activity.article="";activity.object_type="";activity.punctuation="";if(activity.verb){activity.punctuation=":"}if(activity.object_type=="user"){activity.article="";activity.object_type="";activity.punctuation=""}var string_length=(activity.actorDisplayname+activity.verb+activity.article+activity.object_type).length+5;activity.truncated_object=activity.object;activity.userpage=app.Config.host+"/view/user/"+activity.actorId;activity.display_annotations=display_annotations;return app.template(activityTemplate,activity)}return FeedView})();app.FeedContentView=app.FeedView})(TimesPeople);(function(app){app.LocalFeedView=(function(){var activityTemplate='      <tr>        <td class="TP_avatar_cell">          <a href="<%= userpage %>"><img class="TP_avatar" src="<%= picURL %>"></a>        </td>        <td class="TP_object_cell">          <span class="TP_story"><a class="TP_user" href="<%= userpage %>"><%= actorDisplayname %></a> <%= verb %></span>          <% if (object_note) { %>            <img src="<%= TimesPeople.Config.image_host + TimesPeople.Config.image_path %>toolbar/1.5/annotation.gif">          <% } %>          <% if (object_note) { %>            <p class="TP_annotation">&ldquo;<%= object_note %>&rdquo;</p>          <% } %>        </td>      </tr>    ';function LocalFeedView(element,data){this.element=element||document.createElement("div");this.data=data||{}}LocalFeedView.prototype={draw:function(length){this.element.innerHTML=buildFeed(length,this.data)}};function buildFeed(length,activities){if(!activities||!activities.length){return""}length=length||activities.length;var html=[];html.push('<table class="TP_feed_content">');for(var i=0;i<length;i++){if(i==25){break}html.push(buildFeedItem(activities[i]))}html.push("</table>");return html.join("")}function buildFeedItem(activity){activity=app.Object.extend({},activity);activity.actorDisplayname=activity.actorDisplayname||activity.user_displayname;activity.actorId=activity.actorId||activity.userid;activity.userpage=app.Config.host+"/view/user/"+activity.actorId;return app.template(activityTemplate,activity)}return LocalFeedView})()})(TimesPeople);(function(app){app.PageActivityView=(function(){var annotateButton,textArea,_feedView,characterCount,characterLimit=140;var annotationFormTemplate='    <h4><label>      <img src="'+TimesPeople.Config.image_host+TimesPeople.Config.image_path+'toolbar/1.5/annotation.gif">      Add a note to your recommendation    </label></h4>    <textarea id="TP_annotation_form"></textarea>    <div class="opposingFloatControl clearfix">    <div class="element1" id="TP_note_char_count"><p>(optional)</p></div>    <div class="element2">    <button id="TP_annotate_btn" class="TP_leftcap TP_rightcap" >      <span>Recommend</span>    </button>    </div>    </div>    <div id="TP_page_activity_feed"></div>    ';function PageActivityView(feedView){this.element=document.createElement("div");this.feedView=_feedView=feedView;_feedView.display_annotations=true}PageActivityView.prototype={draw:function(length){this.element.innerHTML=annotationFormTemplate;_feedView.draw();app.$("TP_page_activity_feed").appendChild(_feedView.element);annotateButton=app.$("TP_annotate_btn");characterCount=app.$("TP_note_char_count");textArea=app.$("TP_annotation_form");app.Event.observe(annotateButton,"click",onClickAnnotateButton);app.Event.observe(textArea,"keyup",onKeyUp);app.Event.observe(textArea,"focus",onFocus)}};function onKeyUp(){updateCharCount()}function onFocus(){updateCharCount()}function updateCharCount(){characterCount.innerHTML=characterLimit-textArea.value.length+" characters left";if(textArea.value.length>characterLimit-10){characterCount.style.color="#A81817"}else{characterCount.style.color=""}}function onClickAnnotateButton(){var span=annotateButton.getElementsByTagName("span")[0];if(span.innerHTML=="Thanks!"){return false}var title=app.Page&&app.Page.title||document.title;var note=app.$("TP_annotation_form").value;var activity=new app.Activity({verb:"recommended",object:title,object_thumbnail_url:app.Page.getThumbnail(),object_note:app.$("TP_annotation_form").value.substr(0,characterLimit)});var item=activity.makeDisplayReady();updateFeed(item);app.$("TP_annotation_form").value="";span.innerHTML="Thanks!";window.setTimeout(function(){span.innerHTML="Recommend"},2000)}function updateFeed(item){_feedView.data.unshift(item);_feedView.draw(_feedView.data.length)}return PageActivityView})()})(TimesPeople);(function(app){app.UserView=(function(){function UserView(user){this.user=user;this.user.register(this)}UserView.prototype={setElement:function(element){this.element=element},draw:function(){if(this.element){this.element.innerHTML=buildUser(this.user)}},update:function(msg){switch(msg.event){case"attributes updated":case"user saved":app.console.log("update user name view");this.draw();break}}};function buildUser(user){var template_object=app.Object.extend({},user.profile);template_object.people_count=buildPeople(user);template_object.displayname=app.truncate(template_object.displayname,20);template_object.followers_url=user.getFollowersPageURI();return app.template(template,template_object)}function buildPeople(user){var number=user.profile.followers_count;var people=(number==1)?"Follower":"Followers";return number+" "+people}var template='      <div class="TP_user">       <a href="<%= userpage %>"><img class="TP_avatar you" src="<%= picURL %>"></a>       <h4 class="TP_header">        <% if (userpage) { %>          <a href="<%= userpage %>">            <%= displayname %>          </a>        <% } else { %>          <%= displayname %>        <% } %>      </h4>       <p class="TP_following_count">        <% if (followers_url) { %>          <a href="<%= followers_url %>">            <%= people_count %>          </a>        <% } else { %>          <%= people_count %>        <% } %>      </p>      </div>    ';return UserView})()})(TimesPeople);(function(app){app.ToolsView=(function(){function ToolsView(user){var events={},recommendButton,annotateButton;app.Object.extend(this,{user:user,setElement:function(element){this.element=element},draw:function(){if(!this.element){throw"You must provide an element: call setElement(el) before calling draw()"}this.element.innerHTML='          <div class="TP_split_button" id="TP_toolbar_buttons">          <button id="TP_toolbar_recommend_btn" class="TP_leftcap TP_disabled" disabled="disabled" >            <span>Recommend</span>          </button><button id="TP_toolbar_annotate_btn" class="TP_bevel TP_rightcap TP_disabled" disabled="disabled">            <span><img src="'+TimesPeople.Config.image_host+TimesPeople.Config.image_path+'toolbar/1.5/annotation.gif"></img>          </button>          </div>          <div id="TP_page_activity_count_button" class="TP_capsule_button" style="display:none"><span id="TP_page_activity_count">...</span></div>          ';recommendButton=app.$("TP_toolbar_recommend_btn");annotateButton=app.$("TP_toolbar_annotate_btn");app.Event.observe(annotateButton,"click",onClickAnnotateButton);app.Event.observe(recommendButton,"click",onClickRecommendButton);if(app.Page&&app.Page.isRecommendable()){enableButton()}},updatePageActivityCount:function(count){if(count>0){var countView=app.$("TP_page_activity_count");countView.innerHTML=count;$("TP_page_activity_count_button").style.display=""}},observe:function(event,fn){events[event]=fn}});function enableButton(){recommendButton.disabled=false;recommendButton.className=recommendButton.className.replace("TP_disabled","");annotateButton.disabled=false;annotateButton.className=annotateButton.className.replace("TP_disabled","")}function onClickRecommendButton(event){var span=recommendButton.getElementsByTagName("span")[0];if(span.innerHTML=="Thanks!"){return false}var title=app.Page&&app.Page.title||document.title;new app.Activity("recommended",app.Page.getTitle(),app.Page.getDescription(),app.Page.getUrl(),app.Page.getThumbnail());dcsMultiTrack&&dcsMultiTrack("DCS.dcssip","www.nytimes.com","DCS.dcsuri","/Article-Tool-Share-Recommend-Toolbar.html","WT.ti","Article-Tool-Share-Recommend-Toolbar ","WT.z_dcsm","1");span.innerHTML="Thanks!";window.setTimeout(function(){span.innerHTML="Recommend"},2000);event.stopPropagation();event.preventDefault()}function onClickAnnotateButton(event){fire("clickAnnotate");event.stopPropagation();event.preventDefault()}function fire(event){if(typeof events[event]==="function"){events[event]()}}}return ToolsView})()})(TimesPeople);(function(app){app.ToolbarPanelView=(function(){function ToolbarPanelView(contentView,element,tooltipText,openText,adUrl){var resizing,newY,oldY,instance=this,closed=true,drawer,content,tooltip,tab,teaser,teasing,toggle,ad,drawer_outter=document.createElement("div"),feedHeight="232px";this.contentView=contentView;draw();drawer=app.getElementsByClassName("TP_drawer",drawer_outter)[0];tooltip=app.getElementsByClassName("TP_drawer_tooltip",drawer_outter)[0];tab=app.getElementsByClassName("TP_drawer_tab",drawer_outter)[0];teaser=app.getElementsByClassName("TP_teaser",drawer_outter)[0];toggle=app.getElementsByClassName("TP_drawer_toggle",drawer_outter)[0];ad=app.getElementsByClassName("TP_tile_ad",drawer_outter)[0];this.handle=app.getElementsByClassName("TP_feed_handle",drawer_outter)[0];this.toggleDrawer=function toggleDrawer(e){app.console.log("toggle feed",e);if(closed){open()}else{close()}};this.open=open;this.close=close;app.Event.observe(element,"mouseenter",onMouseEnter);app.Event.observe(element,"mouseleave",onMouseLeave);app.Event.observe(element,"click",onClickToggle);app.Event.observe(tab,"click",onClickToggle);app.Event.observe(this.handle,"mousedown",onMouseDown);function onMouseEnter(e){app.console.log("enter");tease();element.className+=" TP_toolbar_item_highlight"}function onMouseLeave(e){app.console.log("leave");untease();element.className=element.className.replace(" TP_toolbar_item_highlight","")}function onClickToggle(e){app.console.log(e.target);app.console.log(e.target.href);app.console.log(e.target.parentNode.href);switch(true){case /TP_drawer_toggle/.test(e.target.className):case /TP_drawer_tab/.test(this.className):case closed&&(!e.target.href&&!e.target.parentNode.href):instance.toggleDrawer(e);e.preventDefault();e.stopPropagation()}}function onMouseDown(e){startResize(e);e.preventDefault();e.stopPropagation();document.body.focus();document.onselectstart=function(){return false};if(e.srcElement){e.srcElement.ondragstart=function(){return false}}return false}function onMouseMove(e){resize(e);e.preventDefault();e.stopPropagation()}function onMouseUp(e){stopResize(e);e.preventDefault();e.stopPropagation()}function draw(){drawer_outter.className="TP_drawer_outter";drawer_outter.innerHTML=app.template(template,{tooltipText:tooltipText,openText:openText});element.appendChild(drawer_outter);var content=app.getElementsByClassName("TP_drawer_content",drawer_outter)[0];content.appendChild(contentView.element)}function tease(){teasing=window.setTimeout(showTooltip,1000)}function untease(){window.clearTimeout(teasing);tooltip.style.display="none";teaser.className=teaser.className.replace(/\btease|shadow|border-shadow\b/g,"")}function showTooltip(){tooltip.style.display="block";teaser.className+=app.hasNativeShadow?" tease shadow":" tease border-shadow"}function open(){untease();app.Event.stopObserving(element,"mouseenter",onMouseEnter);app.Event.stopObserving(element,"mouseleave",onMouseLeave);instance.contentView.draw();tab.style.display="block";drawer.style.height=(feedHeight);drawer.className+=app.hasNativeShadow?" open shadow":" open border-shadow";toggle.className="TP_drawer_toggle_up";closed=false;app.Event.fire(document.body,"ToolbarPanelView:open",instance);ad.innerHTML=adTemplate(adUrl)}function close(){if(closed){return}app.Event.observe(element,"mouseenter",onMouseEnter);app.Event.observe(element,"mouseleave",onMouseLeave);tab.style.display="none";feedHeight=drawer.style.height||feedHeight;drawer.style.height=null;drawer.className=drawer.className.replace(/\s*open|shadow|border-shadow/g,"");toggle.className="TP_drawer_toggle";closed=true;app.Event.fire(document.body,"ToolbarPanelView:close",instance)}function startResize(e){app.console.log("start resize");resizing=true;app.Event.observe(document,"mouseup",onMouseUp);app.Event.observe(document,"mousemove",onMouseMove)}function resize(e){app.console.log("resizing...");if(resizing){newY=app.Event.pointer(e).y;oldY=oldY||newY;var delta=oldY<newY?newY-oldY:-(oldY-newY);drawer.style.height=parseInt(drawer.style.height,10)+delta+"px";oldY=newY;if(window.opera){var n=document.createTextNode(" ");content.appendChild(n);window.setTimeout(function(){n.parentNode.removeChild(n)},10)}}}function stopResize(e){app.console.log("stop resize");resizing=false;app.Event.stopObserving(document,"mousemove",onMouseMove);app.Event.stopObserving(document,"mouseup",onMouseUp)}}var template='      <div class="TP_drawer">        <div class="TP_drawer_content TP_drawer_content"></div>        <div class="TP_feed_handle">          <div class="TP_groove"></div>        </div>      </div>      <div class="TP_drawer_tooltip">        <div class="TP_drawer_tooltip_inner">        <%= tooltipText %>        </div>      </div>      <div class="TP_drawer_tab">        <div class="TP_tile_ad"></div>        <h4><%= openText %></h4>      </div>      <div class="TP_teaser"></div>      <div class="TP_drawer_toggle"></div>    ';function adTemplate(adUrl){return'<iframe width="88" height="31" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" src="'+app.Config.ad_host+adUrl+'"></iframe>'}return ToolbarPanelView})()})(TimesPeople);(function(app){app.MemberToolsItemView=function MemberToolsItemView(toolbar){this.toolbar=toolbar;this.toolbar.minimizedView=this;var memberTools=app.$("memberTools");var memberLinks=app.$("memberLinks");if(memberTools){memberTools.innerHTML+='<li id="TP_restore_button" style="display:none"><a>TimesPeople</a></li>';var login_iframe=memberTools.getElementsByTagName("iframe")[0];if(login_iframe){var iframeStyle=login_iframe.style;iframeStyle.width="400px";iframeStyle.position="relative";iframeStyle.top="2px";iframeStyle.marginRight="-4px";memberTools.style.paddingTop="0"}}else{if(memberLinks){memberLinks.innerHTML+='- <a id="TP_restore_button" style="display:none">TimesPeople</a>'}else{var page=app.$("shell")||document.body;var button=document.createElement("div");var coords=page.id=="shell"?"top: -14px; right: 0pt;":"top: 0px; right: 0pt;";button.innerHTML='<a id="TP_restore_button" style="display:none;position: absolute; '+coords+' font-family: Arial, Helvetica, sans-serif;font-size:10px;">TimesPeople</a>';page.insertBefore(button,page.firstChild)}}var self=this;this.button=app.$("TP_restore_button");app.Event.observe(this.button,"click",function(){self.toolbar.restore()},false)};app.MemberToolsItemView.prototype={toggle:function(){this.button.style.display=this.button.style.display==""?"none":""},show:function(){this.button.style.display=""}}})(TimesPeople);(function(app){var _ran,_user,_view,anchorLinkPattern=/#.+/;app.ToolbarController=function ToolbarController(user,view){_ToolbarController.initialize(user,view);return _ToolbarController};var _ToolbarController={initialize:function(user,view){_user=user;_view=view;_minimizedView=new app.MemberToolsItemView(_view)},run:function(){app.state=app.state||app.Cookie.get("news_people_toolbar");if(app.state=="NO"){runMinimized()}else{runMaximized()}}};function runMinimized(){_view.minimized=true;_minimizedView.show()}function runMaximized(){respectAnchorLinks();_view.draw()}function respectAnchorLinks(){app.Event.observe(document.body,"click",onClickWindow)}function onClickWindow(event){var href,position,hrefNode=event.target.getAttributeNode("href");if(hrefNode&&(href=hrefNode.nodeValue)){position=href.search(anchorLinkPattern);if(position===-1){return}var name=href.substring(position+1);var destination=app.$(name)||document.getElementsByName(name)[0];if(destination){var valueT=0,element=destination;do{valueT+=element.offsetTop||0}while(element=element.offsetParent);window.setTimeout(function(){window.scroll(0,valueT-45)},0)}}}})(TimesPeople);(function(app){function run(){if(app.isReady()&&!app.ran){var user=new app.User(),userView=new app.UserView(user),feedView=new app.FeedView(),latestItemView=new app.FeedView(),localFeedView=new app.LocalFeedView(),pageActivityView=new app.PageActivityView(localFeedView),toolsView=new app.ToolsView(user),toolbarView=new app.ToolbarView(user,latestItemView,feedView,userView,toolsView,pageActivityView),toolbarController=new app.ToolbarController(user,toolbarView);latestItemView.setDisplayAnnotations(false);toolbarController.run();user.load();app.ran=true}else{setTimeout(run,10)}}run()})(TimesPeople);