	function showProvinces(country)
	{
		// clear the province box
		while (document.frmSearch.province.options.length>0)
			document.frmSearch.province.remove(0);
			
		addOption(document.frmSearch.province, "", "All Provinces");
		if (country != "")
		{
			// add the relevant provinces in the country to the list.
			for (i=0;i<provinces.length;i++)
			{
				if (provinces[i].country == country)
					addOption(document.frmSearch.province, provinces[i].id, provinces[i].name);
			}
		}
		
		showRegions("");
		showSuburbs("");
	}
	
	function showRegions(province)
	{
		// clear the province box
		while (document.frmSearch.region.options.length>0)
			document.frmSearch.region.remove(0);
			
		addOption(document.frmSearch.region, "", "All Regions");
		if (province != "")
		{
			// add the relevant provinces in the country to the list.
			for (i=0;i<regions.length;i++)
			{
				if (regions[i].province == province)
					addOption(document.frmSearch.region, regions[i].id, regions[i].name);
			}
		}
		
		showSuburbs("");
	}
	
	function showSuburbs(region)
	{
		// clear the province box
		while (document.frmSearch.suburb.options.length>0)
			document.frmSearch.suburb.remove(0);
			
		addOption(document.frmSearch.suburb, "", "Select a Town ------»");
		if (region != "")
		{
			// add the relevant suburbs in the country to the list.
			for (i=0;i<suburbs.length;i++)
			{
				if (suburbs[i].region == region)
					addOption(document.frmSearch.suburb, suburbs[i].id, suburbs[i].name);
			}
		}
	}
	
	function addOption(selectBox, optionValue, optionName)
	{
  		var newOpt = new Option(optionName, optionValue);
  		var selLength = selectBox.length;
  		selectBox.options[selLength] = newOpt;
	}
	
	function loadWindow()
	{
		if (document.frmSearch.country.value != "")
		{
			showProvinces(document.frmSearch.country.value);
		}
		
		if (document.frmSearch.defProvince.value != "")
		{
			document.frmSearch.province.value = document.frmSearch.defProvince.value;
			showRegions(document.frmSearch.province.value);
		}
		
		if (document.frmSearch.defRegion.value != "")
		{
			document.frmSearch.region.value = document.frmSearch.defRegion.value;
			showSuburbs(document.frmSearch.region.value);
		}
		
		if (document.frmSearch.defSuburb.value != "")
		{
			document.frmSearch.suburb.value = document.frmSearch.defSuburb.value;
		}
	}

function Province(provinceId, provinceName, countryId)
{
	this.id = provinceId;
	this.name = provinceName;
	this.country = countryId;
}

function Region(regionId, regionName, provinceId)
{
	this.id = regionId;
	this.name = regionName;
	this.province = provinceId;
}

function Suburb(suburbId, suburbName, regionId)
{
	this.id = suburbId;
	this.name = suburbName;
	this.region = regionId;
}

	function showProvinces2(country)
	{
		// clear the province box
		while (document.frmSearch2.province.options.length>0)
			document.frmSearch2.province.remove(0);
			
		addOption(document.frmSearch2.province, "", "All Provinces");
		if (country != "")
		{
			// add the relevant provinces in the country to the list.
			for (i=0;i<provinces.length;i++)
			{
				if (provinces[i].country == country)
					addOption(document.frmSearch2.province, provinces[i].id, provinces[i].name);
			}
		}
		
		showRegions2("");
		showSuburbs2("");
	}
	
	function showRegions2(province)
	{
		// clear the province box
		while (document.frmSearch2.region.options.length>0)
			document.frmSearch2.region.remove(0);
			
		addOption(document.frmSearch2.region, "", "All Regions");
		if (province != "")
		{
			// add the relevant provinces in the country to the list.
			for (i=0;i<regions.length;i++)
			{
				if (regions[i].province == province)
					addOption(document.frmSearch2.region, regions[i].id, regions[i].name);
			}
		}
		
		showSuburbs2("");
	}
	
	function showSuburbs2(region)
	{
		// clear the province box
		while (document.frmSearch2.suburb.options.length>0)
			document.frmSearch2.suburb.remove(0);
			
		addOption(document.frmSearch2.suburb, "", "Select a Town / Suburb");
		if (region != "")
		{
			// add the relevant suburbs in the country to the list.
			for (i=0;i<suburbs2.length;i++)
			{
				if (suburbs2[i].region == region)
					addOption(document.frmSearch2.suburb, suburbs2[i].id, suburbs2[i].name);
			}
		}
	}
	
	function addOption2(selectBox, optionValue, optionName)
	{
  		var newOpt = new Option(optionName, optionValue);
  		var selLength = selectBox.length;
  		selectBox.options[selLength] = newOpt;
	}
	
	function loadWindow2()
	{
		if (document.frmSearch2.country.value != "")
		{
			showProvinces2(document.frmSearch2.country.value);
		}
		
		if (document.frmSearch2.defProvince.value != "")
		{
			document.frmSearch2.province.value = document.frmSearch2.defProvince.value;
			showRegions2(document.frmSearch2.province.value);
		}
		
		if (document.frmSearch2.defRegion.value != "")
		{
			document.frmSearch2.region.value = document.frmSearch2.defRegion.value;
			showSuburbs2(document.frmSearch2.region.value);
		}
		
		if (document.frmSearch2.defSuburb.value != "")
		{
			document.frmSearch2.suburb.value = document.frmSearch2.defSuburb.value;
		}
	}

function Province2(provinceId, provinceName, countryId)
{
	this.id = provinceId;
	this.name = provinceName;
	this.country = countryId;
}

function Region2(regionId, regionName, provinceId)
{
	this.id = regionId;
	this.name = regionName;
	this.province = provinceId;
}

function Suburb2(suburbId, suburbName, regionId)
{
	this.id = suburbId;
	this.name = suburbName;
	this.region = regionId;
}