function update_combo(caller, rootdir, controlname, targetname){
	getComboContents(controlname, rootdir, caller.options[caller.selectedIndex].value, targetname);
}

function setTargetValues(result,targetname){
	options=eval(result); //az uj opciok
	target=document.getElementsByName(targetname)[0]; //ebbe a komboba pakoljuk bele
	target.options.length=0;
	for (i=0; i<options.length; i++){
		target.options[i]=new Option(options[i][1], options[i][0]);
	}
}
	
function getComboContents(controlname, rootdir, value, targetname) {
  try {
    // Moz supports XMLHttpRequest. IE uses ActiveX. 
    // browser detction is bad. object detection works for any browser
    xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
    xmlhttp.open('POST', rootdir + '_framework/provider/dynamiccombo/?controlname=' + controlname + '&value=' + value, true);
		xmlhttp.onreadystatechange=function(){
			if (xmlhttp.readyState == 4){
				setTargetValues(unescape(xmlhttp.responseText), targetname);
			}
		}
		xmlhttp.send(null);
  } catch (e) {
	alert(e.name+' '+e.message);
		// alert('no ajax available');
   // browser doesn't support ajax. handle however you want
  }
}
