/***

    hXUL Library 0.1.alpha

    Build $Thu, 27 Aug 2009 17:40:27 UTC$

    Copyright (c) 2007 Veer West LLC <contact@veerwest.com>.
    See: http://www.veerwest.com/hXUL/
***/
if(typeof (hXUL)=="undefined"){
hXUL={};
}
hXUL.NAME="hXUL";
hXUL.VERSION="0.1.alpha";
hXUL.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
hXUL.toString=function(){
return this.__repr__();
};
hXUL.Class={};
hXUL.Class.extend=function(_1,_2){
var _3=function(){
};
_3.prototype=_2.prototype;
_1.prototype=new _3();
_1.prototype.constructor=_1;
_1.prototype.superconstructor=_2;
_1.prototype.supertype=_2.prototype;
};
hXUL.hasSupportForXUL=function(){
if(hXUL.disableXULRendering==true){
return false;
}
if(navigator.userAgent&&navigator.userAgent.indexOf("Gecko/")!=-1){
return true;
}else{
return false;
}
};
hXUL.AssetManager={};
if(typeof (hXUL._aux)=="undefined"){
hXUL._aux={};
}
hXUL._aux.bind=function(_4,_5){
if(typeof (_4)=="string"){
_4=_5[_4];
}
var _6=null;
if(typeof (_4.im_func)=="function"){
_6=_4.im_func;
}else{
_6=_4;
}
_4=function(){
return _4.im_func.apply(_4.im_self,arguments);
};
_4.im_func=_6;
_4.im_self=_5;
return _4;
};
hXUL._aux.addEvent=function(_7,_8,fn){
if(!_7){
return;
}
if(_7.attachEvent){
_7["e"+_8+fn]=fn;
_7[_8+fn]=function(){
_7["e"+_8+fn](window.event);
};
_7.attachEvent("on"+_8,_7[_8+fn]);
}else{
if(_7.addEventListener){
_7.addEventListener(_8,fn,false);
}else{
var _a=_7["on"+_8];
if(_a){
_7["on"+_8]=function(e){
_a(e);
fn(e);
};
}else{
_7["on"+_8]=fn;
}
}
}
};
hXUL._aux.getEventSource=function(e){
if(!e){
e=window.event;
}
if(e.target){
var n=e.target;
}else{
var n=e.srcElement;
}
if(!n){
return null;
}
if(n.nodeType==3){
n=n.parentNode;
}
return n;
};
hXUL._aux.preventEvent=function(e){
if(!e){
e=window.event;
}
if(e.preventDefault){
e.preventDefault();
}else{
e.returnValue=false;
}
return false;
};
hXUL._aux.stopPropagation=function(e){
if(!e){
var e=window.event;
}
e.cancelBubble=true;
if(e.stopPropagation){
e.stopPropagation();
}
};
hXUL._aux.hasClass=function(_10,_11){
if(_10&&_10.className){
if((" "+_10.className+" ").indexOf(" "+_11+" ")!=-1){
return true;
}
}
return false;
};
hXUL._aux.getScreenCoordinates=function(_12){
var _13=curtop=0;
if(_12.offsetParent){
_13=_12.offsetLeft;
curtop=_12.offsetTop;
while(_12=_12.offsetParent){
_13+=_12.offsetLeft;
curtop+=_12.offsetTop;
}
}
return {x:_13,y:curtop};
};
hXUL._aux.getMouseCoordinates=function(e){
var _15=0;
var _16=0;
if(!e){
var e=window.event;
}
if(e.pageX||e.pageY){
_15=e.pageX;
_16=e.pageY;
}else{
if(e.clientX||e.clientY){
_15=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
_16=e.clientY+document.body.scrollTop+document.documentElement.scrollTop;
}
}
return {x:_15,y:_16};
};
hXUL.AssetManager.panels=[];
hXUL.AssetManager.createPanel=function(id,_18,_19){
var p=new hXUL.Panel(id,_18,_19,this.createPanelRenderer());
hXUL.AssetManager.panels.push(p);
return p;
};
hXUL.AssetManager.createPanelRenderer=function(){
if(hXUL.hasSupportForXUL()){
return new hXUL.Panel.Renderer.XULRenderer();
}else{
return new hXUL.Panel.Renderer.XHTMLRenderer();
}
};
hXUL.Panel=function(id,_1c,_1d,_1e){
this.id=id;
this.element=null;
this.tabs=_1c;
this._renderer=_1e;
this._renderer._panel=this;
this.setPlaceholder(_1d);
};
hXUL.Panel.prototype.setPlaceholder=function(_1f){
if(typeof _1f=="string"){
this.placeholder=document.getElementById(_1f);
}else{
this.placeholder=_1f;
}
};
hXUL.Panel.prototype.selectTab=function(tab){
if(typeof tab=="string"){
for(var i=0;i<this.tabs.length;i++){
if(this.tabs[i].title.toLowerCase()==tab.toLowerCase()){
tab=i;
break;
}
}
}
this._renderer.selectTab(tab);
};
hXUL.Panel.prototype.disableTab=function(tab){
if(typeof tab=="string"){
for(var i=0;i<this.tabs.length;i++){
if(this.tabs[i].title.toLowerCase()==tab.toLowerCase()){
tab=i;
break;
}
}
}
this._renderer.disableTab(tab);
};
hXUL.Panel.prototype.enableTab=function(tab){
if(typeof tab=="string"){
for(var i=0;i<this.tabs.length;i++){
if(this.tabs[i].title.toLowerCase()==tab.toLowerCase()){
tab=i;
break;
}
}
}
this._renderer.enableTab(tab);
};
hXUL.Panel.prototype.render=function(_26){
if(_26){
this.setPlaceholder(_26);
}
for(var i=0;i<this.tabs.length;i++){
if(!this.tabs[i].content){
this.tabs[i].content=document.createElement("div");
this.tabs[i].content.id=this.id+"-tabpanel-content"+i;
this.tabs[i].content.setAttribute("title",this.tabs[i].title);
}else{
if(!this.tabs[i].title&&this.tabs[i].content.getAttribute("title")){
this.tabs[i].title=this.tabs[i].content.getAttribute("title");
}
}
}
this._renderer.render(this);
};
hXUL.Panel.Renderer=function(){
};
hXUL.Panel.Renderer.XULRenderer=function(){
};
hXUL.Class.extend(hXUL.Panel.Renderer.XULRenderer,hXUL.Panel.Renderer);
hXUL.Panel.Renderer.XULRenderer.prototype.render=function(_28){
var _29=this.createTabBoxElement(_28.id);
var _2a=_29.appendChild(this.createTabsElement(_28.id));
var _2b=_29.appendChild(this.createTabPanelsElement(_28.id));
for(var i=0;i<_28.tabs.length;i++){
var _2d=_28.tabs[i].title;
_28.tabs[i].tab=_2a.appendChild(this.createTabElement(_28.id,i,_2d));
var _2e=_2b.appendChild(this.createTabPanelElement(_28.id,i));
_28.tabs[i].content=_2e.appendChild(_28.tabs[i].content);
}
_28.element=_28.placeholder.appendChild(_29);
};
hXUL.Panel.Renderer.XULRenderer.prototype.createTabBoxElement=function(_2f){
var _30=document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","tabbox");
_30.id=_2f+"-tabbox";
return _30;
};
hXUL.Panel.Renderer.XULRenderer.prototype.createTabsElement=function(_31){
var _32=document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","tabs");
_32.id=_31+"-tabs";
_32.setAttribute("setfocus","false");
return _32;
};
hXUL.Panel.Renderer.XULRenderer.prototype.createTabElement=function(_33,_34,_35){
var tab=document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","tab");
tab.id=_33+"-tab"+_34;
tab.setAttribute("label",_35);
return tab;
};
hXUL.Panel.Renderer.XULRenderer.prototype.createTabPanelsElement=function(_37){
var _38=document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","tabpanels");
_38.id=_37+"-tabpanels";
return _38;
};
hXUL.Panel.Renderer.XULRenderer.prototype.createTabPanelElement=function(_39,_3a){
var _3b=document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul","tabpanel");
_3b.id=_39+"-tabpanel"+_3a;
_3b.onselectstart=function(){
alert("ok");
};
return _3b;
};
hXUL.Panel.Renderer.XULRenderer.prototype.selectTab=function(_3c,_3d){
_3c.element.firstChild.selectedIndex=_3d;
};
hXUL.Panel.Renderer.XULRenderer.prototype.disableTab=function(_3e,_3f){
_3e.element.firstChild.childNodes[_3f].setAttribute("disabled","true");
};
hXUL.Panel.Renderer.XULRenderer.prototype.enableTab=function(_40,_41){
_40.element.firstChild.childNodes[_41].setAttribute("disabled","false");
};
hXUL.Panel.Renderer.XHTMLRenderer=function(){
};
hXUL.Class.extend(hXUL.Panel.Renderer.XHTMLRenderer,hXUL.Panel.Renderer);
hXUL.Panel.Renderer.XHTMLRenderer.prototype.render=function(){
var _42=this._panel;
var _43=this.createTabBoxElement(_42.id);
var _44=_43.appendChild(this.createTabsElement(_42.id));
var _45=_43.appendChild(this.createTabPanelsElement(_42.id));
for(var i=0;i<_42.tabs.length;i++){
var _47=_42.tabs[i].title;
_42.tabs[i].tab=_44.appendChild(this.createTabElement(_42.id,i,_47));
_42.tabs[i].tab.onclick=function(n){
_42.selectTab(this.getAttribute("rel"));
};
_42.tabs[i].content=_45.appendChild(_42.tabs[i].content);
}
_42.element=_42.placeholder.appendChild(_43);
this.selectTab(0);
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.createTabBoxElement=function(_49){
var _4a=document.createElement("div");
_4a.className="tabBox";
_4a.id=_49+"-tabBox";
return _4a;
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.createTabsElement=function(_4b){
var _4c=document.createElement("div");
_4c.className="tabs";
_4c.id=_4b+"-tabs";
return _4c;
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.createTabElement=function(_4d,_4e,_4f){
var tab=document.createElement("a");
tab.className="tab";
tab.id=_4d+"-tab"+_4e;
tab.setAttribute("rel",_4e);
tab.setAttribute("href","#"+_4d+"-tabPanel"+_4e);
var _51=tab.appendChild(document.createElement("span"));
_51.appendChild(document.createTextNode(_4f));
return tab;
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.createTabPanelsElement=function(_52){
var _53=document.createElement("div");
_53.className="tabPanels";
_53.id=_52+"-tabPanels";
return _53;
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.createTabPanelElement=function(_54,_55){
var _56=document.createElement("div");
_56.className="tabPanel";
_56.id=_54+"-tabPanel"+_55;
return _56;
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.selectTab=function(_57){
var _58=this._panel;
if(!_58.tabs[_57].disabled){
for(var i=0;i<_58.tabs.length;i++){
if(i==_57){
_58.tabs[i].tab.className+=" selected";
_58.tabs[i].content.style.display="block";
}else{
_58.tabs[i].tab.className=_58.tabs[i].tab.className.replace(" selected","");
_58.tabs[i].content.style.display="none";
}
}
}
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.disableTab=function(_5a){
this._panel.tabs[_5a].disabled=true;
this._panel.tabs[_5a].tab.className+=" disabled";
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.enableTab=function(_5b){
this._panel.tabs[_5b].disabled=false;
this._panel.tabs[_5b].tab.className=this._panel.tabs[_5b].tab.className.replace(" disabled","");
};
hXUL.AssetManager.initPanelShuffle=function(){
for(var i=0;i<hXUL.AssetManager.panels.length;i++){
var _5d=hXUL.AssetManager.panels[i];
_5d.tabWidth=_5d.tabs[0].tab.offsetWidth;
for(var j=0;j<_5d.tabs.length;j++){
var _5f=_5d.tabs[j];
_5f.open=false;
_5f.tab.style.zIndex=10+_5d.tabs.length-j;
_5f.content.style.zIndex=10+_5d.tabs.length-j;
}
_5d.selectTab(0);
}
};
hXUL.Panel.prototype.selectTab=function(tab,_61){
if(typeof tab=="string"){
for(var i=0;i<this.tabs.length;i++){
if(this.tabs[i].title.toLowerCase()==tab.toLowerCase()){
tab=i;
break;
}
}
}
this._renderer.selectTab(tab,_61);
};
hXUL.Panel.prototype.resetPanelHeight=function(){
this._renderer.resetPanelHeight();
};
hXUL.Panel.prototype.mousedownHandler=function(e){
};
hXUL.Panel.prototype.startDrag=function(e){
};
hXUL.Panel.prototype.dropDrag=function(e){
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.selectTab=function(_66,_67){
var _68=this._panel;
if(_68.tabs[_66].disabled){
return false;
}
if(_68.tabs[_66].open){
if(!_67){
_68.tabs[_66].tab.className=_68.tabs[_66].tab.className.replace(" selected","");
_68.tabs[_66].content.className=_68.tabs[_66].content.className.replace(" open","");
_68.tabs[_66].open=false;
_68.tabs[_66].focus=false;
}
}else{
_68.tabs[_66].open=true;
_68.tabs[_66].focus=true;
_68.tabs[_66].tab.className+=" selected";
_68.tabs[_66].content.className+=" open";
for(var i=0;i<_68.tabs.length;i++){
if(_66!=i){
_68.tabs[i].focus=false;
}
}
}
for(var i=0;i<_68.tabs.length;i++){
if(_66!=i){
_68.tabs[i].tab.className=_68.tabs[i].tab.className.replace(" selected","");
if(_68.onePanelOpenOnly){
_68.tabs[i].content.className=_68.tabs[_66].content.className.replace(" open","");
_68.tabs[i].open=false;
_68.tabs[i].focus=false;
}
}
}
this.resetTabPosition();
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.disableTab=function(_6a){
this._panel.tabs[_6a].disabled=true;
this._panel.tabs[_6a].open=false;
if(this._panel.tabs[_6a].tab.className.indexOf("disabled")==-1){
this._panel.tabs[_6a].tab.className+=" disabled";
}
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.enableTab=function(_6b){
this._panel.tabs[_6b].disabled=false;
this._panel.tabs[_6b].tab.className=this._panel.tabs[_6b].tab.className.replace(" disabled","");
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.resetTabPosition=function(){
var _6c=this._panel;
if(!_6c.availableWidth){
_6c.availableWidth=_6c.placeholder.offsetWidth-_6c.tabWidth;
}
var _6d=_6c.availableWidth;
var _6e=0;
var _6f=new Array();
var _70=null;
var _71=0;
var _72=0;
for(var i=0;i<_6c.tabs.length;i++){
if(_6c.tabs[i].open){
_6f[i]=_6c.tabs[i].content.offsetWidth;
_71++;
}else{
_6f[i]=0;
}
_6e+=_6f[i];
if(_70==null&&_6c.tabs[i].open){
_70=i;
_72=i;
}
if(_6c.tabs[i].focus){
_70=i;
}
}
if(_6e>_6d&&_71>2){
for(var i=_72+1;i<_6c.tabs.length;i++){
if(i!=_70&&_6c.tabs[i].open){
_6f[i]=0;
_6c.tabs[i].content.className=_6c.tabs[i].content.className.replace(" open","");
_6c.tabs[i].open=false;
_6c.tabs[i].focus=false;
}
}
if(_6c.onePanelOpenOnly){
_6e=_6d;
}
}
var _74=0;
var _75=0;
for(var i=0;i<_6c.tabs.length;i++){
var _76=_6c.tabs[i];
if(_76.open){
_76.content.style.visibility="visible";
var _77=_75+_6f[i]-_76.content.offsetWidth;
this.setPanelPosition(i,_77);
_75+=_6f[i];
}else{
_76.content.style.visibility="hidden";
}
if(_6c.onePanelOpenOnly){
this.setTabPosition(i,_6e,_74);
}else{
this.setTabPosition(i,_75,_74);
}
_74++;
}
if(_6c.onTabPositionReset){
_6c.onTabPositionReset(_6e);
}
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.setPanelPosition=function(_78,_79){
if(typeof _78=="number"){
_78=this._panel.tabs[_78];
}
_78.content.style.left=_79+"px";
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.setTabPosition=function(_7a,_7b,_7c){
var _7d=this._panel.tabs[_7a];
_7d.tab.style.left=_7b+"px";
_7d.tab.style.top=(_7c*(_7d.tab.offsetHeight+3)+5)+"px";
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.resetPanelHeight=function(){
var _7e=0;
var _7f=this._panel;
for(var i=0;i<_7f.tabs.length;i++){
_7f.tabs[i].content.style.minHeight="500px";
var h=_7f.tabs[i].content.offsetHeight;
if(h>_7e){
_7e=h;
}
}
for(var i=0;i<_7f.tabs.length;i++){
_7f.tabs[i].content.style.minHeight=_7e+"px";
}
_7f.element.style.minHeight=_7e+"px";
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.openTab=function(_82){
};
hXUL.Panel.Renderer.XHTMLRenderer.prototype.moveTabTo=function(_83,x,y){
var c=this.tabs[_83].content;
var t=this.tabs[_83].tab;
if(x){
c.style.left=x;
t.style.left=x;
}
if(y){
c.style.top=y;
t.style.top=y;
}
};
hXUL.AssetManager.treeViews=[];
hXUL.AssetManager.createTreeView=function(id,_89,_8a,_8b){
var r=this.createTreeViewRenderer();
var t=new hXUL.TreeView(id,_89,this.dataTransformer(_8a),_8b,r);
hXUL.AssetManager.treeViews.push(t);
t.assetIndex=hXUL.AssetManager.treeViews.length-1;
r.assetIndex=hXUL.AssetManager.treeViews.length-1;
return t;
};
hXUL.AssetManager.dataTransformer=function(_8e){
return _8e;
};
hXUL.AssetManager.createTreeViewRenderer=function(){
return new hXUL.TreeView.Renderer.XHTMLRenderer();
};
hXUL.TreeView=function(id,_90,_91,_92,_93){
this.id=id;
this.element=null;
this.data=_91;
this.columnTitles=_90;
this._renderer=_93;
this.setPlaceholder(_92);
this.onselect=null;
this.ondeselect=null;
this.onreorder=null;
this.onexpand=null;
this.oncollapse=null;
this.onrender=null;
};
hXUL.TreeView.prototype.setPlaceholder=function(_94){
if(typeof _94=="string"){
this.placeholder=document.getElementById(_94);
}else{
this.placeholder=_94;
}
};
hXUL.TreeView.prototype.render=function(_95){
if(_95){
this.setPlaceholder(_95);
}
this._renderer.render(this);
};
hXUL.TreeView.prototype.refresh=function(_96){
if(_96){
this.data=hXUL.AssetManager.dataTransformer(_96);
}
this.placeholder.innerHTML="";
var _97=this._renderer.getSelected();
this._renderer.render(this);
if(_97){
this._renderer.selectRow(_97.id,true);
}
};
hXUL.TreeView.prototype.select=function(id,_99){
return this._renderer.selectRow(id,_99);
};
hXUL.TreeView.prototype.getSelected=function(){
return this._renderer.getSelected();
};
hXUL.TreeView.Renderer=function(){
};
hXUL.TreeView.Renderer.XHTMLRenderer=function(){
this.primaryColumnIndex=0;
this.setClassLevel=false;
};
hXUL.Class.extend(hXUL.TreeView.Renderer.XHTMLRenderer,hXUL.TreeView.Renderer);
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.render=function(_9a){
this.selectedRow=null;
var _9b=this.createTreeElement(_9a.id);
var _9c=_9b.firstChild;
if(_9a.columnTitles.length>0){
var _9d=_9c.appendChild(this.createTreeColsElement(_9a.id));
for(var i=0;i<_9a.data[0].content.length;i++){
_9d.appendChild(this.createTreeColElement(_9a.id,i,_9a.columnTitles[i]));
}
}
this.renderTreeElements(_9a.id,_9a.data,_9c);
_9c.appendChild(this.createTreeFooterElement(_9a));
_9a.element=_9a.placeholder.appendChild(_9b);
this.tree=_9a.element;
this.resetTreeLayout();
this._treeOffsetTop=hXUL._aux.getScreenCoordinates(this.tree).y;
_9a.element.onmousedown=hXUL._aux.bind("mousedownHandler",this);
_9a.element.onmouseup=hXUL._aux.bind("mouseupHandler",this);
_9a.element.onkeyup=hXUL._aux.bind("keyShortCuts",this);
if(_9a.onrender){
_9a.onrender();
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.adjustScrollableArea=function(){
if(this._scrollWindow){
var _9f=hXUL.AssetManager.treeViews[this.assetIndex];
if(typeof this._scrollWindow.style.overflowY!="undefined"){
this._scrollWindow.style.overflowY="auto";
this._scrollWindow.style.overflowX="hidden";
}else{
this._scrollWindow.style.overflow="auto";
}
var h=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
var ty=hXUL._aux.getScreenCoordinates(_9f.element).y;
var th=_9f.element.clientHeight;
var sh=this._scrollWindow.clientHeight;
var _a4=h-ty-th;
if(sh+_a4>0&&_a4<0){
this._scrollWindow.style.height=(sh+_a4)+"px";
}
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.renderTreeElements=function(_a5,_a6,_a7,_a8,_a9){
if(!_a8){
_a8=0;
}
if(!_a9){
_a9=0;
}
for(var i=0;i<_a6.length;i++){
var _ab=_a6[i].children?true:false;
var _ac=_a7.appendChild(this.createTreeRowElement(_ab,_a6[i].rowClass,_a6[i].id));
_a8++;
for(var j=0;_a6[i].content&&j<_a6[i].content.length;j++){
_ac.appendChild(this.createTreeCellElement(_a6[i].content[j],j,_ab));
}
this.setLevel(_ac,_a9);
if(_ab){
_a8=this.renderTreeElements(_a5,_a6[i].children,_a7,_a8,_a9+1);
if(_a6[i].collapse=="collapse"){
this.closeContainer(_ac,true,true);
}
}
}
return _a8;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createTreeElement=function(_ae){
var _af=document.createElement("table");
_af.id=_ae+"-tree";
_af.className="tree";
var _b0=document.createElement("tbody");
_af.appendChild(_b0);
return _af;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createTreeColsElement=function(_b1){
var _b2=document.createElement("tr");
_b2.id=_b1+"-treeCols";
_b2.className="treecols";
return _b2;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createTreeColElement=function(_b3,_b4,_b5){
var _b6=document.createElement("th");
_b6.id=_b3+"-treeCol"+_b4;
_b6.className="treecol";
if(_b5){
_b6.appendChild(document.createTextNode(_b5));
}
return _b6;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createTreeRowElement=function(_b7,_b8,_b9){
var _ba=document.createElement("tr");
_ba.className="treerow";
if(_b7){
_ba.className+=" container open";
}
if(_b8){
_ba.className+=" "+_b8;
}
if(_b9){
_ba.id=_b9;
}
return _ba;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createTreeCellElement=function(_bb,_bc,_bd,_be,_bf){
var _c0=document.createElement("td");
if(_be&&_bf&&_bc){
_c0.id=_be+"-treeCell"+_bf+"-"+_bc;
}
_c0.className="treecell";
_c0.innerHTML="<div class=\"content\">"+_bb+"</div>";
if(_bc==this.primaryColumnIndex){
_c0.className+=" primary";
var _c1=document.createElement("div");
_c1.className="icon";
_c0.insertBefore(_c1,_c0.firstChild);
if(_bd){
_c0.insertBefore(this.createTwistieElement(),_c0.firstChild);
}
_c0.insertBefore(this.createSpacersElement(),_c0.firstChild);
}
return _c0;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createTwistieElement=function(){
var _c2=document.createElement("div");
_c2.className="twistie";
_c2.innerHTML="&nbsp;";
_c2.onmousedown=hXUL._aux.bind(this.toggleOpenState,this);
_c2.onmouseup=function(e){
hXUL._aux.stopPropagation(e);
};
_c2.style.cursor="pointer";
return _c2;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createTreeFooterElement=function(_c4){
var _c5=document.createElement("tr");
_c5.className="treefooter";
for(var i=0;i<_c4.data[0].content.length;i++){
_c5.appendChild(document.createElement("td"));
}
return _c5;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createSpacersElement=function(){
var _c7=document.createElement("div");
_c7.className="spacers";
return _c7;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.createSpacerElement=function(_c8){
var _c9=document.createElement("div");
_c9.className="spacer "+_c8;
return _c9;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.toggleOpenState=function(e){
var _cb=hXUL._aux.getEventSource(e);
var _cc=_cb.parentNode.parentNode;
if(this.isContainerOpen(_cc)){
this.closeContainer(_cc);
}else{
this.openContainer(_cc);
}
this.preventSelectEvent=true;
this.preventDeselectEvent=true;
hXUL._aux.stopPropagation(e);
return hXUL._aux.preventEvent(e);
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.openContainer=function(_cd,_ce,_cf){
if(!_cd){
return;
}
var _d0=this.getChildrenRows(_cd);
for(var i=_d0.length-1;i>=0;i--){
this.showRow(_d0[i]);
if(this.isContainerClosed(_d0[i])){
i-=this.getChildrenRows(_d0[i]).length;
}
}
_cd.className=_cd.className.replace(" closed"," open");
if(!_ce){
this.resetTreeLayout({alternateRows:true,startRow:_cd});
}
if(!_cf){
var _d2=hXUL.AssetManager.treeViews[this.assetIndex];
if(_d2.onexpand){
_d2.onexpand(_cd);
}
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.closeContainer=function(_d3,_d4,_d5){
if(!_d3){
return;
}
var _d6=this.getChildrenRows(_d3);
for(var i=0;i<_d6.length;i++){
this.hideRow(_d6[i]);
}
_d3.className=_d3.className.replace(" open"," closed");
if(!_d4){
this.resetTreeLayout({alternateRows:true,startRow:_d3});
}
if(!_d5){
var _d8=hXUL.AssetManager.treeViews[this.assetIndex];
if(_d8.oncollapse){
_d8.oncollapse(_d3);
}
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.isContainerOpen=function(_d9){
return hXUL._aux.hasClass(_d9,"open")&&this.isContainer(_d9);
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.isContainerClosed=function(_da){
return hXUL._aux.hasClass(_da,"closed")&&this.isContainer(_da);
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.isContainer=function(row){
return hXUL._aux.hasClass(row,"container");
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.showRow=function(row){
try{
row.style.display="table-row";
}
catch(x){
row.style.display="block";
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.hideRow=function(row){
row.style.display="none";
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.getLevel=function(row){
if(!row||!row._level){
return 0;
}
return row._level;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.setLevel=function(row,_e0){
if(!row||row._level==_e0){
return;
}
row._level=_e0;
if(this.setClassLevel){
var _e1=/level\d+/;
var _e2=row.className.match(_e1);
if(_e2&&_e2[0]){
row.className=row.className.replace(_e2[0],"level"+_e0);
}else{
row.className+=" level"+_e0;
}
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.setIndent=function(row){
var _e4=row.childNodes[this.primaryColumnIndex];
if(!_e4){
return;
}
var _e5=row._level;
var _e6=_e4.firstChild;
if(_e6){
for(var i=0;i<_e5;i++){
if(i==_e5-1){
var _e8=this.hasNextSibling(row,i+1)?"branch":"last";
}else{
var _e8=this.hasNextSibling(row,i+1)?"line":"";
}
if(_e6.childNodes[i]){
var _e9=_e6.childNodes[i];
_e9.className="spacer "+_e8;
}else{
var _e9=_e6.appendChild(this.createSpacerElement(_e8));
}
var h=_e6.parentNode.parentNode.offsetHeight;
if(h>0){
_e9.style.height=h+"px";
}
}
while(_e6.childNodes[i]){
_e6.removeChild(_e6.childNodes[i]);
}
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.mousedownHandler=function(e){
if(!e){
e=window.event;
}
var _ec=e.target||e.srcElement;
while(_ec&&_ec.tagName!="TR"){
_ec=_ec.parentNode;
}
if(_ec){
this.cleanDragged();
this._clickedRow=_ec;
var _ed=hXUL._aux.getMouseCoordinates(e);
this._dragGestureY=_ed.y;
this.tree.onmousemove=hXUL._aux.bind("checkDragGesture",this);
document.body.onselectstart=function(e){
hXUL._aux.stopPropagation(e);
return hXUL._aux.preventEvent(e);
};
document.body.ondrag=function(e){
hXUL._aux.stopPropagation(e);
return hXUL._aux.preventEvent(e);
};
}
hXUL._aux.stopPropagation(e);
return hXUL._aux.preventEvent(e);
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.mouseupHandler=function(e){
var _f1=this.toggleRowSelection(this._clickedRow);
this.tree.onmousemove=null;
document.body.ondrag=null;
document.body.onselectstart=null;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.checkDragGesture=function(e){
var _f3=hXUL._aux.getMouseCoordinates(e);
var _f4=this._dragGestureY-_f3.y;
if(_f4>4||_f4<-4){
this.startDrag(e,this._clickedRow);
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.startDrag=function(e,row){
if(this.isDraggable(row)){
if(!e){
e=window.event;
}
this.tree.onmouseup=hXUL._aux.bind("dropDrag",this);
document.onkeypress=hXUL._aux.bind("resetDrag",this);
this.tree.onmousemove=hXUL._aux.bind("drag",this);
this.tree.onmouseover=hXUL._aux.bind("dragOver",this);
this.tree.onmouseout=hXUL._aux.bind(function(e){
if(!e){
var e=window.event;
}
var _f8=(e.relatedTarget)?e.relatedTarget:e.toElement;
p=this.tree.parentNode;
while(p&&p!=_f8){
p=p.parentNode;
}
if(p){
this._resetTimeout=setTimeout(hXUL._aux.bind("resetDrag",this),2000);
if(document.onmouseup){
document.hXUL__onmouseup=document.onmouseup;
}else{
document.hXUL__onmouseup=function(){
};
}
document.onmouseup=hXUL._aux.bind("resetDrag",this);
}
},this);
this.tree.style.cursor="pointer";
this._clickedRow.className+=" dragged";
if(this.isContainer(this._clickedRow)){
var _f9=this.getChildrenRows(this._clickedRow);
for(var i=0;i<_f9.length;i++){
_f9[i].className+=" dragged";
}
}
this._insertType="insertAfter";
var _fb=this._clickedRow.firstChild.getElementsByTagName("div");
for(var i=0;i<_fb.length;i++){
if(_fb[i].className=="content"){
var b=document.body;
var g=_fb[i].cloneNode(true);
g.className="dragGhost";
this._dragGhost=b.appendChild(g);
break;
}
}
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.dropDrag=function(){
if(this._insertPoint&&this._clickedRow){
this.moveDraggedTo(this._insertPoint,this._insertType);
var _fe=hXUL.AssetManager.treeViews[this.assetIndex];
if(_fe.onreorder){
_fe.onreorder(this._clickedRow,this._insertPoint,this._insertType,this.getChildrenRows(this._clickedRow));
}
this.resetDrag(true);
}else{
this.resetDrag();
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.resetDrag=function(_ff){
if(document.hXUL__onmouseup){
document.onmouseup=document.hXUL__onmouseup;
document.hXUL__onmouseup=null;
}else{
document.onmouseup=null;
}
this.tree.onmouseup=hXUL._aux.bind("mouseupHandler",this);
this.tree.onmousemove=null;
this.tree.onmouseover=null;
this.tree.onmouseout=null;
document.onkeypress=null;
document.body.ondrag=null;
document.body.onselectstart=null;
this.tree.style.cursor="default";
if(this._dragGhost){
this._dragGhost.parentNode.removeChild(this._dragGhost);
this._dragGhost=null;
}
if(this._insertPoint){
this._insertPoint.className=this._insertPoint.className.replace(" "+this._insertType,"");
this._insertPoint=null;
}
this._cleanRow=this._clickedRow;
this._clickedRow=null;
if(this._cleanRow&&_ff){
this._timeout=setTimeout(hXUL._aux.bind("cleanDragged",this),2000);
}else{
this.cleanDragged();
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.cleanDragged=function(){
if(this._cleanRow){
if(this._timeout){
clearTimeout(this._timeout);
this._timeout=null;
}
this._cleanRow.className=this._cleanRow.className.replace(" dragged","");
if(this.isContainer(this._cleanRow)){
var rows=this.getChildrenRows(this._cleanRow);
for(var i=0;i<rows.length;i++){
rows[i].className=rows[i].className.replace(" dragged","");
}
}
this._cleanRow=null;
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.drag=function(e){
var _103=hXUL._aux.getMouseCoordinates(e);
var h=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
var sh=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop;
if(_103.y>h+sh-50){
if(this._dragDirectionLastY){
this._dragDirection=_103.y-this._dragDirectionLastY;
}
if(this._dragDirection>0){
window.scrollBy(0,5);
}
this._dragDirectionLastY=_103.y;
}
if(_103.y<sh+50){
if(this._dragDirectionLastY){
this._dragDirection=_103.y-this._dragDirectionLastY;
}
if(this._dragDirection<0){
window.scrollBy(0,-5);
}
this._dragDirectionLastY=_103.y;
}
if(this._dragGhost){
this._dragGhost.style.top=_103.y+"px";
this._dragGhost.style.left=_103.x+"px";
}
if(this._insertPoint){
if(_103.y>this._midPoint){
if(this.isContainer(this._insertPoint)){
this._insertType="insertInside";
}else{
this._insertType="insertAfter";
}
}else{
if(_103.y<=this._midPoint){
this._insertType="insertBefore";
}
}
if(this._insertType!=this._previousInsertType){
this._insertPoint.className=this._insertPoint.className.replace(" insertInside","");
this._insertPoint.className=this._insertPoint.className.replace(" insertAfter","");
this._insertPoint.className=this._insertPoint.className.replace(" insertBefore","");
this._insertPoint.className+=" "+this._insertType;
this._previousInsertType=this._insertType;
}
if(this._insertType=="insertInside"&&this.isContainerClosed(this._insertPoint)){
if(!this._openContainerTimer){
this._openContainerTimer=setTimeout(hXUL._aux.bind(function(){
this.openContainer(this._insertPoint);
},this),1200);
}
return;
}else{
if(this._openContainerTimer){
clearTimeout(this._openContainerTimer);
this._openContainerTimer=null;
}
}
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.startScroll=function(_106){
if(this._scrollWindowIncrement!=_106){
this.stopScroll();
this._scrollWindowIncrement=_106;
this.scrollDiv(_106);
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.stopScroll=function(){
if(this._scrollWindowTimer){
clearTimeout(this._scrollWindowTimer);
this._scrollWindowTimer=null;
}
this._scrollWindowIncrement=null;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.scrollDiv=function(_107){
this._scrollWindow.scrollTop+=_107;
var self=this;
this._scrollWindowTimer=setTimeout(function(){
self.scrollDiv(_107);
},10);
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.dragOver=function(e){
if(!e){
e=window.event;
}
if(this._resetTimeout){
clearTimeout(this._resetTimeout);
this._resetTimeout=null;
}
var _10a=e.target||e.srcElement;
while(_10a&&_10a.tagName!="TR"){
_10a=_10a.parentNode;
}
if(this.isDraggedRow(_10a)||!this.isDroppable(_10a)){
return;
}
if(_10a!=this._insertPoint){
if(this._insertPoint){
this._insertPoint.className=this._insertPoint.className.replace(" insertInside","");
this._insertPoint.className=this._insertPoint.className.replace(" insertAfter","");
this._insertPoint.className=this._insertPoint.className.replace(" insertBefore","");
if(this._openContainerTimer){
clearTimeout(this._openContainerTimer);
this._openContainerTimer=null;
}
}
this._insertPoint=_10a;
this._midPoint=this._treeOffsetTop+_10a.offsetTop+_10a.offsetHeight/2;
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.moveDraggedTo=function(_10b,_10c){
var rows=this.getChildrenRows(this._clickedRow);
var _10e=this.getLevel(this._clickedRow);
var _10f=this.getLevel(_10b);
var _110=_10f-_10e;
var _111=this._clickedRow.previousSibling;
if(_10c=="insertBefore"){
this._clickedRow=_10b.parentNode.insertBefore(this._clickedRow,_10b);
}else{
if(this.isContainer(_10b)&&_10c=="insertInside"){
_10f++;
_110++;
var _112=this.getChildrenRows(_10b);
if(_112[0]){
_10b=_112[0];
}
}
this._clickedRow=_10b.parentNode.insertBefore(this._clickedRow,_10b.nextSibling);
}
this.setLevel(this._clickedRow,_10f);
for(var i=0;i<rows.length;i++){
var _10f=this.getLevel(rows[i])+_110;
var row=this._clickedRow.parentNode.insertBefore(rows[i],this._clickedRow.nextSibling);
this.setLevel(row,_10f);
}
if(_111.offsetTop<this._clickedRow.offsetTop){
var _115=_111;
while(_115&&this.getLevel(_115)>=_10e){
_115=_115.previousSibling;
}
var _116=rows[0]||this._clickedRow;
}else{
var _115=this._clickedRow;
var _116=_111;
}
this.resetTreeLayout({indent:true,alternateRows:true,startRow:_115,endRow:_116});
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.keyShortCuts=function(e){
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.toggleRowSelection=function(row){
if(row==this.selectedRow){
this.deselectRow();
return false;
}else{
this.selectRow(row);
return true;
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.selectRow=function(row,_11a){
if(typeof row=="string"){
row=document.getElementById(row);
}
if(!this.isSelectable(row)){
return false;
}
this.deselectRow();
this.selectedRow=row;
if(this.selectedRow){
this.selectedRow.className+=" selected";
}
var _11b=hXUL.AssetManager.treeViews[this.assetIndex];
if(_11b.onselect&&!_11a){
setTimeout(hXUL._aux.bind(function(){
this.onselect(this._renderer.selectedRow);
},_11b),1);
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.deselectRow=function(){
if(this.selectedRow){
this.selectedRow.className=this.selectedRow.className.replace(" selected","");
var _11c=hXUL.AssetManager.treeViews[this.assetIndex];
if(_11c.ondeselect){
setTimeout(hXUL._aux.bind(function(){
this.ondeselect(this._renderer.selectedRow);
},_11c),1);
}
this.selectedRow=null;
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.getSelected=function(){
return this.selectedRow;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.isSelectable=function(row){
return row&&!hXUL._aux.hasClass(row,"inert");
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.resetTreeLayout=function(_11e){
if(_11e&&_11e.startRow){
var row=_11e.startRow;
}else{
var row=this.tree.firstChild.firstChild;
}
if(_11e&&_11e.endRow){
var end=_11e.endRow.nextSibling;
}else{
var end=this.tree.firstChild.lastChild;
}
var i=0;
if(row.previousSibling&&hXUL._aux.hasClass(row.previousSibling,"odd")){
var _122=0;
}else{
var _122=1;
}
while(row&&row!=end){
if(row.style.display!="none"){
i++;
}
if(!_11e||_11e.indent==true){
this.setIndent(row);
}
if(!_11e||_11e.alternateRows==true){
if(i%2==_122){
if(!hXUL._aux.hasClass(row,"odd")){
row.className+=" odd";
}
}else{
if(hXUL._aux.hasClass(row,"odd")){
row.className=row.className.replace(" odd","");
}
}
}
row=row.nextSibling;
}
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.getChildrenRows=function(_123){
if(!_123){
return null;
}
var _124=this.getLevel(_123);
var rows=[];
var row=_123.nextSibling;
while(row){
var _127=this.getLevel(row);
if(_127>_124){
rows.unshift(row);
row=row.nextSibling;
}else{
row=null;
}
}
return rows;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.hasNextSibling=function(row,_129){
if(!row){
return false;
}
if(!_129){
_129=this.getLevel(row);
}
row=row.nextSibling;
while(row){
var lvl=this.getLevel(row);
if(lvl==_129){
return true;
}
if(lvl<_129){
return false;
}
row=row.nextSibling;
}
return false;
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.isDraggedRow=function(row){
return hXUL._aux.hasClass(row,"dragged");
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.isDraggable=function(row){
return row&&!hXUL._aux.hasClass(row,"anchored")&&!hXUL._aux.hasClass(row,"inert");
};
hXUL.TreeView.Renderer.XHTMLRenderer.prototype.isDroppable=function(row){
return row&&!hXUL._aux.hasClass(row,"undroppable");
};

