var xmlHttp

function showCD(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="getcd.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{
    if (xmlHttp.responseText == '2') {
        document.getElementById("nick").style.backgroundColor = "#ef2e29";
        document.getElementById("txtHint").value = 'Müsait Değil';
    }
   if (xmlHttp.responseText == '1'){
        document.getElementById("nick").style.backgroundColor = "#91c266";
        document.getElementById("txtHint").value = 'Müsait';
    }
    if (xmlHttp.responseText == '') {
        document.getElementById("nick").style.backgroundColor = "#eaf2d4";
        document.getElementById("txtHint").value = '';
    }
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}