function getXMLHTTP() { //fuction to return the xml http object

	var xmlhttp = false;

	try {
		xmlhttp = new XMLHttpRequest();
	}

	catch(e) {		
		try {			
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e) {
			try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e1) {
				xmlhttp = false;
			}
		}
	}
	return xmlhttp;
}

/*
function getIlce(strURL)
{         
	var req = getXMLHTTP(); // fuction to get xmlhttp object
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4) { //data is retrieved from server
				if (req.status == 200) { // which reprents ok status                    
					alert("Status: "+req.status+"\nText: "+req.responseText);
					document.getElementById('ilcediv').innerHTML = req.responseText;
				}
				else
				{
					alert("There was a problem while using XMLHTTP:\nURL:"+strURL+"\nreq.status = "+req.status);
				}
			}
		}  
		req.open("GET", strURL, true); //open url using get method
		req.send(null);
	}
}
*/


function getIlce2(strURL)
{
	var req = getXMLHTTP(); // fuction to get xmlhttp object
	if (req)
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4) { //data is retrieved from server
				if (req.status == 200) { // which reprents ok status                    
					// alert("Status: "+req.status+"\nText: "+req.responseText);
					// document.getElementById('ilcediv').innerHTML = req.responseText;
					
					var totals = req.responseText.split("|");
					
					// alert("Ilce adedi: "+totals.length);
					
					// select elementimizi secelim
					var selectBox = document.getElementById('ilce');
					
					// once eski tüm option'lari ucuralim.
					selectBox.options.length = 0;
					

					// sonra yenilerini ekleyelim.
					for(var i=0; i < totals.length; i++) {
						selectBox.options[i] = new Option(totals[i], totals[i]);
					}
					
				}
				else
				{
					alert("There was a problem while using XMLHTTP:\nURL:"+strURL+"\nreq.status = "+req.status);
				}
			}
		}  
		req.open("GET", strURL, true); //open url using get method
		req.send(null);
	}
}



/*
function GetXmlHttpObject(handler)
{
   var objXMLHttp = null
   if (window.XMLHttpRequest)
   {
       objXMLHttp = new XMLHttpRequest();
   }
   else if (window.ActiveXObject)
   {
       objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }
   return objXMLHttp;
}

function stateChanged()
{
   if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
   {
           document.getElementById("ilcediv").innerHTML= xmlHttp.responseText;
   }
   else {
           //alert(xmlHttp.status);
   }
}

// Will populate data based on input
function htmlData(url, qStr)
{
   if (url.length==0)
   {
       document.getElementById("txtResult").innerHTML="";
       return;
   }
   xmlHttp=GetXmlHttpObject()
   if (xmlHttp==null)
   {
       alert ("Browser does not support HTTP Request");
       return;
   }

   url=url+"?"+qStr;
   url=url+"&sid="+Math.random();
   xmlHttp.onreadystatechange=stateChanged;
   xmlHttp.open("GET",url,true) ;
   xmlHttp.send(null);
}
*/