function countdown () {
	if (count>1) {
		count = count-1;
		draw(count);
	} else {
	window.clearInterval(mytimer);
		getAddy();
	}
}

function startCount () {
	count = 40;
	mytimer = window.setInterval('countdown ()', 40);	
}

function draw(content) {
	var message = "Please wait... "
	var paddedCount = pad(content,2);
	$('#targetDiv').html(message + paddedCount);
}
	

  
function getAddy() {
	var ajaxObject = $.getJSON('/js/addy.php','',function(data){
		$("#targetDiv").fadeOut(200, function () {
		$('#targetDiv').html(data);
		$("#targetDiv").fadeIn(1300);
		});
	
			
	});
}

function pad(number,length) {
    var str = '' + number;
    while (str.length < length)
        str = '0' + str;
    return str;
}