function fillVacancy(id, root, regionID){
	continuefunction = document.frmsearch.f;
	if(continuefunction.value == 0 ){ 
		sendRequest(root + 'include/functions/func_fill_vacancy.asp?type=vakgebied&id='+id+'&r='+regionID,continuefunction);
	}
}

function fillregion(id,root,vacancyID){
	continuefunction = document.frmsearch.r;
	if(continuefunction.value == 0 ){ 
		sendRequest(root + 'include/functions/func_fill_vacancy.asp?type=regio&id='+id+'&v='+vacancyID ,continuefunction);
	}
}

function StringtoXML(text){
	
	if (window.ActiveXObject){
		var doc=new ActiveXObject('Microsoft.XMLDOM');
		doc.async='false';
        doc.loadXML(text);
    } else {
          var parser=new DOMParser();
          var doc=parser.parseFromString(text,'text/xml');
    }
        return doc;
}


function sendRequest(customLink, continuefunction) {

	var oXmlHttp = zXmlHttp.createRequest();
	
	oXmlHttp.open("get", customLink , true);
	oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	
	oXmlHttp.onreadystatechange = function () {
		if (oXmlHttp.readyState == 4) {
	    	if (oXmlHttp.status == 200) {
					
				saveResult2(oXmlHttp.responseText,continuefunction);	
					
            } else {
		          alert("An error occurred: " + oXmlHttp.statusText);
	        }
        }            
	};
	
	oXmlHttp.send(null);
}
	
	
function saveResult2(returntext, continuefunction){
	xml 	= StringtoXML(returntext);
	aModels = xml.getElementsByTagName("title");
	continuefunction.options.length = 0
	
	for (var k = 0; k < aModels.length; k++)
	{
		sTitle 	= aModels[k].childNodes[0].nodeValue;
		sID		= aModels[k].getAttribute("id");
		
		continuefunction.options[k] = new Option(sTitle, sID);
	}

	
}
