/************************************************************************
* Name: calendar.js														*
* Company: Fusework Studios												*
* Author: Brandon Coppernoll											*
* Date Created: August 3, 2006											*
*																		*
* This file will allow the client to access functions and server actions*
* for the event calendar module.										*
************************************************************************/

/*
* This function changes a calendar month on the main site.
*/
function displayCalendarMonth( vMonth, vYear )
{
	var oForm = document.forms[0];
	var oXmlHttp = zXmlHttp.createRequest();
  	// Open a connection to the server
  	oXmlHttp.open("GET", "/calendar/scripts/_switchmonth.asp?MonthNum=" + vMonth + "&YearNum=" + vYear , true);
  	// Setup a function for the server to run when it's done
  	oXmlHttp.onreadystatechange = function ()
	{
		if (oXmlHttp.readyState == 1) 
			document.getElementById("spnCalendarMonth").innerHTML = "<strong>Loading month</strong>";
		else if (oXmlHttp.readyState == 2) 
			document.getElementById("spnCalendarMonth").innerHTML = "<strong>Loading month</strong>";
		else if (oXmlHttp.readyState == 3) 
			document.getElementById("spnCalendarMonth").innerHTML = "<strong>Loading month</strong>";
		else if (oXmlHttp.readyState == 4) 
		{
			response = oXmlHttp.responseText;
			if (oXmlHttp.status == 200)
			{
				document.getElementById("divCurrentMonth").innerHTML = response;
				window.status = "Done";
				response = "";
			}
			else
				alert("Sorry, server error (" + oXmlHttp.status + ") has occurred when changing the calendar month. If problems persist please contact your site administrator or hosting company. Thank you!");
		}
	};
  	// Send the request
  	oXmlHttp.send(null);
}

/*
* This function changes a calendar month on the main site.
*/
function displaySmallCalendarMonth( vMonth, vYear )
{
	var oForm = document.forms[0];
	var oXmlHttp = zXmlHttp.createRequest();
  	// Open a connection to the server
  	oXmlHttp.open("GET", "/calendar/scripts/_switchmonthsmall.asp?MonthNum=" + vMonth + "&YearNum=" + vYear , true);
  	// Setup a function for the server to run when it's done
  	oXmlHttp.onreadystatechange = function ()
	{
		if (oXmlHttp.readyState == 1) 
			document.getElementById("spnCalendarMonth").innerHTML = "<strong>Loading month</strong>";
		else if (oXmlHttp.readyState == 2) 
			document.getElementById("spnCalendarMonth").innerHTML = "<strong>Loading month</strong>";
		else if (oXmlHttp.readyState == 3) 
			document.getElementById("spnCalendarMonth").innerHTML = "<strong>Loading month</strong>";
		else if (oXmlHttp.readyState == 4) 
		{
			response = oXmlHttp.responseText;
			if (oXmlHttp.status == 200)
			{
				document.getElementById("divCurrentMonth").innerHTML = response;
				window.status = "Done";
				response = "";
			}
			else
				alert("Sorry, server error (" + oXmlHttp.status + ") has occurred when changing the calendar month. If problems persist please contact your site administrator or hosting company. Thank you!");
		}
	};
  	// Send the request
  	oXmlHttp.send(null);
}
