function ajax_request(url, params){
	var ajaxRequest;
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	
	
	ajaxRequest.open("POST", url, true);
		
	//Send the proper header information along with the request
	ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajaxRequest.setRequestHeader("Content-length", params.length);
	ajaxRequest.setRequestHeader("Connection", "close");
	
	ajaxRequest.send(params);
	
	return ajaxRequest;
}

function get_slots(){
	var game_id=document.getElementById("game").value;
	var ajaxRequest = new ajax_request("searcher.php", "get_slots=" + game_id, true);
	ajaxRequest.onreadystatechange = function(){
		if (ajaxRequest.readyState == 4 && ajaxRequest.status == 200) {
			//alert("txt back is " + ajaxRequest.responseText);
			var slot_list=document.getElementById("game_slots");
			slot_list.innerHTML="";
			if (ajaxRequest.responseText != "") {
				var j = eval('(' + ajaxRequest.responseText + ')');
				if (j.length > 0) {
					var max_slot=j[j.length-1];
					//alert("max slot is " + max_slot);
					for (var i=1; i<=max_slot; i++){
						var slot_option=document.createElement("option");
						slot_option.text=i;
						slot_option.value=i;
						slot_list.appendChild(slot_option);
					}
				}
			}
		}
	}
}
