// JavaScript Document

$(document).ready( function() {
	
	$("#searching").hide();
	
	$(".dropdown").change( function() { 
									
		// nasty fix for double event trigger - ensure the item has valid ID..
		var id = $(this).attr("id");
		if (id != 'undefined') {	
		
			var data = $("#frmFindCourses").serialize();
			
			$.ajax({
			   url: "/learner_groups.asp",
			   type: "POST",
			   data: data,
			   dataType: "html",
			   async: true,
			   cache: true,
			   success: function(html) { displayResults(html); },
			   error: function() { alert("AJAX error!"); }
			});
		}
	});
	
	$("#searching").ajaxStart( function() { $(this).show(); }).ajaxStop( function() { $(this).hide(); });
	
});


function displayResults(html) {
	$("#courseResults").html(html);
}


/*

*/