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