NP.Sparkline={getIcon:function(x,y,msg){var pixel=Drupal.settings.static_url+"graphics/sites/all/themes/nova/default/images/1px.gif";return $("<a></a>").click(function(e){e.preventDefault()}).mouseover(function(){NP.Sparkline.show_message(msg)}).append($('<img src="'+pixel+'" />')).css({right:x,top:y}).addClass("icon-recommended-graph-point")},tabShow:function(ui){if(typeof (Drupal.settings.le_sparklines)=="undefined"){return }var spark_options={fillColor:"",lineColor:"#ffffff",height:"60px",width:"580px"};var sparks=Drupal.settings.le_sparklines;var data;var sPeriod="";switch(ui.panel.id){case"np-chatter-stats-tab-24-hours":data=sparks.hr24;sPeriod="24 Hours";break;case"np-chatter-stats-tab-48-hours":data=sparks.hr48;sPeriod="48 Hours";break;case"np-chatter-stats-tab-1-week":data=sparks.wk;sPeriod="Week";break;case"np-chatter-stats-tab-1-month":data=sparks.month;sPeriod="Month";break;default:break}var lepost=$("#le-a-posts");if(!lepost.data(sPeriod)){var sum=0;for(i=0;i<data.length;++i){sum+=data[i]}lepost.data(sPeriod,sum)}lepost.html(lepost.data(sPeriod));$("#le-a-period").html(sPeriod);$(".graph-container",ui.panel).sparkline(data,spark_options);NP.Sparkline.drawRecommendations(ui.panel.id)},drawRecommendations:function(id){var icon="",max_recommendations=0,most_recommended=0,graph,len,i,post;graph=$("#"+id+" div.graph .graph-container");$("a",graph).remove();switch(id){case"np-chatter-stats-tab-24-hours":len=Drupal.settings.le_recommended_posts.hr24.length;for(i=0;i<len;++i){NP.Sparkline.drawRecommendation(Drupal.settings.le_recommended_posts.hr24[i],graph);if(Drupal.settings.le_recommended_posts.hr24[i].post.recommendations_count>max_recommendations){most_recommended=i;max_recommendations=Drupal.settings.le_recommended_posts.hr24[i].post.recommendations_count}}break;case"np-chatter-stats-tab-48-hours":len=Drupal.settings.le_recommended_posts.hr48.length;for(i=0;i<len;++i){NP.Sparkline.drawRecommendation(Drupal.settings.le_recommended_posts.hr48[i],graph);if(Drupal.settings.le_recommended_posts.hr48[i].post.recommendations_count>max_recommendations){most_recommended=i;max_recommendations=Drupal.settings.le_recommended_posts.hr48[i].post.recommendations_count}}break;case"np-chatter-stats-tab-1-week":len=Drupal.settings.le_recommended_posts.week.length;for(i=0;i<len;++i){NP.Sparkline.drawRecommendation(Drupal.settings.le_recommended_posts.week[i],graph);if(Drupal.settings.le_recommended_posts.week[i].post.recommendations_count>max_recommendations){most_recommended=i;max_recommendations=Drupal.settings.le_recommended_posts.week[i].post.recommendations_count}}break;case"np-chatter-stats-tab-1-month":len=Drupal.settings.le_recommended_posts.month.length;for(i=0;i<len;++i){NP.Sparkline.drawRecommendation(Drupal.settings.le_recommended_posts.month[i],graph);if(Drupal.settings.le_recommended_posts.month[i].post.recommendations_count>max_recommendations){most_recommended=i;max_recommendations=Drupal.settings.le_recommended_posts.month[i].post.recommendations_count}}break;default:break}if(len===0){$("#np_chatter_stats_message").hide()}else{$("#np_chatter_stats_message").show()}$("a:eq("+most_recommended+")",graph).mouseover()},drawRecommendation:function(info,graph){icon=NP.Sparkline.getIcon(info.x,info.y,info);graph.append(icon)},show_message:function(message){var content="";var with_pic=false;var name=($.trim(message.post.author_username)?message.post.author_username:message.post.author_name);if($.trim(message.post.author_image_url)){with_pic=true;content+='<div class="author-image"><a href="'+message.post.author_url+'"><img src="'+message.post.author_image_url+'" height="30" width="30" /></a></div>'}content+='<div class="msg-content'+(with_pic?" with-image":"")+'"><div class="body">'+message.post.content+'</div><p class="byline">by <a href="'+message.post.author_url+'">'+name+"</a> via "+message.post.source+" @ "+message.post.date_created+"</p></div>";$("#np_chatter_stats_message .content").html(content)}};$(function(){$(".container-np-chatter-stats").show();$(".np-chatter-stats-tabs ul").tabs({selected:0,show:NP.Sparkline.tabShow})});