// JavaScript Document
 function countDown(startDate) {
	startDate.setSeconds(startDate.getSeconds() + 1);
	var th = startDate.getHours();
	var tm = startDate.getMinutes();
	var ts = startDate.getSeconds();
	var fh = 19;
	
	if (startDate.getDay() == 5)
		$('#getCashDiv').text('Time left to get cash Monday.');
	if (startDate.getDay() == 0 || startDate.getDay() == 6)
		$('#getCashDiv').text('Time left to get Tuesday.');
	if (startDate.getDay() == 0)
		fh = fh + 24;
	if (startDate.getDay() == 6)
		fh = fh + 48;

	if (th < fh) {
		if (tm == 0)
			(ts == 0) ? $("#TotalTime").text(fh - th + ":00:00") : $("#TotalTime").text(fh - (th + 1) + ":59:" + (60 - ts))
		else
			(ts == 0) ? $("#TotalTime").text(fh - (th + 1) + ":" + (60 - tm ) + ":00") : $("#TotalTime").text(fh - (th + 1) + ":" + (60 - (tm + 1)) + ":" + (60 - ts))
	} else if (th > fh) {
		if (tm == 0)
			(ts == 0) ? $("#TotalTime").text(24 - (th - fh) + ":00:00") : $("#TotalTime").text(24 - (th - fh +1) + ":59:" + (60 - ts))
		else
			(ts == 0) ? $("#TotalTime").text(24 - (th - fh + 1) + ":" + (60 - tm) + ":00") : $("#TotalTime").text(24 - (th - fh + 1) + ":" + (60 - (tm + 1)) + ":" + (60 - ts))
	} else if (th == fh) {
		if (tm == 0)
			(ts == 0) ? $("#TotalTime").text("24:00:00") : $("#TotalTime").text("23:59:" + (60 - ts))
		else
			(ts == 0) ? $("#TotalTime").text( "23:" + (60 - tm ) + ":00") : $("#TotalTime").text("23:" + (60 - tm + 1) + ":" + (60 - ts))

	}
	var time = $("#TotalTime").text().split(":");
	$("#TotalTime").text(((time[0].length == 1) ? '0' + time[0] : time[0]) + ":" + ((time[1].length == 1) ? '0' + time[1] : time[1]) + ":" + ((time[2].length == 1) ? '0' + time[2] : time[2]));
	
	return startDate;
}
