todayDate=new Date();
thisday=todayDate.getDay();
thismonth=todayDate.getMonth();
thisdate=todayDate.getDate();
thisyear=todayDate.getYear();
thisyear = (thisyear < 1000) ? thisyear + 1900 : thisyear;
monthnames = new Array(12);
monthnames[0]="JANUARY";
monthnames[1]="FEBRUARY";
monthnames[2]="MARCH";
monthnames[3]="APRIL";
monthnames[4]="MAY";
monthnames[5]="JUNE";
monthnames[6]="JULY";
monthnames[7]="AUGUST";
monthnames[8]="SEPTEMBER";
monthnames[9]="OCTOBER";
monthnames[10]="NOVEMBER";
monthnames[11]="DECEMBER";
monthdays = new Array(12);
monthdays[0]=31;
monthdays[1]=28;
monthdays[2]=31;
monthdays[3]=30;
monthdays[4]=31;
monthdays[5]=30;
monthdays[6]=31;
monthdays[7]=31;
monthdays[8]=30;
monthdays[9]=31;
monthdays[10]=30;
monthdays[11]=31;
monthtemps = new Array(12);
monthtemps[0]="Normal High: 35°F - Normal Low: 20°F - Normal Average: 27°F";
monthtemps[1]="Normal High: 39°F - Normal Low: 22°F - Normal Average: 30°F";
monthtemps[2]="Normal High: 49°F - Normal Low: 30°F - Normal Average: 39°F";
monthtemps[3]="Normal High: 61°F - Normal Low: 39°F - Normal Average: 50°F";
monthtemps[4]="Normal High: 71°F - Normal Low: 49°F - Normal Average: 60°F";
monthtemps[5]="Normal High: 79°F - Normal Low: 58°F - Normal Average: 68°F";
monthtemps[6]="Normal High: 83°F - Normal Low: 63°F - Normal Average: 73°F";
monthtemps[7]="Normal High: 81°F - Normal Low: 61°F - Normal Average: 71°F";
monthtemps[8]="Normal High: 75°F - Normal Low: 54°F - Normal Average: 64°F";
monthtemps[9]="Normal High: 63°F - Normal Low: 43°F - Normal Average: 53°F";
monthtemps[10]="Normal High: 51°F - Normal Low: 34°F - Normal Average: 43°F";
monthtemps[11]="Normal High: 40°F - Normal Low: 25°F - Normal Average: 33°F";
if(thismonth == 0){January()};
if(thismonth == 1){February()};
if(thismonth == 2){March()};
if(thismonth == 3){April()};
if(thismonth == 4){May()};
if(thismonth == 5){June()};
if(thismonth == 6){July()};
if(thismonth == 7){August()};
if(thismonth == 8){September()};
if(thismonth == 9){October()};
if(thismonth == 10){November()};
if(thismonth == 11){December()};

