ChangeMonth = Date
ChangeYear = Year(Date)
oFlag=0

Sub Start()
	ChangeMonth = Date
	ChangeYear = Year(Date)
	oFlag=0
	Calendar(Date)
End Sub

Sub TimeLine(y)

	if Year(Date) <> ChangeYear then 
		MsgBox "You must be on this year to view history. Click on the clock to go to today. Click OK now..."
		Exit Sub
	End If
	if Month(ChangeMonth) < 10 then M = "0" & Month(ChangeMonth) else M = Month(ChangeMonth) 
	if y < 10 then y = "0" & y
	MD = M & "_" & y
	MD1 = M & "/" & y
	ask = Confirm("Do you want to see what happened in history on " & MD1 & "? Hold down your [Ctrl] key if you have pop-up blocker. Click OK or Cancel...")
	if ask = "False" then Exit Sub
	window.open "http://timelines.ws/days/" & MD & ".HTML","History","top=100,left=100,width=700,height=550,resizable=1,scrollbars=1"
End Sub

sub GoTL()
 	if Month(ChangeMonth) < 10 then oMM = "0" & Month(ChangeMonth) else oMM = Month(ChangeMonth)
 	if Day(ChangeMonth) < 10 then oDD = "0" & Day(ChangeMonth) else oDD = Day(ChangeMonth)
	toDay = oMM & "_" & oDD
	MD = prompt("What month and day. Must be in this format: mm_day (and zero fill leading zeros) Example: 01_01 for January 1st not 1_1, 1_01, nor 01_1",toDay)
	if len(MD) < 5 then 
		msgbox "ERROR! Sorry you must zero fill dates. Example: 01_01 for January 1st. Click OK to continue..."
		exit sub
	end if
	if MD <> "" then
		window.open "http://timelines.ws/days/" & MD & ".HTML","History","top=100,left=100,width=700,height=550,resizable=1,scrollbars=1"
	end if
end sub

Sub Calendar(num)
oMonth.focus()
'Chrono()
ThisMonth = (Month(num) & "/1/" & ChangeYear)
If ThisMonth =  "12/1/" & ChangeYear then 
	NextMonth = "1/1/" & (ChangeYear) + 1
Else
	NextMonth =  (CDate((Month(ThisMonth) + 1) & "/1/" & ChangeYear))
End If
FDOM = WeekDay(ThisMonth)
LDOM = DateDiff("d",ThisMonth,NextMonth)
oMonth.innerText = MonthName(Month(ThisMonth)) & " " & ChangeYear

'line 55

	For oX = FDOM To ((LDOM + FDOM)-1)
		c = c + 1
		if c = Day(ChangeMonth) then
		document.all("c" & oX).innerHTML = "<b><u><font color=red><a title='Click for history...' onmouseover=c" & oX & ".style.cursor='hand' onclick='TimeLine(" & c & ")' target=_blank>" & c & "</a></u><b></font>"
		else
		document.all("c" & oX).innerHTML = "<a title='Click for history...' onmouseover=c" & oX & ".style.cursor='hand' onclick='TimeLine(" & c & ")' target=_blank>" & c & "</a>"
		end if
	Next
		'if flag = 0 then document.all("c" & Day(now)).innerHTML = "<b><u><a  title='Click for history...' onmouseover=c" & Day(now) & ".style.cursor='hand' onclick='TimeLine(" & Day(now) & ")' target=_blank>" & Day(now) & "</a></b></u>"
End Sub

Sub PrevD()
	oFlag = 1
	For oX = 1 To 42
		document.all("c" & oX).innerText = ""
	Next

If Month(ChangeMonth) = 1 then
	ChangeYear = ChangeYear - 1
	ChangeMonth = "12/" & Day(ChangeMonth) & "/" & ChangeYear
	Calendar(ChangeMonth)
	Exit Sub
End If
	ChangeMonth =  CDate((Month(ChangeMonth) - 1) & "/" & Day(ChangeMonth) & "/" & ChangeYear)
	Calendar(ChangeMonth)
End Sub

Sub NextD()
	oFlag = 1
	For oX = 1 To 42
		document.all("c" & oX).innerText = ""
	Next

If Month(ChangeMonth) = 12 then  
	ChangeYear = ChangeYear + 1
	ChangeMonth = "1/" & Day(ChangeMonth) & "/" & ChangeYear
	Calendar(ChangeMonth)
	Exit Sub
End If
	ChangeMonth =  CDate((Month(ChangeMonth) + 1) & "/" & Day(ChangeMonth) & "/" & ChangeYear)
	Calendar(ChangeMonth)	
End Sub

Sub Chrono()
'	oClock.innerText = Date & " " & Time
'	setTimeout "Chrono()", 1000, VBScript
End Sub

