var xmlHttp=crXHRO();
var aobj;
function crXHRO()
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch(e)
	{
		var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
										"MSXML2.XMLHTTP.5.0",
										"MSXML2.XMLHTTP.4.0",
										"MSXML2.XMLHTTP.3.0",
										"MSXML2.XMLHTTP",
										"Microsoft.XMLHTTP");
		for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++)
		{
			try
			{
				xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
			}
			catch (e) {}
		}
	}
	if (!xmlHttp)
	alert("ERROR!!!");
	else
	return xmlHttp;
}

function ajax_Get(url,obj)
{
	if (xmlHttp)
	{
		try
		{aobj=obj;
		xmlHttp.open("GET",url, true);
		xmlHttp.onreadystatechange=print_Ajax;
		xmlHttp.send(null);
		}
		catch(e)
		{
		}
	}
	
}

function ajax_Post(url,param,obj)
{	
	if (xmlHttp)
	{
		try
		{aobj=obj;
		xmlHttp.open("POST",url, true);
		xmlHttp.onreadystatechange=print_Ajax;
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
		xmlHttp.send(param);
		}
		catch(e)
		{
		}
	}
}

function print_Ajax()
{
	if(xmlHttp.readyState==4)
	{
		if(xmlHttp.status==200)
		{
		helloMessage=xmlHttp.responseText;
		
		document.getElementById(aobj).innerHTML=helloMessage;
		//window.alert(helloMessage);
		//if(document.getElementById("gruzim"))
		//document.getElementById("gruzim").style.display="none";
		}
		else
		{
			alert(xmlHttp.statusText);
		}
	}
}

function ajax_Value(url,obj)
{
	if (xmlHttp)
	{
		try
		{
		xmlHttp.open("GET",url, true);
		xmlHttp.onreadystatechange=function()
		{
				if(xmlHttp.readyState==4)
				{
					if(xmlHttp.status==200)
					{
					helloMessage=xmlHttp.responseText;
		//alert(helloMessage);
					document.getElementById(obj).value=helloMessage;

					}
					else
					{
						alert(xmlHttp.statusText);
					}
				}
		}
		xmlHttp.send(null);
		}
		catch(e)
		{
		}
	}
	
}


