%@ EnableSessionState=false Language=JavaScript %>
<%
check_cookie();
function getDaysInMonth(month,year)
{
var days;
if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
{ days=31; }
else if (month==4 || month==6 || month==9 || month==11)
{ days=30; }
else if (month==2)
{
if (isLeapYear(year))
{ days=29; }
else
{ days=28; }
}
return (days);
}
function isLeapYear(Year)
{
if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0))
{ return (true); }
else
{ return (false); }
}
var server_date;
server_date = new Date();
local_date = new Date(server_date.getTime() + (Number(Request.Cookies("UserData")("Timezone")) * 60*60*1000));
this_year = local_date.getUTCFullYear() + 0;
this_month = local_date.getUTCMonth() + 1;
today = local_date.getUTCDate() + 0;
now_hr = local_date.getUTCHours() + 0;
now_min = local_date.getUTCMinutes() + 0;
now_sec = local_date.getUTCSeconds() + 0;
if ((isFinite(Request.Form("m")) == true) && (Request.Form("m") > 0) && (Request.Form("m") <= 12))
{ phase_month = Request.Form("m"); }
else
{ phase_month = this_month; }
if ((isFinite(Request.Form("y")) == true) && (Request.Form("y") > 1900) && (Request.Form("y") <= 2100))
{ phase_year = Request.Form("y"); }
else
{ phase_year = this_year; }
Response.write("\n");
days = getDaysInMonth(phase_month, phase_year)
conn = Server.CreateObject("ADODB.Connection");
conn.Open("DSN=admain");
rs = Server.CreateObject("ADODB.RecordSet");
sql = "select date_format(max(newmoon), '%b %e, %Y %H:%i:%s') as lnm from phase where newmoon < '" + phase_year + "-" + phase_month + "-1 12:00:00'";
rs.Open(sql, conn);
var lnm_date = String(rs.fields.item("lnm"));
rs.Close();
conn.Close();
%>
AstronomyDaily.com - Moon Phases
<% insert_menu(0); %>
<% title_block("phases of the moon", "the moon | the sun | the planets"); %>
|
|
| Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
<%
thefirst = new Date(phase_year, phase_month - 1, 1)
skip = thefirst.getDay();
for (i = 0; i < skip; i++)
{
Response.write("| | \n");
}
for (today = 1; today <= days; today++)
{
var ageofmoon = Date.parse(phase_month + "-" + today + "-" + phase_year + " 12:00:00") - Date.parse(lnm_date);
var moonimg = Math.round((ageofmoon / 2551392000) * 32) + 1;
while (moonimg < 1)
{ moonimg = 32 + moonimg }
while (moonimg > 32)
{ moonimg = moonimg - 32 }
if (moonimg == 17) { pname = ' full' }
else if (moonimg == 9) { pname = ' first qtr' }
else if (moonimg == 25) { pname = ' last qtr' }
else if (moonimg == 1) { pname = ' new' }
else { pname = '' }
Response.write("" + String(today) + pname + " \n");
Response.write("\n");
Response.write(" \n");
Response.write("\n");
Response.write(" | \n");
if ((today + skip) % 7 == 0)
{
Response.write(" \n\n");
}
}
%>
|
|
|
<% insert_footer(); %>
|
|