// JavaScript Document
var http_request_2;

function buildCalendar2(senderID,date,jointo)
{
	
	if (!document.getElementById('calendarWrapper'))
	{
		var objDivContainer = document.createElement("div");
		objDivContainer.id = "calendarWrapper";
		objDivContainer.style.position = 'absolute';
		objDivContainer.style.width = 100;
		objDivContainer.style.visibility = 'hidden';
		document.body.appendChild(objDivContainer);
	}
	else
	{
		objDivContainer = document.getElementById('calendarWrapper');
	}
	senderH = parseInt(getStyle(document.getElementById(senderID),"height"));
	senderTop = parseInt(getTop(document.getElementById(senderID)));
	objDivContainer.style.top = senderTop+senderH +'px';
	objDivContainer.style.left = getLeft(document.getElementById(senderID)) +'px';
	fixLeft = parseInt(objDivContainer.style.left) - 220;
	objDivContainer.style.left = fixLeft+parseInt(getStyle(document.getElementById(senderID),"width")) +'px';

	if (window.XMLHttpRequest)
	{
		http_request_2 = new XMLHttpRequest();

		if (http_request_2.overrideMimeType)
		{
			http_request_2.overrideMimeType('text/html');
		}
	}
	else if (window.ActiveXObject)
	{
		try
		{
			http_request_2 = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				http_request_2 = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {}
		}
	}

	var parameters = 'senderID='+senderID+'&jointo='+jointo+'&date='+date;

	http_request_2.onreadystatechange =
	function()
	{
		if (http_request_2.readyState == 4)
		{
			if (http_request_2.status == 200)
			{
				result = http_request_2.responseText;
				objDivContainer.innerHTML = result;
				objDivContainer.style.visibility = 'visible';
			}
			else
			{
				alert('There was a problem with the request.');
			}
		}
		else
		{
			if (document.getElementById('calMonth'))
			{
				document.getElementById('calMonth').innerHTML = "Please wait...";
			}
		}
	};

	http_request_2.open('POST', 'calendar2.php', true);
	http_request_2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
	http_request_2.setRequestHeader("Content-length", parameters.length);
	http_request_2.setRequestHeader("Connection", "close");
	http_request_2.send(parameters);
}