function whenLoading(){
	var e = document.getElementById('loading'); 
	e.innerHTML = "<img src=\"/files/images/ajax-loader.gif\" /> Загрузка...";
}
function whenLoaded(){
	var e = document.getElementById('loading'); 
	e.innerHTML = " ";
}
var ajax = new Array();
function gethouses(sel)
{
	var street_id = sel.options[sel.selectedIndex].value;
	var el_id = 'houses';
	document.getElementById(el_id).options.length = 0;	// Empty houses select box
	if( street_id >= 0){
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = 'houses.php?street_id='+street_id;	// Specifying which file to get
		ajax[index].onLoading = whenLoading;
		ajax[index].onLoaded = whenLoaded; 
		ajax[index].onCompletion = function(){ createSubCategories(el_id,index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}
function createSubCategories(el_id,index)
{
	var obj = document.getElementById(el_id);
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}


