function createRequestObject() {
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
	try { return new XMLHttpRequest(); } catch(e) {}
	alert("XMLHttpRequest not supported");
	return null;
}

var http = createRequestObject();

function sndReq(action) {
    http.open('GET', 'http://de.picolodia.com/rpc.php?action=' + action, true);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if (http.readyState == 4) {
        var response = http.responseText;
        var elements = new Array();

        if (response.indexOf('|' != -1)) {
			elements = response.split('@');
        }

		for (var i = 0; i < elements.length; i++) {
			if (elements[i].substring(0, 5) == 'eval:') {
				eval(elements[i].substr(5));
			}
			else {
				var update = new Array();
				update = elements[i].split('|');
				/*console.log(update[0] + update[1]);*/
				if (update[0]) {
					parent.document.getElementById(update[0]).innerHTML = update[1].replace(/~/g, '|');
				}
			}
		}
	}
}