// Product title: Gurt JavaScript Tree Menu
// Product version details: 1.1.1, 02-17-2006 (mm-dd-yyyy) [compressed version]
// Product URL: http://gurtom.com/products/trees/js
// Contact info: gurt-feedback@gurtom.com (specify product title in the subject)
// Notes: This script is free. Feel free to copy, use and change this script as 
// long as this head part remains unchanged.  Visit official site for details.
// Copyright: (c) 2005 by Gurtom.Com

var curSel;
var gTrees=[];function gTree(_t1Y,_t1M)
{
  var i,_t12=_t1M.items;this._t14=_t1M.tpl;for(i in this._t14)if(i.charAt(0)=='i'&&this._t14[i]){this._t14['o'+i]=new Image();this._t14['o'+i].src=this._t14[i];}this.level=0;this.id=_t1Y;this.tree=gTrees[_t1Y]=this;this.all=[];for(i=0;i<_t12.length;i++)_t1A(this,_t12[i]);document.write(_t1B(this).join(''));
this.toggle=function(_t1K)
{
var _t1Q=this.all[_t1K];
gToggleItem(_t1Q,_t1Q.bOpened)
};
this.rollover=function(_t1K,_t15)
{
  _t1J(this.all[_t1K],_t15)
};
this.select=function(_t1K)
{
  var _t1Q=this.all[_t1K];
  gOpenItem(_t1Q,_t1Q.bOpened);
}
}
function _t1A(_,_t10,_t1L){var _t1W,_t1Q,i;if(!_.aDesc)_.aDesc=[];if(_t1L==undefined||_t1L>_.aDesc.length)_t1L=_.aDesc.length;_t1Q=new _t1E(_,_t10[0],_t10[1],_t10[2]);if(_t10[3])for(i=3;i<_t10.length;i++)_t1A(_t1Q,_t10[i],i-2);i=_t1L;while(_t1Q){_t1W=_.aDesc[i];_.aDesc[i]=_t1Q;_t1Q=_t1W;i++;}return _.aDesc[_t1L];}function gAddItem(_,_t10,_t1L){var _t1Q=_t1A(_,_t10,_t1L);_t1I(_);return _t1Q;}function _t1G(_,_t1Q){var n=0,i=0,_t1U=[];if(_.tree.oSel==_t1Q)_.tree.oSel=0;for(i in _.aDesc)if(_.aDesc[i]!=_t1Q)_t1U[n++]=_.aDesc[i];_.tree.all[_t1Q.id]==0;if(!_t1U.length)_.aDesc=0;else _.aDesc=_t1U;_t1I(_);}function gRemoveItem(_){if(_.aDesc)while(_.aDesc[0])gRemoveItem(_.aDesc[0]);_t1G(_.oAnc,_);}
function gOpenItem(_,_t17)
{
_.bOpened=1;
var _t1O=gGetDiv('i_div'+_.tree.id+'_'+_.id);
if(curSel != null) {
curSel.style.fontWeight='normal';
}
gGetDiv('i_txt'+_.tree.id+'_'+_.id).style.fontWeight='bold';
curSel = gGetDiv('i_txt'+_.tree.id+'_'+_.id);
if(_t1O)
{
  if(!_t1O.innerHTML)
  {
    _t1O.innerHTML=_t1B(_).join('');
  }
  _t1O.style.display=('block');
  var _t1R=document.images['j_img'+_.tree.id+'_'+_.id],_t1P=document.images['i_img'+_.tree.id+'_'+_.id];
  if(_t1R)_t1R.src=_t1D(_,true);
  if(_t1P)_t1P.src=_t1D(_);
}
return false;
}
function gToggleItem(_,_t17)
{
_.bOpened=!_t17;
var _t1O=gGetDiv('i_div'+_.tree.id+'_'+_.id);
if(_t1O)
{
  if(!_t1O.innerHTML)
  {
    _t1O.innerHTML=_t1B(_).join('');
  }
  _t1O.style.display=(_t17?'none':'block');
  var _t1R=document.images['j_img'+_.tree.id+'_'+_.id],_t1P=document.images['i_img'+_.tree.id+'_'+_.id];
  if(_t1R)_t1R.src=_t1D(_,true);
  if(_t1P)_t1P.src=_t1D(_);
}
return false;
}
function gSelectItem(_,_t18)
{
  if(!_t18){
    var _t1V=_.tree.oSel;
    _.tree.oSel=_;if(_t1V)gSelectItem(_t1V,1);
  }
  if(_.bShow){
    document.images['i_img'+_.tree.id+'_'+_.id].src=_t1D(_,false);
    gGetDiv('i_txt'+_.tree.id+'_'+_.id).style.fontWeight=_t18?'normal':'bold';
    _t1J(_,_t18);
  }
  return Boolean(_.sLnk);
}
function gHideItem(_,bShow){_.bShow=bShow;if(_.level)_t1I(_.oAnc);else{var _t1O=gGetDiv('s_div'+_.tree.id+'_'+_.id);if(!_t1O)return false;_t1O.style.display=(bShow?'block':'none');}}function _t1J(_,_t16){window.setTimeout('window.status=unescape("'+(_t16?'':escape(_.sSrc+(_.sLnk?' ('+_.sLnk+')':'')))+'")',10);}function _t1E(oAnc,sSrc,sLnk,sId){this.oAnc=oAnc;this.tree=oAnc.tree;this.id=sId;this.tree.all[this.id]=this;this.sSrc=sSrc;this.sLnk=sLnk?sLnk:this.tree._t14.def_link;this.level=oAnc.level+1;this.bShow=1;this.bOpened=0;}function _t1I(_){if(!_.bShow)return;var _t1O=gGetDiv('s_div'+_.tree.id+'_'+_.id);if(!_t1O)return;_t1O.innerHTML=_t1C(_);}function _t1H(_){return['<div id="s_div',_.tree.id,'_',_.id,'" style="display:',(_.bShow?'block':'none'),'">',_t1C(_),'</div>'].join('');}function _t1C(_){var _t13=[],_t1N=_.oAnc;
for(var i=_.level;i>1;i--)
{
  _t13[i]='<img src="'+_.tree._t14[_t1F(_t1N)?'ie':'il']+'" border="0" align="absbottom">';
  _t1N=_t1N.oAnc;
}
var _t1a=['gTrees[\'',_.tree.id,'\'].toggle(\'',_.id,'\')'].join(''),_t1Z=[' onmouseover="javascript: gTrees[\'',_.tree.id,'\'].rollover(\'',_.id,'\')" onmouseout="javascript: gTrees[\'',_.tree.id,'\'].rollover(\'',_.id,'\',1)"'].join(''),_t1_=['onclick="return gTrees[\'',_.tree.id,'\'].select(\'',_.id,'\')"'].join('');_t1X=_.aDesc?'<div id="i_div'+_.tree.id+'_'+_.id+'"  style="display:'+(_.bOpened?'block':'none')+'" >'+(_.bOpened||_.tree._t14.build_whole?_t1B(_).join(''):'')+'</div>':'';

return['<table class=treeview cellpadding=0 cellspacing=0 border=0><tr><td wrap>',
       (_.level?_t13.join('')+(_.aDesc?['</td><td><a href="javascript:',_t1a,'"',_t1Z,'><img src="',_t1D(_,true),'" border="0" align="absbottom" name="j_img',_.tree.id,'_',_.id,'"></a></td><td>'].join(''):['<img src="',_t1D(_,true),'" border="0" align="absbottom">'].join('')):''),
       '</td><td><a href="',_.sLnk,'" target="',_.tree._t14['target'],'" ',
       _t1_,(_.aDesc?' ondblclick="'+_t1a+'"':''),
       _t1Z,' class="treeview" id="i_txt',
       _.tree.id,'_',_.id,'"><img src="',_t1D(_),'" border="0" align="absbottom" name="i_img',_.tree.id,'_',_.id,'" class="treeSelected">',_.sSrc,'</a></td></tr></table>',_t1X].join('');}


