function waiting() {
//document.getElementById("temp").innerHTML='<img src="graph/l.gif"> czekam na serwer...';
}

function doit(string, dest) {
// document.getElementById("temp").innerHTML='';
document.getElementById(dest).innerHTML=string;
//autoajax(); //funkcje zdefiniowne wcześniej do wykonani zaraz po połączeniu
}

function beMyAjax(acValue, dest) {
//alert( edDomain + '/admin,hrt_updatemonitor,' + acValue);
advAJAX.get({
    //url: 'http://localhost/swiat/zakupy/admin,hrt_updatemonitor,' + acValue,
    url: edDomain + '/admin,hrt_updatemonitor,' + acValue,
    onInitialization : function (obj) { waiting();},
    onSuccess : function(obj) { doit(obj.responseText, dest); },
    onError : function(obj) { alert("Error: " + obj.status); }
});

}

function submit_form(fname, dest) {
	
advAJAX.submit(document.getElementById(fname), {
    onSuccess : function(obj) { doit(obj.responseText, dest); },
    onError : function(obj) { alert("Error: " + obj.status); }
});

}

















	function beMyXML(acValue, dest)
	{
			advAJAX.get({
				url: 'http://localhost/' + acValue,
				onInitialization : function (obj) { waiting();},
				onFinalization : function(obj) { parseXML(obj.responseXML, dest); },
				onError : function(obj) { alert("Error: " + obj.status); }
		});
	}

	function parseXML(xml, div)
	{
		tab='';

		tab=doParse(xml.documentElement); // z ajaxa
		//logLine(xml.firstChild.childNodes[2].tagName);
		byId(div).innerHTML=tab;
		byId('dump').innerHTML=getLogLine();
	}

	function doParse(xml)
	{
	//var nodes;
	str='';
		logLine('wejscie: ' + xml.tagName);
		
			if(xml.hasChildNodes() && xml.firstChild.nodeType!==3)
			{
				nodes=xml.childNodes;
				
					for(var i=0; i < nodes.length; i++)
					{
							logLine('tablica zawiera ' + nodes.length + ' element(ów), a aktalna wartość i to: ' + i);
						str+=doParse(nodes[i]);
					//nodes=xml.childNodes;
							logLine('dół ' + nodes.length + ' element(ów), a aktalna wartość i to: ' + i + ' oryginalny xml ' + xml.childNodes.length);
					}
			}
			else
			{
					if(xml.firstChild)
					{
						logLine('Zapisałem znaleziony tekst: ' + xml.firstChild.nodeValue);
						str+=xml.firstChild.nodeValue + "<br />";
					}
					else{
						str+='novalue' + '<br />';	
					}

			}
		logLine('wyjscie: ' + xml.tagName);
		return str;
	}


	var logline;
	function logLine(line)
	{
		logline+='<b>' + line + '</b>' + '<br />';
	}
	
	function getLogLine()
	{
		txt='Zalogowane linie: <br />';
		end='<hr />';
		return txt + logline + end;
	}















function postAjax(params, acValue, dest) {

advAJAX.post({
    url: 'http://localhost/' + acValue,
	parameters : {
      "updateValue" : params
    },
    onInitialization : function (obj) { waiting();},
    onSuccess : function(obj) { doit(obj.responseText, dest); },
    onError : function(obj) { alert("Error: " + obj.status); }
});
}