
var progressPercentage = 87.60;		 	// The final percentage the bar should animate to
var progressAnimationSpeed = 2000;   	// The time to complete the bar animation in milliseconds, 1000 = 1 second


$(window).load(function() {
	animateProgressBar();
}); // End window.load()


// Animates the progress bar to the specified percentage at the specified speed.
// Calls showTweets() once the animation is completed
function animateProgressBar()
{
	// Normalise the percentage to 1-100
	if (progressPercentage < 1) {
		progressPercentage = 1;
	} else if (progressPercentage > 100) {
		progressPercentage = 100;
	}
    var progressBarWrap = $('#progress-bar-wrap');
    var progressAmount = $('#progress-amount');    
    var targetWidth = $('#progress-wrap').width() * (progressPercentage / 100);
    progressBarWrap.animate({
        width: targetWidth
    }, progressAnimationSpeed, function() {
		$('#moving-arrow').animate({height: 35}, 'slow', 'easeOutBack', function() {
			progressAmount.text(progressPercentage + '%').fadeIn('slow', showTweets);
		});		
    }).css('overflow', 'visible');
	$('#progress-indicator').fadeIn('slow');
}
