﻿function days2Thomas(){
         var before=" Thomas returns to the Dean Forest Railway!"
         var current="See Thomas today at the Dean Forest Railway!"
         var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
         function countdown(d,m,yr) {
         var today=new Date()
         var todayy=today.getYear()
         if (todayy < 1000)
         todayy+=1900
         var todaym=today.getMonth()
         var todayd=today.getDate()
         var todaystring=montharray[todaym]+" "+todayd+", "+todayy
         var futurestring=montharray[m-1]+" "+d+", "+yr
         var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
         //ADD MORE IF DIFFERENCE LINES IF MORE THAN ONE DAY USING ==-1 and ==-2 etc FOR MORE DAYS
         if (difference==1)
         document.write("Thomas comes to the Dean Forest Railway tomorrow!")
         if (difference==0)
         document.write(current)
         if (difference==-1)
         document.write(current)
         if (difference==-2)
         document.write(current)
         if (difference==-3)
         document.write(current)
         if (difference==-4)
         document.write(current)
         else if (difference>0)
         document.write("Only "+difference+" days until "+before)
         }
         //THIS IS WHERE YOU SET THE DATE OF THE EVENT:
         countdown(7,4,2006)
}
