YAHOO.widget.TreeView=function(id){
if(id){
this.init(id);
}
};
YAHOO.widget.TreeView.prototype={id:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,_maxAnim:2,setExpandAnim:function(_2){
if(YAHOO.widget.TVAnim.isValid(_2)){
this._expandAnim=_2;
}
},setCollapseAnim:function(_3){
if(YAHOO.widget.TVAnim.isValid(_3)){
this._collapseAnim=_3;
}
},animateExpand:function(el){
if(this._expandAnim&&this._animCount<this._maxAnim){
var _5=this;
var a=YAHOO.widget.TVAnim.getAnim(this._expandAnim,el,function(){
_5.expandComplete();
});
if(a){
++this._animCount;
a.animate();
}
return true;
}
return false;
},animateCollapse:function(el){
if(this._collapseAnim&&this._animCount<this._maxAnim){
var _8=this;
var a=YAHOO.widget.TVAnim.getAnim(this._collapseAnim,el,function(){
_8.collapseComplete();
});
if(a){
++this._animCount;
a.animate();
}
return true;
}
return false;
},expandComplete:function(){
--this._animCount;
},collapseComplete:function(){
--this._animCount;
},init:function(id){
this.id=id;
this._nodes=new Array();
YAHOO.widget.TreeView.trees[id]=this;
this.root=new YAHOO.widget.RootNode(this);
},draw:function(){
var _b=this.root.getHtml();
document.getElementById(this.id).innerHTML=_b;
this.firstDraw=false;
},regNode:function(_c){
this._nodes[_c.index]=_c;
},getRoot:function(){
return this.root;
},setDynamicLoad:function(_d){
this.root.setDynamicLoad(_d);
},expandAll:function(){
if(!this.locked){
this.root.expandAll();
}
},collapseAll:function(){
if(!this.locked){
this.root.collapseAll();
}
},getNodeByIndex:function(_e){
var n=this._nodes[_e];
return (n)?n:null;
},getNodeByProperty:function(_10,_11){
for(var i in this._nodes){
var n=this._nodes[i];
if(n.data&&_11==n.data[_10]){
return n;
}
}
return null;
},onExpand:function(_14){
},onCollapse:function(_15){
}};
YAHOO.widget.TreeView.trees=[];
YAHOO.widget.TreeView.getTree=function(_16){
var t=YAHOO.widget.TreeView.trees[_16];
return (t)?t:null;
};
YAHOO.widget.TreeView.nodeCount=0;
YAHOO.widget.TreeView.getNode=function(_18,_19){
var t=YAHOO.widget.TreeView.getTree(_18);
return (t)?t.getNodeByIndex(_19):null;
};
YAHOO.widget.TreeView.addHandler=function(el,_1c,fn,_1e){
_1e=(_1e)?true:false;
if(el.addEventListener){
el.addEventListener(_1c,fn,_1e);
}else{
if(el.attachEvent){
el.attachEvent("on"+_1c,fn);
}else{
el["on"+_1c]=fn;
}
}
};
YAHOO.widget.TreeView.preload=function(){
var _1f=["ygtvtn","ygtvtm","ygtvtmh","ygtvtp","ygtvtph","ygtvln","ygtvlm","ygtvlmh","ygtvlp","ygtvlph","ygtvloading"];
var sb=[];
for(var i=0;i<_1f.length;++i){
sb[sb.length]="<span class=\""+_1f[i]+"\">&nbsp;</span>";
}
var f=document.createElement("div");
var s=f.style;
s.position="absolute";
s.top="-1000px";
s.left="-1000px";
f.innerHTML=sb.join("");
document.body.appendChild(f);
};
YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);
YAHOO.widget.Node=function(_24,_25,_26){
if(_25){
this.init(_24,_25,_26);
}
};
YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,init:function(_27,_28,_29){
this.data=_27;
this.children=[];
this.index=YAHOO.widget.TreeView.nodeCount;
++YAHOO.widget.TreeView.nodeCount;
this.expanded=_29;
if(_28){
this.tree=_28.tree;
this.parent=_28;
this.href="javascript:"+this.getToggleLink();
this.depth=_28.depth+1;
this.multiExpand=_28.multiExpand;
_28.appendChild(this);
}
},appendChild:function(_2a){
if(this.hasChildren()){
var sib=this.children[this.children.length-1];
sib.nextSibling=_2a;
_2a.previousSibling=sib;
}
this.tree.regNode(_2a);
this.children[this.children.length]=_2a;
return _2a;
},getSiblings:function(){
return this.parent.children;
},showChildren:function(){
if(!this.tree.animateExpand(this.getChildrenEl())){
if(this.hasChildren()){
this.getChildrenEl().style.display="";
}
}
},hideChildren:function(){
if(!this.tree.animateCollapse(this.getChildrenEl())){
this.getChildrenEl().style.display="none";
}
},getElId:function(){
return "ygtv"+this.index;
},getChildrenElId:function(){
return "ygtvc"+this.index;
},getToggleElId:function(){
return "ygtvt"+this.index;
},getEl:function(){
return document.getElementById(this.getElId());
},getChildrenEl:function(){
return document.getElementById(this.getChildrenElId());
},getToggleEl:function(){
return document.getElementById(this.getToggleElId());
},getToggleLink:function(){
return "YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+").toggle()";
},collapse:function(){
if(!this.expanded){
return;
}
if(!this.getEl()){
this.expanded=false;
return;
}
this.hideChildren();
this.expanded=false;
if(this.hasIcon){
this.getToggleEl().className=this.getStyle();
}
this.tree.onCollapse(this);
},expand:function(){
if(this.expanded){
return;
}
if(!this.getEl()){
this.expanded=true;
return;
}
if(!this.childrenRendered){
this.getChildrenEl().innerHTML=this.renderChildren();
}
this.expanded=true;
if(this.hasIcon){
this.getToggleEl().className=this.getStyle();
}
if(this.isLoading){
this.expanded=false;
return;
}
if(!this.multiExpand){
var _2c=this.getSiblings();
for(var i=0;i<_2c.length;++i){
if(_2c[i]!=this&&_2c[i].expanded){
_2c[i].collapse();
}
}
}
this.showChildren();
this.tree.onExpand(this);
},getStyle:function(){
if(this.isLoading){
return "ygtvloading";
}else{
var loc=(this.nextSibling)?"t":"l";
var _2f="n";
if(this.hasChildren(true)||this.isDynamic()){
_2f=(this.expanded)?"m":"p";
}
return "ygtv"+loc+_2f;
}
},getHoverStyle:function(){
var s=this.getStyle();
if(this.hasChildren(true)&&!this.isLoading){
s+="h";
}
return s;
},expandAll:function(){
for(var i=0;i<this.children.length;++i){
var c=this.children[i];
if(c.isDynamic()){
alert("Not supported (lazy load + expand all)");
break;
}else{
if(!c.multiExpand){
alert("Not supported (no multi-expand + expand all)");
break;
}else{
c.expand();
c.expandAll();
}
}
}
},collapseAll:function(){
for(var i=0;i<this.children.length;++i){
this.children[i].collapse();
this.children[i].collapseAll();
}
},setDynamicLoad:function(_34){
this.dataLoader=_34;
this._dynLoad=true;
},isRoot:function(){
return (this==this.tree.root);
},isDynamic:function(){
var _35=(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));
return _35;
},hasChildren:function(_36){
return (this.children.length>0||(_36&&this.isDynamic()&&!this.childrenRendered));
},toggle:function(){
if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){
if(this.expanded){
this.collapse();
}else{
this.expand();
}
}else{
if(this.checked){
this.uncheck();
}else{
this.check();
}
}
},getHtml:function(){
var sb=[];
sb[sb.length]="<div class=\"ygtvitem\" id=\""+this.getElId()+"\">";
sb[sb.length]=this.getNodeHtml();
sb[sb.length]=this.getChildrenHtml();
sb[sb.length]="</div>";
return sb.join("");
},getChildrenHtml:function(){
var sb=[];
sb[sb.length]="<div class=\"ygtvchildren\"";
sb[sb.length]=" id=\""+this.getChildrenElId()+"\"";
if(!this.expanded){
sb[sb.length]=" style=\"display:none;\"";
}
sb[sb.length]=">";
if(this.hasChildren(true)&&this.expanded){
sb[sb.length]=this.renderChildren();
}
sb[sb.length]="</div>";
return sb.join("");
},renderChildren:function(){
var _39=this;
if(this.isDynamic()&&!this.childrenRendered){
this.isLoading=true;
this.tree.locked=true;
if(this.dataLoader){
setTimeout(function(){
_39.dataLoader(_39,function(){
_39.loadComplete();
});
},10);
}else{
if(this.tree.root.dataLoader){
setTimeout(function(){
_39.tree.root.dataLoader(_39,function(){
_39.loadComplete();
});
},10);
}else{
return "Error: data loader not found or not specified.";
}
}
return "";
}else{
return this.completeRender();
}
},completeRender:function(){
var sb=[];
for(var i=0;i<this.children.length;++i){
sb[sb.length]=this.children[i].getHtml();
}
this.childrenRendered=true;
return sb.join("");
},loadComplete:function(){
this.getChildrenEl().innerHTML=this.completeRender();
this.isLoading=false;
this.expand();
this.tree.locked=false;
},getAncestor:function(_3c){
if(_3c>=this.depth||_3c<0){
return null;
}
var p=this.parent;
while(p.depth>_3c){
p=p.parent;
}
return p;
},getDepthStyle:function(_3e){
return (this.getAncestor(_3e).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";
},getNodeHtml:function(){
return "";
}};
YAHOO.widget.RootNode=function(_3f){
this.init(null,null,true);
this.tree=_3f;
};
YAHOO.widget.RootNode.prototype=new YAHOO.widget.Node();
YAHOO.widget.RootNode.prototype.getNodeHtml=function(){
return "";
};
YAHOO.widget.TextNode=function(_40,_41,_42){
if(_41){
this.init(_40,_41,_42);
this.setUpLabel(_40);
}
};
YAHOO.widget.TextNode.prototype=new YAHOO.widget.Node();
YAHOO.widget.TextNode.prototype.labelStyle="ygtvlabel";
YAHOO.widget.TextNode.prototype.labelElId=null;
YAHOO.widget.TextNode.prototype.label=null;
YAHOO.widget.TextNode.prototype.setUpLabel=function(_43){
if(typeof _43=="string"){
_43={label:_43};
}
this.label=_43.label;
if(_43.href){
this.href=_43.href;
}
if(_43.target){
this.target=_43.target;
}
this.labelElId="ygtvlabelel"+this.index;
};
YAHOO.widget.TextNode.prototype.getLabelEl=function(){
return document.getElementById(this.labelElId);
};
YAHOO.widget.TextNode.prototype.getNodeHtml=function(){
var sb=new Array();
sb[sb.length]="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
sb[sb.length]="<tr>";
for(i=0;i<this.depth;++i){
sb[sb.length]="<td class=\""+this.getDepthStyle(i)+"\">&nbsp;</td>";
}
var _45="YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+")";
sb[sb.length]="<td";
sb[sb.length]=" id=\""+this.getToggleElId()+"\"";
sb[sb.length]=" class=\""+this.getStyle()+"\"";
if(this.hasChildren(true)){
sb[sb.length]=" onmouseover=\"this.className=";
sb[sb.length]=_45+".getHoverStyle()\"";
sb[sb.length]=" onmouseout=\"this.className=";
sb[sb.length]=_45+".getStyle()\"";
}
sb[sb.length]=" onclick=\"javascript:"+this.getToggleLink()+"\">&nbsp;";
sb[sb.length]="</td>";
sb[sb.length]="<td>";
sb[sb.length]="<a";
sb[sb.length]=" id=\""+this.labelElId+"\"";
sb[sb.length]=" class=\""+this.labelStyle+"\"";
sb[sb.length]=" href=\""+this.href+"\"";
sb[sb.length]=" target=\""+this.target+"\"";
if(this.hasChildren(true)){
sb[sb.length]=" onmouseover=\"document.getElementById('";
sb[sb.length]=this.getToggleElId()+"').className=";
sb[sb.length]=_45+".getHoverStyle()\"";
sb[sb.length]=" onmouseout=\"document.getElementById('";
sb[sb.length]=this.getToggleElId()+"').className=";
sb[sb.length]=_45+".getStyle()\"";
}
sb[sb.length]=" >";
sb[sb.length]=this.label;
sb[sb.length]="</a>";
sb[sb.length]="</td>";
sb[sb.length]="</tr>";
sb[sb.length]="</table>";
return sb.join("");
};
YAHOO.widget.MenuNode=function(_46,_47,_48){
if(_47){
this.init(_46,_47,_48);
this.setUpLabel(_46);
}
this.multiExpand=false;
};
YAHOO.widget.MenuNode.prototype=new YAHOO.widget.TextNode();
YAHOO.widget.HTMLNode=function(_49,_4a,_4b,_4c){
if(_4a){
this.init(_49,_4a,_4b);
this.initContent(_49,_4c);
}
};
YAHOO.widget.HTMLNode.prototype=new YAHOO.widget.Node();
YAHOO.widget.HTMLNode.prototype.contentStyle="ygtvhtml";
YAHOO.widget.HTMLNode.prototype.contentElId=null;
YAHOO.widget.HTMLNode.prototype.content=null;
YAHOO.widget.HTMLNode.prototype.initContent=function(_4d,_4e){
if(typeof _4d=="string"){
_4d={html:_4d};
}
this.html=_4d.html;
this.contentElId="ygtvcontentel"+this.index;
this.hasIcon=_4e;
};
YAHOO.widget.HTMLNode.prototype.getContentEl=function(){
return document.getElementById(this.contentElId);
};
YAHOO.widget.HTMLNode.prototype.getNodeHtml=function(){
var sb=new Array();
sb[sb.length]="<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
sb[sb.length]="<tr>";
for(i=0;i<this.depth;++i){
sb[sb.length]="<td class=\""+this.getDepthStyle(i)+"\">&nbsp;</td>";
}
if(this.hasIcon){
sb[sb.length]="<td";
sb[sb.length]=" id=\""+this.getToggleElId()+"\"";
sb[sb.length]=" class=\""+this.getStyle()+"\"";
sb[sb.length]=" onclick=\"javascript:"+this.getToggleLink()+"\">&nbsp;";
if(this.hasChildren(true)){
sb[sb.length]=" onmouseover=\"this.className=";
sb[sb.length]="YAHOO.widget.TreeView.getNode('";
sb[sb.length]=this.tree.id+"',"+this.index+").getHoverStyle()\"";
sb[sb.length]=" onmouseout=\"this.className=";
sb[sb.length]="YAHOO.widget.TreeView.getNode('";
sb[sb.length]=this.tree.id+"',"+this.index+").getStyle()\"";
}
sb[sb.length]="</td>";
}
sb[sb.length]="<td";
sb[sb.length]=" id=\""+this.contentElId+"\"";
sb[sb.length]=" class=\""+this.contentStyle+"\"";
sb[sb.length]=" >";
sb[sb.length]=this.html;
sb[sb.length]="</td>";
sb[sb.length]="</tr>";
sb[sb.length]="</table>";
return sb.join("");
};
YAHOO.widget.TVAnim=new function(){
this.FADE_IN="YAHOO.widget.TVFadeIn";
this.FADE_OUT="YAHOO.widget.TVFadeOut";
this.getAnim=function(_50,el,_52){
switch(_50){
case this.FADE_IN:
return new YAHOO.widget.TVFadeIn(el,_52);
case this.FADE_OUT:
return new YAHOO.widget.TVFadeOut(el,_52);
default:
return null;
}
};
this.isValid=function(_53){
return ("undefined"!=eval("typeof "+_53));
};
};
YAHOO.widget.TVFadeIn=function(el,_55){
this.el=el;
this.callback=_55;
};
YAHOO.widget.TVFadeIn.prototype={animate:function(){
var _56=this;
var s=this.el.style;
s.opacity=0.1;
s.filter="alpha(opacity=10)";
s.display="";
var dur=0.4;
var a=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},dur);
a.onComplete.subscribe(function(){
_56.onComplete();
});
a.animate();
},onComplete:function(){
this.callback();
}};
YAHOO.widget.TVFadeOut=function(el,_5b){
this.el=el;
this.callback=_5b;
};
YAHOO.widget.TVFadeOut.prototype={animate:function(){
var _5c=this;
var dur=0.4;
var a=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},dur);
a.onComplete.subscribe(function(){
_5c.onComplete();
});
a.animate();
},onComplete:function(){
var s=this.el.style;
s.display="none";
s.filter="alpha(opacity=100)";
this.callback();
}};


