		var strDelimiter = ",";
		var strEmpty = '';
		var lngNoneSelected = -1;
	
	function submitForm(){
		document.frmMain.submit();
	}

	// function to check all the fields if the form is submitted.
	function attemptSubmitForm(){
		
		var strErrorCheck = '';
		if (checkItem(document.forms.frmMain.State) == false) {
			strErrorCheck = strErrorCheck + ' State';
		}
		if (checkItem(document.frmMain.Location) == false) {
			strErrorCheck = strErrorCheck + ' Location';
		}
		if (checkItem(document.frmMain.Dimension) == false) {
			strErrorCheck = strErrorCheck + ' Dimension';
		}
		//If an error display a message, or else exit...
		if (strErrorCheck != strEmpty) {
			strErrorCheck = 'Please check the following fields: ' + strErrorCheck;
			alert(strErrorCheck);
		}
		else {
			submitForm();
		}
	}

	function checkItem(oItem){

		var blnResult = false;
		if (oItem.value == strEmpty){
			oItem.focus();
			blnResult = false;
		} else {
			blnResult = true;
		}
		return blnResult;
	}

	// function to remove all but the first items in an object.	
	function removeItems(objName){
		var y = 0;
			for (y = objName.length-1; y > 0; y--){
				//this is the one we want to remove...
				objName.remove(y);
			}
		return;
	}





	// function to remove all the items in an object.	
	function removeAllItems(objName){
		//alert('removeAllItems, ' + String(objName.options.length));
		var y = 0;
		for (y = objName.options.length-1; y >= 0; y--){
			//this is the one we want to remove...
			objName.options[y] = null;
		}
		return;
	}


/* -------------------------------------------------------------------------
	// function to remove all the items in an object.	
	function removeAllItems(objName){
		//alert('removeAllItems, ' + String(objName.options.length));
		var y = 0;
			for (y = objName.length-1; y >= 0; y--){
				//this is the one we want to remove...
				objName.remove(y);
			}
		return;
	}
-------------------------------------------------------------------------- */

	function selectItems(objName, intSelect){
		var i = 0;
		for(i=0;i<objName.length;i++) {
			if (objName.options[i].value == intSelect){
						objName.options[i].selected = true;
			}
		}
	}

	// function to build the Location list box again for a new
	// State number.
	function generateLocationList(arrStates, arrLocations, arrLocationNames, arrLocationSuburbIDs, arrSuburbIDs, arrSuburbNames, objItem, intState){
		removeAllItems(objItem);
		AddNewItems(arrStates, arrLocations, arrLocationNames, arrLocationSuburbIDs, arrSuburbIDs, arrSuburbNames, objItem, intState);
		objItem.selectedIndex = 0;
		return;
	}
	
	// function to add options to a select object.
	function AddNewItems(arrStates, arrLocations, arrLocationNames, arrLocationSuburbIDs, arrSuburbIDs, arrSuburbNames, objName, intSearch){
		var i = 0;
		var j = 0;
		var newOption;
		var OptionCount = 0;

		//alert("AddNewItems " + intSearch);

		for(i=0;i<arrStates.length;i++) {
			if (arrStates[i] == intSearch) {
				newOption = new Option(arrLocationNames[i], arrLocations[i]+",0", true, false);
				objName.options[OptionCount] = newOption;
				OptionCount++;
//				objName.add(newOption);
	
				for(j=0;j<arrLocationSuburbIDs.length;j++) {
					if (arrLocationSuburbIDs[j] == arrLocations[i]) {
						newOption = new Option(" - " + arrSuburbNames[j], arrLocations[i]+","+arrSuburbIDs[j], true, false);
						objName.options[OptionCount] = newOption;
						OptionCount++;
//						objName.add(newOption);
					}
				}
			}
		}
//		if (OptionCount == 0) {
		// Add the All selection to the end of the list.	
		newOption = new Option("All of State", "0,0", true, false);
		objName.options[OptionCount] = newOption;
//		objName.add(newOption);
//		}
		return;
	}

	//Used to close window. 
	function Close(strURL){
		window.close();
	}

