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

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

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