var xmlHttp;

function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
  {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
		// Internet Explorer
		try
		{
	  	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
  		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
  }
  return xmlHttp;
}

function CalculateOffsets()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Your browser does not support AJAX!");
		return;
	}
	
	xmlHttp.onreadystatechange=StateChanged;
    xmlHttp.open("GET","OffsetsCalculator.aspx",true);
	xmlHttp.send(null);
}
 
function StateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{
		try
		{
			var xmlDoc=xmlHttp.responseXML.documentElement;
			document.getElementById("offset_month").innerHTML=xmlDoc.getElementsByTagName("month")[0].childNodes[0].nodeValue;
			document.getElementById("offset_total").innerHTML=xmlDoc.getElementsByTagName("total")[0].childNodes[0].nodeValue;
		}
		catch (e)
		{
		}
  }
}  
