(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang,Widget=YAHOO.widget;YAHOO.widget.TreeView=function(id,oConfig){if(id){this.init(id);}
if(oConfig){if(!Lang.isArray(oConfig)){oConfig=[oConfig];}
this.buildTreeFromObject(oConfig);}else if(Lang.trim(this._el.innerHTML)){this.buildTreeFromMarkup(id);}};var TV=Widget.TreeView;TV.prototype={id:null,_el:null,_nodes:null,locked:false,_expandAnim:null,_collapseAnim:null,_animCount:0,maxAnim:2,_hasDblClickSubscriber:false,_dblClickTimer:null,currentFocus:null,singleNodeHighlight:false,_currentlyHighlighted:null,setExpandAnim:function(type){this._expandAnim=(Widget.TVAnim.isValid(type))?type:null;},setCollapseAnim:function(type){this._collapseAnim=(Widget.TVAnim.isValid(type))?type:null;},animateExpand:function(el,node){if(this._expandAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._expandAnim,el,function(){tree.expandComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"expand"});a.animate();}
return true;}
return false;},animateCollapse:function(el,node){if(this._collapseAnim&&this._animCount<this.maxAnim){var tree=this;var a=Widget.TVAnim.getAnim(this._collapseAnim,el,function(){tree.collapseComplete(node);});if(a){++this._animCount;this.fireEvent("animStart",{"node":node,"type":"collapse"});a.animate();}
return true;}
return false;},expandComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"expand"});},collapseComplete:function(node){--this._animCount;this.fireEvent("animComplete",{"node":node,"type":"collapse"});},init:function(id){this._el=Dom.get(id);this.id=Dom.generateId(this._el,"yui-tv-auto-id-");this.createEvent("animStart",this);this.createEvent("animComplete",this);this.createEvent("collapse",this);this.createEvent("collapseComplete",this);this.createEvent("expand",this);this.createEvent("expandComplete",this);this.createEvent("enterKeyPressed",this);this.createEvent("clickEvent",this);this.createEvent('focusChanged',this);var self=this;this.createEvent("dblClickEvent",{scope:this,onSubscribeCallback:function(){self._hasDblClickSubscriber=true;}});this.createEvent("labelClick",this);this.createEvent("highlightEvent",this);this._nodes=[];TV.trees[this.id]=this;this.root=new Widget.RootNode(this);var LW=Widget.LogWriter;if(this._initEditor){this._initEditor();}},buildTreeFromObject:function(oConfig){var build=function(parent,oConfig){var i,item,node,children,type,NodeType,ThisType;for(i=0;i<oConfig.length;i++){item=oConfig[i];if(Lang.isString(item)){node=new Widget.TextNode(item,parent);}else if(Lang.isObject(item)){children=item.children;delete item.children;type=item.type||'text';delete item.type;switch(Lang.isString(type)&&type.toLowerCase()){case'text':node=new Widget.TextNode(item,parent);break;case'menu':node=new Widget.MenuNode(item,parent);break;case'html':node=new Widget.HTMLNode(item,parent);break;default:if(Lang.isString(type)){NodeType=Widget[type];}else{NodeType=type;}
if(Lang.isObject(NodeType)){for(ThisType=NodeType;ThisType&&ThisType!==Widget.Node;ThisType=ThisType.superclass.constructor){}
if(ThisType){node=new NodeType(item,parent);}else{}}else{}}
if(children){build(node,children);}}else{}}};build(this.root,oConfig);},buildTreeFromMarkup:function(id){var build=function(markup){var el,child,branch=[],config={},label,yuiConfig;for(el=Dom.getFirstChild(markup);el;el=Dom.getNextSibling(el)){switch(el.tagName.toUpperCase()){case'LI':label='';config={expanded:Dom.hasClass(el,'expanded'),title:el.title||el.alt||null,className:Lang.trim(el.className.replace(/\bexpanded\b/,''))||null};child=el.firstChild;if(child.nodeType==3){label=Lang.trim(child.nodeValue.replace(/[\n\t\r]*/g,''));if(label){config.type='text';config.label=label;}else{child=Dom.getNextSibling(child);}}
if(!label){if(child.tagName.toUpperCase()=='A'){config.type='text';config.label=child.innerHTML;config.href=child.href;config.target=child.target;config.title=child.title||child.alt||config.title;}else{config.type='html';var d=document.createElement('div');d.appendChild(child.cloneNode(true));config.html=d.innerHTML;config.hasIcon=true;}}
child=Dom.getNextSibling(child);switch(child&&child.tagName.toUpperCase()){case'UL':case'OL':config.children=build(child);break;}
if(YAHOO.lang.JSON){yuiConfig=el.getAttribute('yuiConfig');if(yuiConfig){yuiConfig=YAHOO.lang.JSON.parse(yuiConfig);config=YAHOO.lang.merge(config,yuiConfig);}}
branch.push(config);break;case'UL':case'OL':config={type:'text',label:'',children:build(child)};branch.push(config);break;}}
return branch;};var markup=Dom.getChildrenBy(Dom.get(id),function(el){var tag=el.tagName.toUpperCase();return tag=='UL'||tag=='OL';});if(markup.length){this.buildTreeFromObject(build(markup[0]));}else{}},_getEventTargetTdEl:function(ev){var target=Event.getTarget(ev);while(target&&!(target.tagName.toUpperCase()=='TD'&&Dom.hasClass(target.parentNode,'ygtvrow'))){target=Dom.getAncestorByTagName(target,'td');}
if(Lang.isNull(target)){return null;}
if(/\bygtv(blank)?depthcell/.test(target.className)){return null;}
if(target.id){var m=target.id.match(/\bygtv([^\d]*)(.*)/);if(m&&m[2]&&this._nodes[m[2]]){return target;}}
return null;},_onClickEvent:function(ev){var self=this,td=this._getEventTargetTdEl(ev),node,target,toggle=function(force){node.focus();if(force||!node.href){node.toggle();try{Event.preventDefault(ev);}catch(e){}}};if(!td){return;}
node=this.getNodeByElement(td);if(!node){return;}
target=Event.getTarget(ev);if(Dom.hasClass(target,node.labelStyle)||Dom.getAncestorByClassName(target,node.labelStyle)){this.fireEvent('labelClick',node);}
if(/\bygtv[tl][mp]h?h?/.test(td.className)){toggle(true);}else{if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}else{if(this._hasDblClickSubscriber){this._dblClickTimer=window.setTimeout(function(){self._dblClickTimer=null;if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){toggle();}},200);}else{if(self.fireEvent('clickEvent',{event:ev,node:node})!==false){toggle();}}}}},_onDblClickEvent:function(ev){if(!this._hasDblClickSubscriber){return;}
var td=this._getEventTargetTdEl(ev);if(!td){return;}
if(!(/\bygtv[tl][mp]h?h?/.test(td.className))){this.fireEvent('dblClickEvent',{event:ev,node:this.getNodeByElement(td)});if(this._dblClickTimer){window.clearTimeout(this._dblClickTimer);this._dblClickTimer=null;}}},_onMouseOverEvent:function(ev){var target;if((target=this._getEventTargetTdEl(ev))&&(target=this.getNodeByElement(target))&&(target=target.getToggleEl())){target.className=target.className.replace(/\bygtv([lt])([mp])\b/gi,'ygtv$1$2h');}},_onMouseOutEvent:function(ev){var target;if((target=this._getEventTargetTdEl(ev))&&(target=this.getNodeByElement(target))&&(target=target.getToggleEl())){target.className=target.className.replace(/\bygtv([lt])([mp])h\b/gi,'ygtv$1$2');}},_onKeyDownEvent:function(ev){var target=Event.getTarget(ev),node=this.getNodeByElement(target),newNode=node,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.UP:do{if(newNode.previousSibling){newNode=newNode.previousSibling;}else{newNode=newNode.parent;}}while(newNode&&!newNode._canHaveFocus());if(newNode){newNode.focus();}
Event.preventDefault(ev);break;case KEY.DOWN:do{if(newNode.nextSibling){newNode=newNode.nextSibling;}else{newNode.expand();newNode=(newNode.children.length||null)&&newNode.children[0];}}while(newNode&&!newNode._canHaveFocus);if(newNode){newNode.focus();}
Event.preventDefault(ev);break;case KEY.LEFT:do{if(newNode.parent){newNode=newNode.parent;}else{newNode=newNode.previousSibling;}}while(newNode&&!newNode._canHaveFocus());if(newNode){newNode.focus();}
Event.preventDefault(ev);break;case KEY.RIGHT:do{newNode.expand();if(newNode.children.length){newNode=newNode.children[0];}else{newNode=newNode.nextSibling;}}while(newNode&&!newNode._canHaveFocus());if(newNode){newNode.focus();}
Event.preventDefault(ev);break;case KEY.ENTER:if(node.href){if(node.target){window.open(node.href,node.target);}else{window.location(node.href);}}else{node.toggle();}
this.fireEvent('enterKeyPressed',node);Event.preventDefault(ev);break;case KEY.HOME:newNode=this.getRoot();if(newNode.children.length){newNode=newNode.children[0];}
if(newNode._canHaveFocus()){newNode.focus();}
Event.preventDefault(ev);break;case KEY.END:newNode=newNode.parent.children;newNode=newNode[newNode.length-1];if(newNode._canHaveFocus()){newNode.focus();}
Event.preventDefault(ev);break;case 107:if(ev.shiftKey){node.parent.expandAll();}else{node.expand();}
break;case 109:if(ev.shiftKey){node.parent.collapseAll();}else{node.collapse();}
break;default:break;}},render:function(){var html=this.root.getHtml(),el=this.getEl();el.innerHTML=html;if(!this._hasEvents){Event.on(el,'click',this._onClickEvent,this,true);Event.on(el,'dblclick',this._onDblClickEvent,this,true);Event.on(el,'mouseover',this._onMouseOverEvent,this,true);Event.on(el,'mouseout',this._onMouseOutEvent,this,true);Event.on(el,'keydown',this._onKeyDownEvent,this,true);}
this._hasEvents=true;},getEl:function(){if(!this._el){this._el=Dom.get(this.id);}
return this._el;},regNode:function(node){this._nodes[node.index]=node;},getRoot:function(){return this.root;},setDynamicLoad:function(fnDataLoader,iconMode){this.root.setDynamicLoad(fnDataLoader,iconMode);},expandAll:function(){if(!this.locked){this.root.expandAll();}},collapseAll:function(){if(!this.locked){this.root.collapseAll();}},getNodeByIndex:function(nodeIndex){var n=this._nodes[nodeIndex];return(n)?n:null;},getNodeByProperty:function(property,value){for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if((property in n&&n[property]==value)||(n.data&&value==n.data[property])){return n;}}}
return null;},getNodesByProperty:function(property,value){var values=[];for(var i in this._nodes){if(this._nodes.hasOwnProperty(i)){var n=this._nodes[i];if((property in n&&n[property]==value)||(n.data&&value==n.data[property])){values.push(n);}}}
return(values.length)?values:null;},getNodeByElement:function(el){var p=el,m,re=/ygtv([^\d]*)(.*)/;do{if(p&&p.id){m=p.id.match(re);if(m&&m[2]){return this.getNodeByIndex(m[2]);}}
p=p.parentNode;if(!p||!p.tagName){break;}}
while(p.id!==this.id&&p.tagName.toLowerCase()!=="body");return null;},removeNode:function(node,autoRefresh){if(node.isRoot()){return false;}
var p=node.parent;if(p.parent){p=p.parent;}
this._deleteNode(node);if(autoRefresh&&p&&p.childrenRendered){p.refresh();}
return true;},_removeChildren_animComplete:function(o){this.unsubscribe(this._removeChildren_animComplete);this.removeChildren(o.node);},removeChildren:function(node){if(node.expanded){if(this._collapseAnim){this.subscribe("animComplete",this._removeChildren_animComplete,this,true);Widget.Node.prototype.collapse.call(node);return;}
node.collapse();}
while(node.children.length){this._deleteNode(node.children[0]);}
if(node.isRoot()){Widget.Node.prototype.expand.call(node);}
node.childrenRendered=false;node.dynamicLoadComplete=false;node.updateIcon();},_deleteNode:function(node){this.removeChildren(node);this.popNode(node);},popNode:function(node){var p=node.parent;var a=[];for(var i=0,len=p.children.length;i<len;++i){if(p.children[i]!=node){a[a.length]=p.children[i];}}
p.children=a;p.childrenRendered=false;if(node.previousSibling){node.previousSibling.nextSibling=node.nextSibling;}
if(node.nextSibling){node.nextSibling.previousSibling=node.previousSibling;}
if(this.currentFocus==node){this.currentFocus=null;}
if(this._currentlyHighlighted==node){this._currentlyHighlighted=null;}
node.parent=null;node.previousSibling=null;node.nextSibling=null;node.tree=null;delete this._nodes[node.index];},destroy:function(){if(this._destroyEditor){this._destroyEditor();}
var el=this.getEl();Event.removeListener(el,'click');Event.removeListener(el,'dblclick');Event.removeListener(el,'mouseover');Event.removeListener(el,'mouseout');Event.removeListener(el,'keydown');for(var i=0;i<this._nodes.length;i++){var node=this._nodes[i];if(node&&node.destroy){node.destroy();}}
el.innerHTML='';this._hasEvents=false;},toString:function(){return"TreeView "+this.id;},getNodeCount:function(){return this.getRoot().getNodeCount();},getTreeDefinition:function(){return this.getRoot().getNodeDefinition();},onExpand:function(node){},onCollapse:function(node){},setNodesProperty:function(name,value,refresh){this.root.setNodesProperty(name,value);if(refresh){this.root.refresh();}},onEventToggleHighlight:function(oArgs){var node;if('node'in oArgs&&oArgs.node instanceof Widget.Node){node=oArgs.node;}else if(oArgs instanceof Widget.Node){node=oArgs;}else{return false;}
node.toggleHighlight();return false;}};var PROT=TV.prototype;PROT.draw=PROT.render;YAHOO.augment(TV,YAHOO.util.EventProvider);TV.nodeCount=0;TV.trees=[];TV.getTree=function(treeId){var t=TV.trees[treeId];return(t)?t:null;};TV.getNode=function(treeId,nodeIndex){var t=TV.getTree(treeId);return(t)?t.getNodeByIndex(nodeIndex):null;};TV.FOCUS_CLASS_NAME='ygtvfocus';TV.preload=function(e,prefix){prefix=prefix||"ygtv";var styles=["tn","tm","tmh","tp","tph","ln","lm","lmh","lp","lph","loading"];var sb=[];for(var i=1;i<styles.length;i=i+1){sb[sb.length]='<span class="'+prefix+styles[i]+'">&#160;</span>';}
var f=document.createElement("div");var s=f.style;s.className=prefix+styles[0];s.position="absolute";s.height="1px";s.width="1px";s.top="-1000px";s.left="-1000px";f.innerHTML=sb.join("");document.body.appendChild(f);Event.removeListener(window,"load",TV.preload);};Event.addListener(window,"load",TV.preload);})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.Node=function(oData,oParent,expanded){if(oData){this.init(oData,oParent,expanded);}};YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,expanded:false,multiExpand:true,renderHidden:false,childrenRendered:false,dynamicLoadComplete:false,previousSibling:null,nextSibling:null,_dynLoad:false,dataLoader:null,isLoading:false,hasIcon:true,iconMode:0,nowrap:false,isLeaf:false,contentStyle:"",contentElId:null,enableHighlight:true,highlightState:0,propagateHighlightUp:false,propagateHighlightDown:false,className:null,_type:"Node",init:function(oData,oParent,expanded){this.data={};this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.contentElId="ygtvcontentel"+this.index;if(Lang.isObject(oData)){for(var property in oData){if(oData.hasOwnProperty(property)){if(property.charAt(0)!='_'&&!Lang.isUndefined(this[property])&&!Lang.isFunction(this[property])){this[property]=oData[property];}else{this.data[property]=oData[property];}}}}
if(!Lang.isUndefined(expanded)){this.expanded=expanded;}
this.createEvent("parentChange",this);if(oParent){oParent.appendChild(this);}},applyParent:function(parentNode){if(!parentNode){return false;}
this.tree=parentNode.tree;this.parent=parentNode;this.depth=parentNode.depth+1;this.tree.regNode(this);parentNode.childrenRendered=false;for(var i=0,len=this.children.length;i<len;++i){this.children[i].applyParent(this);}
this.fireEvent("parentChange");return true;},appendChild:function(childNode){if(this.hasChildren()){var sib=this.children[this.children.length-1];sib.nextSibling=childNode;childNode.previousSibling=sib;}
this.children[this.children.length]=childNode;childNode.applyParent(this);if(this.childrenRendered&&this.expanded){this.getChildrenEl().style.display="";}
return childNode;},appendTo:function(parentNode){return parentNode.appendChild(this);},insertBefore:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);p.children.splice(refIndex,0,this);if(node.previousSibling){node.previousSibling.nextSibling=this;}
this.previousSibling=node.previousSibling;this.nextSibling=node;node.previousSibling=this;this.applyParent(p);}
return this;},insertAfter:function(node){var p=node.parent;if(p){if(this.tree){this.tree.popNode(this);}
var refIndex=node.isChildOf(p);if(!node.nextSibling){this.nextSibling=null;return this.appendTo(p);}
p.children.splice(refIndex+1,0,this);node.nextSibling.previousSibling=this;this.previousSibling=node;this.nextSibling=node.nextSibling;node.nextSibling=this;this.applyParent(p);}
return this;},isChildOf:function(parentNode){if(parentNode&&parentNode.children){for(var i=0,len=parentNode.children.length;i<len;++i){if(parentNode.children[i]===this){return i;}}}
return-1;},getSiblings:function(){var sib=this.parent.children.slice(0);for(var i=0;i<sib.length&&sib[i]!=this;i++){}
sib.splice(i,1);if(sib.length){return sib;}
return null;},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl(),this)){if(this.hasChildren()){this.getChildrenEl().style.display="";}}},hideChildren:function(){if(!this.tree.animateCollapse(this.getChildrenEl(),this)){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 Dom.get(this.getElId());},getChildrenEl:function(){return Dom.get(this.getChildrenElId());},getToggleEl:function(){return Dom.get(this.getToggleElId());},getContentEl:function(){return Dom.get(this.contentElId);},collapse:function(){if(!this.expanded){return;}
var ret=this.tree.onCollapse(this);if(false===ret){return;}
ret=this.tree.fireEvent("collapse",this);if(false===ret){return;}
if(!this.getEl()){this.expanded=false;}else{this.hideChildren();this.expanded=false;this.updateIcon();}
ret=this.tree.fireEvent("collapseComplete",this);},expand:function(lazySource){if(this.isLoading||(this.expanded&&!lazySource)){return;}
var ret=true;if(!lazySource){ret=this.tree.onExpand(this);if(false===ret){return;}
ret=this.tree.fireEvent("expand",this);}
if(false===ret){return;}
if(!this.getEl()){this.expanded=true;return;}
if(!this.childrenRendered){this.getChildrenEl().innerHTML=this.renderChildren();}else{}
this.expanded=true;this.updateIcon();if(this.isLoading){this.expanded=false;return;}
if(!this.multiExpand){var sibs=this.getSiblings();for(var i=0;sibs&&i<sibs.length;++i){if(sibs[i]!=this&&sibs[i].expanded){sibs[i].collapse();}}}
this.showChildren();ret=this.tree.fireEvent("expandComplete",this);},updateIcon:function(){if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=el.className.replace(/\bygtv(([tl][pmn]h?)|(loading))\b/gi,this.getStyle());}}},getStyle:function(){if(this.isLoading){return"ygtvloading";}else{var loc=(this.nextSibling)?"t":"l";var type="n";if(this.hasChildren(true)||(this.isDynamic()&&!this.getIconMode())){type=(this.expanded)?"m":"p";}
return"ygtv"+loc+type;}},getHoverStyle:function(){var s=this.getStyle();if(this.hasChildren(true)&&!this.isLoading){s+="h";}
return s;},expandAll:function(){var l=this.children.length;for(var i=0;i<l;++i){var c=this.children[i];if(c.isDynamic()){break;}else if(!c.multiExpand){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(fnDataLoader,iconMode){if(fnDataLoader){this.dataLoader=fnDataLoader;this._dynLoad=true;}else{this.dataLoader=null;this._dynLoad=false;}
if(iconMode){this.iconMode=iconMode;}},isRoot:function(){return(this==this.tree.root);},isDynamic:function(){if(this.isLeaf){return false;}else{return(!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad));}},getIconMode:function(){return(this.iconMode||this.tree.root.iconMode);},hasChildren:function(checkForLazyLoad){if(this.isLeaf){return false;}else{return(this.children.length>0||(checkForLazyLoad&&this.isDynamic()&&!this.dynamicLoadComplete));}},toggle:function(){if(!this.tree.locked&&(this.hasChildren(true)||this.isDynamic())){if(this.expanded){this.collapse();}else{this.expand();}}},getHtml:function(){this.childrenRendered=false;return['<div class="ygtvitem" id="',this.getElId(),'">',this.getNodeHtml(),this.getChildrenHtml(),'</div>'].join("");},getChildrenHtml:function(){var sb=[];sb[sb.length]='<div class="ygtvchildren" id="'+this.getChildrenElId()+'"';if(!this.expanded||!this.hasChildren()){sb[sb.length]=' style="display:none;"';}
sb[sb.length]='>';if((this.hasChildren(true)&&this.expanded)||(this.renderHidden&&!this.isDynamic())){sb[sb.length]=this.renderChildren();}
sb[sb.length]='</div>';return sb.join("");},renderChildren:function(){var node=this;if(this.isDynamic()&&!this.dynamicLoadComplete){this.isLoading=true;this.tree.locked=true;if(this.dataLoader){setTimeout(function(){node.dataLoader(node,function(){node.loadComplete();});},10);}else if(this.tree.root.dataLoader){setTimeout(function(){node.tree.root.dataLoader(node,function(){node.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.dynamicLoadComplete=true;this.isLoading=false;this.expand(true);this.tree.locked=false;},getAncestor:function(depth){if(depth>=this.depth||depth<0){return null;}
var p=this.parent;while(p.depth>depth){p=p.parent;}
return p;},getDepthStyle:function(depth){return(this.getAncestor(depth).nextSibling)?"ygtvdepthcell":"ygtvblankdepthcell";},getNodeHtml:function(){var sb=[];sb[sb.length]='<table id="ygtvtableel'+this.index+'"border="0" cellpadding="0" cellspacing="0" class="ygtvtable ygtvdepth'+this.depth;if(this.enableHighlight){sb[sb.length]=' ygtv-highlight'+this.highlightState;}
if(this.className){sb[sb.length]=' '+this.className;}
sb[sb.length]='"><tr class="ygtvrow">';for(var i=0;i<this.depth;++i){sb[sb.length]='<td class="ygtvcell '+this.getDepthStyle(i)+'"><div class="ygtvspacer"></div></td>';}
if(this.hasIcon){sb[sb.length]='<td id="'+this.getToggleElId();sb[sb.length]='" class="ygtvcell ';sb[sb.length]=this.getStyle();sb[sb.length]='"><a href="#" class="ygtvspacer">&#160;</a></td>';}
sb[sb.length]='<td id="'+this.contentElId;sb[sb.length]='" class="ygtvcell ';sb[sb.length]=this.contentStyle+' ygtvcontent" ';sb[sb.length]=(this.nowrap)?' nowrap="nowrap" ':'';sb[sb.length]=' >';sb[sb.length]=this.getContentHtml();sb[sb.length]='</td></tr></table>';return sb.join("");},getContentHtml:function(){return"";},refresh:function(){this.getChildrenEl().innerHTML=this.completeRender();if(this.hasIcon){var el=this.getToggleEl();if(el){el.className=el.className.replace(/\bygtv[lt][nmp]h*\b/gi,this.getStyle());}}},toString:function(){return this._type+" ("+this.index+")";},_focusHighlightedItems:[],_focusedItem:null,_canHaveFocus:function(){return this.getEl().getElementsByTagName('a').length>0;},_removeFocus:function(){if(this._focusedItem){Event.removeListener(this._focusedItem,'blur');this._focusedItem=null;}
var el;while((el=this._focusHighlightedItems.shift())){Dom.removeClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);}},focus:function(){var focused=false,self=this;if(this.tree.currentFocus){this.tree.currentFocus._removeFocus();}
var expandParent=function(node){if(node.parent){expandParent(node.parent);node.parent.expand();}};expandParent(this);Dom.getElementsBy(function(el){return(/ygtv(([tl][pmn]h?)|(content))/).test(el.className);},'td',self.getEl().firstChild,function(el){Dom.addClass(el,YAHOO.widget.TreeView.FOCUS_CLASS_NAME);if(!focused){var aEl=el.getElementsByTagName('a');if(aEl.length){aEl=aEl[0];aEl.focus();self._focusedItem=aEl;Event.on(aEl,'blur',function(){self.tree.fireEvent('focusChanged',{oldNode:self.tree.currentFocus,newNode:null});self.tree.currentFocus=null;self._removeFocus();});focused=true;}}
self._focusHighlightedItems.push(el);});if(focused){this.tree.fireEvent('focusChanged',{oldNode:this.tree.currentFocus,newNode:this});this.tree.currentFocus=this;}else{this.tree.fireEvent('focusChanged',{oldNode:self.tree.currentFocus,newNode:null});this.tree.currentFocus=null;this._removeFocus();}
return focused;},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count+1;},getNodeDefinition:function(){if(this.isDynamic()){return false;}
var def,defs=Lang.merge(this.data),children=[];if(this.expanded){defs.expanded=this.expanded;}
if(!this.multiExpand){defs.multiExpand=this.multiExpand;}
if(!this.renderHidden){defs.renderHidden=this.renderHidden;}
if(!this.hasIcon){defs.hasIcon=this.hasIcon;}
if(this.nowrap){defs.nowrap=this.nowrap;}
if(this.className){defs.className=this.className;}
if(this.editable){defs.editable=this.editable;}
if(this.enableHighlight){defs.enableHighlight=this.enableHighlight;}
if(this.highlightState){defs.highlightState=this.highlightState;}
if(this.propagateHighlightUp){defs.propagateHighlightUp=this.propagateHighlightUp;}
if(this.propagateHighlightDown){defs.propagateHighlightDown=this.propagateHighlightDown;}
defs.type=this._type;for(var i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
children.push(def);}
if(children.length){defs.children=children;}
return defs;},getToggleLink:function(){return'return false;';},setNodesProperty:function(name,value,refresh){if(name.charAt(0)!='_'&&!Lang.isUndefined(this[name])&&!Lang.isFunction(this[name])){this[name]=value;}else{this.data[name]=value;}
for(var i=0;i<this.children.length;i++){this.children[i].setNodesProperty(name,value);}
if(refresh){this.refresh();}},toggleHighlight:function(){if(this.enableHighlight){if(this.highlightState==1){this.unhighlight();}else{this.highlight();}}},highlight:function(_silent){if(this.enableHighlight){if(this.tree.singleNodeHighlight){if(this.tree._currentlyHighlighted){this.tree._currentlyHighlighted.unhighlight();}
this.tree._currentlyHighlighted=this;}
this.highlightState=1;this._setHighlightClassName();if(!this.tree.singleNodeHighlight){if(this.propagateHighlightDown){for(var i=0;i<this.children.length;i++){this.children[i].highlight(true);}}
if(this.propagateHighlightUp){if(this.parent){this.parent._childrenHighlighted();}}}
if(!_silent){this.tree.fireEvent('highlightEvent',this);}}},unhighlight:function(_silent){if(this.enableHighlight){this.tree._currentlyHighlighted=null;this.highlightState=0;this._setHighlightClassName();if(!this.tree.singleNodeHighlight){if(this.propagateHighlightDown){for(var i=0;i<this.children.length;i++){this.children[i].unhighlight(true);}}
if(this.propagateHighlightUp){if(this.parent){this.parent._childrenHighlighted();}}}
if(!_silent){this.tree.fireEvent('highlightEvent',this);}}},_childrenHighlighted:function(){var yes=false,no=false;if(this.enableHighlight){for(var i=0;i<this.children.length;i++){switch(this.children[i].highlightState){case 0:no=true;break;case 1:yes=true;break;case 2:yes=no=true;break;}}
if(yes&&no){this.highlightState=2;}else if(yes){this.highlightState=1;}else{this.highlightState=0;}
this._setHighlightClassName();if(this.propagateHighlightUp){if(this.parent){this.parent._childrenHighlighted();}}}},_setHighlightClassName:function(){var el=Dom.get('ygtvtableel'+this.index);if(el){el.className=el.className.replace(/\bygtv-highlight\d\b/gi,'ygtv-highlight'+this.highlightState);}}};YAHOO.augment(YAHOO.widget.Node,YAHOO.util.EventProvider);})();YAHOO.widget.RootNode=function(oTree){this.init(null,null,true);this.tree=oTree;};YAHOO.extend(YAHOO.widget.RootNode,YAHOO.widget.Node,{_type:"RootNode",getNodeHtml:function(){return"";},toString:function(){return this._type;},loadComplete:function(){this.tree.draw();},getNodeCount:function(){for(var i=0,count=0;i<this.children.length;i++){count+=this.children[i].getNodeCount();}
return count;},getNodeDefinition:function(){for(var def,defs=[],i=0;i<this.children.length;i++){def=this.children[i].getNodeDefinition();if(def===false){return false;}
defs.push(def);}
return defs;},collapse:function(){},expand:function(){},getSiblings:function(){return null;},focus:function(){}});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.TextNode=function(oData,oParent,expanded){if(oData){if(Lang.isString(oData)){oData={label:oData};}
this.init(oData,oParent,expanded);this.setUpLabel(oData);}};YAHOO.extend(YAHOO.widget.TextNode,YAHOO.widget.Node,{labelStyle:"ygtvlabel",labelElId:null,label:null,title:null,href:null,target:"_self",_type:"TextNode",setUpLabel:function(oData){if(Lang.isString(oData)){oData={label:oData};}else{if(oData.style){this.labelStyle=oData.style;}}
this.label=oData.label;this.labelElId="ygtvlabelel"+this.index;},getLabelEl:function(){return Dom.get(this.labelElId);},getContentHtml:function(){var sb=[];sb[sb.length]=this.href?'<a':'<span';sb[sb.length]=' id="'+this.labelElId+'"';sb[sb.length]=' class="'+this.labelStyle+'"';if(this.href){sb[sb.length]=' href="'+this.href+'"';sb[sb.length]=' target="'+this.target+'"';}
if(this.title){sb[sb.length]=' title="'+this.title+'"';}
sb[sb.length]=' >';sb[sb.length]=this.label;sb[sb.length]=this.href?'</a>':'</span>';return sb.join("");},getNodeDefinition:function(){var def=YAHOO.widget.TextNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.label=this.label;if(this.labelStyle!='ygtvlabel'){def.style=this.labelStyle;}
if(this.title){def.title=this.title;}
if(this.href){def.href=this.href;}
if(this.target!='_self'){def.target=this.target;}
return def;},toString:function(){return YAHOO.widget.TextNode.superclass.toString.call(this)+": "+this.label;},onLabelClick:function(){return false;},refresh:function(){YAHOO.widget.TextNode.superclass.refresh.call(this);var label=this.getLabelEl();label.innerHTML=this.label;if(label.tagName.toUpperCase()=='A'){label.href=this.href;label.target=this.target;}}});})();YAHOO.widget.MenuNode=function(oData,oParent,expanded){YAHOO.widget.MenuNode.superclass.constructor.call(this,oData,oParent,expanded);this.multiExpand=false;};YAHOO.extend(YAHOO.widget.MenuNode,YAHOO.widget.TextNode,{_type:"MenuNode"});(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event;YAHOO.widget.HTMLNode=function(oData,oParent,expanded,hasIcon){if(oData){this.init(oData,oParent,expanded);this.initContent(oData,hasIcon);}};YAHOO.extend(YAHOO.widget.HTMLNode,YAHOO.widget.Node,{contentStyle:"ygtvhtml",html:null,_type:"HTMLNode",initContent:function(oData,hasIcon){this.setHtml(oData);this.contentElId="ygtvcontentel"+this.index;if(!Lang.isUndefined(hasIcon)){this.hasIcon=hasIcon;}},setHtml:function(o){this.html=(typeof o==="string")?o:o.html;var el=this.getContentEl();if(el){el.innerHTML=this.html;}},getContentHtml:function(){return this.html;},getNodeDefinition:function(){var def=YAHOO.widget.HTMLNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
def.html=this.html;return def;}});})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,Calendar=YAHOO.widget.Calendar;YAHOO.widget.DateNode=function(oData,oParent,expanded){YAHOO.widget.DateNode.superclass.constructor.call(this,oData,oParent,expanded);};YAHOO.extend(YAHOO.widget.DateNode,YAHOO.widget.TextNode,{_type:"DateNode",calendarConfig:null,fillEditorContainer:function(editorData){var cal,container=editorData.inputContainer;if(Lang.isUndefined(Calendar)){Dom.replaceClass(editorData.editorPanel,'ygtv-edit-DateNode','ygtv-edit-TextNode');YAHOO.widget.DateNode.superclass.fillEditorContainer.call(this,editorData);return;}
if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=false;editorData.node.destroyEditorContents(editorData);editorData.inputObject=cal=new Calendar(container.appendChild(document.createElement('div')));if(this.calendarConfig){cal.cfg.applyConfig(this.calendarConfig,true);cal.cfg.fireQueue();}
cal.selectEvent.subscribe(function(){this.tree._closeEditor(true);},this,true);}else{cal=editorData.inputObject;}
editorData.oldValue=this.label;cal.cfg.setProperty("selected",this.label,false);var delim=cal.cfg.getProperty('DATE_FIELD_DELIMITER');var pageDate=this.label.split(delim);cal.cfg.setProperty('pagedate',pageDate[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]+delim+pageDate[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]);cal.cfg.fireQueue();cal.render();cal.oDomContainer.focus();},getEditorValue:function(editorData){if(Lang.isUndefined(Calendar)){return editorData.inputElement.value;}else{var cal=editorData.inputObject,date=cal.getSelectedDates()[0],dd=[];dd[cal.cfg.getProperty('MDY_DAY_POSITION')-1]=date.getDate();dd[cal.cfg.getProperty('MDY_MONTH_POSITION')-1]=date.getMonth()+1;dd[cal.cfg.getProperty('MDY_YEAR_POSITION')-1]=date.getFullYear();return dd.join(cal.cfg.getProperty('DATE_FIELD_DELIMITER'));}},displayEditedValue:function(value,editorData){var node=editorData.node;node.label=value;node.getLabelEl().innerHTML=value;},getNodeDefinition:function(){var def=YAHOO.widget.DateNode.superclass.getNodeDefinition.call(this);if(def===false){return false;}
if(this.calendarConfig){def.calendarConfig=this.calendarConfig;}
return def;}});})();(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang,Event=YAHOO.util.Event,TV=YAHOO.widget.TreeView,TVproto=TV.prototype;TV.editorData={active:false,whoHasIt:null,nodeType:null,editorPanel:null,inputContainer:null,buttonsContainer:null,node:null,saveOnEnter:true,oldValue:undefined};TVproto.validator=null;TVproto._initEditor=function(){this.createEvent("editorSaveEvent",this);this.createEvent("editorCancelEvent",this);};TVproto._nodeEditing=function(node){if(node.fillEditorContainer&&node.editable){var ed,topLeft,buttons,button,editorData=TV.editorData;editorData.active=true;editorData.whoHasIt=this;if(!editorData.nodeType){editorData.editorPanel=ed=document.body.appendChild(document.createElement('div'));Dom.addClass(ed,'ygtv-label-editor');buttons=editorData.buttonsContainer=ed.appendChild(document.createElement('div'));Dom.addClass(buttons,'ygtv-button-container');button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvok');button.innerHTML=' ';button=buttons.appendChild(document.createElement('button'));Dom.addClass(button,'ygtvcancel');button.innerHTML=' ';Event.on(buttons,'click',function(ev){var target=Event.getTarget(ev);var node=TV.editorData.node;if(Dom.hasClass(target,'ygtvok')){Event.stopEvent(ev);this._closeEditor(true);}
if(Dom.hasClass(target,'ygtvcancel')){Event.stopEvent(ev);this._closeEditor(false);}},this,true);editorData.inputContainer=ed.appendChild(document.createElement('div'));Dom.addClass(editorData.inputContainer,'ygtv-input');Event.on(ed,'keydown',function(ev){var editorData=TV.editorData,KEY=YAHOO.util.KeyListener.KEY;switch(ev.keyCode){case KEY.ENTER:Event.stopEvent(ev);if(editorData.saveOnEnter){this._closeEditor(true);}
break;case KEY.ESCAPE:Event.stopEvent(ev);this._closeEditor(false);break;}},this,true);}else{ed=editorData.editorPanel;}
editorData.node=node;if(editorData.nodeType){Dom.removeClass(ed,'ygtv-edit-'+editorData.nodeType);}
Dom.addClass(ed,' ygtv-edit-'+node._type);topLeft=Dom.getXY(node.getContentEl());Dom.setStyle(ed,'left',topLeft[0]+'px');Dom.setStyle(ed,'top',topLeft[1]+'px');Dom.setStyle(ed,'display','block');ed.focus();node.fillEditorContainer(editorData);return true;}};TVproto.onEventEditNode=function(oArgs){if(oArgs instanceof YAHOO.widget.Node){oArgs.editNode();}else if(oArgs.node instanceof YAHOO.widget.Node){oArgs.node.editNode();}};TVproto._closeEditor=function(save){var ed=TV.editorData,node=ed.node,close=true;if(save){close=ed.node.saveEditorValue(ed)!==false;}else{this.fireEvent('editorCancelEvent',node);}
if(close){Dom.setStyle(ed.editorPanel,'display','none');ed.active=false;node.focus();}};TVproto._destroyEditor=function(){var ed=TV.editorData;if(ed&&ed.nodeType&&(!ed.active||ed.whoHasIt===this)){Event.removeListener(ed.editorPanel,'keydown');Event.removeListener(ed.buttonContainer,'click');ed.node.destroyEditorContents(ed);document.body.removeChild(ed.editorPanel);ed.nodeType=ed.editorPanel=ed.inputContainer=ed.buttonsContainer=ed.whoHasIt=ed.node=null;ed.active=false;}};var Nproto=YAHOO.widget.Node.prototype;Nproto.editable=false;Nproto.editNode=function(){this.tree._nodeEditing(this);};Nproto.fillEditorContainer=null;Nproto.destroyEditorContents=function(editorData){Event.purgeElement(editorData.inputContainer,true);editorData.inputContainer.innerHTML='';};Nproto.saveEditorValue=function(editorData){var node=editorData.node,value,validator=node.tree.validator;value=this.getEditorValue(editorData);if(Lang.isFunction(validator)){value=validator(value,editorData.oldValue,node);if(Lang.isUndefined(value)){return false;}}
if(this.tree.fireEvent('editorSaveEvent',{newValue:value,oldValue:editorData.oldValue,node:node})!==false){this.displayEditedValue(value,editorData);}};Nproto.getEditorValue=function(editorData){};Nproto.displayEditedValue=function(value,editorData){};var TNproto=YAHOO.widget.TextNode.prototype;TNproto.fillEditorContainer=function(editorData){var input;if(editorData.nodeType!=this._type){editorData.nodeType=this._type;editorData.saveOnEnter=true;editorData.node.destroyEditorContents(editorData);editorData.inputElement=input=editorData.inputContainer.appendChild(document.createElement('input'));}else{input=editorData.inputElement;}
editorData.oldValue=this.label;input.value=this.label;input.focus();input.select();};TNproto.getEditorValue=function(editorData){return editorData.inputElement.value;};TNproto.displayEditedValue=function(value,editorData){var node=editorData.node;node.label=value;node.getLabelEl().innerHTML=value;};TNproto.destroyEditorContents=function(editorData){editorData.inputContainer.innerHTML='';};})();YAHOO.widget.TVAnim=function(){return{FADE_IN:"TVFadeIn",FADE_OUT:"TVFadeOut",getAnim:function(type,el,callback){if(YAHOO.widget[type]){return new YAHOO.widget[type](el,callback);}else{return null;}},isValid:function(type){return(YAHOO.widget[type]);}};}();YAHOO.widget.TVFadeIn=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeIn.prototype={animate:function(){var tvanim=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(){tvanim.onComplete();});a.animate();},onComplete:function(){this.callback();},toString:function(){return"TVFadeIn";}};YAHOO.widget.TVFadeOut=function(el,callback){this.el=el;this.callback=callback;};YAHOO.widget.TVFadeOut.prototype={animate:function(){var tvanim=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(){tvanim.onComplete();});a.animate();},onComplete:function(){var s=this.el.style;s.display="none";s.filter="alpha(opacity=100)";this.callback();},toString:function(){return"TVFadeOut";}};YAHOO.register("treeview",YAHOO.widget.TreeView,{version:"@VERSION@",build:"@BUILD@"});