	// suggestion provider for the suggest control
	// This file makes an AJAX call to ax_suggest.asp.

	function ax_suggestions()
		{
		this.oControl = null
		this.bAhead = false
		}

	ax_suggestions.prototype.requestSuggestions = function (oAutoSuggestControl, bTypeAhead)
		{
		this.oControl = oAutoSuggestControl
		this.bAhead = bTypeAhead
		var sTextboxValue = this.oControl.textbox.value

		if (sTextboxValue.length > 1)
			{
			ax_makeRequest_object("http://www.scienceandsociety.co.uk/ax_suggest.asp?t=" + sTextboxValue.replace(/ /g, "%20"), this, this.callBack)
		//	alert("ax_suggest.asp?t=" + sTextboxValue.replace(/ /g, "%20"))
			}
		else
			this.oControl.autosuggest(new Array(), this.bAhead)
		}

	ax_suggestions.prototype.callBack = function()
		{
		if (http_request.readyState == 4 && http_request.status == 200)
			{
			var xmldoc = http_request.responseText

		//	xmldoc contains something like this:
		// new Array ('Dog','Dog & Duck','Dog And Duck','Dog And Duck Pub','Dog And Trumpet Pub','Dog Basket','Dog Bite','Dog food','Dog Lead','Dog Mountain','Dog owner','Dog Paddle','Dog Paddling','Dog Race Track','Dog Rose','Dog Sled','Dog Sled Race','Dog Sled Racing','Dog Sledding','Dog%27s Bay','Dog-rose','Doganella Di Ninfa','Doge%27s Palace','Doges Palace','Doges%27 Palace');

			try
				{
				eval ('var aSuggestions = ' + xmldoc)
				
				for (i=0;i<aSuggestions.length;++i)
					aSuggestions[i] = aSuggestions[i].replaceall("%27", "'")
					
				this.oControl.autosuggest(aSuggestions, this.bAhead)
				}
			catch(er) {}
			}
		}
		
	String.prototype.replaceall = function(c1, c2)
		{
		var i = 0
		var s = this.replace(c1, c2)
		while (s.indexOf(c1) > -1 && i < 10000)
			{
			s = s.replace(c1, c2)
			++i
			}
		return(s)
		}


