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;
}

function prnt(f,u,t,m1,m2){if(!u)u=location.href;if(!t)t=document.title;u=encodeURIComponent(u);t=encodeURIComponent(t);document.write('<div id="share42">');var s=new Array('"/print/'+u+'.html" target="_blank" title="Распечатать стандарт для ознакомления"');for(i=0;i<s.length;i++)document.write('<a rel="nofollow" style="display:block;width:32px;height:32px;margin:0 0 6px;background:url('+f+'icons.png) -'+32*i+'px 0" href='+s[i]+' target="_blank"></a>');document.write('</div>');window.onload=function(){var p=document.getElementById('share42');function m(){var top=Math.max(document.body.scrollTop,document.documentElement.scrollTop);if(top+m2<m1){p.style.top=m1-top+'px';}else{p.style.top=m2+'px';}}m();window.onscroll=m;}}
