var antjax1 = new sack();

function whenLoading(){
	var e = document.getElementById('cities'); 
	e.innerHTML = '<p style="padding:1em;text-align:center;font-weight:bold">Loading Data...</p>';
}

function getCities(){
	var form = document.getElementById('searchForm');
	antjax1.setVar("cmd", "ajax");
	antjax1.setVar("type", "county"); 
	antjax1.setVar("code", form.counties.value); 
	antjax1.requestFile = "/idx/app/search.php";
	antjax1.method = "POST";
	antjax1.element = 'cities';
	antjax1.onLoading = whenLoading;
//	antjax1.onLoaded = whenLoaded; 
//	antjax1.onInteractive = whenInteractive;
//	antjax1.onCompletion = whenCompleted;
	antjax1.runAJAX();
}

var antjax2 = new sack();
function getPTypes(){
	var form = document.getElementById('searchForm');
	antjax2.setVar("cmd", "ajax");
	antjax2.setVar("type", "subtype"); 
	antjax2.setVar("code", form.type.value); 
	antjax2.requestFile = "/idx/app/search.php";
	antjax2.method = "POST";
	antjax2.element = 'subtypes';
//	antjax2.onLoading = whenLoading;
//	antjax2.onLoaded = whenLoaded; 
//	antjax2.onInteractive = whenInteractive;
//	antjax2.onCompletion = whenCompleted;
	antjax2.runAJAX();
}

//
//var ajaxTypes = new sack();
//var ajaxCounty = new sack();
//
//function getXList(daobj, sel, typename, fldx)
//{
//	var xCode = sel.options[sel.selectedIndex].value;
//	document.getElementById(fldx).options.length = 0;	// Empty select box
//	if(xCode.length>0){
//		daobj.requestFile = '/idx/app/search.php?cmd=ajax&type='+typename+'&code='+xCode;
//		if (typename == 'county') {
//			daobj.onCompletion = createXList;
//		}
//		else if (typename == 'subtype') {
//			daobj.onCompletion = createYList;
//		}
//		daobj.runAJAX();
//	}
//}
//
//			
//function createXList()
//{
//	var obj = document.getElementById('cities');
//	eval(ajaxCounty.response);	// Executing the response from Ajax as Javascript code	
//}
//
//function createYList()
//{
//	var obj = document.getElementById('subtypes');
//	eval(ajaxTypes.response);	// Executing the response from Ajax as Javascript code	
//}
//