function displaycal(){
document.write("<h2><table border=0 bgcolor=white width='800px'>");
document.write("<tr>");
document.write("<td align='center' width='145px'><font color='blue'><img src='lq.jpg'><br />"+"LQ"+"</td>");
document.write("<td align='center' width='145px'><font color='black'><img src='nm.jpg'><br />"+"NM"+"</td>");
if(thismonth == 11 ){document.write("<td colspan=3 align='center' width='435px'><font face='arial' color='#000000' size='5'>"+monthnames[thismonth]+"<br />"+thisyear+"</td>")};
if(thismonth < 2){document.write("<td colspan=3 align='center' width='435px'><font face='arial' color='#000000' size='5'>"+monthnames[thismonth]+"<br />"+thisyear+"</td>")};
if(thismonth >= 2 && thismonth <5){document.write("<td colspan=3 align='center' width='435px'><font face='arial' color='green' size='5'>"+monthnames[thismonth]+"<br />"+thisyear+"</td>")};
if(thismonth >= 5 && thismonth <8){document.write("<td colspan=3 align='center' width='435px'><font face='arial' color='red' size='5'>"+monthnames[thismonth]+"<br />"+thisyear+"</td>")};
if(thismonth >= 8 && thismonth <11){document.write("<td colspan=3 align='center' width='435px'><font face='arial' color='#ff5500' size='5'>"+monthnames[thismonth]+"<br />"+thisyear+"</td>")};
document.write("<td align='center' width='145px'><font color='green'><img src='fq.jpg'><br />"+"FQ"+"</td>");
document.write("<td align='center' width='145px'><font color='#ff5500'><img src='fm.jpg'><br />"+"FM"+"</td>");
document.write("</tr>");
document.write("<tr><td align='center' colspan='7'><font size='2' color='gray'>Pittsburgh temperature averages for "+monthnames[thismonth]+": "+monthtemps[thismonth]+"<br />Calendar number in <font color = 'green'>GREEN</font> - hours of daylight in Pittsburgh</font></td></tr>")
document.write("</table></h2>");

document.write("<table border='1' bgcolor='white' width='800px'>");
if(thisday==0){document.write("<td align='center' bgcolor='#FFFF00'><font color='red' size='4'><b>SUN</b></td>")}else{document.write("<td align='center'><font color='black' size='3'>Sun</td>")};
if(thisday==1){document.write("<td align='center' bgcolor='#FFFF00'><font color='red' size='4'><b>MON</b></td>")}else{document.write("<td align='center'><font color='black' size='3'>Mon</td>")};
if(thisday==2){document.write("<td align='center' bgcolor='#FFFF00'><font color='red' size='4'><b>TUE</b></td>")}else{document.write("<td align='center'><font color='black' size='3'>Tue</td>")};
if(thisday==3){document.write("<td align='center' bgcolor='#FFFF00'><font color='red' size='4'><b>WED</b></td>")}else{document.write("<td align='center'><font color='black' size='3'>Wed</td>")};
if(thisday==4){document.write("<td align='center' bgcolor='#FFFF00'><font color='red' size='4'><b>THU</b></td>")}else{document.write("<td align='center'><font color='black' size='3'>Thu</td>")};
if(thisday==5){document.write("<td align='center' bgcolor='#FFFF00'><font color='red' size='4'><b>FRI</b></td>")}else{document.write("<td align='center'><font color='black' size='3'>Fri</td>")};
if(thisday==6){document.write("<td align='center' bgcolor='#FFFF00'><font color='red' size='4'><b>SAT</b></td>")}else{document.write("<td align='center'><font color='black' size='3'>Sat</td>")};
document.write("</tr>");
offsett = 1;
offset = thisday - (thisdate%7);
if(offset == -1){offsett = 1};
if(offset == 0 || offset == -7){offsett = 0};
if(offset == 1 || offset == -6){offsett = -1};
if(offset == 2 || offset == -5){offsett = -2};
if(offset == 3 || offset == -4){offsett = -3};
if(offset == 4 || offset == -3){offsett = -4};
if(offset == 5 || offset == -2){offsett = -5};
weeks = 5;
if(monthdays[thismonth]==30 && offsett == -5){weeks = 6}
if(monthdays[thismonth]==31 && offsett <= -4){weeks = 6}
for(week=1;week<=weeks;week++){
document.write("<tr>");
for(day=1;day<=7;day++){
if(offsett==thisdate){document.write("<td align='center' valign='top' bgcolor='#FFFF00'><font face='arial' color='red' size='4'><b>"+offsett+"&nbsp;&nbsp;&nbsp;&nbsp;<font color = 'green'>"+daylight[offsett]+"</font><br /><font size='3'>"+mom[thisdate]+"</font></b><br /><a href='http://www.wunderground.com/US/PA/Pittsburgh.html'></a></td>")}
else{if(!(offsett==thisdate) && offsett > 0 && offsett<= monthdays[thismonth]){document.write("<td align='center' valign='top'><font size='3'><b>"+offsett+"&nbsp;&nbsp;&nbsp;&nbsp;<font  color='green'  size='2'>"+daylight[offsett]+"</b></font><br /><font  size='2'>"+mom[offsett]+"</font></td>");}
else{document.write("<td align='center'>"+"</td>")}};
offsett++;
}
document.write("</tr>");
}
document.write("</table>");
}

