﻿//Code modifed by Stan Jones (www.videoandcomputer.com), based on script from JavaScript Kit (www.javascriptkit.com)
//Much of the Javascript Kit code appeared to be an older common source

//Change word to the word to end the sentence "Only .... until Word" (the event).
var before="Camp!"

//Change to the sentence to use once the event has been reached.
var current="Camp is in session!"

//Change to the year (YYYY), month (MM), and day (DD) of the event you are counting down to.
var theyear = 2008;
var themonth = 06;
var theday = 07;

//Do not change below here
var yr = theyear;
var mo = themonth;
var da = theday;
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function countdown(){
var today=new Date()
var todayy=today.getYear()

if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todayh=today.getHours()
var todaymin=today.getMinutes()
var todaysec=today.getSeconds()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
var futurestring=montharray[mo-1]+" "+da+", "+yr
dd=Date.parse(futurestring)-Date.parse(todaystring)
dday=Math.floor(dd/(60*60*1000*24)*1)
dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
if(dday==0&&dhour==0&&dmin==0&&dsec==1){;
document.getElementById('countdown_div').innerHTML = current;
return
}
else
document.getElementById('countdown_div').innerHTML="Only "+dday+ " days, "+dhour+" hours, "+dmin+" minutes, and "+dsec+" seconds left until "+before;
setTimeout("countdown()",1000)
}

window.onload =function() {
countdown()
}
