HR_today = new Date();

function HR_getHttp ( ) {
	if (window.XMLHttpRequest) return new XMLHttpRequest()
	else {
		try {
			return new ActiveXObject("Microsoft.XMLHTTP");
			} 
		catch (oErr) {
			return false;
			}
		}
	}
	
	
	
function HR_runScript( addr , no_cache , method ) {
	if( addr.indexOf( "?" ) > 0 ) {
		addr +="&";
		}
	else {
		addr +="?";
		}
	if( no_cache ) addr +="random=" + HR_today.getTime();
	var xmlhttp = HR_getHttp( );
	if( xmlhttp ) {
		addr += ( no_cache ? "&" : "" ) + "utf=yes";
		addr += "&testEncode=тест";
		//alert( addr );
		if( method && method == "POST" ) {
			xmlhttp.open("POST", addr );
			}
		else {
			xmlhttp.open("GET", addr );
			}
		xmlhttp.onreadystatechange = function()  {
				if ( xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					//alert(xmlhttp.getAllResponseHeaders());
					//alert( xmlhttp.responseText );
					eval( xmlhttp.responseText );
					}
			}
		xmlhttp.send(null);
		}
	else {
		//if( safari ) {
			var ifr = document.createElement( "IFRAME" );
			
			ifr.style.visibility = "hidden";
			ifr.style.position = "absolute";
			ifr.src = addr + "&old=yes";
			document.body.appendChild( ifr );
		//	}
		//else {
			//alert( getElement( "HR_hidden" ) );
		//	getElement( "HR_hidden" ).src = addr + "&old=yes";
			/*
			var scr = document.createElement( "SCRIPT" );
			try {
				alert( addr );
				scr.src = addr;
				scr = document.body.appendChild( scr );
				//alert( scr.onLoad );
				} 
			catch (oErr) {
				getElement( "HR_hidden" ).src = addr + "&old=yes";
				}
			*/
		//	}
		}
	}
	
function HR_getHTML( addr , no_cache , element , load_str , type_ins ) {
	if( addr.indexOf( "?" ) > 0 ) {
		addr +="&";
		}
	else {
		addr +="?";
		}
	if( no_cache ) addr +="random=" + HR_today.getTime();
	var xmlhttp = HR_getHttp( );
	if( xmlhttp ) {
		if( element && load_str ) {
			element.innerHTML = load_str;
			}
		addr += ( no_cache ? "&" : "" ) + "utf=yes";
		addr += "&testEncode=тест";
		xmlhttp.open("GET", addr );
		xmlhttp.onreadystatechange = function()  {
				if ( xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					//alert(xmlhttp.getAllResponseHeaders());
					if( element ) {
						element.innerHTML = xmlhttp.responseText;
						}
					else {
						return xmlhttp.responseText;
						}
					}
			}
		xmlhttp.send(null);
		}
	}