var remote;
var onAjaxFinished='';

function GetXMLHttp() {
	var xmlhttp=false;
	try 
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
	catch (e) 
		{
			try 
				{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				}
			catch (E)
				{
					xmlhttp = false;
				}
		}
	// Mozilla then?
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}		

function ChangeContent(id,href,autoclose) {
	if (autoclose!=null)
		var ac=autoclose;
	else
		var ac=0;
	obj=new Object();
	obj['p1']=id;
	obj['p2']=href;
	obj['p3']=ac;
	wf=onAjaxFinished;
	onAjaxFinished='';
	
	DoAjax(id,href,ac,wf);
}

function DoAjax(id,href,autoclose) {
	var xmlhttp = GetXMLHttp();
//	document.getElementById(id).innerHTML = 'Egy pillanat, már nézem is...';
	xmlhttp.open("GET", href, true);
  xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			document.getElementById(id).innerHTML = xmlhttp.responseText;
			if ((autoclose==1) && (remote!=null)) {
				remote.close();
			}
			if (wf!='') {
				eval(wf);
			}
		}
	}
	xmlhttp.send(null);
}


