/*
	Feel free to use your custom icons for the tree. Make sure they are all of the same size.
	User icons collections are welcome, we'll publish them giving all regards.
*/

var TREE_TPL = {
	'target'  : '_self',	// name of the frame links will be opened in
							// other possible values are: _blank, _parent, _search, _self and _top
	'icon_e'  : 'tree/icons/empty.gif', // empty image
	'icon_l'  : 'tree/icons/line.gif',  // vertical line
	
        'icon_32' : 'tree/icons/base.gif',   // root leaf icon normal
        'icon_36' : 'tree/icons/base.gif',   // root leaf icon selected
	
	'icon_48' : 'tree/icons/.gif',   // root icon normal
	'icon_52' : 'tree/icons/tom.gif',   // root icon selected
	'icon_56' : 'tree/icons/tom.gif',   // root icon opened
	'icon_60' : 'tree/icons/tom.gif',   // root icon selected
	
	'icon_16' : 'tree/icons/tom.gif', // node icon normal
	'icon_20' : 'tree/icons/tom.gif', // node icon selected
	'icon_24' : 'tree/icons/tom.gif', // node icon opened
	'icon_28' : 'tree/icons/tom.gif', // node icon selected opened

	'icon_0'  : 'tree/icons/tom.gif', // leaf icon normal
	'icon_4'  : 'tree/icons/tom.gif', // leaf icon selected
	
	'icon_2'  : 'tree/icons/joinbottom.gif', // junction for leaf
	'icon_3'  : 'tree/icons/join.gif',       // junction for last leaf
	'icon_18' : 'tree/icons/plusbottom.gif', // junction for closed node
	'icon_19' : 'tree/icons/plus.gif',       // junctioin for last closed node
	'icon_26' : 'tree/icons/minusbottom.gif',// junction for opened node
	'icon_27' : 'tree/icons/minus.gif',       // junctioin for last opended node
	
	'style_48' : 'rubrik2',  //style for caption of a root
	'style_52' : 'rubrik2',  //Style for caption of selected root
	'style_56' : 'rubrik2',  //Style for caption of opened root
	'style_60' : 'rubrik2',  //Style for caption of selected opened root
	'style_20' : 'bold',  //style for selected node
	'style_24' : 'navopen',  //style for opened node
	'style_28' : 'bold',  //style for selected opened node
	'style_4' : 'bold', //style for selected leaf
	
	// event handlers - item
	'onItemSelect':'onItemSelectHandler',// on item open event handler
	'onItemOpen':'onItemOpenHandler'// on item open event handler
	
};

function onItemSelectHandler (o_item) {
if (o_item.a_children)
o_item.o_root.toggle(o_item.n_id)

return true;
}

function onItemOpenHandler (o_item) {

	// get current block
	var a_curblock = o_item.o_parent.a_children;

	// close all nodes except current
	for (var i = 0; i < a_curblock.length; i++)
		if (a_curblock[i].n_state & 48 && a_curblock[i] != o_item)
			a_curblock[i].open(true);

	// proceed to default handler
	return true;
}


