var xmlHttp;
var haslo;
var kier;

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function mainFunction(haslo,kier) {
if (haslo.length==0) {
	//document.getElementById("imie").innerHTML="";
	document.getElementById("wyniki").innerHTML="";
	return;
}
var url="podpow.php";
url=url+"?haslo="+haslo;
url=url+"&kier="+kier;
url=url+"&sid="+Math.random();
xmlHttp=GetXmlHttpObject();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function GetXmlHttpObject()
{
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  return xmlHttp;
}

function stateChanged()
{
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
  {
  //document.getElementById("imie").innerHTML=xmlHttp.responseText;
  if (xmlHttp.responseText.substring(0,1)=="_"){
  document.getElementById("wyniki").innerHTML=xmlHttp.responseText.substring(1);
  	}
  }
}

//function resetF()
//{
//document.getElementById("haslo").value="";
//document.getElementById("haslo").focus();
//}

//function dodaj(str)
//{
//document.getElementById("imie").innerHTML = str;
//}
