//window.onload = init;

function encode(thisOne) {

	returnThis = encodeURIComponent(thisOne);
	return	returnThis;
}



function doSomething(chosen,section){ ///////////// Starts /////////////////////

	var ajaxRequest;  // The variable that makes Ajax possible!
	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 has problems!");
					return false;
				}
			}
		}	
	
	


  	 /////// setup the Send  queryString
	 var chosen = encode(chosen);
	 var section = encode(section);
				var d = new Date();
				var curr_sec = d.getSeconds();
				var curr_min = d.getMinutes();
 				var time = curr_min*curr_sec ;//  Stops IE Cache PRoblem so srtig different
	
		var data = '?chosen=' + chosen + "&section=" + section+"&"+time   ;	
		var queryString = data;
		//alert(data);
	//ajaxRequest.open("GET", "ajax-example.php" + queryString, true);
		ajaxRequest.open('get', 'ajax.php' + queryString, true );
			ajaxRequest.send(null); 
	
	
			//  function that will receive data sent from the server
		ajaxRequest.onreadystatechange = function(){
			if(ajaxRequest.readyState == 4){ /////// Response
			  if (ajaxRequest.status == 200) {
				//document.myForm.time.value = ajaxRequest.responseText;
				//alert(ajaxRequest.responseText);//////
				document.getElementById('chosensuburbs').innerHTML = ajaxRequest.responseText;
				//document.getElementById('label_'+formID).className = 'done';
				}
			}
		}
	
	
}


