function WBI() { };

WBI.getChildren = function(objTarget, tmplId, strRecordType, params, selectedid, parentobjectval) {
	for (x=objTarget.length; x >= 0; x--) {
		objTarget[x] = null;
	}
	objTarget[0] = new Option("-- Select " + strRecordType + " --","");
	if (tmplId == '' || tmplId == null) return;
	var url;
	if (params != null) {
             if (parentobjectval != null && (parseInt(parentobjectval) > 0))
                 url = '/ui.ashx?f=frag_list&d=' + parseInt(parentobjectval) + '&tag=json';
             else
                 url = '/ui.ashx?f=frag_list&a=' + parseInt(tmplId) + '&tag=json';
	} else {

                url = '/ui.ashx?f=frag_list&d=' + parseInt(tmplId) + '&tag=json';
	}
	
	var _xh= GetXMLHTTP();
	
	if (_xh) {
		AJAX_loadStart();
		_xh.onreadystatechange = function() {
			if (_xh.readyState == 4) {
				if (_xh.status == 200) {		
					if (_xh.responseText != '' && _xh.responseText != null) {
						try {
							eval("var options=" + _xh.responseText);

							for (i=0; i < options.length; i++) {

                                                                if (selectedid > 0 && options[i].value==selectedid) 
                                                                  objTarget[i + 1] = new Option(options[i].text.replace('&amp;','&'),options[i].value,true,true);
                                                                else
    								  objTarget[i + 1] = new Option(options[i].text.replace('&amp;','&'),options[i].value);
                                                                							}
						} catch(e) {
							objTarget[0] = new Option("-- Select " + strRecordType + " --","");
						}
					}
					AJAX_loadEnd();
				}
			}
		}
		
		_xh.open('GET',url,true);
		_xh.send(null);
	}
}

