var loadstatustext="<img src='loading.gif' >";

function PReitingas(mano,rez,aid)
{
var i = 0;
var user_input = -1;
content = document.getElementById('vopros').innerHTML;

if (rez == 0)
{
 for (i=0;i<mano.answer.length;i++) {
	if (mano.answer[i].checked) {
	user_input = mano.answer[i].value;
	}
 }
    if (user_input < 0){
    return false;
 }
}

  url='anketa.php?iw='+aid+'&rAnswerID='+user_input;
  message   = document.getElementById('vopros');
  message.innerHTML=loadstatustext;

var xmlhttp=false;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
    try {
        xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
    } catch (e) {
        try { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } catch (E) { xmlhttp = false; }
    }
    @end @*/
    if(!xmlhttp) { xmlhttp=new XMLHttpRequest(); }
    xmlhttp.open('GET', url, true);
    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState==4) {
	  if (xmlhttp.status == 200)
	  { document.getElementById('vopros').innerHTML = xmlhttp.responseText; }
          else
	  { document.getElementById('vopros').innerHTML = content; }
	}
    }
    xmlhttp.send(null);


}


function NEP()
{
  maila   = document.getElementById('myloz').value;
  url='pastas.php?bic=7&mail='+maila;
  //alert(url);
  message   = document.getElementById('mylo');
  message.innerHTML=loadstatustext;
  loadXMLDocFR(url);
}



function loadXMLDocFR(url) {
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChangeFR;
        req.open("GET", url, true);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChangeFR;
            req.open("GET", url, true);
            req.send();
        }
    }
}

function processReqChangeFR()
{
    // only if req shows "complete"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
         result = req.responseText;
	 message   = document.getElementById('mylo');
   	 message.innerHTML=result;
        } else {
         alert("There was a problem retrieving the XML data:\n" + req.statusText+" "+req.readyState+" "+req.status);
        }
    }
}

