YAHOO.widget.TreeView=function(a){if(a){this.init(a)}};YAHOO.widget.TreeView.nodeCount=0;YAHOO.widget.TreeView.prototype={id:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,setExpandAnim:function(a){if(YAHOO.widget.TVAnim.isValid(a)){this._expandAnim=a}},setCollapseAnim:function(a){if(YAHOO.widget.TVAnim.isValid(a)){this._collapseAnim=a}},animateExpand:function(d){if(this._expandAnim&&this._animCount<this.maxAnim){var c=this;var b=YAHOO.widget.TVAnim.getAnim(this._expandAnim,d,function(){c.expandComplete()});if(b){++this._animCount;b.animate()}return true}return false},animateCollapse:function(d){if(this._collapseAnim&&this._animCount<this.maxAnim){var c=this;var b=YAHOO.widget.TVAnim.getAnim(this._collapseAnim,d,function(){c.collapseComplete()});if(b){++this._animCount;b.animate()}return true}return false},expandComplete:function(){--this._animCount},collapseComplete:function(){--this._animCount},init:function(a){this.id=a;this._nodes=new Array();YAHOO.widget.TreeView.trees[a]=this;this.root=new YAHOO.widget.RootNode(this)},draw:function(){var a=this.root.getHtml();document.getElementById(this.id).innerHTML=a;this.firstDraw=false},regNode:function(a){this._nodes[a.index]=a},getRoot:function(){return this.root},setDynamicLoad:function(a){this.root.setDynamicLoad(a)},expandAll:function(){if(!this.locked){this.root.expandAll()}},collapseAll:function(){if(!this.locked){this.root.collapseAll()}},getNodeByIndex:function(a){var b=this._nodes[a];return(b)?b:null},getNodeByProperty:function(c,b){for(var a in this._nodes){var d=this._nodes[a];if(d.data&&b==d.data[c]){return d}}return null},onExpand:function(a){},onCollapse:function(a){}};YAHOO.widget.TreeView.trees=[];YAHOO.widget.TreeView.getTree=function(a){var b=YAHOO.widget.TreeView.trees[a];return(b)?b:null};YAHOO.widget.TreeView.getNode=function(b,a){var c=YAHOO.widget.TreeView.getTree(b);return(c)?c.getNodeByIndex(a):null};YAHOO.widget.TreeView.addHandler=function(b,d,a,c){c=(c)?true:false;if(b.addEventListener){b.addEventListener(d,a,c)}else{if(b.attachEvent){b.attachEvent("on"+d,a)}else{b["on"+d]=a}}};YAHOO.widget.TreeView.preload=function(){var d=["ygtvtn","ygtvtm","ygtvtmh","ygtvtp","ygtvtph","ygtvln","ygtvlm","ygtvlmh","ygtvlp","ygtvlph","ygtvloading"];var e=[];for(var a=0;a<d.length;++a){e[e.length]='<span class="'+d[a]+'">&nbsp;</span>'}var c=document.createElement("div");var b=c.style;b.position="absolute";b.top="-1000px";b.left="-1000px";c.innerHTML=e.join("");document.body.appendChild(c)};YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);YAHOO.widget.Node=function(c,b,a){if(b){this.init(c,b,a)}};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(b,a,c){this.data=b;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.expanded=c;if(a){this.tree=a.tree;this.parent=a;this.href="javascript:"+this.getToggleLink();this.depth=a.depth+1;this.multiExpand=a.multiExpand;a.appendChild(this)}},appendChild:function(b){if(this.hasChildren()){var a=this.children[this.children.length-1];a.nextSibling=b;b.previousSibling=a}this.tree.regNode(b);this.children[this.children.length]=b;return b},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 b=this.getSiblings();for(var a=0;a<b.length;++a){if(b[a]!=this&&b[a].expanded){b[a].collapse()}}}this.showChildren();this.tree.onExpand(this)},getStyle:function(){if(this.isLoading){return"ygtvloading"}else{var b=(this.nextSibling)?"t":"l";var a="n";if(this.hasChildren(true)||this.isDynamic()){a=(this.expanded)?"m":"p"}return"ygtv"+b+a}},getHoverStyle:function(){var a=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){a+="h"}return a},expandAll:function(){for(var a=0;a<this.children.length;++a){var b=this.children[a];if(b.isDynamic()){alert("Not supported (lazy load + expand all)");break}else{if(!b.multiExpand){alert("Not supported (no multi-expand + expand all)");break}else{b.expand();b.expandAll()}}}},collapseAll:function(){for(var a=0;a<this.children.length;++a){this.children[a].collapse();this.children[a].collapseAll()}},setDynamicLoad:function(a){this.dataLoader=a;this._dynLoad=true},isRoot:function(){return(this==this.tree.root)},isDynamic:function(){var a=(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));return a},hasChildren:function(a){return(this.children.length>0||(a&&this.isDynamic()&&!this.childrenRendered))},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse()}else{this.expand()}}},getHtml:function(){var a=[];a[a.length]='<div class="ygtvitem" id="'+this.getElId()+'">';a[a.length]=this.getNodeHtml();a[a.length]=this.getChildrenHtml();a[a.length]="</div>";return a.join("")},getChildrenHtml:function(){var a=[];a[a.length]='<div class="ygtvchildren"';a[a.length]=' id="'+this.getChildrenElId()+'"';if(!this.expanded){a[a.length]=' style="display:none;"'}a[a.length]=">";if(this.hasChildren(true)&&this.expanded){a[a.length]=this.renderChildren()}a[a.length]="</div>";return a.join("")},renderChildren:function(){var a=this;if(this.isDynamic()&&!this.childrenRendered){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){a.dataLoader(a,function(){a.loadComplete()})},10)}else{if(this.tree.root.dataLoader){setTimeout(function(){a.tree.root.dataLoader(a,function(){a.loadComplete()})},10)}else{return"Error: data loader not found or not specified."}}return""}else{return this.completeRender()}},completeRender:function(){var b=[];for(var a=0;a<this.children.length;++a){b[b.length]=this.children[a].getHtml()}this.childrenRendered=true;return b.join("")},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();this.isLoading=false;this.expand();this.tree.locked=false},getAncestor:function(a){if(a>=this.depth||a<0){return null}var b=this.parent;while(b.depth>a){b=b.parent}return b},getDepthStyle:function(a){return(this.getAncestor(a).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell"},getNodeHtml:function(){return""}};YAHOO.widget.RootNode=function(a){this.init(null,null,true);this.tree=a};YAHOO.widget.RootNode.prototype=new YAHOO.widget.Node();YAHOO.widget.RootNode.prototype.getNodeHtml=function(){return""};YAHOO.widget.TextNode=function(c,b,a){if(b){this.init(c,b,a);this.setUpLabel(c)}};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(a){if(typeof a=="string"){a={label:a}}this.label=a.label;if(a.href){this.href=a.href}if(a.target){this.target=a.target}this.labelElId="ygtvlabelel"+this.index};YAHOO.widget.TextNode.prototype.getLabelEl=function(){return document.getElementById(this.labelElId)};YAHOO.widget.TextNode.prototype.getNodeHtml=function(){var b=new Array();b[b.length]='<table border="0" cellpadding="0" cellspacing="0">';b[b.length]="<tr>";for(i=0;i<this.depth;++i){b[b.length]='<td class="'+this.getDepthStyle(i)+'">&nbsp;</td>'}var a="YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+")";b[b.length]="<td";b[b.length]=' id="'+this.getToggleElId()+'"';b[b.length]=' class="'+this.getStyle()+'"';if(this.hasChildren(true)){b[b.length]=' onmouseover="this.className=';b[b.length]=a+'.getHoverStyle()"';b[b.length]=' onmouseout="this.className=';b[b.length]=a+'.getStyle()"'}b[b.length]=' onclick="javascript:'+this.getToggleLink()+'">&nbsp;';b[b.length]="</td>";b[b.length]="<td>";b[b.length]="<a";b[b.length]=' id="'+this.labelElId+'"';b[b.length]=' class="'+this.labelStyle+'"';b[b.length]=' href="'+this.href+'"';b[b.length]=' target="'+this.target+'"';if(this.hasChildren(true)){b[b.length]=" onmouseover=\"document.getElementById('";b[b.length]=this.getToggleElId()+"').className=";b[b.length]=a+'.getHoverStyle()"';b[b.length]=" onmouseout=\"document.getElementById('";b[b.length]=this.getToggleElId()+"').className=";b[b.length]=a+'.getStyle()"'}b[b.length]=" >";b[b.length]=this.label;b[b.length]="</a>";b[b.length]="</td>";b[b.length]="</tr>";b[b.length]="</table>";return b.join("")};YAHOO.widget.MenuNode=function(c,b,a){if(b){this.init(c,b,a);this.setUpLabel(c)}this.multiExpand=false};YAHOO.widget.MenuNode.prototype=new YAHOO.widget.TextNode();YAHOO.widget.HTMLNode=function(a,d,c,b){if(d){this.init(a,d,c);this.initContent(a,b)}};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(b,a){if(typeof b=="string"){b={html:b}}this.html=b.html;this.contentElId="ygtvcontentel"+this.index;this.hasIcon=a};YAHOO.widget.HTMLNode.prototype.getContentEl=function(){return document.getElementById(this.contentElId)};YAHOO.widget.HTMLNode.prototype.getNodeHtml=function(){var a=new Array();a[a.length]='<table border="0" cellpadding="0" cellspacing="0">';a[a.length]="<tr>";for(i=0;i<this.depth;++i){a[a.length]='<td class="'+this.getDepthStyle(i)+'">&nbsp;</td>'}if(this.hasIcon){a[a.length]="<td";a[a.length]=' id="'+this.getToggleElId()+'"';a[a.length]=' class="'+this.getStyle()+'"';a[a.length]=' onclick="javascript:'+this.getToggleLink()+'">&nbsp;';if(this.hasChildren(true)){a[a.length]=' onmouseover="this.className=';a[a.length]="YAHOO.widget.TreeView.getNode('";a[a.length]=this.tree.id+"',"+this.index+').getHoverStyle()"';a[a.length]=' onmouseout="this.className=';a[a.length]="YAHOO.widget.TreeView.getNode('";a[a.length]=this.tree.id+"',"+this.index+').getStyle()"'}a[a.length]="</td>"}a[a.length]="<td";a[a.length]=' id="'+this.contentElId+'"';a[a.length]=' class="'+this.contentStyle+'"';a[a.length]=" >";a[a.length]=this.html;a[a.length]="</td>";a[a.length]="</tr>";a[a.length]="</table>";return a.join("")};YAHOO.widget.TVAnim=new function(){this.FADE_IN="YAHOO.widget.TVFadeIn";this.FADE_OUT="YAHOO.widget.TVFadeOut";this.getAnim=function(_63,el,_64){switch(_63){case this.FADE_IN:return new YAHOO.widget.TVFadeIn(el,_64);case this.FADE_OUT:return new YAHOO.widget.TVFadeOut(el,_64);default:return null}};this.isValid=function(_65){return("undefined"!=eval("typeof "+_65))}};YAHOO.widget.TVFadeIn=function(b,a){this.el=b;this.callback=a};YAHOO.widget.TVFadeIn.prototype={animate:function(){var c=this;var e=this.el.style;e.opacity=0.1;e.filter="alpha(opacity=10)";e.display="";var d=0.4;var b=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},d);b.onComplete.subscribe(function(){c.onComplete()});b.animate()},onComplete:function(){this.callback()}};YAHOO.widget.TVFadeOut=function(b,a){this.el=b;this.callback=a};YAHOO.widget.TVFadeOut.prototype={animate:function(){var b=this;var d=0.4;var c=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},d);c.onComplete.subscribe(function(){b.onComplete()});c.animate()},onComplete:function(){var a=this.el.style;a.display="none";a.filter="alpha(opacity=100)";this.callback()}};
