

SZN.DynamicTree = SZN.ClassMaker.makeClass({
	NAME: "DynamicTree",
	VERSION: "1.0",
	CLASS: "class"
});

SZN.DynamicTree.prototype.$constructor = function(id) {
	this._dom = SZN.gEl(id);
	if(!this._dom) this.$destructor();
	
	this.eventsCache = [];
	this.eventsCache.push(SZN.Events.addListener(window,"unload",this,"$destructor",false,true));
	
	var lis =  $('#'+this._dom.id+' > li');
	for (var i = 0; i < lis.length; i++){
		this.eventsCache.push(SZN.Events.addListener(lis.get(i),"mouseover",this,"showChild",false,true));
		this.eventsCache.push(SZN.Events.addListener(lis.get(i),"mouseout",this,"hideChild",false,true));		
	}
	$('#'+this._dom.id+' ul').css( 'opacity', '0' );
	//this.showInpath();
}

SZN.DynamicTree.prototype.$destructor = function() {
	for (var i=0;i<this.eventsCache.length;i++) {
		SZN.Events.removeListener(this.eventsCache[i]);
	}
	for (var p in this) { this[p] = null; }
}

SZN.DynamicTree.prototype.showChild = function(e,elm) {
	//this.hideInpath();
	$('#'+elm.id+' > ul').stop(true).css( 'display', 'block' ).animate({ opacity: 1 },"normal" );
}
SZN.DynamicTree.prototype.hideChild = function(e,elm) {
	var mThis = this;
	$('#'+elm.id+' > ul').stop(true).animate({ opacity: 0 },"normal","", function(){  $('#'+elm.id+' > ul').css("display","none"); /*mThis.showInpath();*/ } );
}
/*
SZN.DynamicTree.prototype.showInpath = function() {
	$('#'+this._dom.id+' > li.inpath > ul').css( 'display', 'block' ).animate({ opacity: 1 },"normal" );
}
SZN.DynamicTree.prototype.hideInpath = function() {
	var mThis = this;
	$('#'+this._dom.id+' > li.inpath > ul').animate({ opacity: 0 },"normal","",function(){  $('#'+mThis._dom.id+' > li.inpath > ul').css("display","none"); } );
	
}
*/