function _t1B(_)
{
  var _t11=[];
  for(var i=0;i<_.aDesc.length;i++)
  {
    if(_.aDesc[i].bShow)
      _t11[i]=_t1H(_.aDesc[i]);
  }
  return _t11;
}
function _t1D(_,_t19)
{
  return _.tree._t14[['i',(_.level?'_':'r'),(_.aDesc?'n':'_'),(_.aDesc&&_.bOpened?'o':'_'),(_.tree.oSel==_&&!_t19?'s':'_'),(_t19?'j':'_')+(_t19&&_t1F(_)?'l':'_')].join('')];}function _t1F(_){var _t1T=_.oAnc.aDesc,_t1S;for(var i=0;i<_t1T.length;i++){if(_t1T[i].bShow)_t1S=_t1T[i];}return _t1S==_?1:0}gGetDiv=document.all?function(_t1Y){return document.all[_t1Y]}:(document.getElementById?function(_t1Y){return document.getElementById(_t1Y)}:null);


function TreeSelectItem( sItem ) {
// Author: Leandro Camilo - leandro@websimple.com.br
// Inc: Websimple - www.websimple.com.br - São Paulo/SP - Brasil
// Date: 23-May-2006
// Search for desired item in the tree, select and show it up, opening all leafs over the item.
// Param: sItem - is the name of the item desired to select and show.
// ** This code can be used as it is, since this credits remains with the code.
// ** Any comments, suggestions, and donations via PayPal (lecamilo@msn.com) fell free. :)
   var i
   var x
   var y                                     
   var j
   var prevlevel
   x =  gTrees['tree'].all;
   y = sItem.length;
   for (i=0;i<x.length;i++)
   {
      // search for desired item
if(x[i])
{
      if (x[i].sSrc.substr(0, y) == sItem)
      {
         // open all leafs over the desired item
         // folowing the item ID in reverse direction and looking for one item of each level, increasing the level until 0,
         // we can open all leafs over the desired item
         prevlevel = x[i].level;
         for (j = x[i].id; j > 0; j--) {
            // item is of previous level
if(x[j])
{
            if ( x[j].level < prevlevel )
	    {
               // open the item
               gOpenItem(x[j], 0);
               // goto previous level
               prevlevel--;
               // if is level 0, get out
               if ( prevlevel == 0 ) {
                  break;
               }
            }
}
         }
         //select the desired item and get out
         gSelectItem(x[i]);
         break;
      }
}
   }
}

