/*
	Original by Bill Bercik, http://www.webpasties.com/xmlHttpRequest/
	Modified by Marius Andra for Endurance CMS in 2005
*/

function cal_handleHttpResponse() 
{
	if(cal_http.readyState == 4) 
	{
		document.getElementById('cal_contents').innerHTML = cal_http.responseText;
	}
}
function cal_update() 
{
	var c_month = document.smallcal.cal_month;
	var c_year = document.smallcal.cal_year;
	
	var url = "index.php?part=calendar&small=yes&onlycont=yes&templayout=empty&cal_month=" + 
				escape(c_month.options[c_month.selectedIndex].value) + "-" + escape(c_year.options[c_year.selectedIndex].value) +
				"&selday=" + escape(document.smallcal.selected_day.value);
	
	cal_http.open("GET", url, true);
	cal_http.onreadystatechange = cal_handleHttpResponse;
	cal_http.send(null);
}
function cal_getHTTPObject() 
{
	var xmlhttp;
	/*@cc_on
		@if (@_jscript_version >= 5)
			try 
			{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} 
			catch (e) 
			{
				try 
				{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (E)
				{
					xmlhttp = false;
				}
			}
		@else
			xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
	{
		try 
		{
			xmlhttp = new XMLHttpRequest();
		} 
		catch (e) 
		{
			xmlhttp = false;
		}
	}
	return xmlhttp;
}

var cal_http = cal_getHTTPObject(); // We create the HTTP Object
