var child = data[0];
while (child != null){
if (child.children != null && child.children.length > 0){
child = child.children[0];
} else {
$("#agencyTree").jqxTree('selectItem', $("#agencyTree").find('li[id=' + child.id + ']')[0]);
child = null;
}
}