Amending Senocular's Countdown timer


I’m amending Senocular’s countdown timer that he has posted both on his site and as a tutorial on this site, but I’m trying to expand it slightly and need some advice.

His counter countsdown to one specific date, I have amended that date fine but need the date to change each month specified by the variable ‘drawmonth’ to countdown to the last day of the month at 17:00 when a competition draw will be made. So far I’ve got it working for September but when I add other variables it doesn’t work.

This is a small section of the code that I know works fine:

loadVariables(“test_index.asp”, get);

currentDate = new Date();
thisYear = currentDate.getFullYear();

counter.onEnterFrame = function(){
eventDate = new Date(thisYear, 8 , 30, 17 , 00, 00, 00);
eventMillisecs = eventDate.getTime();

currentDate = new Date();
currentMillisecs = currentDate.getTime();


This is counting down to 30th September at 17:00. I need to insert something like this in the function:

if (drawmonth == October){
eventDate = newDate(thisYear, 9, 31, 17, 00, 00, 00)
if (drawmonth == November){
eventDate = newDate(thisYear, 10, 30, 17, 00, 00, 00)

etc up to March, I’ve tried this but doesn’t work.

Anyone any better ideas?