// Function to submit form from previous month text link in webcal
function prevmonth()
{
  document.prevmonthform.submit();
}
// Function to submit form from next month text link in webcal
function nextmonth()
{
  document.nextmonthform.submit();
}
// Function providing form button for browser history
function goHist(a)
{
   history.go(a);
}
// Function providing popup window with calendar event information
function eventPopup(eType,eTitle,eDate,eTime,eLocation,eContact,eURL,eDetails,eParams) {
	var eWin
	if(eWin!=null && !eWin.closed){ 
		eWin.close()
	}
	var eWin = window.open("","t500event",eParams)
	eWin.focus() 
	eWin.document.open();
	eWin.document.write("<html>\n<head>\n<title>Troop 500 Event - " + eTitle + "</title>\n");
<!-- Include Stylesheets -->
	eWin.document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/global.css\">\n");
	eWin.document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/webcal.css\">\n");
<!-- Script to open new window and close event details window -->
	eWin.document.write("<\script language=\"JavaScript\" type=\"text/javascript\">\n");
	eWin.document.write("function swapWindow(url){\n");
	eWin.document.write("var newWin = window.open(url,\"_blank\",\"width=740,height=540,top=40,left=40,location,menubar,toolbar,scrollbars,resizable,status\")\n");
	eWin.document.write("	setTimeout('self.close()',0100);\n");
	eWin.document.write("}\n");
	eWin.document.write("</\script>\n");
	eWin.document.write("</head>\n<body onload=\"document.body.focus()\" onBlur=\"self.focus()\">\n");
	eWin.document.write("<form>\n");
<!-- Page Header Graphic -->
	eWin.document.write("<table border=0 cellpadding=0 cellspacing=0 background=\"/images/header-event-filler.gif\">\n");
	eWin.document.write("<tr><td align=left valign=top><img src=\"/images/header-event.gif\" width=499 height=50 border=0 alt=\"Boy Scout Troop 500 Event Details\"></td>\n");
	eWin.document.write("<td align=right valign=top background=\"/images/header-event-filler\"><img src=\"/images/spacer.gif\"></td></tr>\n");
	eWin.document.write("</table>\n");
<!-- Event Information -->
	eWin.document.write("<table cellspacing=5>\n");
	if (eTitle){
		eWin.document.write("<tr><td colspan=2 class=\"event_title\">" + eTitle + "</td></tr>\n");
	}
	if (eType == "M"){
		if (eDate){
		eWin.document.write("<tr><td class=\"event_field_name\">Starts: </td><td class=\"event_field\">" + eDate + "</td></tr>\n");
		}
		if (eTime){
		eWin.document.write("<tr><td class=\"event_field_name\">Ends: </td><td class=\"event_field\">" + eTime + "</td></tr>\n");
		}
	} else {
		if (eDate){
		eWin.document.write("<tr><td class=\"event_field_name\">Date: </td><td class=\"event_field\">" + eDate + "</td></tr>\n");
		}
		if (eTime){
		eWin.document.write("<tr><td class=\"event_field_name\">Time: </td><td class=\"event_field\">" + eTime + "</td></tr>\n");
		}
	}
	if (eLocation){
	eWin.document.write("<tr><td class=\"event_field_name\">Location: </td><td class=\"event_field\">" + eLocation + "</td></tr>\n");
	}
	if (eContact){
	eWin.document.write("<tr><td class=\"event_field_name\">Contact: </td><td class=\"event_field\">" + eContact + "</td></tr>");
	}
	if (eDetails){
	eWin.document.write("<tr><td class=\"event_field_name\">Details: </td><td class=\"event_field\">" + eDetails + "</td></tr>");
	}
	if (eURL){
	eWin.document.write("<tr><td colspan=2><a href=\"javascript:swapWindow('" + eURL + "');\">Additional Information</a></td></tr>\n");
	}
	eWin.document.write("<tr><td colspan=2>\n");
	eWin.document.write("<hr>\n");
	eWin.document.write("<input type=button name=printbutton value=\"Print Event\" onClick=\"window.print()\">");
	eWin.document.write("&nbsp;&nbsp;&nbsp;&nbsp;<input type=button name=focusbutton value=\"Close Window\" onClick=\"window.close()\">");
	eWin.document.write("</td></tr>\n");
	eWin.document.write("</form>\n");
	eWin.document.write("</table>\n");
	eWin.document.write("</body></html>\n");
	eWin.document.close();
}

// Function to open new window and close event details window -->
function showLink(linkURL){
	var newLink = window.open(linkURL,"_blank","width=740,height=540,top=40,left=40,location,menubar,toolbar,scrollbars,resizable,status")
	setTimeout('self.close()',0100);
}
