<!--
//****************************************
// Yorumcu AstroRehber Atlas Ajax Query
// Author: Altan Yildiz - www.altanyildiz.com
// Date: 11-10-2008 - ver: 1.0.1
//****************************************
function changer(bcityVal,bcountryVal,bstateidVal,bcitySel) {
	var selObj=document.getElementById('bcountry'+bcitySel);
	var selIndex=selObj.selectedIndex;
	var selItem=selObj.options[selIndex];

	document.getElementById('bcity'+bcitySel).value=bcityVal;
	//item.text=bcountryVal;item.value=bstateidVal;

	for (var i=0;i<selObj.length;i++) {
	if (selObj.options[i].value==bstateidVal) {
		selObj.selectedIndex=i;document.getElementById('atlasSrcDiv'+bcitySel).style.visibility='hidden';break;
		}
	}
}
function searchAtlas(cityVal,countryVal,bcitySel) {
	var xh = Atlas_CreateXmlHttp();
	var url = '/astrorehber/atlasSearch.asp?bci='+cityVal+"&bco="+countryVal+"&bcs="+bcitySel;
	//url+="&"+new Date().getTime();
	xh.onreadystatechange=function(){Atlas_handleResponse(xh,bcitySel);}
	xh.open('GET', url, true);
	try {
		xh.send(null);
	}
	catch(e) {
		alert(e);
	}
}
function Atlas_handleResponse(xh,bcitySel) {
	//(0) (UNINITIALIZED) The object has been created, but not initialized (open method has not been called). 
	//(1) LOADING The object has been created, but the send method has not been called. 
	//(2) LOADED The send method has been called and the status and headers are available, but the response is not yet available. 
	//(3) INTERACTIVE Some data has been received. You can call responseBody and responseText to get the current partial results. 
	//(4) COMPLETED All the data has been received, and the complete data is available in responseBody and responseText 

	var atlasDivID = "atlasSrcDiv"+bcitySel;

	if (xh.readyState == 4) {
		try
		{//if "OK"
			if (xh.status==200 || window.location.href.indexOf("http")==-1)
				{//Response ok.
					document.getElementById(atlasDivID).innerHTML=xh.responseText;
					document.getElementById(atlasDivID).style.visibility="visible";
					return;
				}
			else
				{//Problem retrieving XML data
					document.getElementById(atlasDivID).innerHTML="Hata: Sunucuya bağlanılamadı."
				}
		}
		catch(err)
		{//Internet is not connected.
			document.getElementById(atlasDivID).innerHTML="Hata: İnternet bağlantısı yok."
		}

	} else {//Processing
		//
	}
}
function Atlas_CreateXmlHttp() {
	var xh = false; //variable to hold ajax object
	/*@cc_on
	   @if (@_jscript_version >= 5)
	      try {
	      xh=new ActiveXObject("Msxml2.XMLHTTP");
	      }
	      catch (e) {
	         try {
	         xh=new ActiveXObject("Microsoft.XMLHTTP");
	         }
	         catch (e) {
	         xh=false;
	         }
	      }
	   @end
	@*/

	if (!xh && typeof XMLHttpRequest != 'undefined') xh=new XMLHttpRequest();
	return xh;
}
//-->
