function showTooltip(x, y, contents) {
	$('<div id="tooltip">' + contents + '</div>').css( {
		position: 'absolute',
		display: 'none',
		top: y + 5,
		left: x + 15,
		border: '1px solid #fff',
		padding: '2px',
		color: '#fff',
		'background-color': '#000',
		opacity: 0.80
	}).appendTo("body").fadeIn(200);
}

function full_month(month)
{
	switch (month)
	{
		case 0:return "January";break;
		case 1:return "February";break;
		case 2:return "March";break;
		case 3:return "April";break;
		case 4:return "May";break;
		case 5:return "June";break;
		case 6:return "July";break;
		case 7:return "August";break;
		case 8:return "September";break;
		case 9:return "October";break;
		case 10:return "November";break;
		case 11:return "December";break;
		default:return "January";break;
	}
}

function init_graphs()
{
	$('#hits-link').click(function(){
		setTimeout(function(){
			init_hits_graph();
		}, 500);
	});
	$('#value-link').click(function(){
		setTimeout(function(){
			init_value_graph();
		}, 500);
	});
	$('#updates-link').click(function(){
		setTimeout(function(){
			init_updates_graph();
		}, 500);
	});
	$('#revenue-link').click(function(){
		setTimeout(function(){
			init_revenue_graph();
		}, 500);
	});
	$('#growth-link').click(function(){
		setTimeout(function(){
			init_growth_graph();
		}, 500);
	});
}

var charCounterTimer = 0;
function textCounter(field, counter, limit)
{
	if (field.value.length > limit)
	{
		field.className = field.className + " error";
		field.value = field.value.substring(0, limit);

		if (charCounterTimer > 0)
			clearTimeout(charCounterTimer);

		charCounterTimer = setTimeout(function(){
			field.className = field.className.replace(/\s*error/g, '');
		}, 500);
	}
	else
	{
		counter.innerHTML = limit - field.value.length + " characters remaining";
	}
}
