// overwrites the same method in module.autocomplete.js

AutoCompleteLayer.prototype.load = function() {

		var me = this;
		var msg = this.input.value;
		
		msg = encodeURI(msg);
		
		var loaderobject=null;
		var xmltype = "";
		try
		{
			xmltype = "Msxml2.XMLHTTP";
			loaderobject=new ActiveXObject("Msxml2.XMLHTTP")
		}
		catch(e)
		{	
			try
			{
				xmltype = "Microsoft.XMLHTTP";
				loaderobject=new ActiveXObject("Microsoft.XMLHTTP")
				
			}
			catch(sc)
			{	
				xmltype = "Msxml2.XMLHTTP and Microsoft.XMLHTTP failed";
				loaderobject=null
			}
		}
		
		if(!loaderobject&&typeof XMLHttpRequest!="undefined")
		{
			xmltype = "typeof XMLHttpRequest";
			loaderobject=new XMLHttpRequest()
		}
		result = "";
		returnstring = "";
		if(loaderobject)
		{
			
			try 
			{
				loaderobject.open("GET","/queryhelp-v2/queryhelp.aspx?format=piped&query="+msg,true);
				loaderobject.onreadystatechange=function()
				{
					if(loaderobject.readyState==4&&loaderobject.responseText)
					{
						if (loaderobject.responseText !="nothing")
						{
							var tempresult = loaderobject.responseText;
							if (tempresult!="")
							{
							//result =  tempresult.split("||");
								result = "<ul><li><a href=\"javascript:void(0);\">"+tempresult.replace(/\|\|/gi,"</a></li><li><a href=\"javascript:void(0);\">")+"</a></li></ul>";
								me.content = result;
								window.setTimeout(function(){
																me.display(); 
															}, 400);
							}
							else
							{
								me.content = "";
								window.setTimeout(function(){
																me.display();
															}, 400);
							}
							
						}
						else
						{
							me.content = "";
							window.setTimeout(function(){
															me.display(); 
														}, 400);
						}
					}
					else
					{
						me.content = "";
						window.setTimeout(function(){
														me.display(); 
													}, 400);
					}
				};

				loaderobject.send(null);
			}
			catch (E)
			{
				// do nothing
			}
		}
		else
		{
			me.content = "";
			window.setTimeout(function() { me.display(); }, 400);
		}
}


