var Dashboard=function(){return{initJQVMAP:function(){if(jQuery().vectorMap){var e=function(e){jQuery(".vmaps").hide(),jQuery("#vmap_"+e).show()},t=function(e){var t={map:"world_en",backgroundColor:null,borderColor:"#333333",borderOpacity:.5,borderWidth:1,color:"#c6c6c6",enableZoom:!0,hoverColor:"#c9dfaf",hoverOpacity:null,values:sample_data,normalizeFunction:"linear",scaleColors:["#b6da93","#909cae"],selectedColor:"#c9dfaf",selectedRegion:null,showTooltip:!0,onLabelShow:function(e,t,a){},onRegionOver:function(e,t){"ca"==t&&e.preventDefault()},onRegionClick:function(e,t,a){var i='You clicked "'+a+'" which has the code: '+t.toUpperCase();alert(i)}};t.map=e+"_en";var a=jQuery("#vmap_"+e);a&&(a.width(a.parent().parent().width()),a.show(),a.vectorMap(t),a.hide())};t("world"),t("usa"),t("europe"),t("russia"),t("germany"),e("world"),jQuery("#regional_stat_world").click(function(){e("world")}),jQuery("#regional_stat_usa").click(function(){e("usa")}),jQuery("#regional_stat_europe").click(function(){e("europe")}),jQuery("#regional_stat_russia").click(function(){e("russia")}),jQuery("#regional_stat_germany").click(function(){e("germany")}),$("#region_statistics_loading").hide(),$("#region_statistics_content").show(),App.addResizeHandler(function(){jQuery(".vmaps").each(function(){var e=jQuery(this);e.width(e.parent().width())})})}},initCalendar:function(){if(jQuery().fullCalendar){var e=new Date,t=e.getDate(),a=e.getMonth(),i=e.getFullYear(),l={};$("#calendar").width()<=400?($("#calendar").addClass("mobile"),l={left:"title, prev, next",center:"",right:"today,month,agendaWeek,agendaDay"}):($("#calendar").removeClass("mobile"),l=App.isRTL()?{right:"title",center:"",left:"prev,next,today,month,agendaWeek,agendaDay"}:{left:"title",center:"",right:"prev,next,today,month,agendaWeek,agendaDay"}),$("#calendar").fullCalendar("destroy"),$("#calendar").fullCalendar({disableDragging:!1,header:l,editable:!0,events:[{title:"All Day",start:new Date(i,a,1),backgroundColor:App.getBrandColor("yellow")},{title:"Long Event",start:new Date(i,a,t-5),end:new Date(i,a,t-2),backgroundColor:App.getBrandColor("blue")},{title:"Repeating Event",start:new Date(i,a,t-3,16,0),allDay:!1,backgroundColor:App.getBrandColor("red")},{title:"Repeating Event",start:new Date(i,a,t+6,16,0),allDay:!1,backgroundColor:App.getBrandColor("green")},{title:"Meeting",start:new Date(i,a,t+9,10,30),allDay:!1},{title:"Lunch",start:new Date(i,a,t,14,0),end:new Date(i,a,t,14,0),backgroundColor:App.getBrandColor("grey"),allDay:!1},{title:"Birthday",start:new Date(i,a,t+1,19,0),end:new Date(i,a,t+1,22,30),backgroundColor:App.getBrandColor("purple"),allDay:!1},{title:"Click for Google",start:new Date(i,a,28),end:new Date(i,a,29),backgroundColor:App.getBrandColor("yellow"),url:"http://google.com/"}]})}},initCharts:function(){function e(e,t,a,i){$('
'+i+"
").css({position:"absolute",display:"none",top:t-40,left:e-40,border:"0px solid #ccc",padding:"2px 6px","background-color":"#fff"}).appendTo("body").fadeIn(200)}if(jQuery.plot){var t=[["02/2013",1500],["03/2013",2500],["04/2013",1700],["05/2013",800],["06/2013",1500],["07/2013",2350],["08/2013",1500],["09/2013",1300],["10/2013",4600]];if(0!=$("#site_statistics").size()){$("#site_statistics_loading").hide(),$("#site_statistics_content").show();var a=($.plot($("#site_statistics"),[{data:t,lines:{fill:.6,lineWidth:0},color:["#f89f9f"]},{data:t,points:{show:!0,fill:!0,radius:5,fillColor:"#f89f9f",lineWidth:3},color:"#fff",shadowSize:0}],{xaxis:{tickLength:0,tickDecimals:0,mode:"categories",min:0,font:{lineHeight:14,style:"normal",variant:"small-caps",color:"#6F7B8A"}},yaxis:{ticks:5,tickDecimals:0,tickColor:"#eee",font:{lineHeight:14,style:"normal",variant:"small-caps",color:"#6F7B8A"}},grid:{hoverable:!0,clickable:!0,tickColor:"#eee",borderColor:"#eee",borderWidth:1}}),null);$("#site_statistics").bind("plothover",function(t,i,l){if($("#x").text(i.x.toFixed(2)),$("#y").text(i.y.toFixed(2)),l){if(a!=l.dataIndex){a=l.dataIndex,$("#tooltip").remove();l.datapoint[0].toFixed(2),l.datapoint[1].toFixed(2);e(l.pageX,l.pageY,l.datapoint[0],l.datapoint[1]+" visits")}}else $("#tooltip").remove(),a=null})}if(0!=$("#site_activities").size()){var i=null;$("#site_activities_loading").hide(),$("#site_activities_content").show();var l=[["DEC",300],["JAN",600],["FEB",1100],["MAR",1200],["APR",860],["MAY",1200],["JUN",1450],["JUL",1800],["AUG",1200],["SEP",600]];$.plot($("#site_activities"),[{data:l,lines:{fill:.2,lineWidth:0},color:["#BAD9F5"]},{data:l,points:{show:!0,fill:!0,radius:4,fillColor:"#9ACAE6",lineWidth:2},color:"#9ACAE6",shadowSize:1},{data:l,lines:{show:!0,fill:!1,lineWidth:3},color:"#9ACAE6",shadowSize:0}],{xaxis:{tickLength:0,tickDecimals:0,mode:"categories",min:0,font:{lineHeight:18,style:"normal",variant:"small-caps",color:"#6F7B8A"}},yaxis:{ticks:5,tickDecimals:0,tickColor:"#eee",font:{lineHeight:14,style:"normal",variant:"small-caps",color:"#6F7B8A"}},grid:{hoverable:!0,clickable:!0,tickColor:"#eee",borderColor:"#eee",borderWidth:1}});$("#site_activities").bind("plothover",function(t,a,l){if($("#x").text(a.x.toFixed(2)),$("#y").text(a.y.toFixed(2)),l&&i!=l.dataIndex){i=l.dataIndex,$("#tooltip").remove();l.datapoint[0].toFixed(2),l.datapoint[1].toFixed(2);e(l.pageX,l.pageY,l.datapoint[0],l.datapoint[1]+"M$")}}),$("#site_activities").bind("mouseleave",function(){$("#tooltip").remove()})}}},initEasyPieCharts:function(){jQuery().easyPieChart&&($(".easy-pie-chart .number.transactions").easyPieChart({animate:1e3,size:75,lineWidth:3,barColor:App.getBrandColor("yellow")}),$(".easy-pie-chart .number.visits").easyPieChart({animate:1e3,size:75,lineWidth:3,barColor:App.getBrandColor("green")}),$(".easy-pie-chart .number.bounce").easyPieChart({animate:1e3,size:75,lineWidth:3,barColor:App.getBrandColor("red")}),$(".easy-pie-chart-reload").click(function(){$(".easy-pie-chart .number").each(function(){var e=Math.floor(100*Math.random());$(this).data("easyPieChart").update(e),$("span",this).text(e)})}))},initSparklineCharts:function(){jQuery().sparkline&&($("#sparkline_bar").sparkline([8,9,10,11,10,10,12,10,10,11,9,12,11,10,9,11,13,13,12],{type:"bar",width:"100",barWidth:5,height:"55",barColor:"#35aa47",negBarColor:"#e02222"}),$("#sparkline_bar2").sparkline([9,11,12,13,12,13,10,14,13,11,11,12,11,11,10,12,11,10],{type:"bar",width:"100",barWidth:5,height:"55",barColor:"#ffb848",negBarColor:"#e02222"}),$("#sparkline_bar5").sparkline([8,9,10,11,10,10,12,10,10,11,9,12,11,10,9,11,13,13,12],{type:"bar",width:"100",barWidth:5,height:"55",barColor:"#35aa47",negBarColor:"#e02222"}),$("#sparkline_bar6").sparkline([9,11,12,13,12,13,10,14,13,11,11,12,11,11,10,12,11,10],{type:"bar",width:"100",barWidth:5,height:"55",barColor:"#ffb848",negBarColor:"#e02222"}),$("#sparkline_line").sparkline([9,10,9,10,10,11,12,10,10,11,11,12,11,10,12,11,10,12],{type:"line",width:"100",height:"55",lineColor:"#ffb848"}))},initMorisCharts:function(){Morris.EventEmitter&&$("#sales_statistics").size()>0&&(dashboardMainChart=Morris.Area({element:"sales_statistics",padding:0,behaveLikeLine:!1,gridEnabled:!1,gridLineColor:!1,axes:!1,fillOpacity:1,data:[{period:"2011 Q1",sales:1400,profit:400},{period:"2011 Q2",sales:1100,profit:600},{period:"2011 Q3",sales:1600,profit:500},{period:"2011 Q4",sales:1200,profit:400},{period:"2012 Q1",sales:1550,profit:800}],lineColors:["#399a8c","#92e9dc"],xkey:"period",ykeys:["sales","profit"],labels:["Sales","Profit"],pointSize:0,lineWidth:0,hideHover:"auto",resize:!0}))},initChat:function(){var e=$("#chats"),t=$(".chats",e),a=$(".chat-form",e),i=$("input",a),l=$(".btn",a),o=function(a){a.preventDefault();var l=i.val();if(0!=l.length){var o=new Date,n=o.getHours()+":"+o.getMinutes(),r="";r+='',r+='+'avatar1.jpg) ',r+='
',r+='',r+='
',r+='
Bob Nilson ',r+='
at '+n+"",r+='
',r+=l,r+="",r+="
[[value]] [[additional]]",fillAlphas:1,title:"Income",type:"column",valueField:"income",dashLengthField:"dashLengthColumn"},{id:"graph2",balloonText:"[[title]] in [[category]]:
[[value]] [[additional]]",bullet:"round",lineThickness:3,bulletSize:7,bulletBorderAlpha:1,bulletColor:"#FFFFFF",useLineColorForBulletBorder:!0,bulletBorderThickness:3,fillAlphas:0,lineAlpha:1,title:"Expenses",valueField:"expenses"}],categoryField:"year",categoryAxis:{gridPosition:"start",axisAlpha:0,tickLength:0},"export":{enabled:!0}})}},initAmChart4:function(){if("undefined"!=typeof AmCharts&&0!==$("#dashboard_amchart_4").size()){var e=AmCharts.makeChart("dashboard_amchart_4",{type:"pie",theme:"light",path:"../assets/global/plugins/amcharts/ammap/images/",dataProvider:[{country:"Lithuania",value:260},{country:"Ireland",value:201},{country:"Germany",value:65},{country:"Australia",value:39},{country:"UK",value:19},{country:"Latvia",value:10}],valueField:"value",titleField:"country",outlineAlpha:.4,depth3D:15,balloonText:"[[title]]
[[value]] ([[percents]]%)",angle:30,"export":{enabled:!0}});jQuery(".chart-input").off().on("input change",function(){var t=jQuery(this).data("property"),a=e,i=Number(this.value);e.startDuration=0,"innerRadius"==t&&(i+="%"),a[t]=i,e.validateNow()})}},initWorldMapStats:function(){0!==$("#mapplic").size()&&($("#mapplic").mapplic({source:"../assets/global/plugins/mapplic/world.json",height:265,animate:!1,sidebar:!1,minimap:!1,locations:!0,deeplinking:!0,fullscreen:!1,hovertip:!0,zoombuttons:!1,clearbutton:!1,developer:!1,maxscale:2,skin:"mapplic-dark",zoom:!0}),$("#widget_sparkline_bar").sparkline([8,7,9,8.5,8,8.2,8,8.5,9,8,9],{type:"bar",width:"100",barWidth:5,height:"30",barColor:"#4db3a4",negBarColor:"#e02222"}),$("#widget_sparkline_bar2").sparkline([8,7,9,8.5,8,8.2,8,8.5,9,8,9],{type:"bar",width:"100",barWidth:5,height:"30",barColor:"#f36a5a",negBarColor:"#e02222"}),$("#widget_sparkline_bar3").sparkline([8,7,9,8.5,8,8.2,8,8.5,9,8,9],{type:"bar",width:"100",barWidth:5,height:"30",barColor:"#5b9bd1",negBarColor:"#e02222"}),$("#widget_sparkline_bar4").sparkline([8,7,9,8.5,8,8.2,8,8.5,9,8,9],{type:"bar",width:"100",barWidth:5,height:"30",barColor:"#9a7caf",negBarColor:"#e02222"}))},init:function(){this.initJQVMAP(),this.initCalendar(),this.initCharts(),this.initEasyPieCharts(),this.initSparklineCharts(),this.initChat(),this.initDashboardDaterange(),this.initMorisCharts(),this.initAmChart1(),this.initAmChart2(),this.initAmChart3(),this.initAmChart4(),this.initWorldMapStats()}}}();App.isAngularJsApp()===!1&&jQuery(document).ready(function(){Dashboard.init()});