/* From: wfe2-ewr : 8259 */
(function(){function a(d,c,b){this.target=undefined;this.sb_container=undefined;this.height=undefined;this.rendered=false;this._hp_scrollbar=undefined;this._scroller=undefined;this._hp_sb_up=undefined;this._hp_sb_down=undefined;this._hp_sb_scroll_t=undefined;this._hp_sb_scroll_b=undefined;this._hp_sb_track=undefined;this._first_click_y=undefined;this._can_drag=false;this._can_scroll=false;this._step_delta=40;this._step=0;this._scroller_height=undefined;this._scroll_delta=0;this._can_draw=false;this._on_bottom_callback=undefined;this._on_bottom_callback_ctx=undefined;this._on_bottom_callback_indent=20;this._update_on_init=false;this._run_in_progress=false;this.y=0;this.onPosYChange=false;this._applyTo(d,c,b)}a.prototype._applyTo=function(d,c,b){if(!d){return}this.target=typeof d=="string"?jQuery("#"+d).get(0):d;this.sb_container=typeof c=="string"?jQuery("#"+c).get(0):c;this.height=b||parseInt(this.target.offsetHeight);this.run()};a.prototype.onBottom=function(d,c,b){if(d){this._on_bottom_callback=d;this._on_bottom_callback_ctx=c||this;if(b){this._on_bottom_callback_indent=b}}};a.prototype.run=function(){var c=new Image();this._run_in_progress=true;var b=this;c.onload=function(){var d=b;d._setScrollerHeight();if(d._can_draw){d._draw();d._init();d._applyEvents();d.reset();d.rendered=true;if(d._update_on_init){d.update();d._update_on_init=false}}d._run_in_progress=false};c.src="http://s.huffpost.com/images/hp_scrollbar.png"};a.prototype.reset=function(){this._moveScroll(0)};a.prototype._setScrollerHeight=function(){var b=20;if(this.target.scrollHeight>this.target.clientHeight){b=(this.height*(this.height-34))/this.target.scrollHeight;b=Math.round(b);b=b<15?15:b;this._can_draw=true;this._show()}else{this._hide()}this._scroller_height=b};a.prototype._draw=function(){var b='          <div class="hp_scrollbar">            <div class="hp_sb_up hp_sb_bg"><b></b></div>            <div class="hp_sb_c hp_sb_bg" style="height: '+(this.height-34)+'px">                <div class="hp_sb_scroll hp_sb_bg" style="height: '+this._scroller_height+'px">                    <div class="hp_sb_scroll_t hp_sb_bg"><b></b></div>                    <div class="hp_sb_scroll_b hp_sb_bg" style="margin-top: '+(this._scroller_height-4)+'px"><b></b></div>                </div>            </div>            <div class="hp_sb_down hp_sb_bg"><b></b></div>          </div>        ';if(this.sb_container){this.sb_container.innerHTML=b}};a.prototype._show=function(){if(this._is_hidden()){jQuery(this.sb_container).removeClass("invisible")}};a.prototype._hide=function(){if(!this._is_hidden()){jQuery(this.sb_container).addClass("invisible")}};a.prototype._is_hidden=function(){return jQuery(this.sb_container).hasClass("invisible")};a.prototype._init=function(){var b=jQuery(this.sb_container);this._scroller=b.find(".hp_sb_scroll")[0];this._hp_sb_up=b.find(".hp_sb_up")[0];this._hp_sb_down=b.find(".hp_sb_down")[0];this._hp_sb_scroll_t=b.find(".hp_sb_scroll_t")[0];this._hp_sb_scroll_b=b.find(".hp_sb_scroll_b")[0];this._hp_sb_track=b.find(".hp_sb_c")[0];this._hp_scrollbar=b.find(".hp_scrollbar")[0];this.recalculateStep()};a.prototype._moveScroll=function(i,d){var e=this.height-34-this._scroller_height-4;if(i<0){i=0}else{if(i>e){i=e}}if(i<0){i=0}var g=i*(this.target.scrollHeight-this.height)/e;var h=(this.target.scrollHeight-this.height)/e*1;if(d){var b=this._getScrollPosition();var c={marginTop:i+"px"};jQuery(this._scroller).animate(c,{duration:250});c={scrollTop:g};jQuery(this.target).animate(c,{duration:250})}else{jQuery(this._scroller).css("margin-top",i+"px");this.target.scrollTop=g}var f=this.target.scrollHeight-(this.target.scrollTop+this.height);if(this._on_bottom_callback&&f<this._on_bottom_callback_indent){this._on_bottom_callback.apply(this._on_bottom_callback_ctx);this._on_bottom_callback=undefined}this.y=i;if("function"==typeof(this.onPosYChange)){this.onPosYChange()}};a.prototype._applyEvents=function(){var f=this._hp_sb_up;var c=this._hp_sb_down;var i=this._scroller;var g=this._hp_sb_scroll_t;var e=this._hp_sb_scroll_b;var h=this._hp_scrollbar;var b=this._scroller;jQuery(f).mouseover(function(){jQuery(this).addClass("hp_sb_up_hv")});jQuery(f).mouseout(function(){jQuery(this).removeClass("hp_sb_up_hv")});jQuery(c).mouseover(function(){jQuery(this).addClass("hp_sb_down_hv")});jQuery(c).mouseout(function(){jQuery(this).removeClass("hp_sb_down_hv")});jQuery(i).bind("mouseover",{scroll_top:g,scroll_bot:e},function(j){jQuery(j.data.scroll_top).addClass("hp_sb_scroll_t_hv");jQuery(this).addClass("hp_sb_scroll_hv");jQuery(j.data.scroll_bot).addClass("hp_sb_scroll_b_hv")});jQuery(i).bind("mouseout",{scroll_top:g,scroll_bot:e},function(j){jQuery(j.data.scroll_top).removeClass("hp_sb_scroll_t_hv");jQuery(this).removeClass("hp_sb_scroll_hv");jQuery(j.data.scroll_bot).removeClass("hp_sb_scroll_b_hv")});var d=this;jQuery(h).mousedown(function(j){d._dispatchMouseDownEvents(j)});jQuery(document).mousemove(function(j){d._handleScrollMouseMove(j)});jQuery(document).mouseup(function(j){d._handleScrollMouseUp(j)});jQuery(document).click(function(j){d._disableScrolling(j)});jQuery([this.target,this.sb_container]).bind("mousewheel",function(j){d._handleScrollMouseWheel(j)});jQuery([this.target,this.sb_container]).click(function(k){var j=jQuery(k.target);if(!j.is("a")){d._enableScrolling(k)}})};a.prototype._enableScrolling=function(b){this._can_scroll=true;b.stopPropagation();b.preventDefault()};a.prototype._disableScrolling=function(){this._can_scroll=false};a.prototype._dispatchMouseDownEvents=function(c){var b=c.target;if(jQuery(b).hasClass("hp_sb_scroll")){this._handleScrollMouseDown(c)}else{if(jQuery(b).hasClass("hp_sb_c")){this._handleTrackMouseClick(c,b)}else{if(jQuery(b).hasClass("hp_sb_down")){this._handleScrollDownMouseClick(c,b)}else{if(jQuery(b).hasClass("hp_sb_up")){this._handleScrollUpMouseClick(c,b)}}}}};a.prototype._handleTrackMouseClick=function(h,g){g=g||h.target;if(!jQuery(g).hasClass("hp_sb_c")){return}var f=this._getScrollPosition();var d=h.pageY-jQuery(this._hp_sb_track).offset().top;var c=this._scroller_height;if(d<f){c=(-1)*c}var b=f+c;this._moveScroll(b)};a.prototype._handleScrollMouseWheel=function(b){if(!this._can_scroll){return}b.stopPropagation();b.preventDefault();var c;if(b.wheelDelta){c=b.wheelDelta}else{if(b.detail){c=-b.detail}}if(c>0){this._scroll_delta=-1}else{this._scroll_delta=1}this._moveScroll(this._getScrollPosition()+(this._step*this._scroll_delta))};a.prototype._handleScrollUpMouseClick=function(c,b){this._moveScroll(this._getScrollPosition()-this._step,true)};a.prototype._handleScrollDownMouseClick=function(c,b){this._moveScroll(this._getScrollPosition()+this._step,true)};a.prototype._handleScrollMouseDown=function(b){this._can_drag=true;this._first_click_y=b.pageY-jQuery(this.target).offset().top-17-this._getScrollPosition();b.stopPropagation();b.preventDefault()};a.prototype._handleScrollMouseUp=function(){this._can_drag=false};a.prototype._handleScrollMouseMove=function(b){if(this._can_drag){var c=b.pageY-jQuery(this.target).offset().top-17-this._first_click_y;this._moveScroll(c);b.stopPropagation();b.preventDefault()}};a.prototype._getScrollPosition=function(){return +(jQuery(this._scroller).css("margin-top").replace("px",""))};a.prototype.update=function(h){if(!this._scroller&&this._run_in_progress){this._update_on_init=true;if(h){h()}return}else{if(!this._scroller&&!this._run_in_progress){this.run();if(h){h()}return}}var e=this.target.offsetHeight;var g=1;if(e!==this.height){this.height=e;this._hp_sb_track.style.height=(e-34)+"px";g=0}var d=this._scroller_height;this._setScrollerHeight();var f=this.height-34-this._scroller_height-4;var c=this.target.scrollTop*f/(this.target.scrollHeight-this.height);var b={height:this._scroller_height+"px",marginTop:c+"px"};jQuery(this._scroller).animate(b);b={marginTop:(this._scroller_height-4).toString()+"px"};jQuery(this._hp_sb_scroll_b).animate(b,{complete:h});this.recalculateStep()};a.prototype.recalculateStep=function(){this._step=this._step_delta*(this.height-34)/this.target.scrollHeight};a.prototype.refresh=function(){this.update()};a.prototype.attachEvent=function(b,d){var c=this;if(c&&"undefined"!=c[b]){c[b]=d}return};a.prototype.detachEvent=function(b){var c=this;if(c&&"undefined"!=c[b]){c[b]=false}return};a.prototype.getBaseHeight=function(){return jQuery(".hp_scrollbar").length&&jQuery(".hp_scrollbar").height()||0};a.prototype.getScrollbarHeight=function(){return this._scroller_height||0};a.prototype.getYPos=function(){return Math.abs(Math.floor(this.y))||0};window.HPScrollbar=a})();

/* From: wfe2-ewr : 8259 *//* 3d02700c7f2d43b7f966de7768fcd59fc8d2deac */