// AJAX Modified class
// Usage Example:  onsubmit="XMLRequest('call.php','id','text=Some kind of text')"
// Copyright 2005


//document.write('<div style=display:none;><iframe name="IFR" id="IFR"></iframe></div>');


function process(script, div, str){
	XMLRequest(script, div, str);
//	alert(document.getElementById('div_node_0').innerHTML);
}



var xmlhttp;
var elid = '';
var xmlrs = '';

function XMLRequest(url, id, str)
{
    elid = id;
    p='div';
    loadXMLDoc(url,str);
}

function loadXMLDoc(url, str)
{
             
    if (window.XMLHttpRequest) // Not Internet Explorer
        {
            xmlhttp=new XMLHttpRequest();
            xmlhttp.open("POST",url,true);
            xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=windows-1251");
            xmlhttp.send(str);
            xmlhttp.onreadystatechange=state_Change;
        }
        
    else if (window.ActiveXObject) // Internet Explorer
        {
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              if (xmlhttp)
                {
                    xmlhttp.open("POST",url,true);
                    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=windows-1251");
                    xmlhttp.send(str);
                    xmlhttp.onreadystatechange=state_Change;
                   
                    }
        }
}

function state_Change()
{
    if (xmlhttp.readyState==4) //if shows "loaded"
        {
            if (xmlhttp.status==200) // i.e. "OK"
                {
                    if(elid!='') {   	
			var sss = xmlhttp.responseText;
	                document.getElementById(elid).innerHTML = sss;
                        }
                   
                }
            else
                {
                    alert("Problem retrieving XML data:" + xmlhttp.statusText);
                }
        }
}

