	function createRequestObject()
	{
		var request_o; //declare the variable to hold the object.
		var browser = navigator.appName; //find the browser name
		if(browser == "Microsoft Internet Explorer")
		{
			/* Create the object using MSIE's method */
			request_o = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			/* Create the object using other browser's method */
			request_o = new XMLHttpRequest();
		}
		return request_o; //return the object
	}
	var http = createRequestObject(); 
	function getProducts()
	{
		http.open('get', 'internal_request.php?action=get_products&nSettingCityID=' 
				+ document.myform.nSettingCityID.value);
		http.onreadystatechange = handleProducts; 
		http.send(null);
	}
	function getAgents()
	{
		http.open('get', 'internal_request.php?action=getAgents&nSettingCityID=' 
				+ document.myform.nSettingCityID.value);
		http.onreadystatechange = handleGetAgents;
		http.send(null);
	}
	function handleGetAgents()
	{
		if(http.readyState == 4)
		{
			var response = http.responseText;
			document.getElementById('product_cage').innerHTML = response;
		}
	}

//	checkemail()
	function checkemail()
	{
		http.open('get', 'internal_request.php?action=checkmail&strAgentEmail=' 
				+ document.myform.strAgentEmail.value);
		http.onreadystatechange = handleCheckemail; 
		http.send(null);
	}
	function handleCheckemail()
	{
		if(http.readyState == 4)
		{
			var response = http.responseText;
			if(response != 0)	{	alert ( "Email Address:\nNot Available!" );	}
		}
	}
	function checkidwithZeroOne(x)
	{
		if(x == 1)
		{
			http.open('get', 'internal_request.php?action=checkid&strAgentUserName=' 
					+ document.myform.strAgentUserName.value);
			http.onreadystatechange = handleCheckidwithZeroOne;
		}
		else
		{
			http.open('get', 'internal_request.php?action=checkmail&strAgentEmail=' 
					+ document.myform.strAgentEmail.value);
			http.onreadystatechange = handleCheckEmailWithZeroOne;
		}
		http.send(null);
	}
	function handleCheckEmailWithZeroOne()
	{
		if(http.readyState == 4)
		{
			var response = http.responseText;
			if(response == 0)	{	alert ( "Email Address:\nAvailable!" );		}
			else				{	alert ( "Email Address:\nNot Available!" );	}
		}
	}
	function handleCheckidwithZeroOne()
	{
		if(http.readyState == 4)
		{
			var response = http.responseText;
			if(response == 0)	{	alert ( "User ID:\nAvailabale!" );			}
			else				{	alert ( "User ID:\nNot Available!" );		}
		}
	}
	function checkidWithBlue()
	{
		http.open('get', 'internal_request.php?action=checkid&strAgentUserName=' 
				+ document.myform.strAgentUserName.value);
		http.onreadystatechange = handleCheckidWithBlue;
		http.send(null);
	}
	function handleCheckidWithBlue()
	{
		if(http.readyState == 4)
		{
			var response = http.responseText;
			if(response != 0)	{	alert ( "User ID:\nNot Available!" );		}
		}
	}
	function handleProducts()
	{
		/* Make sure that the transaction has finished. The XMLHttpRequest object 
			has a property called readyState with several states:
			0: Uninitialized
			1: Loading
			2: Loaded
			3: Interactive
			4: Finished */
		if(http.readyState == 4)
		{ //Finished loading the response
			/* We have got the response from the server-side script,
				let's see just what it was. using the responseText property of 
				the XMLHttpRequest object. */
			var response = http.responseText;
			/* And now we want to change the product_categories <div> content.
				we do this using an ability to get/change the content of a page element 
				that we can find: innerHTML. */
			if(navigator.appName == "Microsoft Internet Explorer")
			{
			document.getElementById('product_cage').innerHTML = response;
			}
			else
			{
			document.getElementById('nSettingLocationID').innerHTML = response;
			}
			
		}
	}
