var xmlhttp;
 
function checkNamn(str,id)
{
xmlhttp=GetXmlHttpObject();

if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }

var url="test2.php";
if (id==1)
{
var params = "grupp="+str;
}
else if (id==2)
{
var params = "sokord="+str;
}
xmlhttp.open("POST", url, true);

//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
//xmlhttp.setRequestHeader("Connection", "close"); IE BUGG v6 & 7 använd inte..

url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.send(params);

function stateChanged()
{

if (xmlhttp.readyState==4)
{
 if (id==1)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
 else if (id==2)
{
document.getElementById("txtHint2").innerHTML=xmlhttp.responseText;
}

  
}
}
}


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

