function GetXmlHttpObject(){ var xmlHttp=null; try { xmlHttp=new XMLHttpRequest(); } catch (e) { try  { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }

var xmlHttp;
		
		/*
		////////////////////////////////////////
		//// Var Descriptions: + uses
		////
		///	 itemid = item to get num from i.e. dropdown
		//// dir = image directory
		//// dyndiv = div to swap out
		//// dbase = database name
		//// key = key name for mysql select
		//// width = Image Width
		//// logo_field = db field for logo/picture
		//// num = item num
		////
		///////////////////////////////////////
		*/
function limit_subdivisions()
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	

	var num = document.getElementById("location").value;
	//var num = document.getElementById(floorplan_image).value;
	if (num != '')
	{

		var url = "http://www.wintonhomes.com/includes/dropdown.php"; 
		url	= url+"?location="+location;
		url = url+"&sid="+Math.random();
		//prompt("",url);
		
		xmlHttp.onreadystatechange = function()
		{
			if(xmlHttp.readyState == 4)
			{ 
				var result = xmlHttp.responseText;
				//prompt("",result);
				if(result != '')
				{
					document.getElementById(criteria).innerHTML = result;
				}
				else
				{
					document.getElementById(criteria).innerHTML = "<option value=''>Sorry, No results for that location</option>";
					return;
				}
				
						
			}
		}
		 
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	else
	{
		document.getElementById(dyndiv).innerHTML = "";
		return;
	}
}
