function getHTTPObject() {
	var http = false;
	if(typeof ActiveXObject != 'undefined') {
		try {http = new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {
			try {http = new ActiveXObject("Microsoft.XMLHTTP");}
			catch (E) {http = false;}
		}
	} else if (XMLHttpRequest) {
		try {http = new XMLHttpRequest();}
		catch (e) {http = false;}
	}
	return http;
}

var http = getHTTPObject();
var element_id;

function handler() {
	if(http.readyState == 4 && http.status == 200) {
		document.getElementById(element_id).innerHTML = http.responseText;
		if (element_id == "location_container")
			GetHtmlData('goldajax.php', 'course='+document.getElementById('course').value+'&location='+document.getElementById('location').value, 'workshop_container');
		else if (element_id.indexOf("location_container_") == 0)
		{
			suffix = element_id.substring(19);
			GetHtmlData('goldajax.php', 'course_'+suffix+'='+document.getElementById('course_'+suffix).value+'&location_'+suffix+'='+document.getElementById('location_'+suffix).value+'&suffix='+suffix, 'workshop_container_'+suffix);
		}
	}
}

function GetHtmlData(url, params, id) {
	params += "&ajax=" + new Date().getTime();
	http.open("POST", url, true);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	element_id = id;
	http.onreadystatechange = handler;
	http.send(params);
}
