So I am making a countdown on javascript, I replaced my intention with the end of the school year coming up. The code is as following, but my issue is that I want it to stop at 0 and display the variable endMessage. I have tried many things but I can't get it to work, the times just keep going into negatives, messing up the equations. A few of my ill attempts remain there, as they do not affect the code. Any ideas? Here is the countdown function:


Code:
function countdown()
{

var endMessage="School's out!";
var currentTime=new Date()
var month=currentTime.getMonth()+1;
var day=currentTime.getDate();
var hour=currentTime.getHours();
var minute=currentTime.getMinutes();
var second=currentTime.getSeconds()
var targetTimeMonth=6;
var targetTimeDay=(10)-1;
var targetTimeHour=15;
var targetTimeMinute=30;
var targetTimeSecond=60;
if(minute>targetTimeMinute)
{
targetTimeMinute=targetTimeMinute+60;
targetTimeHour--;
}
var countdownEnder=0;
var endResultMonth=targetTimeMonth-month;
var endResultDay=targetTimeDay;
var endResultMinute=targetTimeMinute-minute-1;
var endResultHour=targetTimeHour-hour;
var endResultSecond=targetTimeSecond-second;
var endResult=endResultMonth+endResultDay+endResultHour+endResultMinute+endResultSecond;
if(endResultMinute<0)
endResultMinute=endMessage;
if(endResultHour<0)
{
endResultDay--;
endResultHour+=24;
}
if(endResultDay=targetTimeDay)
endResultDay--;
if(month<targetTimeMonth)
targetTimeDay+30;
document.quoteform.quoter.value=endResultMonth+"  months   "+endResultDay+"   days   "+endResultHour+"  hours   "+endResultMinute+"   minutes   "+endResultSecond+"   seconds left 'till the end of school!";

if(endResultMinute<0)
{
endResultMinute=59;
endResultHour--;
}
var countdownEnded=0;

if(countdownEnded>0)
document.quoteform.quote.value=endMessage;
if(endResult=0)
{
document.write(endMessage);
document.images[0].src="BlueColor.gif";
tick=null;
document.quoteform.quote.value=null;
}
}


var tick=setInterval("countdown()", 1000);
//-->
</script>