function clickLiveSearchResult(iId, sIdElement, sValue, sValueElement)
{
	document.getElementById(sIdElement).value = iId;
	document.getElementById(sValueElement).value = sValue;
}

function changeAmount(sKey)
{
	iValue = document.getElementById('amount'+sKey).value;
	ajax('product', 'section=changeamount&prdid='+sKey+'&prdcount='+iValue , 'bestelling');
}

function callback(sTargetElement, sResponse)
{
	document.getElementById(sTargetElement).innerHTML = sResponse;
}

function ajaxD(sFile, sArguments)
{
	/* ****************************************************************** *\
	 *																																		*
	 *		INPUT																														*
	 *			sFile = The name of the file to call, without the .asp part;	*
	 *			sArguments = The querystring to use;													*	
	 *		OUTPUT																													*
	 *			No																														*
	 *																																		*
	\* ****************************************************************** */
	httpRequest = iniAjax();
	httpRequest.open('GET', sFile + '.asp?ajax=true&' + sArguments, true);
	httpRequest.send(null);
}

function sendAjaxRequest(url, postdata, eventhandler) {
  if (window.ActiveXObject) {
	var xhr = new ActiveXObject("Microsoft.XMLHTTP");
  } else if (window.XMLHttpRequest) {
	var xhr = new XMLHttpRequest();
  }
  xhr.onreadystatechange = function() {
	 if(xhr.readyState == 4)
		if(xhr.status == 200)
		   eventhandler(xhr)
		else {
		   alert('mislukt: ' + xhr.status + ' ' + xhr.statusText )
		   document.body.innerHTML = xhr.responseText
		}
  }
  xhr.open("POST", url, true )
  xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
  xhr.send(postdata)
}


/* **************************************************** *\
 *																											*
 *		~VANAF HIER GEEN STIEKEME AANPASSINGEN MAKEN~			*
 *																											*
\* **************************************************** */

function ajax(sFile, sArguments, sElId)
{
	/* ****************************************************************** *\
	 *																																		*
	 *		INPUT																														*
	 *			sFile = The name of the file to call, without the .asp part;	*
	 *			sArguments = The querystring to use;													*
	 *			sElId = The ID of the element to post the result to.					*
	 *		OUTPUT																													*
	 *			Changes the innerHTML for the given element (sElId) to the		*
	 *			response generated by the asp file.														*
	 *																																		*
	\* ****************************************************************** */
	httpRequest = iniAjax();
	httpRequest.onreadystatechange = function()
	{
		if (httpRequest.readyState == 4)
		{
			document.getElementById(sElId).innerHTML = httpRequest.responseText;
		}
	}
	httpRequest.open('GET', sFile + '.asp?ajax=true&' + sArguments, true);
	try
	{
		httpRequest.overrideMimeType('text/xml; charset=iso-8859-1'); 
	}
	catch(e){}
	httpRequest.send(null);
}

function global_ajax(sCallback, sArguments, sTargetElement)
{
	httpRequest = iniAjax();
	httpRequest.onreadystatechange = function()
	{
		if (httpRequest.readyState == 4)
		{
			sCallback(sTargetElement, httpRequest.responseText);
		}
	}
	httpRequest.open('GET', 'ajax.asp?' + sArguments, true);
	httpRequest.send(null);
}

function elValue(sId)
{
	/* ********************************************************** *\
	 *		INPUT																										*
	 *			sId = The ID of the element to get the value from			*
	 *		OUTPUT																									*
	 *			The value for the given element												*
	\* ********************************************************** */
	return document.getElementById(sId).value;
}

function iniAjax()
{
	var xmlHttp;
	try
  {
  	// Firefox, Opera 8.0+, Safari
  	xmlHttp=new XMLHttpRequest();
  }
	catch (e)
  {
  	// Internet Explorer
  	try
    {
    	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  	catch (e)
    {
    	try
      {
      	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    	catch (e)
      {
      	alert("Your browser does not support AJAX!");
      	return false;
      }
    }
  }
  return xmlHttp;
}