//Browser Support Code
function ajaxRequest(act, vars){
        var ajaxRequest;  // The variable that makes Ajax possible!
        var path = '/kantoormrvanzijl.nl_object_upload/extfrag/';

        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)
			{
				return processResponse(act, vars, ajaxRequest.responseText);
			}
		}
		
		// window.alert('starting calculation: ' + calculating);
        var len = vars.length;
        var pageString = "ajax.php?act=" + act;
        for(var i=0;i<len;i++)
        {
                var value = vars[i].toString();
                value = value.split(".").join(""); //replaceAll(value, ".", "");
                var nrv = i + 1;
                pageString += "&var" + nrv + "=" + value;
        }
        ajaxRequest.open("GET", path + pageString, true);
        ajaxRequest.send(null);
}

function processResponse(act, vars, text)
{
	switch(act)
	{
		case "get_suggestions":
			processSuggestions(text);
			break;
	}
}

function processSuggestions(text)
{
	if ( document.getElementById('suggestionsd') )
	{
		if ( text == '<ul></ul>' || text == '' )
		{
			document.getElementById('suggestionsd').style.display = 'none';
		}
		else
		{
			document.getElementById('suggestionsd').style.display = 'block';
			document.getElementById('suggestionsd').innerHTML = text;
		}
	}

}
