
function makeHttpRequest(evokerid, url, callback_function, elementid, return_xml, msg_float, msx_text)
{
	 var http_request = false;

	 if (window.XMLHttpRequest) { // Mozilla, Safari,...
			 http_request = new XMLHttpRequest();
			 if (http_request.overrideMimeType) {
					 http_request.overrideMimeType('text/xml');
			 }
	 } else if (window.ActiveXObject) { // IE
			 try {
					 http_request = new ActiveXObject("Msxml2.XMLHTTP");
			 } catch (e) {
					 try {
							 http_request = new ActiveXObject("Microsoft.XMLHTTP");
					 } catch (e) {
							 alert('Caught Exception: ' + e.description)
							 }
			 }
	 }

	 if (!http_request) {
			 alert('Unfortunatelly you browser doesn\'t support this feature.');
			 return false;
	 }
	 http_request.onreadystatechange = function() {
		 //document.debug.document.write('httpreq: event <br />');
	try {
			 if (http_request.readyState == 4) {
					 if (http_request.status == 200) {
				 //document.debug.document.write('httpreq: '+http_request+' <br />');
							 if (return_xml) {
									 eval(callback_function + '("'+elementid+'", http_request.responseXML)');
							 } else {
									 eval(callback_function + '("'+elementid+'", http_request.responseText)');
							 }
					 } else {
							 alert('There was a problem with the request.(Code: ' + http_request.status + ')');
					 }
			}
	} catch (e) {
		alert('Caught Exception: ' + e.description)
		}

	 }
	 http_request.open('GET', url, true);
	 http_request.send(null);

	 var evoker=document.getElementById(evokerid);
	 //document.debug.document.write('httpreq: evokerid :'+evokerid+'<br />');
	 //document.debug.document.write('httpreq: evoker :'+evoker+'<br />');

	var msg = document.createElement(msg_float==''?'span':'div');
	msg.className='msgw';
	msg.style.cssFloat=msg_float; // compactible
	msg.style.styleFloat=msg_float; // IE
	msg.innerHTML=msx_text;
	msg.id='smsg';

	 var parelm=evoker.parentNode;
	 if (evoker.nextSibling!=null)
		parelm.insertBefore(msg,evoker.nextSibling);
	else
		parelm.appendChild(msg);

	 //document.debug.document.write('httpreq: parent :'+parelm+'<br />');
}

function appendTo(elementid,srv_resp)
{
	// where to append
	var block=document.getElementById(elementid);
	//document.debug.document.write('appendTo: elm :'+elementid+'<br />');
	//document.debug.document.write('appendTo: block: '+block+'<br />');
	// what to appned
	var idend = srv_resp.indexOf('-->');
	var identifier=srv_resp.substr(4,idend-4);
	//document.debug.document.write('appendTo: '+idend+' identifier: '+identifier+'<br />');
	//var child = document.createElement('tr');
	var child = document.createElement('div');
	//document.debug.document.write('appendTo: child: '+child+'<br />');

	child.id=identifier;
	//var ss=identifier.split('_');
	//child.className='level'+(ss.length-1);
	if (idend==-1 || idend>30) // if not begin id - not ajaxed text
		child.innerHTML=srv_resp; // put whole text to get info
	else
		child.innerHTML=srv_resp.substr(idend+3);
		//child.innerHTML='js:'+identifier+' : '+(ss.length-1)+'<br />'+srv_resp.substr(idend+3);
		//child.innerText='<pre>'+srv_resp.'</pre>';
		/*{
		var newText = document.createTextNode(srv_resp);
			child.appendChild(newText);
			}*/
	block.appendChild(child);


	// remove message
	var msg=document.getElementById('smsg');
	//document.debug.document.write('appendTo: msg: '+msg+'<br />');
	msg.parentNode.removeChild(msg);
}

function removeThe(elementid, srv_resp)
{
	// remove element
	var elm=document.getElementById(elementid);
	//document.debug.document.write('removeThe: elmid: '+elementid+' elm: '+elm+' resp: '+srv_resp+'<br />');
	elm.parentNode.removeChild(elm);

	// above removes also msg
}

// myslim ze vyzaduje xml format
function fillSelect(elementid, srv_resp)
{
	var selector=document.getElementById(elementid);

	// to best debug, try put !url! to browser

	//opera.postError('fillSelect: srv_resp: '+typeof(srv_resp.documentElement)+' '+(srv_resp.documentElement));
	//opera.postError('fillSelect: srv_resp: '+typeof(srv_resp)+' '+(srv_resp));

	// Remove all children from a node
	while (selector.firstChild)
		{
		selector.removeChild(selector.firstChild);
		}
	var options=null;
	if (srv_resp.documentElement!=null)
		options = srv_resp.documentElement.getElementsByTagName('option');
	else
		options = srv_resp.getElementsByTagName('option');

	//opera.postError('fillSelect: opt: '+options);

	//opera.postError('fillSelect: opt.num: '+options.length);
 	for (var i=0; i < options.length; i++)
		{
		var option = document.createElement('option');
		option.value = options[i].getAttribute('value');
		option.appendChild(document.createTextNode(options[i].firstChild.data));
		selector.appendChild(option);
		}

	// remove message
	var msg=document.getElementById('smsg');
	//opera.postError('appendTo: msg: '+msg);
	if (msg!=null) {
		msg.parentNode.removeChild(msg);
	}

}
/*
function fillSelect(elementid, srv_resp)
{
	var selector=document.getElementById(elementid);
		 //opera.postError('httpreq: event <br />');
	//document.debug.document.write('fillSelect: srv_resp: '+typeof(elementid)+' '+(elementid)+'<br />');
	//document.debug.document.write('fillSelect: srv_resp: '+typeof(selector)+' '+(selector)+'<br />');

	// to best debug, try put !url! to browser

	//document.debug.document.write('fillSelect: srv_resp: '+typeof(srv_resp.documentElement)+' '+(srv_resp.documentElement)+'<br />');
	//document.debug.document.write('fillSelect: srv_resp: '+typeof(srv_resp)+' '+(srv_resp)+'<br />');

	// Remove all children from a node
	while (selector.firstChild)
		{
			selector.removeChild(selector.firstChild);
		}
	var options=null;
	if (srv_resp.documentElement!=null)
		options = srv_resp.documentElement.getElementsByTagName('option');
	else
		options = srv_resp.getElementsByTagName('option');

	//document.debug.document.write('fillSelect: opt: '+options+'<br />');

	//document.debug.document.write('fillSelect: opt.num: '+options.length+'<br />');
 	for (var i=0; i < options.length; i++)
		{
		var option = document.createElement('option');
		option.value = options[i].getAttribute('value');
		option.appendChild(document.createTextNode(options[i].firstChild.data));
		selector.appendChild(option);
		}

	// remove message
	var msg=document.getElementById('smsg');
	//document.debug.document.write('appendTo: msg: '+msg+'<br />');
	msg.parentNode.removeChild(msg);

}
*/