	function countDown(targetDiv, totalSeconds, formatId)
	{
		var textTarget = null;
		if(textTarget = document.getElementById(targetDiv))
		{
			if((formatId == "1") || (totalSeconds % 60 == 59))
			{
				var newText = formatOutput(totalSeconds, formatId);
				textTarget.innerHTML = newText;
				if(targetDiv.substr(0, 9) == 'countdown')
				{
					document.getElementById('countdownShadow'+targetDiv.substr(9)).innerHTML = newText;
				}
			}
			
			if(totalSeconds > 0)
			{
				totalSeconds--;
				setTimeout("countDown('"+targetDiv+"', "+totalSeconds+", '"+formatId+"');", 1000);
			}
			else
			{
				if(targetDiv.substr(0, 9) == 'countdown')
				{
					$.ajax({
					   type: "POST",
					   url: "ajax/getPageData.php",
					   data: "targetPageId=pL11&customVar=1",
					   success: function(msg){
						   loadDivPage(msg);
					   }
					 });
				} //End if this is the primary counter
			}
		} //End if the target still exists
	}
	
	function padZeros(n)
	{
		if(n.toString().length < 2) {
			return '0' + n;
		} else {
			return n;
		}
	}
	
	function formatOutput(totalSeconds, formatId)
	{
		var formattedTimer;
		var days, hours, minutes, seconds;
		seconds = totalSeconds % 60;
		minutes = Math.floor(totalSeconds / 60) % 60;
		hours = Math.floor(totalSeconds / 3600) % 24;
		days = Math.floor(totalSeconds / 24 / 3600);
		
		switch(formatId)
		{
			case "1":
				seconds = padZeros( seconds );
				minutes = padZeros( minutes );
				hours = padZeros( hours );
				days = padZeros( days );
			
				formattedTimer = days + ':' + hours + ':' + minutes + ':' + seconds;
				break;
				
			case "2":
				var sDay = "s";
				var sHour = "s";
				var sMinute = "s";
				
				if(days == 1)
				{
					sDay = "";
				}
				
				if(hours == 1)
				{
					sHour = "";
				}
				
				if(minutes == 1)
				{
					sMinute = "";
				}
				
				formattedTimer = days + ' day'+sDay+': ' + hours + ' hr'+sHour+': ' + minutes + ' minute'+sMinute;
				break;
		}
	
		return formattedTimer;
	}
