// JavaScript Document
var xmlHttp=createXmlHttpRequestObject();

function createXmlHttpRequestObject()
{
	
	var xmlHttp;
	
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch(e)
	{
		var xmlHttpVersions=new Array("MSXML2.HTTP.6.0",
									  "MSXML2.HTTP.5.0",
									  "MSXML2.HTTP.4.0",
									  "MSXML2.HTTP.3.0",
									  "MSXML2.HTTP",
									  "Microsoft.XMLHTTP");
		for(var i=0;i<xmlHttpVersions.length && !xmlHttp;i++)
		{
			try
			{
				xmlHttp=new ActiveXObject(xmlHttpVersions[i]);
			}
		
			catch(e)
			{
				
			}
		}
	}
	if(!xmlHttp)
	alert("Error creating xmlHttp Request Object");
	else
	return xmlHttp;
	
}


function showArea(x)
{
	if(xmlHttp)
	{
		var param=x;
		//alert(param);
		try
		{
					
			
			xmlHttp.open("GET","inc/showcity.php?city=" +param,true);
			//alert("Is there any option");
			xmlHttp.onreadystatechange=function()
					{
						
					if(xmlHttp.readyState==4)
					  {
						  if(xmlHttp.status==200)
						  {
						  //alert("hi i am");
						  document.getElementById("citydiv").innerHTML=xmlHttp.responseText;
						  }
						  else
					  		{
						 		 alert("Error reading the response" + xmlHttp.responseText);
					  		}
					  }
					  
					}
			xmlHttp.send(null);
		}
		catch(e)
		{
			alert("Can't connect to the server " + e.toString());
			
		}
		
	}
	else
	{
		alert("Error creating xmlhttp object");
	}
}

