// JavaScript Document

function lookup2(inputString2) {
		//get_radio_value()
		if(inputString2.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			//alert("InputString is.. "+inputstring)
			$.post("scripts/php/rpc2.php", {queryString: ""+inputString2+""}, function(data){
				//$.post("scripts/rpc.php?querystring="+querystring, function(data){
				if(data.length >0) {
					$('#suggestions2').show();
					$('#autoSuggestionsList2').html(data);
				}
			});
		}
	}
	
	
	function fill2(thisValue) {
		$('#inputString2').val(thisValue);
		setTimeout("$('#suggestions2').hide();", 200);
	}
	
	
	function opencrechelink(crechename){

var selectedcreche = crechename.inputbox2.value;
var crechelink;

//returncrechesearchname(selectedcreche); 
// make ajax call here to return the link...


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 broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			//document.myForm.time.value = ajaxRequest.responseText;
			//document.getElementById('nonmembers').innerHTML=ajaxRequest.responseText;
			crechelink = ajaxRequest.responseText;
			
			window.location.href=(crechelink);		
		}
	}
	
	//var querystring = "?searchtype=" + searchtype;  
	
	//ajaxRequest.open("GET","searchrecords.php" + queryString, true);
	ajaxRequest.open("GET","scripts/php/getcrechelink.php?crechename="+selectedcreche, true);
	ajaxRequest.send(null); 
	
	


}
