var ajax = new Array();

function getObjectTypesList(sel) {
	var branchCode = sel.options[sel.selectedIndex].value;
	document.getElementById('object_type').options.length = 0;	// Empty city select box
	if (branchCode.length > 0) {
		var index = ajax.length;
		ajax[index] = new sack();
		ajax[index].requestFile = '/ajax/getObjectTypes.php?branchCode='+branchCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createObjectTypes(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function createObjectTypes(index) {
	var obj = document.getElementById('object_type');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code
}

// $(document).ready(function(){ getObjectTypesList(document.getElementById('branch_id')); });
