(function($){
	$(document).ready(function(){
		if (document.getElementById('chartStats')) {
			$.plot($("#chartStats"), statsData, {
				lines: { show: true },
      			points: { show: true },
				shadowSize: 0,
				grid: {
					hoverable: true
				},
				xaxis: { mode: 'time', timeformat: "%b %y" }
			});
			$("#chartStats").bind("plothover", function (event, pos, item) {
				if (item) {
					$('#tooltipStats')
						.html(item.series.label+': '+item.datapoint[1])
						.css({
							top: item.pageY + 10 +'px',
							left: item.pageX + 10 +'px',
							display: 'block'
						});
				} else {
					$('#tooltipStats').hide();
				}
			});
		}
	});
})(jQuery);
