function setNprops(ind, id, childs_num, n, options, display, title, parent, level, obj_type){
if(obj_type=='as_array') var obj = new Array(childs_num); else var obj = new Object;
obj.id = id;
obj.childs_num = childs_num;
obj.n = n;
obj.options = options;
obj.display = display;
obj.title = title;
obj.parent = parent;
obj.ind = ind;
obj.level = level;
eval('tNode'+ind+' = obj');
}
function exploreNode(nod, v, type, tid, tblname, url_prefix, sect_code, data_modulesID, js_handler){
if(isDefined(nod)){
var tree_id = tid+'_'+v+'_';
var div = xGetElementById('t_'+tree_id+nod.id);
if((nod.length>0) || !(nod.options.match(/dynamic/))) {
switchBlockDisplay('t_'+tree_id+nod.id);
setLayerItem('p_'+tree_id+nod.id, icon('node-'+((div.style.display=='block')?'expand':'collapse')));
}
else {
fillContainerBy(htmlrootpath+'/system/container_actions.php3?parent='+nod.id+'&ind='+nod.ind+'&var='+v+'&type='+type+'&tblname='+tblname+'&data_modulesID='+data_modulesID+'&url_prefix='+url_prefix+'§_code='+sect_code+'&tree_id='+tid+'&options='+nod.options+'&js_handler='+js_handler+'&referer='+encoded_uri, 't_cont_'+v);
}
} else {
showAlert('Ýëåìåíò íå îïðåäåëåí. Îøèáêà.');
}
}
function drawNode(ind, v, type, tid, tblname, url_prefix, sect_code, data_modulesID, js_handler){
// node obj: childs_num, n, options, display, title, parent, level
eval('var nod = tNode'+ind+';');
var tree_id = tid+'_'+v+'_';
var div = xGetElementById('t_'+tree_id+nod.id);
var documentBody = document.getElementsByTagName('BODY')[0];
setLayerItem('p_'+tree_id+nod.id, icon('node-expand'));
var subnode, subn_controls, a, subn_title, input;
for(i in nod)
if(i.match(/\d+/) && isDefined(nod[i])) {
subnode = new_DIV();
subnode.className = 'tNr';
div.appendChild(subnode);
subn_body = new_DIV();
subn_body.className = 'tNt';
subn_body.id = 't_'+tree_id+nod[i].id;
div.appendChild(subn_body);
subn_switcher = new_DIV();
subn_switcher.id = 'p_'+tree_id+nod[i].id;
subn_switcher.className = 'tNsw';
subn_switcher.innerHTML = icon('node-'+((parseInt(nod[i].childs_num)>0)?'collapse':'leaf'));
if(parseInt(nod[i].childs_num)>0)
subn_switcher_onclick = 'exploreNode(tNode'+ind+'['+nod[i].id+'], \''+v+'\', \''+type+'\', \''+tid+'\', \''+tblname+'\', \''+url_prefix+'\', \''+sect_code+'\', \''+data_modulesID+'\', \''+js_handler+'\');';
else
subn_switcher_onclick = '';
subnode.appendChild(subn_switcher);
if(isDefined(type) && type!='' && (nod[i].childs_num==0 || !nod[i].options.match(/chooseonlylastchilds/))){
subn_inputs = new_DIV();
subn_inputs.id = 'inp_'+tree_id+nod[i].id+'_div';
subn_inputs.className = 'tNctrls';
subnode.appendChild(subn_inputs);
// (preg_match(/','..',/', ','..',')?' checked':'')
switch(type){
case('checkbox'):{
input = new_CHECKBOX(subn_inputs);
input.onclick = new Function ('collect_IDs(this.form.'+v+', '+nod[i].id+', this.checked);if(event)stopBubble(event);'+js_handler);
input.className = 'commonCheck';
input.id = 'inp_'+tree_id+nod[i].id;
subn_switcher_onclick = 'var inpsw=xGetElementById("'+input.id+'");inpsw.onclick();inpsw.checked=true;' + subn_switcher_onclick;
break;
}
case('radio'):{
input = new_RADIO(subn_inputs, 'inp_'+tree_id+'rgr');
input.onclick = new Function ('this.form.'+v+'.value='+nod[i].id+';if(event)stopBubble(event);'+js_handler);
input.className = 'commonCheck';
input.id = 'inp_'+tree_id+nod[i].id;
input.name = 'inp_'+tree_id+'rgr';
subn_switcher_onclick = 'var inpsw=xGetElementById("'+input.id+'");inpsw.onclick();inpsw.checked=true;' + subn_switcher_onclick;
break;
}
}
}
if(subn_switcher_onclick!='')
subn_switcher.onclick = new Function(subn_switcher_onclick);
subn_title = new_DIV();
subn_title.id = 'tit_'+tree_id+nod[i].id;
subn_title.className = 'tree_node';
if(url_prefix && url_prefix!='')
subn_title.innerHTML = ''+nod[i].title+'';
else
if(input && input.id=='inp_'+tree_id+nod[i].id)
subn_title.innerHTML = '';
else
subn_title.innerHTML = nod[i].title;
subnode.appendChild(subn_title);
xDisplay(div, 'block');
}
hideAlert();
}