var AviarcNavigation;(function(){var a={};AviarcNavigation=function(){AviarcNavigation.superclass.constructor.apply(this,arguments);var b={parentid:null,id:"root0",type:"root",name:null,children:[]};this.rootNodeID=b.id;this.treeStruct=[];this.itemWidth=150;this.itemsPerColumn=30;this.treeStruct[b.id]=b;b=null;this.selectedNode=null;this.container=null;if(a.root==undefined){a.root=this.rootNodeID}if(a.navigateEvent==undefined){a.navigateEvent="click"}this.currentClass="current"};YAHOO.lang.extend(AviarcNavigation,AviarcWidget,{startup:function(){this.container=document.getElementById(this.name+":div");this.datasetToTree(this.attributes.dataset);var b=this;this.showTree(this.container,this.rootNodeID);$(document).ready(function(){$("ul.sf-menu").superfish({animation:{height:"show"},delay:1200})})},getSelectedNode:function(){return this.selectedNode},datasetToTree:function(l){var d=dataset(l);if(d){var o=d.getRowCount(),g=0,f=null;while(g<o){var p=d.getRow(g),f={parentid:p.getField("parentid"),id:p.getField("type")+p.getField("itemid"),type:p.getField("type"),itemid:p.getField("itemid"),name:p.getField("name"),filename:p.getField("filename"),actiontype:p.getField("actiontype"),action:p.getField("action"),current:(p.getField("current").toLowerCase()=="y"),expand:(p.getField("expand").toLowerCase()=="y"),level:(p.getField("level")||0),code:(p.getField("code")||""),datarow:p,children:[]};this.treeStruct[f.id]=f;g++}}var b=d.getRowCount();var m=0;while(m<b){rowagain=d.getRow(m);var e=rowagain.getField("parentid");var c=rowagain.getField("type")+rowagain.getField("itemid");if(this.treeStruct[e]){var h=this.treeStruct[e].children.length;var n=false;if(h>0){var k=this.treeStruct[e].children;for(var j=0;j<h;j++){if(k[j]===c){n=true;break}}}if(!n){this.treeStruct[e].children.push(c)}}m++}return},render:function(b){var r=[];var h=0;var k=document.createElement("ul");k.className="sf-menu sf-vertical"+(b==a.root?"":" subnav");r.push(k);var f=this.treeStruct[b];var e=f.children.length;
var m=1;if(b!=a.root){m=parseInt(e/this.itemsPerColumn)+((e%this.itemsPerColumn)>0?1:0);if(m>1){r[0].style.width=(this.itemWidth*m)+"px";for(var g=1;g<m;g++){k=document.createElement("ul");k.style.width=(this.itemWidth*m)+"px";k.className="sf-menu sf-vertical"+(b==a.root?"":" subnav");k.style.cssText="display: none";r.push(k)}}}for(var p=0;p<e;p++){h=m>1?parseInt(p/this.itemsPerColumn):0;var c=this.treeStruct[f.children[p]];var o=document.createElement("a");var q=document.createElement("li");o.href=(c.action=="home"?"./":c.action);o.rel=c.id;o.setAttribute("itemid",c.itemid);o.setAttribute("itemname",c.name);o.setAttribute("itemtype",c.type);o.setAttribute("actiontype",c.actiontype);o.setAttribute("action",c.action);o.setAttribute("level",c.level);o.setAttribute("code",c.code);o.datarow=c.datarow;o.className=c.type;q.className=c.type;if(b!=a.root){o.href=c.action+"?"+(c.action=="product"?"productid":"categoryid")+"="+c.itemid;r[h].style.top="-999px";var t=document.createElement("span");t.className="subnav";t.innerHTML=c.name;o.appendChild(t);if(c.current){YAHOO.util.Dom.addClass(o,this.currentClass)}}else{var l=document.createElement("div");l.className=c.type+(c.current?" current":"");o.appendChild(l)}if(c.children.length>0){if(this.showExpandCollapse){var j=document.createElement("div");j.onclick=function(){$(this.nextSibling.nextSibling).trigger(a.expandEvent)};YAHOO.util.Dom.addClass(j,"collapsed");q.appendChild(j)}}if(this.showIcons){var n=document.createElement("div");n.className=c.type;n.onclick=function(){$(this.nextSibling).trigger(a.expandEvent)};q.appendChild(n)}q.appendChild(o);r[h].appendChild(q);if(c.children.length>0){if(true||c.expand){this.showTree(q,c.id);YAHOO.util.Dom.addClass(q,"expanded")}else{YAHOO.util.Dom.addClass(q,"collapsed")}}}return r},showTree:function(j,e){var g=this;$(j).addClass("wait");$(".jqueryFileTree.start").remove();var h=this.render(e);$(j).find(".start").html("");$(j).removeClass("wait");if(true||a.root==e){if(h.length>1){var f=$("<ul class='sf-menu sf-vertical"+(e==a.root?"":" subnav")+"'/>");
f.css({display:"none",width:(h.length*152)});var b=$("<li style='width:"+(h.length*152)+"px'/>");f.append(b);for(var d=0;d<h.length;d++){h[d].className="";$(h[d]).css({width:152,position:"relative",top:0,"float":"left",display:"block"})}b.append(h);b.append("<div style='clear:both'/>");$(j).append(f)}else{$(j).append(h)}$(j).find("UL:hidden").show()}}})})();

