/*
	surveys_per_month - the # surveys completed per month
	start_number - the number of completed surveys at given time. 
	start_ts - timestamp of the given time
*/

$(document).ready(function(){ 

	count_str = count.toString();
	for(i = 0; i < count_str.length; i++)
	{
		setDigit((count_str.length-i - 1), count_str.charAt(i)); 
		$('#digit_' + i).hide();
	}
	
  increment(1);
});



function increment(inc_amount)
{
	if(isNaN(inc_amount))
	{
		inc_amount = 1;
	}
	old_count = count.toString(); 
	
	count = count + inc_amount;
	new_count = count.toString(); 

 
	for(i = 0; i < new_count.length; i++)
	{
		if(old_count[i] != new_count[i])
		{
			setDigit(new_count.length-i - 1, new_count[i]); 
		}
	}
	
	setTimeout('increment(1)', rate);
}

function setDigit(digit_number, value)
{
	$('#counter_' + digit_number).css('background-position','0px -' + 47*value + 'px');
}