// functions used for advanced search

function getSuburbs(postcode)
	{
		//document.getElementById(lstSuburb).length=0;
		document.frmSearch.lstSuburb.options.length = 0;		
		if(postcode.length>0)
		{
			ajax.requestFile = '/getPropSuburbs.php?postCode='+postcode;
			ajax.onCompletion = createSuburbs;
			ajax.runAJAX();
		}
	}
	function getSuburbsByState(postcode)
	{
		//document.getElementById(lstSuburb).length=0;
		document.frmSearch.lstSuburb.options.length = 0;		
		if(postcode.length>0)
		{
			ajax.requestFile = '/getSuburbsByState.php?stateID='+postcode;
			ajax.onCompletion = createSuburbs;
			ajax.runAJAX();
		}
	}
	function createSuburbs()
	{
		var obj = document.frmSearch.lstSuburb;
		eval(ajax.response);
	}		
	function submitForm()
	{
		if(document.frmSearch.lstSuburb.options.length > 0)
		{
			opt = document.frmSearch.lstSuburb.options;
			flg = false;
			var test=0;
			for (var intLoop = 0; intLoop < opt.length; intLoop++)
			{
				if ((opt[intLoop].selected) || (opt[intLoop].checked))
				{

					flg = true;
					var selected = new Array();
					var index = 0;
					var strSel = "";
					for (var intLoop = 0; intLoop < opt.length; intLoop++)
					{
						if ((opt[intLoop].selected) || (opt[intLoop].checked))
						{	
							index = selected.length;
							selected[index] = new Object;
							selected[index].value = opt[intLoop].value;														
							strSel += selected[index].value + ",";														
							selected[index].index = intLoop;
							test=test+1;
						}
					}
					document.frmSearch.hidSuburb.value = strSel;
					
				}
			}			
		}
		document.frmSearch.frmSubmitted.value="yes";
		return true;
	}
