// 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: 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 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=-1;
	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(''));

	for(i=0;i<this.aDesc.length;i++)
		gOpenItem(this.aDesc[i]);

	this.toggle=function(_t1K){
		var _t1Q=this.all[_t1K];
		gOpenItem(_t1Q,_t1Q.bOpened);
	};



	this.rollover=function(_t1K,_t15){
		_t1J(this.all[_t1K],_t15)
	};

	this.select=function(_t1K){
		return gSelectItem(this.all[_t1K])
	};

}



function _t1A(_,_t10,_t1L){
	var _t1W,_t1Q,i;
	if(!_.aDesc)_.aDesc=[];
	if(_t1L==null||_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-3);

	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=!_t17;



if(!_.bOpened){

	if (menu!=''){
		var text= new String(menu);
	
		var armenu= new Array;
		armenu=text.split(",");

		for (i=0; i<armenu.length;i++){
			if (armenu[i]==_.id){armenu=armenu.slice(0,i).concat(armenu.slice(i+1)) }
		}

		menu=armenu.join(',');
	}

     }else{
        if (_.id!=0){ if(menu!=""){menu=menu+','+_.id}else{menu=_.id} }
     }




	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(_);
	}


UlozCookie("UstekMenu", menu, 3600);

	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':'normal'; // ?'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,sClass){
	this.oAnc=oAnc;
	this.tree=oAnc.tree;
	this.id=this.tree.all.length;
	this.tree.all[this.id]=this;
	this.sSrc=sSrc;
	this.sClass=sClass;
	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 cellpadding="0" cellspacing="0" border="0"><tr><td nowrap>',(_.level?_t13.join('')+(_.aDesc?['<a href="javascript:',_t1a,'"',_t1Z,'><img src="',_t1D(_,true),'" border="0" align="absbottom" name="j_img',_.tree.id,'_',_.id,'"></a>'].join(''):['<img src="',_t1D(_,true),'" border="0" align="absbottom">'].join('')):''),'<a ',(!_.sLnk?'href="javascript:'+_t1a+'"':'href="'+_.sLnk+'"'),' ',(_.aDesc?'onClick=""':''),' target="',_.tree._t14['target'],'" ',_t1_,(_.aDesc?' ondblClick="'+_t1a+'"':''),_t1Z,' class="',_.sClass,'" id="i_txt',_.tree.id,'_',_.id,'"><img src="',_t1D(_),'" border="0" align="absbottom" name="i_img',_.tree.id,'_',_.id,'" class="t',_.tree.id,'im">',_.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
}

var menu='';

gGetDiv=document.all?function(_t1Y){return document.all[_t1Y]}:(document.getElementById?function(_t1Y){return document.getElementById(_t1Y)}:null);
