function ReplaceString(exp, str, wit) {
return exp.split(str).join(wit);
}

function newWindow(url,option){
win=open(url,"",option);
}

//TREE

function xmlHttpGet () {
	var http = false;
	if (window.ActiveXObject) {
		try {
			http = new ActiveXObject ('Msxml2.XMLHTTP');
		} catch(e) {
			http = new ActiveXObject ('Microsoft.XMLHTTP');
		}
	} else {
		http = new XMLHttpRequest ();
	}
	return http;
}

function xmlHttpReady (http) {
	return http.readyState == 4 && (http.status == 304 || http.status == 200);
}

function xmlHttpSend (http, url) {
	http.open ('GET', url, true);
	if (window.XMLHttpRequest) {
		http.send (null?null:'');
	} else if (window.ActiveXObject) {
		http.send();
	}
}

function x_getStatus (div) {
	return div.getAttribute('x_status');
}

function setAttr (div, name, val) {
	var attr = document.createAttribute (name);
	attr.value = val;
	div.setAttributeNode (attr);
}

function loadNode_main (p, i, l,s) {
	if (l && showWinL) return;
	var obj = document.getElementById('parent_'+p);
	if (x_getStatus (obj) == 0) {
		var http = xmlHttpGet ();
		if (http) {
			http.onreadystatechange = function () {
				if (xmlHttpReady (http)) {
					if (http.responseText.length) {
						obj.innerHTML = http.responseText;
						obj.style.display = 'block';
					}
					setAttr (obj, 'x_status', 1);
					if (document.getElementById('img'+p))
						document.getElementById('img'+p).src = '/images/minus.gif';
				}
			}

			var l = obj.getAttribute('x_level');
			var url = '/simple.php?god=tree&p='+p+'&i='+i+'&s='+s+'&l='+l;
			xmlHttpSend(http, url);
		}
	} else {
		obj.innerHTML = '';
		obj.style.display = 'none';
		setAttr (obj, 'x_status', 0);
		if (document.getElementById('img'+p))
			document.getElementById('img'+p).src = '/images/plus.gif';
	}

	return false;
}