(function($){$.fn.simpledraw=function(width,height){if(width==undefined){width=$(this).innerWidth()}if(height==undefined){height=$(this).innerHeight()}if($.browser.hasCanvas){return new vcanvas_canvas(width,height,this)}else{if($.browser.msie){return new vcanvas_vml(width,height,this)}else{return false}}};$.fn.sparkline=function(uservalues,options){var options=$.extend({type:"line",lineColor:"#00f",fillColor:"#cdf",width:"auto",height:"auto"},options?options:{});return this.each(function(){var values=(uservalues=="html"||uservalues==undefined)?$(this).text().split(","):uservalues;var width=options.width=="auto"?values.length*3:options.width;var height=options.height=="auto"?$(this).innerHeight():options.height;$.fn.sparkline[options.type].call(this,values,options,width,height)})};$.fn.sparkline.line=function(values,options,width,height){var options=$.extend({spotColor:"#f80",spotRadius:2},options?options:{});var max=Math.max.apply(Math,values);var min=Math.min.apply(Math,values);var range=max-min+1;var vl=values.length-1;if(range==1){range=max*2;min=0}if(vl<1){this.innerHTML="";return }var target=$(this).simpledraw(width,height);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;if(options.spotColor){canvas_width-=options.spotRadius}var path=[[1,target.pixel_height]];for(var i=0;i<values.length;i++){path.push([Math.round(i*(canvas_width/vl)+1),Math.round(canvas_height-(canvas_height*((values[i]-min)/range)))])}if(options.fillColor){path.push([canvas_width+1,canvas_height]);target.drawShape(path,undefined,options.fillColor);path.pop()}path[0]=[1,Math.round(canvas_height-(canvas_height*((values[0]-min)/range)))];target.drawShape(path,options.lineColor);if(options.spotColor){target.drawCircle(canvas_width,Math.round(canvas_height-(canvas_height*((values[vl]-min)/range))),options.spotRadius,undefined,options.spotColor)}}else{this.innerHTML=""}};$.fn.sparkline.bar=function(values,options,width,height){var options=$.extend({type:"bar",barColor:"#00f",negBarColor:"#f44",zeroAxis:undefined,barWidth:4,barSpacing:1},options?options:{});var width=(values.length*options.barWidth)+((values.length-1)*options.barSpacing);var max=Math.max.apply(Math,values);var min=Math.min.apply(Math,values);if(options.zeroAxis==undefined){options.zeroAxis=min<0}var range=max-min+1;var target=$(this).simpledraw(width,height);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var yzero=min<0?Math.round(canvas_height*(Math.abs(min)/range)):canvas_height;for(var i=0;i<values.length;i++){var x=i*(options.barWidth+options.barSpacing);var val=values[i];var color=(val<0)?options.negBarColor:options.barColor;if(options.zeroAxis){var height=val==0?1:Math.round(canvas_height*((Math.abs(val)/range)));var y=(val<0)?yzero:yzero-height}else{var height=val==min?1:Math.round(canvas_height*((val-min)/range));var y=1+(canvas_height-height)}if($.browser.msie){target.drawRect(x,y,options.barWidth-1,height-1,color,color)}else{target.drawRect(x,y,options.barWidth,height,undefined,color)}}}else{this.innerHTML=""}};$.fn.sparkline.tristate=function(values,options,width,height){var options=$.extend({barWidth:4,barSpacing:1,posBarColor:"#6f6",negBarColor:"#f44",zeroBarColor:"#999"},options);var width=(values.length*options.barWidth)+((values.length-1)*options.barSpacing);var target=$(this).simpledraw(width,height);if(target){var canvas_width=target.pixel_width;var canvas_height=target.pixel_height;var half_height=Math.round(canvas_height/2);for(var i=0;i<values.length;i++){var x=i*(options.barWidth+options.barSpacing);if(values[i]<0){var y=half_height;var height=half_height-1;var color=options.negBarColor}else{if(values[i]>0){var y=1;var height=half_height-1;var color=options.posBarColor}else{var y=half_height-1;var height=2;var color=options.zeroBarColor}}if($.browser.msie){target.drawRect(x,y,options.barWidth-1,height-1,color,color)}else{target.drawRect(x,y,options.barWidth,height,undefined,color)}}}else{this.innerHTML=""}};if($.browser.msie&&!document.namespaces.v){document.namespaces.add("v","urn:schemas-microsoft-com:vml");document.createStyleSheet().cssText="v\\:*{behavior:url(#default#VML); display:inline-block; padding:0px; margin:0px;}"}if($.browser.hasCanvas==undefined){var t=document.createElement("canvas");$.browser.hasCanvas=t.getContext!=undefined}var vcanvas_base=function(width,height,target){};vcanvas_base.prototype={init:function(width,height,target){this.width=width;this.height=height;this.target=target},drawShape:function(path,lineColor,fillColor){alert("drawShape not implemented")},drawLine:function(x1,y1,x2,y2,lineColor){return this.drawShape([[x1,y1],[x2,y2]],lineColor)},drawCircle:function(x,y,radius,lineColor,fillColor){alert("drawCircle not implemented")},drawRect:function(x,y,width,height,lineColor,fillColor){alert("drawRect not implemented")},getElement:function(){return this.canvas},_insert:function(el,target){$(target).html(el)}};var vcanvas_canvas=function(width,height,target){return this.init(width,height,target)};vcanvas_canvas.prototype=$.extend(new vcanvas_base,{_super:vcanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);this.canvas=document.createElement("canvas");$(this.canvas).css({display:"inline",width:width,height:height});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height},_getContext:function(lineColor,fillColor){var context=this.canvas.getContext("2d");if(lineColor!=undefined){context.strokeStyle=lineColor}context.lineWidth=1;if(fillColor!=undefined){context.fillStyle=fillColor}return context},drawShape:function(path,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.moveTo(path[0][0],path[0][1]-0.5);for(var i=1;i<path.length;i++){context.lineTo(path[i][0],path[i][1]-0.5)}if(lineColor!=undefined){context.stroke()}if(fillColor!=undefined){context.fill()}},drawCircle:function(x,y,radius,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);context.beginPath();context.arc(x,y,radius,0,2*Math.PI,true);if(lineColor!=undefined){context.stroke()}if(fillColor!=undefined){context.fill()}},drawRect:function(x,y,width,height,lineColor,fillColor){var context=this._getContext(lineColor,fillColor);if(fillColor!=undefined){context.fillRect(x,y,width,height)}if(lineColor!=undefined){context.strokeRect(x,y,width,height)}}});var vcanvas_vml=function(width,height,target){return this.init(width,height,target)};vcanvas_vml.prototype=$.extend(new vcanvas_base,{_super:vcanvas_base.prototype,init:function(width,height,target){this._super.init(width,height,target);this.canvas=document.createElement("span");$(this.canvas).css({display:"inline-block",overflow:"hidden",width:width,height:height,margin:"0px",padding:"0px"});this._insert(this.canvas,target);this.pixel_height=$(this.canvas).height();this.pixel_width=$(this.canvas).width();this.canvas.width=this.pixel_width;this.canvas.height=this.pixel_height;var groupel='<v:group coordorigin="0 0" coordsize="'+this.pixel_width+" "+this.pixel_height+'" style="position:relative;top:0;left:0;width:'+this.pixel_width+"px;height="+this.pixel_height+'px;"></v:group>';this.canvas.insertAdjacentHTML("beforeEnd",groupel);this.group=$(this.canvas).children()[0]},drawShape:function(path,lineColor,fillColor){var vpath=[];for(var i=0;i<path.length;i++){vpath[i]=""+(path[i][0]-1)+","+(path[i][1]-1)}var initial=vpath.splice(0,1);var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var closed=vpath[0]==vpath[vpath.length-1]?"x ":"";var vel='<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+" "+this.pixel_height+'" '+stroke+fill+' style="position:relative;left:0px;top:0px;height:'+this.pixel_height+"px;width:"+this.pixel_width+'px;padding:0px;margin:0px;"  path="m '+initial+" l "+vpath.join(", ")+" "+closed+'e"> </v:shape>';this.group.insertAdjacentHTML("beforeEnd",vel)},drawCircle:function(x,y,radius,lineColor,fillColor){x-=radius+1;y-=radius+1;var stroke=lineColor==undefined?' stroked="false" ':' strokeWeight="1" strokeColor="'+lineColor+'" ';var fill=fillColor==undefined?' filled="false"':' fillColor="'+fillColor+'" filled="true" ';var vel="<v:oval "+stroke+fill+' style="position:absolute;top:'+y+"; left:"+x+"; width:"+(radius*2)+"; height:"+(radius*2)+'"></v:oval>';this.group.insertAdjacentHTML("beforeEnd",vel)},drawRect:function(x,y,width,height,lineColor,fillColor){return this.drawShape([[x,y],[x,y+height],[x+width,y+height],[x+width,y],[x,y]],lineColor,fillColor)}})})(jQuery);if(typeof (Drupal)=="undefined"||!Drupal.advpoll){Drupal.advpoll={}}Drupal.advpoll.attachVoteAjax=function(){$("form.advpoll-vote").each(function(){var thisForm=this;var options={dataType:"json",after:function(data){$("div.messages").remove();if(data.errors){$(data.errors).insertBefore(thisForm).fadeIn()}else{$(thisForm).hide();$(data.statusMsgs).insertBefore(thisForm).fadeIn();$(data.response).insertBefore(thisForm)}$(".form-submit",thisForm).removeAttr("disabled")},before:function(){$(".form-submit",thisForm).attr("disabled","disabled")}};$("input.ajax",thisForm).val(true);$(this).ajaxForm(options)})};Drupal.advpoll.nodeVoteAutoAttach=function(){Drupal.advpoll.attachVoteAjax()};Drupal.advpoll.handleWriteins=function(){$("div.poll").each(function(){var poll=this;if($(".writein-choice",poll).length==0){return }var ranOnce=false;$(".vote-choices input[@type=radio], .vote-choices input[@type=checkbox]",poll).click(function(){var isLast=$(this).val()==$(".vote-choices input[@type=radio]:last, .vote-choices input[@type=checkbox]:last",poll).val();var type=$(this).attr("type");if(isLast||type=="radio"){var showChoice=isLast&&(type=="radio"||$(this).attr("checked"));if(!ranOnce&&showChoice){$(".writein-choice input",poll).clone().addClass("writein-choice").insertAfter($(this).parent()).end().parent().parent().remove();ranOnce=true}$(".writein-choice",poll).css("display",showChoice?"inline":"none");if(showChoice){$(".writein-choice",poll)[0].focus()}else{$(".writein-choice",poll).val("")}}});$(".vote-choices select:last",poll).change(function(){if(!ranOnce){$(".writein-choice input",poll).clone().addClass("writein-choice").insertAfter($(this)).end().parent().parent().remove();ranOnce=true}var showChoice=$(this).val()>0;var alreadyVisible=$(".writein-choice",poll).css("display")=="inline";$(".writein-choice",poll).css("display",showChoice?"inline":"none");if(!showChoice){$(".writein-choice",poll).val("")}else{if(!alreadyVisible){$(".writein-choice",poll)[0].focus()}}})})};if(Drupal.jsEnabled){$(document).ready(function(){Drupal.advpoll.nodeVoteAutoAttach();Drupal.advpoll.handleWriteins()})}(function($){$.effects.slide=function(o){return this.queue(function(){var el=$(this),props=["position","top","left"];var mode=$.effects.setMode(el,o.options.mode||"show");var direction=o.options.direction||"left";$.effects.save(el,props);el.show();$.effects.createWrapper(el).css({overflow:"hidden"});var ref=(direction=="up"||direction=="down")?"top":"left";var motion=(direction=="up"||direction=="left")?"pos":"neg";var distance=o.options.distance||(ref=="top"?el.outerHeight({margin:true}):el.outerWidth({margin:true}));if(mode=="show"){el.css(ref,motion=="pos"?-distance:distance)}var animation={};animation[ref]=(mode=="show"?(motion=="pos"?"+=":"-="):(motion=="pos"?"-=":"+="))+distance;el.animate(animation,{queue:false,duration:o.duration,easing:o.options.easing,complete:function(){if(mode=="hide"){el.hide()}$.effects.restore(el,props);$.effects.removeWrapper(el);if(o.callback){o.callback.apply(this,arguments)}el.dequeue()}})})}})(jQuery);Drupal.slideshowWidget=function(widget){return this.init(widget)};Drupal.slideshowWidget.prototype={currentImage:0,images:null,sliderItems:3,timeout:null,widget:null,interval:7,advanceSlideshow:function(){var slideshowWidget=this;var next=this.currentImage+1>=this.images.length?0:this.currentImage+1;window.clearTimeout(this.timeout);this.widget.find(".content-media:first > span:first img").one("load",function(){slideshowWidget.timeout=window.setTimeout(function(){slideshowWidget.advanceSlideshow()},slideshowWidget.interval*1000)});this.showImage(next)},removeSlideshow:function(){window.clearTimeout(this.timeout)},init:function(widget){var w;var slideshowWidget=this;this.widget=$(widget);this.images=this.widget.find("ul.list-footage li > a");w=this.widget.parents(".widget:first").attr("id");if(this.widget.attr("id")){this.id=this.widget.attr("id")}else{if(w){this.id=w}}if(this.id&&Drupal.settings!==undefined&&Drupal.settings.np_dashboard!==undefined&&Drupal.settings.np_dashboard[this.id]&&Drupal.settings.np_dashboard[this.id]){this.interval=Drupal.settings.np_dashboard[this.id].auto_advance?(Drupal.settings.np_dashboard[this.id].interval||0):0}if(this.interval){this.timeout=window.setTimeout(function(){slideshowWidget.advanceSlideshow()},this.interval*1000)}function showInfo(){slideshowWidget.removeSlideshow();if($(this).children("div.media").size()===0){$(this).addClass("info-visible").find("div.info").show("slide",{direction:"up"},300).end().find("p.more").show("slide",{direction:"down"},300,function(){$(this).parents(".content-media:first").one("mouseleave",hideInfo)}).end().find("a.next, a.prev").fadeIn("normal")}}function hideInfo(){if($(this).children("div.media").size()===0){$(this).removeClass("info-visible").find("div.info").hide("slide",{direction:"up"},300).end().find("p.more").hide("slide",{direction:"down"},300,function(){$(this).parents(".content-media:first").one("mouseenter",showInfo)}).end().find("a.next, a.prev").fadeOut("normal")}}if(this.images.size()>this.sliderItems){var list=this.widget.find("ul.list-footage").css({position:"absolute",left:0,top:0,width:this.images.size()*100}).mousemove(function(){slideshowWidget.widget.find(".content-media:first").trigger("mouseleave")});var slider=this.widget.find(".ui-slider").slider({steps:this.images.size()-this.sliderItems,max:this.images.size()-this.sliderItems,slide:function(ev,ui){list.css("left",-ui.value*100)}});this.widget.find(".slider .arrow-01-l3, .slider .arrow-01-r3").click(function(){slider.slider("moveTo",slider.slider("value",0)+($(this).hasClass("arrow-01-r3")?1:-1));this.blur();return false})}else{this.widget.find(".slider").hide()}this.images.click(function(){slideshowWidget.removeSlideshow();slideshowWidget.showImage(slideshowWidget.images.index(this));slideshowWidget.removeSlideshow();this.blur();return false});var x=this.widget.find(".content-media").one("mouseenter",showInfo).find("div.info, p.more").each(function(){if($.browser.msie||$.browser.safari){if($.browser.msie&&$.browser.version<7&&this.currentStyle.backgroundImage!="none"){$(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod='scale', src='"+$(this).css("background-image").replace(/url\(["']?([^"')]+)["']?\)/,"$1")+"')"})}$(this).filter("p.more").css("top",205-$(this).height())}}).end().find("a.next, a.prev").click(function(){var direction=$(this).hasClass("next")?1:-1;if(slideshowWidget.currentImage+direction>=0&&slideshowWidget.currentImage+direction<slideshowWidget.images.size()){slideshowWidget.showImage(slideshowWidget.currentImage+direction)}return false});return this},showImage:function(next){this.currentImage=Math.max(0,Math.min(next,this.images.size()));var content={};if(this.id&&Drupal.settings!==undefined&&Drupal.settings.np_dashboard!==undefined&&Drupal.settings.np_dashboard[this.id]&&Drupal.settings.np_dashboard[this.id].data[this.currentImage]){content=Drupal.settings.np_dashboard[this.id].data[this.currentImage];if(content.thumb.indexOf("http")==-1){content.thumb=Drupal.settings.media_url+content.thumb}if(content.url&&content.url.indexOf("http")==-1){content.url=Drupal.settings.media_url+content.url}}else{var item=this.images.eq(this.currentImage);var img=item.find("img")[0];content={title:img.alt,path:item.attr("href"),descr:"",url:img.src,thumb:img.src,medium:img.src,info:""}}var media=this.widget.find(".content-media:first");media.removeClass("playlist").find("div.media").remove().end().find("span.media").show().end().find("a.next, a.prev");if(content.output!==undefined&&$.trim(content.output).length){media.addClass("playlist").find("div.info").after($('<div class="media">'+content.output.replace(/\s+width=["']?\d+['"]?/gi,' width="'+300+'"').replace(/\s+height=["']?\d+['"]?/gi,' height="225"')+"</div>")).end().find("span.media").hide().end()}content.link=this.widget.find(".content-media:first > p.more a:last").attr("href",content.path);this.widget.find(".content-media:first").children("p.more").html(content.descr).append(content.link).end().children("div.info").children("h2").text(content.title).end().children("p.info").html(content.info).end().end().find("span.media img").attr({src:content.medium,alt:content.title,title:content.title}).removeAttr("style");if(content.output!==undefined&&$.trim(content.output).length){this.widget.find(".content-media:first > div.info > p.info").prepend(this.widget.find(".content-media:first > p.more a:last").clone())}}};Drupal.reInitSlideshowWidget=function(data){if(!this.attr("id")){this.attr("id","widget-"+data.did)}if(data.options&&data.options[0]=="taxonomy"&&data.options[1]=="slideshow"||data.options[1]=="playlist"){if(Drupal.settings!==undefined){Drupal.settings.np_dashboard=Drupal.settings.np_dashboard||{};Drupal.settings.np_dashboard["widget-"+data.did]=data.js}this.find("div.container-slideshow-widget").each(function(){var ssw=new Drupal.slideshowWidget(this)})}};Drupal.initSlideWidgetForm=function(form,init){var field=form.find("input:hidden:enabled").filter('[name="slideshow-speed"], [name="playlist-speed"]');if(init){field.before('<div class="container-slideshow-widget"><div class="slider"><div class="icon-08-slow" title="slow">slow</div><div class="icon-08-fast" title="fast">fast</div><div class="ui-slider"><div class="ui-slider-handle"></div></div></div></div>').parent().find(".ui-slider").slider({stepping:5,min:40,max:100,startValue:parseInt(field.val(),10)?field.val()*10:70,slide:function(ev,ui){field.val(ui.value/10)}}).parent()}form.find("container-slideshow-widget").show()};if(Drupal.jsEnabled){$(document).ready(function(){$("div.container-slideshow-widget").each(function(){var ssw=new Drupal.slideshowWidget(this)})})}NP.LE=NP.LE||{};NP.LE.Recommend={recommend:function(e){if(!Drupal.settings.uid){return }e.preventDefault();var $link=$(this);var $img=$link.find("img");if(!$img.is(".icon-06-tick-02")){$img.data("baseClass",$img.attr("class"));$img.removeClass().addClass("icon-loading-03")}else{$img.data("baseClass",$img.data("origClass"));$img.data("origClass","icon-loading-03")}$.ajax({dataType:"json",url:$link.attr("href").split("?")[0]+"/json",success:function(request){var tmp=$img;if(request.error==1){alert("Error recommending post, please try again.")}else{if(request.error===0){if($img.data("baseClass")=="icon-06-tick-holder"){$link.after('<div class="count"></div>')}$img.data("baseClass","icon-06-tick-01");$link.siblings(".count").html(request.count);var points=request.points;if(typeof (Drupal.settings.le_recommended_posts)!="undefined"){if(typeof (points.hr24)!="undefined"){Drupal.settings.le_recommended_posts.hr24.push(points.hr24)}if(typeof (points.hr48)!="undefined"){Drupal.settings.le_recommended_posts.hr48.push(points.hr48)}if(typeof (points.week)!="undefined"){Drupal.settings.le_recommended_posts.week.push(points.week)}if(typeof (points.month)!="undefined"){Drupal.settings.le_recommended_posts.month.push(points.month)}var id=$(".np-chatter-stats-tabs .ui-tabs-selected a").attr("href").replace(/\#/,"");NP.Sparkline.drawRecommendations(id)}}}if(!$img.is(".icon-06-tick-02")){$img.removeClass().addClass($img.data("baseClass"));$link.replaceWith($img)}else{$img.data("origClass",$img.data("baseClass"))}}})},hoverOut:function(){var $img=$("img",this);$img.removeClass().addClass($img.data("origClass"));$(this).siblings("div.le-recommend-msg").remove()},hoverIn:function(){var img=$("img",this);var hclass=img.attr("class");img.data("origClass",hclass);img.removeClass().addClass("icon-06-tick-02");$(this).after('<div class="le-recommend-msg">Recommend</div>')},moreClick:function(e){e.preventDefault();var $link=$(this);var $content=$link.siblings(".le-recommend-more-content");if($("img",$link).hasClass("arrow-02-u6")){NP.LE.Recommend.moreLinkToggle($link,"more ");$content.slideUp()}else{if(!$content.data("r-mutex")){$content.data("r-mutex",1);$.ajax({url:$link.attr("href")+"/json",success:function(request){$content.data("r-mutex",2);$content.html(request);Drupal.attachBehaviors($content);NP.LE.Recommend.moreOpen($content,$link)},failure:function(){$content.data("r-mutex",0)}})}else{NP.LE.Recommend.moreOpen($content,$link)}}},moreOpen:function($content,$link){if($content.data("r-mutex")==2){$content.slideDown()}else{$content.html(NP.LE.Recommend.loadingIcn()).slideDown()}NP.LE.Recommend.moreLinkToggle($link,"close ")},moreLinkToggle:function($link,content){var $img=$("img",$link).toggleClass("arrow-02-d6").toggleClass("arrow-02-u6").clone();$link.html(content);$link.append($img)},loadingIcn:function(){return'<img src="'+Drupal.settings.loading_signal+'" alt="loading..."/>'},init:function(){var $recommends=$("div.le-recommend a");$recommends.hover(NP.LE.Recommend.hoverIn,NP.LE.Recommend.hoverOut);if(Drupal.settings.uid){$recommends.click(NP.LE.Recommend.recommend)}else{$recommends.addModalLogin()}$("a.le-recommend-toggle").click(NP.LE.Recommend.moreClick);$(".le-recommend-more-content").hide()}};Drupal.behaviors.recommendAttach=NP.LE.Recommend.init;$(document).ready(function(){display_graph();display_le_tabs()});function display_graph(){var spark_options={fillColor:"",lineColor:"#ffffff",height:"35px",width:"275px"};if(Drupal.settings&&Drupal.settings.np_dashboard){$.each(Drupal.settings.np_dashboard,function(name,value){if(this.le_widget&&this.le_sparklines){var data=this.le_sparklines.hr24;$("#"+name+" .graph-container").sparkline(data,spark_options)}})}}function display_le_tabs(){$("div.container-top-posts").hide();$("div.container-top-links").hide();$("div.container-top-posts div.nodelist-05 .nodeitem:first").addClass("first");$("div.container-top-links div.nodelist-05 .nodeitem:first").addClass("first");$("#le-lnk-recent").click(function(){$("#le-lnk-recent").parents(".container-widget-le").find("div.container-recent").show();$("#le-lnk-recent").parents(".container-widget-le").find("div.container-top-posts").hide();$("#le-lnk-recent").parents(".container-widget-le").find("div.container-top-links").hide();$("#le-lnk-top-posts").parent().removeClass("active");$("#le-lnk-top-links").parent().removeClass("active");$("#le-lnk-recent").parent().addClass("active");return false});$("#le-lnk-top-posts").click(function(){$("#le-lnk-top-posts").parents(".container-widget-le").find("div.container-recent").hide();$("#le-lnk-top-posts").parents(".container-widget-le").find("div.container-top-posts").show();$("#le-lnk-top-posts").parents(".container-widget-le").find("div.container-top-links").hide();$("#le-lnk-top-posts").parent().addClass("active");$("#le-lnk-top-links").parent().removeClass("active");$("#le-lnk-recent").parent().removeClass("active");return false});$("#le-lnk-top-links").click(function(){$("#le-lnk-top-links").parents(".container-widget-le").find("div.container-recent").hide();$("#le-lnk-top-links").parents(".container-widget-le").find("div.container-top-posts").hide();$("#le-lnk-top-links").parents(".container-widget-le").find("div.container-top-links").show();$("#le-lnk-top-posts").parent().removeClass("active");$("#le-lnk-top-links").parent().addClass("active");$("#le-lnk-recent").parent().removeClass("active");return false})}Drupal.behaviors.npAdvpollWidget=function(){var handler=function(id,block){$(this).click(function(){if(!$(this).hasClass("selected")){block.find(".poll-links:first").find("a").removeClass("selected").end().end().addClass("selected");var poll=block.find(".poll-block:first").find("form, div.poll, div.messages, p.poll-links").remove().end().append('<div class="poll"></div>').find(".poll").html('<img src="'+Drupal.settings.loading_signal+'" alt="Loading"/>');var results=this.href.match(/\/results$/);block.find(".poll-vote, .poll-results").removeClass().addClass(results?"poll-results":"poll-vote");$.ajax({type:"POST",url:"/np_advpoll_widget/js/"+id+(results?"/results":"/vote"),dataType:"json",success:function(data){poll.replaceWith(data.content);Drupal.advpoll.nodeVoteAutoAttach();Drupal.advpoll.handleWriteins();block.find("p.poll-links a").each(function(){handler.call(this,id,block)})}})}this.blur();return false})};$(".poll-block").each(function(){var block=$(this).parents('div[id^="np_advpoll_widget-"]:first');if(block.size()>0){var matches=block.attr("id").match(/np_advpoll_widget-([0-9]+)/);if(matches){var id=matches[1];block.find(".poll-links a").each(function(){handler.call(this,id,block)})}}})};Drupal.advpoll.attachVoteAjax=function(){$("form.advpoll-vote").each(function(){var thisForm=this;var options={dataType:"json",success:function(data){$("div.messages").remove();if(data.errors){$(data.errors).insertBefore(thisForm).fadeIn()}else{$(thisForm).hide();$(data.statusMsgs).insertBefore(thisForm).fadeIn();$(data.response).insertBefore(thisForm);$(thisForm).parents('div[id^="np_advpoll_widget-"]:first').find(".poll-vote, .poll-results").removeClass().addClass("poll-results")}$(".form-submit",thisForm).removeAttr("disabled")},beforeSubmit:function(){$(".form-submit",thisForm).attr("disabled","disabled")}};$("input.ajax",thisForm).val(true);$(this).ajaxForm(options)})};