

<!--
function getMoonAge(year, month, day)
{	
	d = Math.floor(year/20)
	r = year-(d*20) //r is the remainder of (year/19)
	while (r>9)
	{	
		r = r-19
	}
	r = r*11
	while (r>29)
	{	
		r = r-30
	}
	if (month<3)
	{	
		month = month+2
	}
	r = r+month+day
	if (year<100)
	{	
		r = r-4
	}
	else
	{
		r = r-8.3
	}
	while(r>29)
	{	
		r = r-30
	}
	while(r<0)
	{	
		r = r+30
	}
	return r
}
function getMoonPhase(moonAge)
{	
	if (moonAge<2) return "Nymåne."
	if (moonAge<5) return "Månskäran växer till för var dag."
	if (moonAge<11) return "Månen är i 1:a kvarteret. Månskuggan minskar nu, dag för dag."
	if (moonAge<13) return "Månskuggan minskar nu, dag för dag."
	if (moonAge<16) return "Fullmåne"
	if (moonAge<20) return "Månskuggan växer nu till, dag för dag."
	if (moonAge<24) return "Månen är i 3:e kvarteret, skuggan växer till, dag för dag."
	if (moonAge<29) return "Månskäran blir mindre för var dag."
	if (moonAge<30) return "Nymåne."
}
function getMoonPhaseImg(moonAge)
{	
	if (moonAge<2) return "moonnew"
	if (moonAge<5) return "waningwcresent"
	if (moonAge<11) return "firstquarter"
	if (moonAge<13) return "waninggibbous"
	if (moonAge<16) return "moonfull"
	if (moonAge<20) return "waxinggibbous"
	if (moonAge<24) return "last quarter"
	if (moonAge<29) return "waxingcresent"
	if (moonAge<30) return "moonnew"
}
monthNames = new Array(13)
monthNames[1]  = "januari"
monthNames[2]  = "februari"
monthNames[3]  = "mars"
monthNames[4]  = "april"
monthNames[5]  = "maj"
monthNames[6]  = "juni"
monthNames[7]  = "juli"
monthNames[8]  = "augusti"
monthNames[9]  = "september"
monthNames[10] = "oktober"
monthNames[11] = "november"
monthNames[12] = "december"
		 
dayNames = new Array(8)
dayNames[1]  = "Söndag"
dayNames[2]  = "Måndag"
dayNames[3]  = "Tisdag"
dayNames[4]  = "Onsdag"
dayNames[5]  = "Torsdag"
dayNames[6]  = "Fredag"
dayNames[7]  = "Lördag"
function getLongDate(dateObj)
{	
	theDay = dayNames[dateObj.getDay()+1]
	theMonth = monthNames[dateObj.getMonth()+1]
	theDate = dateObj.getDate()
	theYear = dateObj.getYear()
return ""+theDay+" , "+theDate+" "+theMonth+" , "+theYear
}
		
function getNextFull(moonAge)
{	
	currMilSecs = (new Date()).getTime()
	daysToGo = 15 - moonAge
	while(daysToGo<2)
	{	
		daysToGo = daysToGo+29
	}
	milSecsToGo = daysToGo*24*60*60*1000
	nextMoonTime = currMilSecs+milSecsToGo
	nextMoonDate = new Date(nextMoonTime)
	return nextMoonDate
}
		
function getNextNew(moonAge)
{	
	currMilSecs = (new Date()).getTime()
	daysToGo = 29 - moonAge
	while(daysToGo<2)
	{	
		daysToGo = daysToGo+29
	}
	milSecsToGo = daysToGo*24*60*60*1000
	nextMoonTime = currMilSecs+milSecsToGo
	nextMoonDate = new Date(nextMoonTime)
	return nextMoonDate
	//-->
}