var jdcountdown = {
	props: {
		total: 0, 
		days: 0, 
		hours: 0, 
		mins: 0, 
		secs: 0, 
		timerInterval: -1, 
		elements: {
			days: [], 
			hours: [], 
			mins: [], 
			secs: []
		}
	}, 
	fn: {
		init: 
			function(intNumSeconds) {
				jdcountdown.props.total				= intNumSeconds;
				jdcountdown.props.elements.days		= $("div.jd-countdown li#jd-days strong");
				jdcountdown.props.elements.hours	= $("div.jd-countdown li#jd-hours strong");
				jdcountdown.props.elements.mins		= $("div.jd-countdown li#jd-minutes strong");
				jdcountdown.props.elements.secs		= $("div.jd-countdown li#jd-seconds strong");
				
				if ((jdcountdown.props.elements.days) && (jdcountdown.props.elements.hours) && (jdcountdown.props.elements.mins) && (jdcountdown.props.elements.secs)) {
					jdcountdown.props.timerInterval		= setInterval(function() { jdcountdown.fn.display(true); }, 1000);
					jdcountdown.props.display(false);
				}
			}, 
		
		display: 
			function(boolSubtract) {
				// should we subtract from the total # of seconds?  this is a useful toggle for the initial run -- we don't want to subtract our first time through here.
				if (boolSubtract) {
					jdcountdown.props.total--;
				}
				
				if (jdcountdown.props.total > 0) {
					// perform math calcs
					jdcountdown.props.days				= jdcountdown.fn.calc(jdcountdown.props.total, 86400, 100000);
					jdcountdown.props.hours				= jdcountdown.fn.calc(jdcountdown.props.total, 3600, 24);
					jdcountdown.props.mins				= jdcountdown.fn.calc(jdcountdown.props.total, 60, 60);
					jdcountdown.props.secs				= jdcountdown.fn.calc(jdcountdown.props.total, 1, 60);
				} else {
					// we counted down to zero, so we finish up and stop the interval
					jdcountdown.props.days				= "0";
					jdcountdown.props.hours				= "0";
					jdcountdown.props.mins				= "0";
					jdcountdown.props.secs				= "0";
					
					clearInterval(jdcountdown.props.timerInterval);
				}
				
				// show it!
				$(jdcountdown.props.elements.days).html(jdcountdown.props.days);
				$(jdcountdown.props.elements.hours).html(jdcountdown.props.hours);
				$(jdcountdown.props.elements.mins).html(jdcountdown.props.mins);
				$(jdcountdown.props.elements.secs).html(jdcountdown.props.secs);
			}, 
			
		calc: 
			function(intNumSeconds, intInterval, intDividend, boolLeadingZero) {
				var strResult						= ((Math.floor(intNumSeconds / intInterval)) % intDividend).toString();
				
				if ((boolLeadingZero) && (strResult.length < 2)) {
					strResult							= "0" + strResult;
				}
				
				return strResult;
			}
	}
}