<!--
//var xmlHttp;

function GetXmlHttpObject()
{
	var xmlHttp=null;
	
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	return xmlHttp;
}

function ajaxCall(url, func, options)
{
	//trace(url);
	var xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Your browser does not support AJAX!");
		return;
	} 

	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState == 4)
		{
			//return xmlHttp.responseText;
			var execute = new func(xmlHttp.responseText, options);
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function replaceAll(sTxt, sSearch, sReplace) {
	str = sTxt
	for (_i = 0; _i < sTxt.length; _i++) {
		_currChar = sTxt.substring(_i,_i+sSearch.length);
		if (_currChar == sSearch) { str = str.replace(sSearch, sReplace); }
	}
	return str;
}

/*
function showDownload(id, obj) {
	val = obj.value;
	mybutton = document.getElementById('btn'+id)
	if (mybutton) {
		//mybutton.onclick = new Function("alert(val);");
		mybutton.onclick = new Function("window.open('../images/downloads/'+val);");
		mybutton.style.visibility = 'visible';
	}
}

function hideDownload(options) {
	mybutton = document.getElementById(options.obj);
	if (mybutton) { mybutton.style.visibility = 'hidden'; }
}
*/

function UpdateCombo(content, options)
{
	//options = options || {};  //optional
	cboName = options.cboName;
	frm = options.frm || 'formulier';
	currVal = options.currVal || '';
	
	if (content != '') {
		aOptions = content.split('||');
		aIds = aOptions[0].split('|');
		if (aOptions.length > 1) {
			aTxts = aOptions[1].split('|');
		} else {
			aTxts = aOptions[0].split('|');
		}
		
		frm = frm || 'formulier';
		cbo = document.forms[frm][cboName];
		
		if (cbo) {
			cbo.selectedIndex = 0;
			cbo.options.length = 0;
			for(i=0;i<aIds.length;i+=1)
			{
				sTxt = replaceAll(unescape(aTxts[i]), '+',' ');
				cbo.options[i] = new Option(sTxt,aIds[i]);
				if (aIds[i] == currVal) { cbo.selectedIndex = i; }
			}
		}
	}
	
	if (options.func) {
		extra_func = options.func;
		funcname = extra_func.func;
		funcoptions = extra_func.options;
		var execute = new funcname(funcoptions);
	}
}


function trace(txt) {
	obj = document.getElementById('debug');
	if (obj) {
		obj.style.display = 'block';
		obj.innerHTML += txt + "<br />";
	} else {
		alert(txt);
	}
}

/* ------- WEG -------
//	function ajaxCall_PLAIN(url, dest, func, frm)
//	{
//		xmlHttp=GetXmlHttpObject();
//		if (xmlHttp==null) {
//			alert ("Your browser does not support AJAX!");
//			return;
//		} 

//		xmlHttp.onreadystatechange = function()
//		{
//			if (xmlHttp.readyState == 4)
//			{
//				//return xmlHttp.responseText;
//				var execute = new func(xmlHttp.responseText, dest, frm);
//			}
//		}
//		xmlHttp.open("GET",url,true);
//		xmlHttp.send(null);
//	}

//	function UpdateCombo_PLAIN(content, cboName, frm)
//	{
//		if (content != '') {
//			aOptions = content.split('||');
//			aIds = aOptions[0].split('|');
//			if (aOptions.length > 1) {
//				aTxts = aOptions[1].split('|');
//			} else {
//				aTxts = aOptions[0].split('|');
//			}
//			
//			frm = frm || 'formulier';
//			cbo = document.forms[frm][cboName];
//			
//			if (cbo) {
//				cbo.options.length = 0;
//				for(i=0;i<aIds.length;i+=1)
//				{
//					sTxt = replaceAll(unescape(aTxts[i]), '+',' ');
//					cbo.options[i] = new Option(sTxt,aIds[i]);
//				}
//			}
//		}
//	}
*/


//-->

