// JavaScript Document
var calculated = false;

function ajaxFunction()
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		return new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			return new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				return new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
}


function xmlhttpPost(strURL, params, div, action) {
	
	var xmlHttpReq = false;
	var self = this;

    self.xmlHttpReq = ajaxFunction();
	
	self.xmlHttpReq.open('POST', strURL + params, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

	self.xmlHttpReq.onreadystatechange = function() {
		if (self.xmlHttpReq.readyState == 1 || self.xmlHttpReq.readyState == 2) {
			updateLoading(div);
		}	
		if (self.xmlHttpReq.readyState == 4) {
			if (action == 'calendar')
				updateContentCalendar(self.xmlHttpReq.responseText, div);
        }
    }
    self.xmlHttpReq.send(params);	
}

function updateLoading(div)
{
	//document.getElementById(div).innerHTML = "";	
}

function updateContentCalendar(text, div)
{
	document.getElementById(div).innerHTML = text;
}


