function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = self;
  remote.opener.name = orgName;
  return remote;
}

function launchRemote(URL) {
myRemote = launch(URL, "myRemote", "height=405,width=640,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0", "myWindow");
myRemote.focus();
}

var thisyear;
var thismonth;
var thisdate;
var thisday;

function dThisMonth() {
	todayDate=new Date();
	thisday=todayDate.getDay();
	thisdate=todayDate.getDate();
	thismonth=todayDate.getMonth();
	thisyear=todayDate.getFullYear();
	startspaces=thisdate;
}

function dLastMonth() {
	iDate = new Date();
	thismonth = iDate.getMonth();
	thisyear = iDate.getFullYear();
	thismonth--;
	if (thismonth < 0) {
		thismonth = 11;
		thisyear--;
		}
	iDate = new Date(thisyear,thismonth,1)
	thisday = iDate.getDay();
	thismonth = iDate.getMonth();
	thisyear = iDate.getFullYear();
	thisdate = 1;
	startspaces=thisdate;
	thisdate = 31;
}

function cal() {

CURRENT_DAY_HIGHLITE_BGCOLOR="#FFFFCC";
MONTH_NAME_BGCOLOR="white";
MONTH_NAME_FONT_SIZE="3";
MONTH_NAME_FONT_COLOR="black";
MONTH_DAYS_BGCOLOR="white";
MONTH_DAYS_FONT_SIZE="-1";
WEEK_DAY_HEADING_BGCOLOR="#8B96AB";
WEEK_DAY_HEADING_FONT_SIZE="-1";
WEEK_DAY_FONT_COLOR="white";
NON_MONTH_DAY_BGCOLOR="#AAAAAA";


monthnames = new Array(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December");

//thisyear = thisyear % 100;
//thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear));

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;

if (((thisyear % 4 == 0) && !(thisyear % 100 == 0)) || (thisyear % 400 == 0))
	monthdays[1]++;

linkmonth = thismonth + 1;
linkmonth = "" + linkmonth;
linkmonth = ((linkmonth.length < 2) ? ("0" + linkmonth) : (linkmonth));

while (startspaces > 7)
	startspaces-=7;

startspaces = thisday - startspaces + 1;

if (startspaces < 0)
	startspaces+=7;

document.write("<table border=2 bgcolor=white ");
document.write("bordercolor=\"black\"><font color=\"black\" face=\"arial, helvetica, sans-serif, swiss, verdana\">");
document.write("<tr><td colspan=7 bgcolor='"+MONTH_NAME_BGCOLOR+"'><font color=\""+MONTH_NAME_FONT_COLOR+"\" size="+MONTH_NAME_FONT_SIZE+"><center><strong>" + monthnames[thismonth] + " " + thisyear + "</strong></center></font></td></tr>");
document.write("<tr bgcolor='"+WEEK_DAY_HEADING_BGCOLOR+"'>");
document.write("<td align=center><font color='"+WEEK_DAY_FONT_COLOR+"' size="+WEEK_DAY_HEADING_FONT_SIZE+">Su</font></td>");
document.write("<td align=center><font color='"+WEEK_DAY_FONT_COLOR+"' size="+WEEK_DAY_HEADING_FONT_SIZE+">M</font></td>");
document.write("<td align=center><font color='"+WEEK_DAY_FONT_COLOR+"' size="+WEEK_DAY_HEADING_FONT_SIZE+">Tu</font></td>");
document.write("<td align=center><font color='"+WEEK_DAY_FONT_COLOR+"' size="+WEEK_DAY_HEADING_FONT_SIZE+">W</font></td>");
document.write("<td align=center><font color='"+WEEK_DAY_FONT_COLOR+"' size="+WEEK_DAY_HEADING_FONT_SIZE+">Th</font></td>");
document.write("<td align=center><font color='"+WEEK_DAY_FONT_COLOR+"' size="+WEEK_DAY_HEADING_FONT_SIZE+">F</font></td>");
document.write("<td align=center><font color='"+WEEK_DAY_FONT_COLOR+"' size="+WEEK_DAY_HEADING_FONT_SIZE+">Sa</font></td>");
document.write("</tr>");
document.write("<tr>");

for (s=0;s<startspaces;s++)
	document.write("<td bgcolor='"+NON_MONTH_DAY_BGCOLOR+"'>&nbsp;</td>");

count=1;
while (count <= monthdays[thismonth])
{
	for (b = startspaces;b<7;b++)
	{
		if(count <= monthdays[thismonth])
	       document.write("<td align=\"right\" bgcolor="+MONTH_DAYS_BGCOLOR+"><font size='"+MONTH_DAYS_FONT_SIZE+"'>");
        else
		   document.write("<td align=\"right\" bgcolor='"+NON_MONTH_DAY_BGCOLOR+"'><font size='"+MONTH_DAYS_FONT_SIZE+"'>");
		if (count <= monthdays[thismonth])
		{
			linkday = "" + count;
			linkday = ((linkday.length < 2) ? ("0" + linkday) : (linkday));
                        document.write("<font face=\"verdana, geneva, arial, helvetica, sans-serif\" COLOR=\"#CCCCCC\">");
                        if (count <= thisdate)
                                document.write('<b><a href=\"javascript:launchRemote(\'http://pooch.sitstay.com/cgi-bin/poochshow.cgi?d=1&sh='+thisyear+linkmonth+linkday+'\')"'+'>');
                           //   document.write('<a href=\"/cgi-bin/poochshow.cgi?sh='+thisyear+linkmonth+linkday+'"'+'>');
                        document.write(count);
                        document.write("</a></b>");
                        document.write("</font>");
		}
		else
			document.write("&nbsp;");
		document.write("</td>");
		count++;
	}
	document.write("</tr>");
	document.write("<tr>");
	startspaces=0;
}
document.write("</table></p>");
}

