<!-- 


var Counties	= [];
var AllTowns	= [];

Array.prototype.Exists=function(v){
for (i=0; i<this.length; i++){
if (this[i]==v) return i;
}
return false;
} 

function loadIntoArray(value, key) {
	if(typeof(Counties[key]) == 'undefined') {
		Counties[key] = [];
	}
	Counties[key][Counties[key].length] = value;
	if(!AllTowns.Exists(value)) // Quick check to test of this value has been added to another county. Without this, would have duplicates.
	{
	    AllTowns[AllTowns.length] = value;
	}
}

function loadSelectedTowns(county) {
	for(i=document.forms['searchForm'].txt_Town.length; i>=0; i--) {
		document.forms['searchForm'].txt_Town[i] = null;
	}
	// add a funky little delay in here, so the user knows something has happened...
	window.setTimeout('delayedLoading(' + county + ')', 400);
}

function delayedLoading(county) {
	
	document.forms['searchForm'].txt_Town[0] = new Option('All', -2);

	// find which array to use (all or specific)
	if(county == -2) {
		var arrTowns = AllTowns;
	}
	else {
		var arrTowns = Counties[county];
	}
	// load into selections, providing that some data exists inside this array?
	if(arrTowns) {
		for(i=0; i<arrTowns.length; i++) {
			document.forms['searchForm'].txt_Town[i + 1] = new Option(arrTowns[i]);
		}
	}
	document.forms['searchForm'].txt_Town.selectedIndex = 0;
}

//-->