/* Parts Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
var YAHOO=function(){return{util:{},widget:{},example:{},namespace:function(a){if(!a||!a.length)return null;for(var a=a.split("."),b=YAHOO,c=a[0]=="YAHOO"?1:0;c<a.length;++c)b[a[c]]=b[a[c]]||{},b=b[a[c]];return b}}}();YAHOO.widget.TreeView=function(a){a&&this.init(a)};YAHOO.widget.TreeView.nodeCount=0;
YAHOO.widget.TreeView.prototype={id:null,_nodes:null,locked:!1,_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(a){if(this._expandAnim&&this._animCount<this.maxAnim){var b=this;if(a=YAHOO.widget.TVAnim.getAnim(this._expandAnim,a,function(){b.expandComplete()}))++this._animCount,a.animate();return!0}return!1},
animateCollapse:function(a){if(this._collapseAnim&&this._animCount<this.maxAnim){var b=this;if(a=YAHOO.widget.TVAnim.getAnim(this._collapseAnim,a,function(){b.collapseComplete()}))++this._animCount,a.animate();return!0}return!1},expandComplete:function(){--this._animCount},collapseComplete:function(){--this._animCount},init:function(a){this.id=a;this._nodes=[];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=!1},regNode:function(a){this._nodes[a.index]=a},getRoot:function(){return this.root},setDynamicLoad:function(a){this.root.setDynamicLoad(a)},expandAll:function(){this.locked||this.root.expandAll()},collapseAll:function(){this.locked||this.root.collapseAll()},getNodeByIndex:function(a){return(a=this._nodes[a])?a:null},getNodeByProperty:function(a,b){for(var c in this._nodes){var d=this._nodes[c];if(d.data&&b==d.data[a])return d}return null},onExpand:function(){},onCollapse:function(){}};
YAHOO.widget.TreeView.trees=[];YAHOO.widget.TreeView.getTree=function(a){return(a=YAHOO.widget.TreeView.trees[a])?a:null};YAHOO.widget.TreeView.getNode=function(a,b){var c=YAHOO.widget.TreeView.getTree(a);return c?c.getNodeByIndex(b):null};YAHOO.widget.TreeView.addHandler=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d?!0:!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c};
YAHOO.widget.TreeView.preload=function(){for(var a=["ygtvtn","ygtvtm","ygtvtmh","ygtvtp","ygtvtph","ygtvln","ygtvlm","ygtvlmh","ygtvlp","ygtvlph","ygtvloading"],b=[],c=0;c<a.length;++c)b[b.length]='<span class="'+a[c]+'">&nbsp;</span>';a=document.createElement("div");c=a.style;c.position="absolute";c.top="-1000px";c.left="-1000px";a.innerHTML=b.join("");document.body.appendChild(a)};YAHOO.widget.TreeView.addHandler(window,"load",YAHOO.widget.TreeView.preload);
YAHOO.widget.Node=function(a,b,c){b&&this.init(a,b,c)};
YAHOO.widget.Node.prototype={index:0,children:null,tree:null,data:null,parent:null,depth:-1,href:null,target:"_self",expanded:!1,multiExpand:!0,renderHidden:!1,childrenRendered:!1,previousSibling:null,nextSibling:null,_dynLoad:!1,dataLoader:null,isLoading:!1,hasIcon:!0,init:function(a,b,c){this.data=a;this.children=[];this.index=YAHOO.widget.TreeView.nodeCount;++YAHOO.widget.TreeView.nodeCount;this.expanded=c;if(b)this.tree=b.tree,this.parent=b,this.href="javascript:"+this.getToggleLink(),this.depth=
b.depth+1,this.multiExpand=b.multiExpand,b.appendChild(this)},appendChild:function(a){if(this.hasChildren()){var b=this.children[this.children.length-1];b.nextSibling=a;a.previousSibling=b}this.tree.regNode(a);return this.children[this.children.length]=a},getSiblings:function(){return this.parent.children},showChildren:function(){if(!this.tree.animateExpand(this.getChildrenEl())&&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)if(this.getEl()){this.hideChildren();
this.expanded=!1;if(this.hasIcon)this.getToggleEl().className=this.getStyle();this.tree.onCollapse(this)}else this.expanded=!1},expand:function(){if(!this.expanded)if(this.getEl()){if(!this.childrenRendered)this.getChildrenEl().innerHTML=this.renderChildren();this.expanded=!0;if(this.hasIcon)this.getToggleEl().className=this.getStyle();if(this.isLoading)this.expanded=!1;else{if(!this.multiExpand)for(var a=this.getSiblings(),b=0;b<a.length;++b)a[b]!=this&&a[b].expanded&&a[b].collapse();this.showChildren();
this.tree.onExpand(this)}}else this.expanded=!0},getStyle:function(){if(this.isLoading)return"ygtvloading";else{var a=this.nextSibling?"t":"l",b="n";if(this.hasChildren(!0)||this.isDynamic())b=this.expanded?"m":"p";return"ygtv"+a+b}},getHoverStyle:function(){var a=this.getStyle();this.hasChildren(!0)&&!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)b.expand(),
b.expandAll();else{alert("Not supported (no multi-expand + expand all)");break}}},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=!0},isRoot:function(){return this==this.tree.root},isDynamic:function(){return!this.isRoot()&&(this._dynLoad||this.tree.root._dynLoad)},hasChildren:function(a){return this.children.length>0||a&&this.isDynamic()&&!this.childrenRendered},toggle:function(){if(!this.tree.locked&&
(this.hasChildren(!0)||this.isDynamic()))this.expanded?this.collapse():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()+'"';this.expanded||(a[a.length]=' style="display:none;"');a[a.length]=">";this.hasChildren(!0)&&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=!0;this.tree.locked=!0;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(){for(var a=[],b=0;b<this.children.length;++b)a[a.length]=this.children[b].getHtml();this.childrenRendered=!0;return a.join("")},loadComplete:function(){this.getChildrenEl().innerHTML=this.completeRender();this.isLoading=!1;this.expand();this.tree.locked=!1},getAncestor:function(a){if(a>=this.depth||a<0)return null;for(var b=this.parent;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,!0);this.tree=a};YAHOO.widget.RootNode.prototype=new YAHOO.widget.Node;YAHOO.widget.RootNode.prototype.getNodeHtml=function(){return""};YAHOO.widget.TextNode=function(a,b,c){b&&(this.init(a,b,c),this.setUpLabel(a))};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){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 a=[];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>';var b="YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+")";a[a.length]="<td";a[a.length]=' id="'+this.getToggleElId()+'"';a[a.length]=' class="'+this.getStyle()+'"';this.hasChildren(!0)&&(a[a.length]=' onmouseover="this.className=',a[a.length]=b+'.getHoverStyle()"',
a[a.length]=' onmouseout="this.className=',a[a.length]=b+'.getStyle()"');a[a.length]=' onclick="javascript:'+this.getToggleLink()+'">&nbsp;';a[a.length]="</td>";a[a.length]="<td>";a[a.length]="<a";a[a.length]=' id="'+this.labelElId+'"';a[a.length]=' class="'+this.labelStyle+'"';a[a.length]=' href="'+this.href+'"';a[a.length]=' target="'+this.target+'"';this.hasChildren(!0)&&(a[a.length]=" onmouseover=\"document.getElementById('",a[a.length]=this.getToggleElId()+"').className=",a[a.length]=b+'.getHoverStyle()"',
a[a.length]=" onmouseout=\"document.getElementById('",a[a.length]=this.getToggleElId()+"').className=",a[a.length]=b+'.getStyle()"');a[a.length]=" >";a[a.length]=this.label;a[a.length]="</a>";a[a.length]="</td>";a[a.length]="</tr>";a[a.length]="</table>";return a.join("")};YAHOO.widget.MenuNode=function(a,b,c){b&&(this.init(a,b,c),this.setUpLabel(a));this.multiExpand=!1};YAHOO.widget.MenuNode.prototype=new YAHOO.widget.TextNode;
YAHOO.widget.HTMLNode=function(a,b,c,d){b&&(this.init(a,b,c),this.initContent(a,d))};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(a,b){typeof a=="string"&&(a={html:a});this.html=a.html;this.contentElId="ygtvcontentel"+this.index;this.hasIcon=b};
YAHOO.widget.HTMLNode.prototype.getContentEl=function(){return document.getElementById(this.contentElId)};
YAHOO.widget.HTMLNode.prototype.getNodeHtml=function(){var a=[];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>';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;',this.hasChildren(!0)&&(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(a,b,c){switch(a){case this.FADE_IN:return new YAHOO.widget.TVFadeIn(b,c);case this.FADE_OUT:return new YAHOO.widget.TVFadeOut(b,c);default:return null}};this.isValid=function(a){return"undefined"!=eval("typeof "+a)}};YAHOO.widget.TVFadeIn=function(a,b){this.el=a;this.callback=b};
YAHOO.widget.TVFadeIn.prototype={animate:function(){var a=this,b=this.el.style;b.opacity=0.1;b.filter="alpha(opacity=10)";b.display="";b=new YAHOO.util.Anim(this.el,{opacity:{from:0.1,to:1,unit:""}},0.4);b.onComplete.subscribe(function(){a.onComplete()});b.animate()},onComplete:function(){this.callback()}};YAHOO.widget.TVFadeOut=function(a,b){this.el=a;this.callback=b};
YAHOO.widget.TVFadeOut.prototype={animate:function(){var a=this,b=new YAHOO.util.Anim(this.el,{opacity:{from:1,to:0.1,unit:""}},0.4);b.onComplete.subscribe(function(){a.onComplete()});b.animate()},onComplete:function(){var a=this.el.style;a.display="none";a.filter="alpha(opacity=100)";this.callback()}};var DLEGEND_CLICK=1,DLEGEND_CHECKSTYLE="check",DLEGEND_RADIOSTYLE="radio";dLegend.prototype=new YAHOO.widget.TreeView;
dLegend.prototype.setHandler=function(a,b){if(a==DLEGEND_CLICK)this.onClickHandler=b};
function dLegend(){function a(a,c){function d(a,b){for(var c=new LegendMetagroup(b,a),f=0;f<a.layers_and_groups.length;f++){var e=a.layers_and_groups[f];if(e.type=="metagroup")d(e,c);else if(e.type=="group")for(var j=new LegendLayer(c,e),g=0;g<e.layers.length;g++){var h=e.layers[g],k=new LegendLayer(j,h);if(h.classes)for(var l=0;l<h.classes.length;l++)new LegendClass(k,h.classes[l])}else if(e.type=="layer"&&(k=new LegendLayer(c,e),e.classes))for(g=0;g<e.classes.length;g++)new LegendClass(k,e.classes[g])}}
for(var f=0;f<c.data.length;f++){var j=c.data[f];j.type=="metagroup"&&d(j,a.getRoot())}}this.initialize=function(b,c,d,f){this.init(b);this.executable=c.executable;this.mapfile=c.mapfile;this.iconurl=c.iconurl;this.imgtype=c.imgtype;d&&this.setHandler(DLEGEND_CLICK,d);this.dynamic_icons=typeof f=="boolean"?f:!1;a(this,c);this.draw();if(typeof c.collapsed_nodes!="undefined")for(b=0;b<c.collapsed_nodes.length;b++)this.collapse(c.collapsed_nodes[b]);if(typeof c.checked_nodes!="undefined")for(b=0;b<c.checked_nodes.length;b++)this.check(c.checked_nodes[b])}}
dLegend.prototype.changeNodeStatus=function(a,b){var c=this.getNodeById(a);if(c.noCheckbox==null||c.noCheckbox==!1)b==null?c.checked?c.uncheck():c.check():b==!0?c.check():b==!1&&c.uncheck()};dLegend.prototype.toggleCheck=function(a){this.changeNodeStatus(a)};dLegend.prototype.check=function(a){this.changeNodeStatus(a,!0)};dLegend.prototype.uncheck=function(a){this.changeNodeStatus(a,!1)};dLegend.prototype.checkAll=function(){for(var a=0;a<this.getRoot().children.length;a++)this.getRoot().children[a].check()};
dLegend.prototype.uncheckAll=function(){for(var a=0;a<this.getRoot().children.length;a++)this.getRoot().children[a].uncheck()};dLegend.prototype.changeNodeExpansion=function(a,b){var c=this.getNodeById(a);c!=null&&c.hasChildren()&&(b==null?c.toggle():b==!0?c.expand():b==!1&&c.collapse())};dLegend.prototype.toggleTree=function(a){this.changeNodeExpansion(a)};dLegend.prototype.expand=function(a){this.changeNodeExpansion(a,!0)};dLegend.prototype.collapse=function(a){this.changeNodeExpansion(a,!1)};
dLegend.prototype.getNodeById=function(a){for(var b=1;b<this._nodes.length;b++){var c=this._nodes[b];if(c.id==a)return c}return null};LegendNode=function(a,b,c,d){if(b)this.init(a,b,c),this.setUpLabel(a),(this.checked=d)&&this.check()};LegendMetagroup=function(a,b){var c=b.element;c||(c=DLEGEND_CHECKSTYLE);var d=b.label;this.type=b.type;this.id=b.id;this.optionStyle=c;this.noCheckbox=!0;this.init(d,a,!0);this.setUpLabel(d)};
LegendLayer=function(a,b){this.type=b.type;this.id=b.id;this.icon_class=b.icon_class;if(b.minscaledenom)this.minscaledenom=b.minscaledenom;if(b.maxscaledenom)this.maxscaledenom=b.maxscaledenom;this.icon_class=b.icon_class;this.noCheckbox=b.type=="class"||a.type=="group";this.init(b.label,a,b.type=="group"||b.type=="layer"&&b.classes);this.setUpLabel(b.label)};
LegendClass=function(a,b){this.type=b.type;this.noCheckbox=!0;this.icon_class=b.icon_class;if(b.minscaledenom)this.minscaledenom=b.minscaledenom;if(b.maxscaledenom)this.maxscaledenom=b.maxscaledenom;this.init(b.label,a,!1);this.setUpLabel(b.label)};LegendNode.prototype=new YAHOO.widget.TextNode;LegendNode.prototype.noCheckbox=!1;LegendNode.prototype.checkState=0;LegendNode.prototype.checked=!1;LegendNode.prototype.hasLegendIcon=function(){return typeof this.icon_class=="undefined"?!1:!0};
LegendMetagroup.prototype=new LegendNode;LegendMetagroup.prototype.className="LegendMetagroup";LegendLayer.prototype=new LegendNode;LegendLayer.prototype.minscaledenom=0;LegendLayer.prototype.maxscaledenom=0;LegendLayer.prototype.className="LegendLayer";LegendLayer.prototype.getRootOptionStyle=function(){var a=this.parent;if(a&&a.getRootOptionStyle)return a.getRootOptionStyle();if(a&&a.optionStyle)return a.optionStyle;if(this.optionStyle)return this.optionStyle};LegendClass.prototype=new LegendNode;
LegendClass.prototype.className="LegendClass";LegendNode.prototype.getCheckElId=function(){return"ygtvcheck"+this.index};LegendNode.prototype.getRadioElId=function(){return"ygtvcheck"+this.index};LegendNode.prototype.getLegendIconImgId=function(){return"legend_icon"+this.index};LegendNode.prototype.getCheckEl=function(){return document.getElementById(this.getCheckElId())};LegendNode.prototype.getRadioEl=function(){return document.getElementById(this.getRadioElId())};
LegendNode.prototype.getLegendIconImg=function(){return document.getElementById(this.getLegendIconImgId())};LegendNode.prototype.getCheckStyle=function(){return"ygtvcheck"+this.checkState};LegendNode.prototype.getRadioStyle=function(){return"ygtvcheck"+this.checkState};LegendNode.prototype.getCheckLink=function(){return"YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+").checkClick(); "};
LegendNode.prototype.getRadioLink=function(){return"YAHOO.widget.TreeView.getNode('"+this.tree.id+"',"+this.index+").radioClick()"};
LegendNode.prototype.getNodeHtml=function(){var a=[];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>';a[a.length]="<td";a[a.length]=' id="'+this.getToggleElId()+'"';a[a.length]=' class="'+this.getStyle()+'"';this.hasChildren(!0)&&(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]=' onclick="javascript:'+this.getToggleLink()+'">&nbsp;';a[a.length]="</td>";var b="none";this.optionStyle&&this.optionStyle==DLEGEND_CHECKSTYLE||this.getRootOptionStyle&&this.getRootOptionStyle()==DLEGEND_CHECKSTYLE?this.noCheckbox?(a[a.length]="<td",a[a.length]=' id="'+this.getCheckElId()+'"',a[a.length]=" ></td>"):(b="check",a[a.length]="<td",
a[a.length]=' id="'+this.getCheckElId()+'"',a[a.length]=' class="'+this.getCheckStyle()+'"',a[a.length]=' onclick="javascript:'+this.getCheckLink()+'">',a[a.length]="&nbsp;</td>"):this.noCheckbox||(b="radio",a[a.length]="<td",a[a.length]=' id="'+this.getRadioElId()+'"',a[a.length]=' class="'+this.getRadioStyle()+'"',a[a.length]=' onclick="javascript:'+this.getRadioLink()+'">',a[a.length]="&nbsp;</td>");a[a.length]="<td>";a[a.length]="<a";a[a.length]=' id="'+this.labelElId+'"';a[a.length]=' class="'+
this.labelStyle+'"';a[a.length]=b=="check"?' href="javascript:'+this.getCheckLink()+'"':b=="radio"?' href="javascript:'+this.getRadioLink()+'"':' href="'+this.href+'"';a[a.length]=' target="'+this.target+'"';this.hasChildren(!0)&&(a[a.length]=" onmouseover=\"document.getElementById('",a[a.length]=this.getToggleElId()+"').className=",a[a.length]="YAHOO.widget.TreeView.getNode('",a[a.length]=this.tree.id+"',"+this.index+').getHoverStyle()"',a[a.length]=" onmouseout=\"document.getElementById('",a[a.length]=
this.getToggleElId()+"').className=",a[a.length]="YAHOO.widget.TreeView.getNode('",a[a.length]=this.tree.id+"',"+this.index+').getStyle()"');a[a.length]=" >";a[a.length]=this.getLegendIconImgTag()+this.label;a[a.length]="</a>";a[a.length]="</td>";a[a.length]="</tr>";a[a.length]="</table>";return a.join("")};
LegendNode.prototype.updateMetagroup=function(){if(this.parent&&this.parent.className=="LegendMetagroup"){node=this.parent;for(var a=!1,b=!1,c=0;c<node.children.length;++c)node.children[c].checked?(a=!0,node.children[c].checkState==1&&(b=!0)):b=!0;a?node.setCheckState(b?1:2):node.setCheckState(0);node.updateMetagroup()}};
LegendNode.prototype.updateStyling=function(){if(!this.noCheckbox)this.getCheckEl().className=this.getCheckStyle(),this.performCallback();this.outOfScale?this.outOfScaleTextStyle():this.inScaleTextStyle()};LegendNode.prototype.performCallback=function(){if(this.className=="LegendLayer"&&this.tree.onClickHandler&&this.checkState!=1)this.tree.onClickHandler(this.id,this.checkState==2||this.checkState==4?!0:!1)};
LegendNode.prototype.inScaleTextStyle=function(){if(label=document.getElementById(this.labelElId))label.className="ygtvlabel"};LegendNode.prototype.outOfScaleTextStyle=function(){if(label=document.getElementById(this.labelElId))label.className="disablednode"};LegendNode.prototype.getLegendIconImgTag=function(){var a="";this.hasLegendIcon()&&(a="<img id='"+this.getLegendIconImgId()+"' class='keyimg' src='"+this.getLegendIconImgSrc()+"' align='absmiddle' />&nbsp;");return a};
LegendNode.prototype.getLegendIconImgSrc=function(a,b){var c="";this.hasLegendIcon()&&(c=this.tree.iconurl==null?this.tree.executable+"?map="+this.tree.mapfile+"&mode=legendicon&icon="+this.icon_class:this.tree.iconurl+"/"+this.icon_class.replace(",","")+this.tree.imgtype,a&&(c+="&scaledenom="+a),b&&(c+="&mapext="+b.join("+")));return c};LegendNode.prototype.updateLegendIcon=function(a,b){this.getLegendIconImg().src=this.getLegendIconImgSrc(a,b)};
dLegend.prototype.update=function(a,b){for(var c in this._nodes){var d=this._nodes[c];this.dynamic_icons&&d.hasLegendIcon()&&d.updateLegendIcon(a,b);d.minscaledenom==0&&d.maxscaledenom==0||(a<=d.minscaledenom||a>=d.maxscaledenom?d.outOfScale||d.shiftOutOfScale():d.outOfScale&&d.shiftInScale())}};LegendNode.prototype.setCheckState=function(a){this.checkState=a;this.checked=a>0&&a!=3;this.outOfScale=a==3||a==4?!0:!1;this.updateStyling()};
LegendNode.prototype.checkClick=function(){this.checked==!0?this.uncheck():this.check()};LegendNode.prototype.check=function(){this.checkState==0||this.checkState==1?this.setCheckState(2):this.checkState==3&&this.setCheckState(4);for(var a=0;a<this.children.length;++a)this.children[a].check();this.updateMetagroup()};
LegendNode.prototype.uncheck=function(){this.checkState==1||this.checkState==2?this.setCheckState(0):this.checkState==4&&this.setCheckState(3);for(var a=0;a<this.children.length;++a)this.children[a].uncheck();this.updateMetagroup()};LegendNode.prototype.radioClick=function(){this.checked==!0?this.uncheck():this.radioSelect()};LegendNode.prototype.radioSelect=function(){for(var a=0;a<this.getSiblings().length;a++)this.getSiblings()[a].uncheck();this.check()};
LegendNode.prototype.shiftOutOfScale=function(){function a(a){a.checkState==0?a.setCheckState(3):a.checkState==2&&a.setCheckState(4)}for(var b=0;b<this.children.length;++b)a(this.children[b]);a(this)};LegendNode.prototype.shiftInScale=function(){function a(a){a.checkState==3?a.setCheckState(0):a.checkState==4&&a.setCheckState(2)}for(var b=0;b<this.children.length;++b)a(this.children[b]);a(this)};

